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 PhysicsList.cc << 26 /// \file electromagnetic/TestEm3/src/PhysicsList.cc 27 /// \brief Implementation of the PhysicsList c 27 /// \brief Implementation of the PhysicsList class 28 // 28 // >> 29 // $Id$ 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" >> 35 #include "PhysicsListMessenger.hh" 34 36 35 #include "PhysListEmStandard.hh" 37 #include "PhysListEmStandard.hh" 36 #include "PhysicsListMessenger.hh" << 37 #include "StepMax.hh" << 38 38 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" 39 #include "G4EmStandardPhysics.hh" 48 #include "G4EmStandardPhysicsGS.hh" << 49 #include "G4EmStandardPhysicsSS.hh" << 50 #include "G4EmStandardPhysicsWVI.hh" << 51 #include "G4EmStandardPhysics_option1.hh" 40 #include "G4EmStandardPhysics_option1.hh" 52 #include "G4EmStandardPhysics_option2.hh" 41 #include "G4EmStandardPhysics_option2.hh" 53 #include "G4EmStandardPhysics_option3.hh" 42 #include "G4EmStandardPhysics_option3.hh" 54 #include "G4EmStandardPhysics_option4.hh" 43 #include "G4EmStandardPhysics_option4.hh" 55 #include "G4HadronElasticPhysics.hh" << 44 #include "G4EmStandardPhysicsWVI.hh" 56 #include "G4ParticleDefinition.hh" << 45 #include "G4EmStandardPhysicsGS.hh" 57 #include "G4ProcessManager.hh" << 46 #include "G4EmStandardPhysicsSS.hh" 58 #include "G4SystemOfUnits.hh" << 47 >> 48 #include "G4EmLivermorePhysics.hh" >> 49 #include "G4EmPenelopePhysics.hh" >> 50 #include "G4EmLowEPPhysics.hh" >> 51 >> 52 #include "G4LossTableManager.hh" 59 #include "G4UnitsTable.hh" 53 #include "G4UnitsTable.hh" >> 54 #include "G4SystemOfUnits.hh" 60 55 61 // particles 56 // particles 62 57 63 #include "G4BaryonConstructor.hh" << 64 #include "G4BosonConstructor.hh" 58 #include "G4BosonConstructor.hh" 65 #include "G4DNAGenericIonsManager.hh" << 66 #include "G4IonConstructor.hh" << 67 #include "G4LeptonConstructor.hh" 59 #include "G4LeptonConstructor.hh" 68 #include "G4MesonConstructor.hh" 60 #include "G4MesonConstructor.hh" >> 61 #include "G4BosonConstructor.hh" >> 62 #include "G4BaryonConstructor.hh" >> 63 #include "G4IonConstructor.hh" 69 #include "G4ShortLivedConstructor.hh" 64 #include "G4ShortLivedConstructor.hh" 70 65 71 //....oooOO0OOooo........oooOO0OOooo........oo 66 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 72 67 73 PhysicsList::PhysicsList() << 68 PhysicsList::PhysicsList() : G4VModularPhysicsList(), >> 69 fEmPhysicsList(0), fStepMaxProcess(0), fMessenger(0) 74 { 70 { >> 71 G4LossTableManager::Instance(); >> 72 SetDefaultCutValue(1*mm); >> 73 75 fMessenger = new PhysicsListMessenger(this); 74 fMessenger = new PhysicsListMessenger(this); 76 SetVerboseLevel(1); 75 SetVerboseLevel(1); 77 76 78 // EM physics 77 // EM physics 79 fEmName = G4String("emstandard_opt4"); << 78 fEmName = G4String("local"); 80 fEmPhysicsList = new G4EmStandardPhysics_opt << 79 fEmPhysicsList = new PhysListEmStandard(fEmName); 81 << 82 // Decay physics << 83 fDecayPhysics = new G4DecayPhysics(1); << 84 80 85 SetDefaultCutValue(1 * mm); << 86 } 81 } 87 82 88 //....oooOO0OOooo........oooOO0OOooo........oo 83 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 89 84 90 PhysicsList::~PhysicsList() 85 PhysicsList::~PhysicsList() 91 { 86 { 92 delete fEmPhysicsList; << 93 delete fMessenger; 87 delete fMessenger; 94 } 88 } 95 89 96 //....oooOO0OOooo........oooOO0OOooo........oo 90 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 97 91 98 void PhysicsList::ConstructParticle() 92 void PhysicsList::ConstructParticle() 99 { 93 { 100 G4BosonConstructor pBosonConstructor; << 94 G4BosonConstructor pBosonConstructor; 101 pBosonConstructor.ConstructParticle(); << 95 pBosonConstructor.ConstructParticle(); 102 96 103 G4LeptonConstructor pLeptonConstructor; << 97 G4LeptonConstructor pLeptonConstructor; 104 pLeptonConstructor.ConstructParticle(); << 98 pLeptonConstructor.ConstructParticle(); 105 99 106 G4MesonConstructor pMesonConstructor; << 100 G4MesonConstructor pMesonConstructor; 107 pMesonConstructor.ConstructParticle(); << 101 pMesonConstructor.ConstructParticle(); 108 102 109 G4BaryonConstructor pBaryonConstructor; << 103 G4BaryonConstructor pBaryonConstructor; 110 pBaryonConstructor.ConstructParticle(); << 104 pBaryonConstructor.ConstructParticle(); 111 105 112 G4IonConstructor pIonConstructor; << 106 G4IonConstructor pIonConstructor; 113 pIonConstructor.ConstructParticle(); << 107 pIonConstructor.ConstructParticle(); 114 108 115 G4ShortLivedConstructor sLivedConstructor; << 109 G4ShortLivedConstructor pShortLivedConstructor; 116 sLivedConstructor.ConstructParticle(); << 110 pShortLivedConstructor.ConstructParticle(); 117 << 118 // Geant4-DNA << 119 << 120 G4DNAGenericIonsManager* genericIonsManager; << 121 genericIonsManager = G4DNAGenericIonsManager << 122 genericIonsManager->GetIon("alpha++"); << 123 genericIonsManager->GetIon("alpha+"); << 124 genericIonsManager->GetIon("helium"); << 125 genericIonsManager->GetIon("hydrogen"); << 126 } 111 } 127 112 128 //....oooOO0OOooo........oooOO0OOooo........oo 113 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 129 114 >> 115 #include "G4ProcessManager.hh" >> 116 130 void PhysicsList::ConstructProcess() 117 void PhysicsList::ConstructProcess() 131 { 118 { >> 119 // Transportation >> 120 // 132 AddTransportation(); 121 AddTransportation(); 133 fEmPhysicsList->ConstructProcess(); << 134 fDecayPhysics->ConstructProcess(); << 135 if (fHadPhysicsList) { << 136 fHadPhysicsList->ConstructProcess(); << 137 } << 138 AddStepMax(); << 139 } << 140 122 141 //....oooOO0OOooo........oooOO0OOooo........oo << 123 // electromagnetic Physics List 142 << 124 // 143 void PhysicsList::AddStepMax() << 125 fEmPhysicsList->ConstructProcess(); 144 { << 145 // Step limitation seen as a process << 146 StepMax* stepMaxProcess = new StepMax(); << 147 << 148 auto particleIterator = GetParticleIterator( << 149 particleIterator->reset(); << 150 while ((*particleIterator)()) { << 151 G4ParticleDefinition* particle = particleI << 152 G4ProcessManager* pmanager = particle->Get << 153 126 154 if (stepMaxProcess->IsApplicable(*particle << 127 // decay Process 155 pmanager->AddDiscreteProcess(stepMaxProc << 128 // 156 } << 129 AddDecay(); 157 } << 130 >> 131 // radioactive decay Process >> 132 // >> 133 ////AddRadioactiveDecay(); >> 134 >> 135 // stepLimitation (as a full process) >> 136 // >> 137 AddStepMax(); 158 } 138 } 159 139 160 //....oooOO0OOooo........oooOO0OOooo........oo 140 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 161 141 162 void PhysicsList::AddPhysicsList(const G4Strin 142 void PhysicsList::AddPhysicsList(const G4String& name) 163 { 143 { 164 if (verboseLevel > -1) { << 144 if (verboseLevel>1) { 165 G4cout << "PhysicsList::AddPhysicsList: <" 145 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl; 166 } 146 } 167 147 168 if (name == fEmName) return; 148 if (name == fEmName) return; 169 149 170 if (name == "local") { 150 if (name == "local") { >> 151 171 fEmName = name; 152 fEmName = name; 172 delete fEmPhysicsList; 153 delete fEmPhysicsList; 173 fEmPhysicsList = new PhysListEmStandard(na 154 fEmPhysicsList = new PhysListEmStandard(name); 174 } << 155 175 else if (name == "emstandard_opt0") { << 156 } else if (name == "emstandard_opt0") { >> 157 176 fEmName = name; 158 fEmName = name; 177 delete fEmPhysicsList; 159 delete fEmPhysicsList; 178 fEmPhysicsList = new G4EmStandardPhysics() 160 fEmPhysicsList = new G4EmStandardPhysics(); 179 } << 161 180 else if (name == "emstandard_opt1") { << 162 } else if (name == "emstandard_opt1") { >> 163 181 fEmName = name; 164 fEmName = name; 182 delete fEmPhysicsList; 165 delete fEmPhysicsList; 183 fEmPhysicsList = new G4EmStandardPhysics_o 166 fEmPhysicsList = new G4EmStandardPhysics_option1(); 184 } << 167 185 else if (name == "emstandard_opt2") { << 168 } else if (name == "emstandard_opt2") { >> 169 186 fEmName = name; 170 fEmName = name; 187 delete fEmPhysicsList; 171 delete fEmPhysicsList; 188 fEmPhysicsList = new G4EmStandardPhysics_o 172 fEmPhysicsList = new G4EmStandardPhysics_option2(); 189 } << 173 190 else if (name == "emstandard_opt3") { << 174 } else if (name == "emstandard_opt3") { >> 175 191 fEmName = name; 176 fEmName = name; 192 delete fEmPhysicsList; 177 delete fEmPhysicsList; 193 fEmPhysicsList = new G4EmStandardPhysics_o 178 fEmPhysicsList = new G4EmStandardPhysics_option3(); 194 } << 179 195 else if (name == "emstandard_opt4") { << 180 } else if (name == "emstandard_opt4") { >> 181 196 fEmName = name; 182 fEmName = name; 197 delete fEmPhysicsList; 183 delete fEmPhysicsList; 198 fEmPhysicsList = new G4EmStandardPhysics_o 184 fEmPhysicsList = new G4EmStandardPhysics_option4(); 199 } << 185 200 else if (name == "emstandardSS") { << 186 } else if (name == "emstandardWVI") { 201 fEmName = name; << 187 202 delete fEmPhysicsList; << 203 fEmPhysicsList = new G4EmStandardPhysicsSS << 204 } << 205 else if (name == "emstandardWVI") { << 206 fEmName = name; 188 fEmName = name; 207 delete fEmPhysicsList; 189 delete fEmPhysicsList; 208 fEmPhysicsList = new G4EmStandardPhysicsWV 190 fEmPhysicsList = new G4EmStandardPhysicsWVI(); 209 } << 191 210 else if (name == "emstandardGS") { << 192 } else if (name == "emstandardGS") { >> 193 211 fEmName = name; 194 fEmName = name; 212 delete fEmPhysicsList; 195 delete fEmPhysicsList; 213 fEmPhysicsList = new G4EmStandardPhysicsGS 196 fEmPhysicsList = new G4EmStandardPhysicsGS(); 214 } << 197 215 else if (name == "empenelope") { << 198 } else if (name == "emstandardSS") { 216 fEmName = name; << 199 217 delete fEmPhysicsList; << 218 fEmPhysicsList = new G4EmPenelopePhysics() << 219 } << 220 else if (name == "emlowenergy") { << 221 fEmName = name; 200 fEmName = name; 222 delete fEmPhysicsList; 201 delete fEmPhysicsList; 223 fEmPhysicsList = new G4EmLowEPPhysics(); << 202 fEmPhysicsList = new G4EmStandardPhysicsSS(); 224 } << 203 225 else if (name == "emlivermore") { << 204 } else if (name == "emlivermore") { >> 205 226 fEmName = name; 206 fEmName = name; 227 delete fEmPhysicsList; 207 delete fEmPhysicsList; 228 fEmPhysicsList = new G4EmLivermorePhysics( 208 fEmPhysicsList = new G4EmLivermorePhysics(); 229 } << 209 230 else if (name == "dna") { << 210 } else if (name == "empenelope") { 231 fEmName = name; << 211 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; 212 fEmName = name; 242 delete fEmPhysicsList; 213 delete fEmPhysicsList; 243 fEmPhysicsList = new G4EmDNAPhysics_option << 214 fEmPhysicsList = new G4EmPenelopePhysics(); 244 } << 215 245 else if (name == "dna_opt6") { << 216 } else if (name == "emlowenergy") { >> 217 246 fEmName = name; 218 fEmName = name; 247 delete fEmPhysicsList; 219 delete fEmPhysicsList; 248 fEmPhysicsList = new G4EmDNAPhysics_option << 220 fEmPhysicsList = new G4EmLowEPPhysics(); >> 221 >> 222 } else { >> 223 >> 224 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" >> 225 << " is not defined" >> 226 << G4endl; 249 } 227 } 250 else if (name == "had_elastic" && !fHadPhysi << 228 } 251 fHadPhysicsList = new G4HadronElasticPhysi << 229 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 230 >> 231 #include "G4PhysicsListHelper.hh" >> 232 #include "G4Decay.hh" >> 233 >> 234 void PhysicsList::AddDecay() >> 235 { >> 236 G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper(); >> 237 >> 238 // Decay Process >> 239 // >> 240 G4Decay* fDecayProcess = new G4Decay(); >> 241 >> 242 auto particleIterator=GetParticleIterator(); >> 243 particleIterator->reset(); >> 244 while( (*particleIterator)() ){ >> 245 G4ParticleDefinition* particle = particleIterator->value(); >> 246 if (fDecayProcess->IsApplicable(*particle)) >> 247 ph->RegisterProcess(fDecayProcess, particle); 252 } 248 } 253 else { << 249 } 254 G4cout << "PhysicsList::AddPhysicsList: <" << 250 255 << " is not defined" << G4endl; << 251 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 252 >> 253 #include "G4PhysicsListHelper.hh" >> 254 #include "G4RadioactiveDecay.hh" >> 255 #include "G4GenericIon.hh" >> 256 #include "G4NuclideTable.hh" >> 257 >> 258 void PhysicsList::AddRadioactiveDecay() >> 259 { >> 260 G4RadioactiveDecay* radioactiveDecay = new G4RadioactiveDecay(); >> 261 >> 262 radioactiveDecay->SetARM(true); //Atomic Rearangement >> 263 >> 264 G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper(); >> 265 ph->RegisterProcess(radioactiveDecay, G4GenericIon::GenericIon()); >> 266 >> 267 // mandatory for G4NuclideTable >> 268 // >> 269 G4NuclideTable::GetInstance()->SetThresholdOfHalfLife(0.1*picosecond); >> 270 } >> 271 >> 272 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 273 >> 274 #include "StepMax.hh" >> 275 >> 276 void PhysicsList::AddStepMax() >> 277 { >> 278 // Step limitation seen as a process >> 279 fStepMaxProcess = new StepMax(); >> 280 >> 281 auto particleIterator=GetParticleIterator(); >> 282 particleIterator->reset(); >> 283 while ((*particleIterator)()){ >> 284 G4ParticleDefinition* particle = particleIterator->value(); >> 285 G4ProcessManager* pmanager = particle->GetProcessManager(); >> 286 >> 287 if (fStepMaxProcess->IsApplicable(*particle)) >> 288 { >> 289 pmanager ->AddDiscreteProcess(fStepMaxProcess); >> 290 } 256 } 291 } 257 } 292 } 258 293 259 //....oooOO0OOooo........oooOO0OOooo........oo 294 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 260 295