Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 /// \file electromagnetic/TestEm6/src/PhysicsL 26 /// \file electromagnetic/TestEm6/src/PhysicsList.cc 27 /// \brief Implementation of the PhysicsList c 27 /// \brief Implementation of the PhysicsList class 28 // 28 // >> 29 // $Id: PhysicsList.cc 73716 2013-09-09 10:07:13Z gcosmo $ 29 // 30 // 30 //....oooOO0OOooo........oooOO0OOooo........oo 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 31 //....oooOO0OOooo........oooOO0OOooo........oo 32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 32 33 33 #include "PhysicsList.hh" 34 #include "PhysicsList.hh" 34 << 35 #include "PhysicsListMessenger.hh" 35 #include "PhysicsListMessenger.hh" 36 #include "StepMax.hh" << 37 36 38 #include "G4AnnihiToMuPair.hh" << 39 #include "G4DecayPhysics.hh" << 40 #include "G4Electron.hh" << 41 #include "G4EmLivermorePhysics.hh" << 42 #include "G4EmLowEPPhysics.hh" << 43 #include "G4EmPenelopePhysics.hh" << 44 #include "G4EmStandardPhysics.hh" << 45 #include "G4EmStandardPhysicsGS.hh" << 46 #include "G4EmStandardPhysicsSS.hh" << 47 #include "G4EmStandardPhysicsWVI.hh" << 48 #include "G4EmStandardPhysics_option1.hh" << 49 #include "G4EmStandardPhysics_option2.hh" << 50 #include "G4EmStandardPhysics_option3.hh" << 51 #include "G4EmStandardPhysics_option4.hh" << 52 #include "G4Gamma.hh" << 53 #include "G4GammaConversionToMuons.hh" << 54 #include "G4LossTableManager.hh" << 55 #include "G4ParticleDefinition.hh" 37 #include "G4ParticleDefinition.hh" 56 #include "G4ParticleTable.hh" << 57 #include "G4Positron.hh" << 58 #include "G4ProcessManager.hh" 38 #include "G4ProcessManager.hh" >> 39 #include "G4ParticleTypes.hh" >> 40 #include "G4ParticleTable.hh" >> 41 >> 42 #include "G4Proton.hh" >> 43 #include "G4AntiProton.hh" >> 44 #include "G4Neutron.hh" >> 45 #include "G4AntiNeutron.hh" >> 46 >> 47 #include "G4GammaConversionToMuons.hh" >> 48 >> 49 #include "G4eMultipleScattering.hh" >> 50 #include "G4MuMultipleScattering.hh" >> 51 #include "G4hMultipleScattering.hh" >> 52 >> 53 #include "G4eIonisation.hh" >> 54 #include "G4eBremsstrahlung.hh" >> 55 #include "G4eplusAnnihilation.hh" >> 56 #include "G4AnnihiToMuPair.hh" >> 57 >> 58 #include "G4MuIonisation.hh" >> 59 #include "G4MuBremsstrahlung.hh" >> 60 #include "G4MuPairProduction.hh" >> 61 >> 62 #include "G4hIonisation.hh" >> 63 #include "G4hhIonisation.hh" >> 64 #include "G4ionIonisation.hh" >> 65 #include "G4eeToHadrons.hh" >> 66 >> 67 #include "G4Decay.hh" >> 68 #include "G4EmProcessOptions.hh" >> 69 >> 70 #include "G4StepLimiter.hh" >> 71 59 #include "G4ProcessTable.hh" 72 #include "G4ProcessTable.hh" >> 73 60 #include "G4SystemOfUnits.hh" 74 #include "G4SystemOfUnits.hh" 61 #include "G4UnitsTable.hh" << 62 #include "G4eeToHadrons.hh" << 63 75 64 //....oooOO0OOooo........oooOO0OOooo........oo 76 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 65 77 66 PhysicsList::PhysicsList() 78 PhysicsList::PhysicsList() 67 : G4VModularPhysicsList(), fEmPhysicsList(0) << 79 : G4VUserPhysicsList(), fMes(0) 68 { 80 { 69 G4LossTableManager::Instance()->SetVerbose(1 << 81 defaultCutValue = 1.*km; 70 << 71 defaultCutValue = 1. * km; << 72 fMes = new PhysicsListMessenger(this); 82 fMes = new PhysicsListMessenger(this); 73 << 83 SetVerboseLevel(1); 74 fStepMaxProcess = new StepMax(); << 75 << 76 fDecayPhysicsList = new G4DecayPhysics(); << 77 << 78 SetVerboseLevel(2); << 79 } 84 } 80 85 81 //....oooOO0OOooo........oooOO0OOooo........oo 86 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 82 87 83 PhysicsList::~PhysicsList() 88 PhysicsList::~PhysicsList() 84 { 89 { 85 delete fMes; 90 delete fMes; 86 delete fDecayPhysicsList; << 87 delete fEmPhysicsList; << 88 delete fStepMaxProcess; << 89 } 91 } 90 92 91 //....oooOO0OOooo........oooOO0OOooo........oo 93 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 92 94 93 void PhysicsList::ConstructParticle() 95 void PhysicsList::ConstructParticle() 94 { 96 { 95 fDecayPhysicsList->ConstructParticle(); << 97 // In this method, static member functions should be called >> 98 // for all particles which you want to use. >> 99 // This ensures that objects of these particle types will be >> 100 // created in the program. >> 101 >> 102 ConstructBosons(); >> 103 ConstructLeptons(); >> 104 ConstructHadrons(); 96 } 105 } 97 106 98 //....oooOO0OOooo........oooOO0OOooo........oo 107 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 99 108 100 void PhysicsList::ConstructProcess() << 109 void PhysicsList::ConstructBosons() 101 { 110 { 102 AddTransportation(); << 111 // pseudo-particles >> 112 G4Geantino::GeantinoDefinition(); >> 113 G4ChargedGeantino::ChargedGeantinoDefinition(); 103 114 104 if (fEmPhysicsList) fEmPhysicsList->Construc << 115 // gamma 105 fDecayPhysicsList->ConstructProcess(); << 116 G4Gamma::GammaDefinition(); >> 117 } 106 118 107 AddStepMax(); << 119 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 108 120 109 ConstructHighEnergy(); << 121 void PhysicsList::ConstructLeptons() >> 122 { >> 123 // leptons >> 124 G4Electron::ElectronDefinition(); >> 125 G4Positron::PositronDefinition(); >> 126 G4MuonPlus::MuonPlusDefinition(); >> 127 G4MuonMinus::MuonMinusDefinition(); >> 128 >> 129 G4NeutrinoE::NeutrinoEDefinition(); >> 130 G4AntiNeutrinoE::AntiNeutrinoEDefinition(); >> 131 G4NeutrinoMu::NeutrinoMuDefinition(); >> 132 G4AntiNeutrinoMu::AntiNeutrinoMuDefinition(); >> 133 } >> 134 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 135 >> 136 void PhysicsList::ConstructHadrons() >> 137 { >> 138 // mesons >> 139 G4PionPlus::PionPlusDefinition(); >> 140 G4PionMinus::PionMinusDefinition(); >> 141 G4PionZero::PionZeroDefinition(); >> 142 G4Eta::EtaDefinition(); >> 143 G4EtaPrime::EtaPrimeDefinition(); >> 144 G4KaonPlus::KaonPlusDefinition(); >> 145 G4KaonMinus::KaonMinusDefinition(); >> 146 G4KaonZero::KaonZeroDefinition(); >> 147 G4AntiKaonZero::AntiKaonZeroDefinition(); >> 148 G4KaonZeroLong::KaonZeroLongDefinition(); >> 149 G4KaonZeroShort::KaonZeroShortDefinition(); >> 150 >> 151 // baryons >> 152 G4Proton::ProtonDefinition(); >> 153 G4AntiProton::AntiProtonDefinition(); >> 154 G4Neutron::NeutronDefinition(); >> 155 G4AntiNeutron::AntiNeutronDefinition(); 110 } 156 } 111 157 112 //....oooOO0OOooo........oooOO0OOooo........oo 158 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 113 159 114 void PhysicsList::ConstructHighEnergy() << 160 void PhysicsList::ConstructProcess() 115 { 161 { 116 const G4ParticleDefinition* particle = G4Gam << 162 AddTransportation(); 117 G4ProcessManager* pmanager = particle->GetPr << 163 ConstructEM(); >> 164 ConstructGeneral(); >> 165 } 118 166 119 pmanager->AddDiscreteProcess(new G4GammaConv << 167 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 120 168 121 particle = G4Positron::Positron(); << 169 void PhysicsList::ConstructEM() 122 pmanager = particle->GetProcessManager(); << 170 { >> 171 theParticleIterator->reset(); >> 172 while( (*theParticleIterator)() ){ >> 173 G4ParticleDefinition* particle = theParticleIterator->value(); >> 174 G4ProcessManager* pmanager = particle->GetProcessManager(); >> 175 G4String particleName = particle->GetParticleName(); 123 176 124 pmanager->AddDiscreteProcess(new G4AnnihiToM << 177 if (particleName == "gamma") { 125 pmanager->AddDiscreteProcess(new G4eeToHadro << 178 // gamma allow only gamma -> mu+mu- >> 179 // pmanager->AddDiscreteProcess(new G4GammaConversionToMuons); >> 180 // pmanager->AddDiscreteProcess(new G4PhotoElectricEffect); >> 181 // pmanager->AddDiscreteProcess(new G4ComptonScattering); >> 182 // pmanager->AddDiscreteProcess(new G4GammaConversion); >> 183 pmanager->AddDiscreteProcess(new G4GammaConversionToMuons); >> 184 >> 185 } else if (particleName == "e-") { >> 186 //electron >> 187 pmanager->AddProcess(new G4eMultipleScattering,-1, 1,1); >> 188 pmanager->AddProcess(new G4eIonisation, -1, 2,2); >> 189 pmanager->AddProcess(new G4eBremsstrahlung, -1, 3,3); >> 190 pmanager->AddProcess(new G4StepLimiter, -1,-1,4); >> 191 >> 192 } else if (particleName == "e+") { >> 193 //positron >> 194 // to make the process of e+e- annihilation more visible, >> 195 // do not enable the other standard processes: >> 196 //pmanager->AddProcess(new G4eMultipleScattering,-1, 1,1); >> 197 //pmanager->AddProcess(new G4eIonisation, -1, 2,2); >> 198 //pmanager->AddProcess(new G4eBremsstrahlung, -1, 3,3); >> 199 //pmanager->AddProcess(new G4eplusAnnihilation, 0,-1,4); >> 200 >> 201 pmanager->AddDiscreteProcess(new G4AnnihiToMuPair); >> 202 pmanager->AddDiscreteProcess(new G4eeToHadrons); >> 203 pmanager->AddDiscreteProcess(new G4StepLimiter); >> 204 >> 205 } else if( particleName == "mu+" || >> 206 particleName == "mu-" ) { >> 207 //muon >> 208 pmanager->AddProcess(new G4MuMultipleScattering,-1, 1,1); >> 209 pmanager->AddProcess(new G4MuIonisation, -1, 2,2); >> 210 pmanager->AddProcess(new G4MuBremsstrahlung, -1, 3,3); >> 211 pmanager->AddProcess(new G4MuPairProduction, -1, 4,4); >> 212 pmanager->AddProcess(new G4StepLimiter, -1,-1,5); >> 213 >> 214 } else if( particleName == "anti_proton") { >> 215 pmanager->AddProcess(new G4hMultipleScattering,-1, 1,1); >> 216 pmanager->AddProcess(new G4hhIonisation, -1, 2,2); >> 217 pmanager->AddProcess(new G4StepLimiter, -1,-1,3); >> 218 >> 219 } else if( particleName == "GenericIon") { >> 220 pmanager->AddProcess(new G4hMultipleScattering,-1, 1,1); >> 221 pmanager->AddProcess(new G4ionIonisation, -1, 2,2); >> 222 pmanager->AddProcess(new G4StepLimiter, -1,-1,3); >> 223 >> 224 } else if( particle->GetPDGCharge() != 0.0 && !particle->IsShortLived() >> 225 && particleName != "chargedgeantino") { >> 226 pmanager->AddProcess(new G4hMultipleScattering,-1, 1,1); >> 227 pmanager->AddProcess(new G4hIonisation, -1, 2,2); >> 228 pmanager->AddProcess(new G4StepLimiter, -1,-1,3); >> 229 } >> 230 } >> 231 >> 232 G4EmProcessOptions opt; >> 233 opt.SetVerbose(1); >> 234 opt.SetMinEnergy(100*eV); >> 235 opt.SetMaxEnergy(1000*TeV); >> 236 opt.SetDEDXBinning(13*7); >> 237 opt.SetLambdaBinning(13*7); 126 } 238 } 127 239 128 //....oooOO0OOooo........oooOO0OOooo........oo 240 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 129 241 130 void PhysicsList::SetGammaToMuPairFac(G4double << 242 void PhysicsList::ConstructGeneral() 131 { 243 { 132 G4ProcessTable* theProcessTable = G4ProcessT << 244 // Add Decay Process 133 G4GammaConversionToMuons* gammaToMuPairProce << 245 G4Decay* theDecayProcess = new G4Decay(); 134 (G4GammaConversionToMuons*)theProcessTable << 246 theParticleIterator->reset(); 135 if (gammaToMuPairProcess) << 247 while ((*theParticleIterator)()){ 136 gammaToMuPairProcess->SetCrossSecFactor(fa << 248 G4ParticleDefinition* particle = theParticleIterator->value(); 137 else << 249 G4ProcessManager* pmanager = particle->GetProcessManager(); 138 G4cout << "Warning. No process GammaToMuPa << 250 if (theDecayProcess->IsApplicable(*particle) && !particle->IsShortLived()) >> 251 { pmanager ->AddProcess(theDecayProcess); >> 252 // set ordering for PostStepDoIt and AtRestDoIt >> 253 pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep); >> 254 pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest); >> 255 } >> 256 } 139 } 257 } 140 258 141 //....oooOO0OOooo........oooOO0OOooo........oo 259 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 142 260 143 void PhysicsList::SetAnnihiToMuPairFac(G4doubl << 261 void PhysicsList::SetCuts() 144 { 262 { 145 G4ProcessTable* theProcessTable = G4ProcessT << 263 if (verboseLevel >0){ 146 G4AnnihiToMuPair* annihiToMuPairProcess = << 264 G4cout << "PhysicsList::SetCuts:"; 147 (G4AnnihiToMuPair*)theProcessTable->FindPr << 265 G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl; 148 if (annihiToMuPairProcess) << 266 } 149 annihiToMuPairProcess->SetCrossSecFactor(f << 267 150 else << 268 // set cut values for gamma at first and for e- second and next for e+, 151 G4cout << "Warning. No process AnnihiToMuP << 269 // because some processes for e+/e- need cut values for gamma >> 270 SetCutValue(defaultCutValue, "gamma"); >> 271 SetCutValue(defaultCutValue, "e-"); >> 272 SetCutValue(defaultCutValue, "e+"); >> 273 >> 274 if (verboseLevel>0) DumpCutValuesTable(); 152 } 275 } 153 276 154 //....oooOO0OOooo........oooOO0OOooo........oo 277 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 155 278 156 void PhysicsList::SetAnnihiToHadronFac(G4doubl << 279 void PhysicsList::SetGammaToMuPairFac(G4double fac) 157 { 280 { 158 G4ProcessTable* theProcessTable = G4ProcessT 281 G4ProcessTable* theProcessTable = G4ProcessTable::GetProcessTable(); 159 G4eeToHadrons* eehadProcess = (G4eeToHadrons << 282 G4GammaConversionToMuons* gammaToMuPairProcess = (G4GammaConversionToMuons*) 160 if (eehadProcess) << 283 theProcessTable->FindProcess("GammaToMuPair","gamma"); 161 eehadProcess->SetCrossSecFactor(fac); << 284 if(gammaToMuPairProcess) gammaToMuPairProcess->SetCrossSecFactor(fac); 162 else << 285 else G4cout 163 G4cout << "Warning. No process ee2hadr fou << 286 << "Warning. No process GammaToMuPair found, SetGammaToMuPairFac was ignored" >> 287 << G4endl; 164 } 288 } 165 289 166 //....oooOO0OOooo........oooOO0OOooo........oo 290 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 167 291 168 void PhysicsList::AddPhysicsList(const G4Strin << 292 void PhysicsList::SetAnnihiToMuPairFac(G4double fac) 169 { 293 { 170 if (verboseLevel > 1) { << 294 G4ProcessTable* theProcessTable = G4ProcessTable::GetProcessTable(); 171 G4cout << "PhysicsList::AddPhysicsList: <" << 295 G4AnnihiToMuPair* annihiToMuPairProcess = (G4AnnihiToMuPair*) 172 } << 296 theProcessTable->FindProcess("AnnihiToMuPair","e+"); 173 << 297 if(annihiToMuPairProcess) annihiToMuPairProcess->SetCrossSecFactor(fac); 174 if (name == fEmName) { << 298 else G4cout 175 return; << 299 << "Warning. No process AnnihiToMuPair found, SetAnnihiToMuPairFac ignored" 176 } << 300 << G4endl; 177 else if (name == "emstandard_opt0") { << 178 fEmName = name; << 179 delete fEmPhysicsList; << 180 fEmPhysicsList = new G4EmStandardPhysics() << 181 } << 182 else if (name == "emstandard_opt1") { << 183 fEmName = name; << 184 delete fEmPhysicsList; << 185 fEmPhysicsList = new G4EmStandardPhysics_o << 186 } << 187 else if (name == "emstandard_opt2") { << 188 fEmName = name; << 189 delete fEmPhysicsList; << 190 fEmPhysicsList = new G4EmStandardPhysics_o << 191 } << 192 else if (name == "emstandard_opt3") { << 193 fEmName = name; << 194 delete fEmPhysicsList; << 195 fEmPhysicsList = new G4EmStandardPhysics_o << 196 } << 197 else if (name == "emstandard_opt4") { << 198 fEmName = name; << 199 delete fEmPhysicsList; << 200 fEmPhysicsList = new G4EmStandardPhysics_o << 201 } << 202 else if (name == "emlivermore") { << 203 fEmName = name; << 204 delete fEmPhysicsList; << 205 fEmPhysicsList = new G4EmLivermorePhysics( << 206 } << 207 else if (name == "empenelope") { << 208 fEmName = name; << 209 delete fEmPhysicsList; << 210 fEmPhysicsList = new G4EmPenelopePhysics() << 211 } << 212 else if (name == "emlowenergy") { << 213 fEmName = name; << 214 delete fEmPhysicsList; << 215 fEmPhysicsList = new G4EmLowEPPhysics(); << 216 } << 217 else if (name == "emstandardGS") { << 218 fEmName = name; << 219 delete fEmPhysicsList; << 220 fEmPhysicsList = new G4EmStandardPhysicsGS << 221 } << 222 else if (name == "emstandardSS") { << 223 fEmName = name; << 224 delete fEmPhysicsList; << 225 fEmPhysicsList = new G4EmStandardPhysicsSS << 226 } << 227 else if (name == "emstandardWVI") { << 228 fEmName = name; << 229 delete fEmPhysicsList; << 230 fEmPhysicsList = new G4EmStandardPhysicsWV << 231 } << 232 else { << 233 G4cout << "PhysicsList::AddPhysicsList: <" << 234 << " is not defined" << G4endl; << 235 } << 236 } 301 } 237 302 238 //....oooOO0OOooo........oooOO0OOooo........oo 303 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 239 304 240 void PhysicsList::AddStepMax() << 305 void PhysicsList::SetAnnihiToHadronFac(G4double fac) 241 { 306 { 242 // Step limitation seen as a process << 307 G4ProcessTable* theProcessTable = G4ProcessTable::GetProcessTable(); 243 << 308 G4eeToHadrons* eehadProcess = (G4eeToHadrons*) 244 auto particleIterator = GetParticleIterator( << 309 theProcessTable->FindProcess("ee2hadr","e+"); 245 particleIterator->reset(); << 310 if(eehadProcess) eehadProcess->SetCrossSecFactor(fac); 246 while ((*particleIterator)()) { << 311 else G4cout 247 G4ParticleDefinition* particle = particleI << 312 << "Warning. No process ee2hadr found, SetAnnihiToHadronFac was ignored" 248 G4ProcessManager* pmanager = particle->Get << 313 << G4endl; 249 << 250 if (fStepMaxProcess->IsApplicable(*particl << 251 pmanager->AddDiscreteProcess(fStepMaxPro << 252 } << 253 } << 254 } 314 } 255 315 256 //....oooOO0OOooo........oooOO0OOooo........oo 316 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 257 317