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/TestEm5/src/PhysicsL << 26 // $Id: PhysicsList.cc,v 1.13.2.1 2006/06/29 16:56:04 gunter Exp $ 27 /// \brief Implementation of the PhysicsList c << 27 // GEANT4 tag $Name: geant4-08-01-patch-01 $ 28 // << 29 // 28 // 30 //....oooOO0OOooo........oooOO0OOooo........oo 29 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 31 //....oooOO0OOooo........oooOO0OOooo........oo 30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 32 31 33 #include "PhysicsList.hh" 32 #include "PhysicsList.hh" >> 33 #include "PhysicsListMessenger.hh" 34 34 35 #include "PhysListEmStandard.hh" 35 #include "PhysListEmStandard.hh" 36 #include "PhysicsListMessenger.hh" << 36 #include "PhysListEmG4v52.hh" 37 #include "StepMax.hh" << 37 #include "PhysListEmG4v71.hh" >> 38 #include "PhysListEmLivermore.hh" >> 39 #include "PhysListEmPenelope.hh" >> 40 #include "PhysListHadronElastic.hh" >> 41 #include "PhysListBinaryCascade.hh" >> 42 #include "PhysListIonBinaryCascade.hh" 38 43 39 #include "G4DecayPhysics.hh" << 44 #include "G4LossTableManager.hh" 40 #include "G4EmDNAPhysics.hh" << 41 #include "G4EmDNAPhysics_option2.hh" << 42 #include "G4EmDNAPhysics_option4.hh" << 43 #include "G4EmDNAPhysics_option6.hh" << 44 #include "G4EmLivermorePhysics.hh" << 45 #include "G4EmLowEPPhysics.hh" << 46 #include "G4EmPenelopePhysics.hh" << 47 #include "G4EmStandardPhysics.hh" << 48 #include "G4EmStandardPhysicsGS.hh" << 49 #include "G4EmStandardPhysicsSS.hh" << 50 #include "G4EmStandardPhysicsWVI.hh" << 51 #include "G4EmStandardPhysics_option1.hh" << 52 #include "G4EmStandardPhysics_option2.hh" << 53 #include "G4EmStandardPhysics_option3.hh" << 54 #include "G4EmStandardPhysics_option4.hh" << 55 #include "G4HadronElasticPhysics.hh" << 56 #include "G4ParticleDefinition.hh" << 57 #include "G4ProcessManager.hh" << 58 #include "G4SystemOfUnits.hh" << 59 #include "G4UnitsTable.hh" 45 #include "G4UnitsTable.hh" 60 46 61 // particles << 62 << 63 #include "G4BaryonConstructor.hh" << 64 #include "G4BosonConstructor.hh" << 65 #include "G4DNAGenericIonsManager.hh" << 66 #include "G4IonConstructor.hh" << 67 #include "G4LeptonConstructor.hh" << 68 #include "G4MesonConstructor.hh" << 69 #include "G4ShortLivedConstructor.hh" << 70 << 71 //....oooOO0OOooo........oooOO0OOooo........oo 47 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 72 48 73 PhysicsList::PhysicsList() << 49 PhysicsList::PhysicsList() : G4VModularPhysicsList() 74 { 50 { 75 fMessenger = new PhysicsListMessenger(this); << 51 G4LossTableManager::Instance(); 76 SetVerboseLevel(1); << 52 pMessenger = new PhysicsListMessenger(this); 77 << 53 78 // EM physics 54 // EM physics 79 fEmName = G4String("emstandard_opt4"); << 55 emName = G4String("standard"); 80 fEmPhysicsList = new G4EmStandardPhysics_opt << 56 emPhysicsList = new PhysListEmStandard(emName); 81 << 57 82 // Decay physics << 58 stepMaxProcess = 0; 83 fDecayPhysics = new G4DecayPhysics(1); << 59 >> 60 defaultCutValue = 1.*mm; >> 61 cutForGamma = defaultCutValue; >> 62 cutForElectron = defaultCutValue; >> 63 cutForPositron = defaultCutValue; 84 64 85 SetDefaultCutValue(1 * mm); << 65 SetVerboseLevel(1); 86 } 66 } 87 67 88 //....oooOO0OOooo........oooOO0OOooo........oo 68 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 89 69 90 PhysicsList::~PhysicsList() 70 PhysicsList::~PhysicsList() 91 { 71 { 92 delete fEmPhysicsList; << 72 delete emPhysicsList; 93 delete fMessenger; << 73 for(size_t i=0; i<hadronPhys.size(); i++) delete hadronPhys[i]; >> 74 delete pMessenger; 94 } 75 } 95 76 96 //....oooOO0OOooo........oooOO0OOooo........oo 77 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 97 78 98 void PhysicsList::ConstructParticle() << 79 // Bosons 99 { << 80 #include "G4ChargedGeantino.hh" 100 G4BosonConstructor pBosonConstructor; << 81 #include "G4Geantino.hh" 101 pBosonConstructor.ConstructParticle(); << 82 #include "G4Gamma.hh" 102 << 83 #include "G4OpticalPhoton.hh" 103 G4LeptonConstructor pLeptonConstructor; << 84 104 pLeptonConstructor.ConstructParticle(); << 85 // leptons 105 << 86 #include "G4MuonPlus.hh" 106 G4MesonConstructor pMesonConstructor; << 87 #include "G4MuonMinus.hh" 107 pMesonConstructor.ConstructParticle(); << 88 #include "G4NeutrinoMu.hh" 108 << 89 #include "G4AntiNeutrinoMu.hh" 109 G4BaryonConstructor pBaryonConstructor; << 90 110 pBaryonConstructor.ConstructParticle(); << 91 #include "G4Electron.hh" 111 << 92 #include "G4Positron.hh" 112 G4IonConstructor pIonConstructor; << 93 #include "G4NeutrinoE.hh" 113 pIonConstructor.ConstructParticle(); << 94 #include "G4AntiNeutrinoE.hh" 114 95 115 G4ShortLivedConstructor sLivedConstructor; << 96 // Hadrons 116 sLivedConstructor.ConstructParticle(); << 97 #include "G4MesonConstructor.hh" >> 98 #include "G4BaryonConstructor.hh" >> 99 #include "G4IonConstructor.hh" 117 100 118 // Geant4-DNA << 101 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 119 102 120 G4DNAGenericIonsManager* genericIonsManager; << 103 void PhysicsList::ConstructParticle() 121 genericIonsManager = G4DNAGenericIonsManager << 104 { 122 genericIonsManager->GetIon("alpha++"); << 105 // pseudo-particles 123 genericIonsManager->GetIon("alpha+"); << 106 G4Geantino::GeantinoDefinition(); 124 genericIonsManager->GetIon("helium"); << 107 G4ChargedGeantino::ChargedGeantinoDefinition(); 125 genericIonsManager->GetIon("hydrogen"); << 108 >> 109 // gamma >> 110 G4Gamma::GammaDefinition(); >> 111 >> 112 // optical photon >> 113 G4OpticalPhoton::OpticalPhotonDefinition(); >> 114 >> 115 // leptons >> 116 G4Electron::ElectronDefinition(); >> 117 G4Positron::PositronDefinition(); >> 118 G4MuonPlus::MuonPlusDefinition(); >> 119 G4MuonMinus::MuonMinusDefinition(); >> 120 >> 121 G4NeutrinoE::NeutrinoEDefinition(); >> 122 G4AntiNeutrinoE::AntiNeutrinoEDefinition(); >> 123 G4NeutrinoMu::NeutrinoMuDefinition(); >> 124 G4AntiNeutrinoMu::AntiNeutrinoMuDefinition(); >> 125 >> 126 // mesons >> 127 G4MesonConstructor mConstructor; >> 128 mConstructor.ConstructParticle(); >> 129 >> 130 // barions >> 131 G4BaryonConstructor bConstructor; >> 132 bConstructor.ConstructParticle(); >> 133 >> 134 // ions >> 135 G4IonConstructor iConstructor; >> 136 iConstructor.ConstructParticle(); 126 } 137 } 127 138 128 //....oooOO0OOooo........oooOO0OOooo........oo 139 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 129 140 130 void PhysicsList::ConstructProcess() 141 void PhysicsList::ConstructProcess() 131 { 142 { 132 AddTransportation(); 143 AddTransportation(); 133 fEmPhysicsList->ConstructProcess(); << 144 AddDecay(); 134 fDecayPhysics->ConstructProcess(); << 145 emPhysicsList->ConstructProcess(); 135 if (fHadPhysicsList) { << 146 for(size_t i=0; i<hadronPhys.size(); i++) hadronPhys[i]->ConstructProcess(); 136 fHadPhysicsList->ConstructProcess(); << 137 } << 138 AddStepMax(); 147 AddStepMax(); 139 } 148 } 140 149 >> 150 141 //....oooOO0OOooo........oooOO0OOooo........oo 151 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 142 152 143 void PhysicsList::AddStepMax() << 153 #include "G4ParticleDefinition.hh" >> 154 #include "G4ProcessManager.hh" >> 155 #include "G4Decay.hh" >> 156 >> 157 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 158 >> 159 void PhysicsList::AddDecay() 144 { 160 { 145 // Step limitation seen as a process << 161 // Add Decay Process 146 StepMax* stepMaxProcess = new StepMax(); << 147 162 148 auto particleIterator = GetParticleIterator( << 163 G4Decay* fDecayProcess = new G4Decay(); 149 particleIterator->reset(); << 164 150 while ((*particleIterator)()) { << 165 theParticleIterator->reset(); 151 G4ParticleDefinition* particle = particleI << 166 while( (*theParticleIterator)() ){ >> 167 G4ParticleDefinition* particle = theParticleIterator->value(); 152 G4ProcessManager* pmanager = particle->Get 168 G4ProcessManager* pmanager = particle->GetProcessManager(); 153 169 154 if (stepMaxProcess->IsApplicable(*particle << 170 if (fDecayProcess->IsApplicable(*particle) && !particle->IsShortLived()) { 155 pmanager->AddDiscreteProcess(stepMaxProc << 171 >> 172 pmanager ->AddProcess(fDecayProcess); >> 173 >> 174 // set ordering for PostStepDoIt and AtRestDoIt >> 175 pmanager ->SetProcessOrdering(fDecayProcess, idxPostStep); >> 176 pmanager ->SetProcessOrdering(fDecayProcess, idxAtRest); >> 177 156 } 178 } 157 } 179 } 158 } 180 } 159 181 160 //....oooOO0OOooo........oooOO0OOooo........oo 182 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 161 183 >> 184 #include "StepMax.hh" >> 185 >> 186 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 187 >> 188 void PhysicsList::AddStepMax() >> 189 { >> 190 // Step limitation seen as a process >> 191 stepMaxProcess = new StepMax(); >> 192 >> 193 theParticleIterator->reset(); >> 194 while ((*theParticleIterator)()){ >> 195 G4ParticleDefinition* particle = theParticleIterator->value(); >> 196 G4ProcessManager* pmanager = particle->GetProcessManager(); >> 197 >> 198 if (stepMaxProcess->IsApplicable(*particle) && !particle->IsShortLived()) >> 199 { >> 200 pmanager ->AddDiscreteProcess(stepMaxProcess); >> 201 } >> 202 } >> 203 } >> 204 >> 205 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 206 162 void PhysicsList::AddPhysicsList(const G4Strin 207 void PhysicsList::AddPhysicsList(const G4String& name) 163 { 208 { 164 if (verboseLevel > -1) { << 209 if (verboseLevel>-1) { 165 G4cout << "PhysicsList::AddPhysicsList: <" 210 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl; 166 } 211 } 167 212 168 if (name == fEmName) return; << 213 if (name == emName) return; >> 214 >> 215 if (name == "standard") { >> 216 >> 217 emName = name; >> 218 delete emPhysicsList; >> 219 emPhysicsList = new PhysListEmStandard(name); >> 220 >> 221 } else if (name == "g4v52") { >> 222 >> 223 emName = name; >> 224 delete emPhysicsList; >> 225 emPhysicsList = new PhysListEmG4v52(name); >> 226 >> 227 } else if (name == "g4v71") { >> 228 >> 229 emName = name; >> 230 delete emPhysicsList; >> 231 emPhysicsList = new PhysListEmG4v71(name); >> 232 >> 233 } else if (name == "livermore") { >> 234 >> 235 emName = name; >> 236 delete emPhysicsList; >> 237 emPhysicsList = new PhysListEmLivermore(name); >> 238 >> 239 } else if (name == "penelope") { >> 240 >> 241 emName = name; >> 242 delete emPhysicsList; >> 243 emPhysicsList = new PhysListEmPenelope(name); >> 244 >> 245 } else if (name == "elastic") { >> 246 >> 247 hadronPhys.push_back( new PhysListHadronElastic(name)); >> 248 >> 249 } else if (name == "binary") { >> 250 >> 251 hadronPhys.push_back( new PhysListBinaryCascade(name)); >> 252 >> 253 } else if (name == "binary_ion") { >> 254 >> 255 hadronPhys.push_back( new PhysListIonBinaryCascade(name)); >> 256 >> 257 } else { 169 258 170 if (name == "local") { << 171 fEmName = name; << 172 delete fEmPhysicsList; << 173 fEmPhysicsList = new PhysListEmStandard(na << 174 } << 175 else if (name == "emstandard_opt0") { << 176 fEmName = name; << 177 delete fEmPhysicsList; << 178 fEmPhysicsList = new G4EmStandardPhysics() << 179 } << 180 else if (name == "emstandard_opt1") { << 181 fEmName = name; << 182 delete fEmPhysicsList; << 183 fEmPhysicsList = new G4EmStandardPhysics_o << 184 } << 185 else if (name == "emstandard_opt2") { << 186 fEmName = name; << 187 delete fEmPhysicsList; << 188 fEmPhysicsList = new G4EmStandardPhysics_o << 189 } << 190 else if (name == "emstandard_opt3") { << 191 fEmName = name; << 192 delete fEmPhysicsList; << 193 fEmPhysicsList = new G4EmStandardPhysics_o << 194 } << 195 else if (name == "emstandard_opt4") { << 196 fEmName = name; << 197 delete fEmPhysicsList; << 198 fEmPhysicsList = new G4EmStandardPhysics_o << 199 } << 200 else if (name == "emstandardSS") { << 201 fEmName = name; << 202 delete fEmPhysicsList; << 203 fEmPhysicsList = new G4EmStandardPhysicsSS << 204 } << 205 else if (name == "emstandardWVI") { << 206 fEmName = name; << 207 delete fEmPhysicsList; << 208 fEmPhysicsList = new G4EmStandardPhysicsWV << 209 } << 210 else if (name == "emstandardGS") { << 211 fEmName = name; << 212 delete fEmPhysicsList; << 213 fEmPhysicsList = new G4EmStandardPhysicsGS << 214 } << 215 else if (name == "empenelope") { << 216 fEmName = name; << 217 delete fEmPhysicsList; << 218 fEmPhysicsList = new G4EmPenelopePhysics() << 219 } << 220 else if (name == "emlowenergy") { << 221 fEmName = name; << 222 delete fEmPhysicsList; << 223 fEmPhysicsList = new G4EmLowEPPhysics(); << 224 } << 225 else if (name == "emlivermore") { << 226 fEmName = name; << 227 delete fEmPhysicsList; << 228 fEmPhysicsList = new G4EmLivermorePhysics( << 229 } << 230 else if (name == "dna") { << 231 fEmName = name; << 232 delete fEmPhysicsList; << 233 fEmPhysicsList = new G4EmDNAPhysics(); << 234 } << 235 else if (name == "dna_opt2") { << 236 fEmName = name; << 237 delete fEmPhysicsList; << 238 fEmPhysicsList = new G4EmDNAPhysics_option << 239 } << 240 else if (name == "dna_opt4") { << 241 fEmName = name; << 242 delete fEmPhysicsList; << 243 fEmPhysicsList = new G4EmDNAPhysics_option << 244 } << 245 else if (name == "dna_opt6") { << 246 fEmName = name; << 247 delete fEmPhysicsList; << 248 fEmPhysicsList = new G4EmDNAPhysics_option << 249 } << 250 else if (name == "had_elastic" && !fHadPhysi << 251 fHadPhysicsList = new G4HadronElasticPhysi << 252 } << 253 else { << 254 G4cout << "PhysicsList::AddPhysicsList: <" 259 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" 255 << " is not defined" << G4endl; << 260 << " is not defined" >> 261 << G4endl; >> 262 } >> 263 } >> 264 >> 265 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 266 >> 267 void PhysicsList::SetCuts() >> 268 { >> 269 >> 270 if (verboseLevel >0){ >> 271 G4cout << "PhysicsList::SetCuts:"; >> 272 G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl; 256 } 273 } >> 274 >> 275 // set cut values for gamma at first and for e- second and next for e+, >> 276 // because some processes for e+/e- need cut values for gamma >> 277 SetCutValue(cutForGamma, "gamma"); >> 278 SetCutValue(cutForElectron, "e-"); >> 279 SetCutValue(cutForPositron, "e+"); >> 280 >> 281 if (verboseLevel>0) DumpCutValuesTable(); 257 } 282 } 258 283 259 //....oooOO0OOooo........oooOO0OOooo........oo 284 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 285 >> 286 void PhysicsList::SetCutForGamma(G4double cut) >> 287 { >> 288 cutForGamma = cut; >> 289 SetParticleCuts(cutForGamma, G4Gamma::Gamma()); >> 290 } >> 291 >> 292 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 293 >> 294 void PhysicsList::SetCutForElectron(G4double cut) >> 295 { >> 296 cutForElectron = cut; >> 297 SetParticleCuts(cutForElectron, G4Electron::Electron()); >> 298 } >> 299 >> 300 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 301 >> 302 void PhysicsList::SetCutForPositron(G4double cut) >> 303 { >> 304 cutForPositron = cut; >> 305 SetParticleCuts(cutForPositron, G4Positron::Positron()); >> 306 } >> 307 >> 308 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 309 260 310