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