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/TestEm12/src/Physics 26 /// \file electromagnetic/TestEm12/src/PhysicsList.cc 27 /// \brief Implementation of the PhysicsList c 27 /// \brief Implementation of the PhysicsList class 28 // 28 // 29 // 29 // 30 //....oooOO0OOooo........oooOO0OOooo........oo 30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 31 //....oooOO0OOooo........oooOO0OOooo........oo 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 32 32 33 #include "PhysicsList.hh" 33 #include "PhysicsList.hh" >> 34 #include "PhysicsListMessenger.hh" 34 35 35 #include "PhysListEmStandard.hh" 36 #include "PhysListEmStandard.hh" 36 #include "PhysListEmStandardSSM.hh" 37 #include "PhysListEmStandardSSM.hh" 37 #include "PhysicsListMessenger.hh" << 38 38 >> 39 #include "G4EmStandardPhysics.hh" >> 40 #include "G4EmStandardPhysics_option1.hh" >> 41 #include "G4EmStandardPhysics_option2.hh" >> 42 #include "G4EmStandardPhysics_option3.hh" >> 43 #include "G4EmStandardPhysics_option4.hh" >> 44 #include "G4EmStandardPhysicsWVI.hh" >> 45 #include "G4EmStandardPhysicsGS.hh" >> 46 #include "G4EmStandardPhysicsSS.hh" >> 47 #include "G4EmLivermorePhysics.hh" >> 48 #include "G4EmPenelopePhysics.hh" >> 49 #include "G4EmLowEPPhysics.hh" 39 #include "G4EmDNAPhysics.hh" 50 #include "G4EmDNAPhysics.hh" 40 #include "G4EmDNAPhysics_option1.hh" 51 #include "G4EmDNAPhysics_option1.hh" 41 #include "G4EmDNAPhysics_option2.hh" 52 #include "G4EmDNAPhysics_option2.hh" 42 #include "G4EmDNAPhysics_option3.hh" 53 #include "G4EmDNAPhysics_option3.hh" 43 #include "G4EmDNAPhysics_option4.hh" 54 #include "G4EmDNAPhysics_option4.hh" 44 #include "G4EmDNAPhysics_option5.hh" 55 #include "G4EmDNAPhysics_option5.hh" 45 #include "G4EmDNAPhysics_option6.hh" 56 #include "G4EmDNAPhysics_option6.hh" 46 #include "G4EmDNAPhysics_option7.hh" 57 #include "G4EmDNAPhysics_option7.hh" 47 #include "G4EmLivermorePhysics.hh" << 58 48 #include "G4EmLowEPPhysics.hh" << 49 #include "G4EmPenelopePhysics.hh" << 50 #include "G4EmStandardPhysics.hh" << 51 #include "G4EmStandardPhysicsGS.hh" << 52 #include "G4EmStandardPhysicsSS.hh" << 53 #include "G4EmStandardPhysicsWVI.hh" << 54 #include "G4EmStandardPhysics_option1.hh" << 55 #include "G4EmStandardPhysics_option2.hh" << 56 #include "G4EmStandardPhysics_option3.hh" << 57 #include "G4EmStandardPhysics_option4.hh" << 58 #include "G4LossTableManager.hh" 59 #include "G4LossTableManager.hh" 59 #include "G4SystemOfUnits.hh" << 60 #include "G4UnitsTable.hh" 60 #include "G4UnitsTable.hh" >> 61 #include "G4SystemOfUnits.hh" 61 62 62 // particles 63 // particles 63 64 64 #include "G4BaryonConstructor.hh" << 65 #include "G4BosonConstructor.hh" 65 #include "G4BosonConstructor.hh" 66 #include "G4DNAGenericIonsManager.hh" << 67 #include "G4IonConstructor.hh" << 68 #include "G4LeptonConstructor.hh" 66 #include "G4LeptonConstructor.hh" 69 #include "G4MesonConstructor.hh" 67 #include "G4MesonConstructor.hh" >> 68 #include "G4BosonConstructor.hh" >> 69 #include "G4BaryonConstructor.hh" >> 70 #include "G4IonConstructor.hh" 70 #include "G4ShortLivedConstructor.hh" 71 #include "G4ShortLivedConstructor.hh" >> 72 #include "G4DNAGenericIonsManager.hh" 71 73 72 G4ThreadLocal StepMax* PhysicsList::fStepMaxPr 74 G4ThreadLocal StepMax* PhysicsList::fStepMaxProcess = nullptr; 73 75 74 //....oooOO0OOooo........oooOO0OOooo........oo 76 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 75 77 76 PhysicsList::PhysicsList() 78 PhysicsList::PhysicsList() 77 { 79 { 78 fMessenger = new PhysicsListMessenger(this); 80 fMessenger = new PhysicsListMessenger(this); 79 81 80 SetVerboseLevel(1); 82 SetVerboseLevel(1); 81 83 82 // EM physics 84 // EM physics 83 fEmPhysicsList = new PhysListEmStandard(fEmN 85 fEmPhysicsList = new PhysListEmStandard(fEmName = "local"); 84 86 85 // Em options 87 // Em options 86 // 88 // 87 G4EmParameters::Instance()->SetBuildCSDARang 89 G4EmParameters::Instance()->SetBuildCSDARange(true); 88 90 89 SetDefaultCutValue(1. * mm); << 91 SetDefaultCutValue(1.*mm); 90 } 92 } 91 93 92 //....oooOO0OOooo........oooOO0OOooo........oo 94 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 93 95 94 PhysicsList::~PhysicsList() 96 PhysicsList::~PhysicsList() 95 { 97 { 96 delete fMessenger; 98 delete fMessenger; 97 delete fEmPhysicsList; 99 delete fEmPhysicsList; 98 } 100 } 99 101 100 //....oooOO0OOooo........oooOO0OOooo........oo 102 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 101 103 102 void PhysicsList::ConstructParticle() 104 void PhysicsList::ConstructParticle() 103 { 105 { 104 G4BosonConstructor pBosonConstructor; << 106 G4BosonConstructor pBosonConstructor; 105 pBosonConstructor.ConstructParticle(); << 107 pBosonConstructor.ConstructParticle(); 106 108 107 G4LeptonConstructor pLeptonConstructor; << 109 G4LeptonConstructor pLeptonConstructor; 108 pLeptonConstructor.ConstructParticle(); << 110 pLeptonConstructor.ConstructParticle(); 109 111 110 G4MesonConstructor pMesonConstructor; << 112 G4MesonConstructor pMesonConstructor; 111 pMesonConstructor.ConstructParticle(); << 113 pMesonConstructor.ConstructParticle(); 112 114 113 G4BaryonConstructor pBaryonConstructor; << 115 G4BaryonConstructor pBaryonConstructor; 114 pBaryonConstructor.ConstructParticle(); << 116 pBaryonConstructor.ConstructParticle(); 115 117 116 G4IonConstructor pIonConstructor; << 118 G4IonConstructor pIonConstructor; 117 pIonConstructor.ConstructParticle(); << 119 pIonConstructor.ConstructParticle(); 118 120 119 G4ShortLivedConstructor pShortLivedConstruct << 121 G4ShortLivedConstructor pShortLivedConstructor; 120 pShortLivedConstructor.ConstructParticle(); << 122 pShortLivedConstructor.ConstructParticle(); 121 123 122 // DNA << 124 // DNA 123 G4DNAGenericIonsManager* genericIonsManager; 125 G4DNAGenericIonsManager* genericIonsManager; 124 genericIonsManager = G4DNAGenericIonsManager << 126 genericIonsManager=G4DNAGenericIonsManager::Instance(); 125 genericIonsManager->GetIon("alpha++"); 127 genericIonsManager->GetIon("alpha++"); 126 genericIonsManager->GetIon("alpha+"); 128 genericIonsManager->GetIon("alpha+"); 127 genericIonsManager->GetIon("helium"); 129 genericIonsManager->GetIon("helium"); 128 genericIonsManager->GetIon("hydrogen"); << 130 genericIonsManager->GetIon("hydrogen"); 129 } 131 } 130 132 131 //....oooOO0OOooo........oooOO0OOooo........oo 133 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 132 134 133 #include "G4ProcessManager.hh" 135 #include "G4ProcessManager.hh" 134 136 135 void PhysicsList::ConstructProcess() 137 void PhysicsList::ConstructProcess() 136 { 138 { 137 // transportation 139 // transportation 138 // 140 // 139 AddTransportation(); 141 AddTransportation(); 140 << 142 141 // electromagnetic physics list 143 // electromagnetic physics list 142 // 144 // 143 fEmPhysicsList->ConstructProcess(); 145 fEmPhysicsList->ConstructProcess(); 144 << 146 145 // decay process 147 // decay process 146 // 148 // 147 AddDecay(); 149 AddDecay(); 148 << 150 149 // step limitation (as a full process) 151 // step limitation (as a full process) 150 // << 152 // 151 AddStepMax(); 153 AddStepMax(); 152 } 154 } 153 155 154 //....oooOO0OOooo........oooOO0OOooo........oo 156 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 155 157 156 void PhysicsList::AddPhysicsList(const G4Strin 158 void PhysicsList::AddPhysicsList(const G4String& name) 157 { 159 { 158 if (verboseLevel > -1) { << 160 if (verboseLevel>-1) { 159 G4cout << "PhysicsList::AddPhysicsList: <" 161 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl; 160 } 162 } 161 163 162 if (name == fEmName) return; 164 if (name == fEmName) return; 163 165 164 if (name == "local") { 166 if (name == "local") { >> 167 165 fEmName = name; 168 fEmName = name; 166 delete fEmPhysicsList; 169 delete fEmPhysicsList; 167 fEmPhysicsList = new PhysListEmStandard(na 170 fEmPhysicsList = new PhysListEmStandard(name); 168 } << 171 169 else if (name == "emstandard_opt0") { << 172 } else if (name == "emstandard_opt0") { >> 173 170 fEmName = name; 174 fEmName = name; 171 delete fEmPhysicsList; 175 delete fEmPhysicsList; 172 fEmPhysicsList = new G4EmStandardPhysics() 176 fEmPhysicsList = new G4EmStandardPhysics(); 173 } << 177 174 else if (name == "emstandard_opt1") { << 178 } else if (name == "emstandard_opt1") { >> 179 175 fEmName = name; 180 fEmName = name; 176 delete fEmPhysicsList; 181 delete fEmPhysicsList; 177 fEmPhysicsList = new G4EmStandardPhysics_o 182 fEmPhysicsList = new G4EmStandardPhysics_option1(); 178 } << 183 179 else if (name == "emstandard_opt2") { << 184 } else if (name == "emstandard_opt2") { >> 185 180 fEmName = name; 186 fEmName = name; 181 delete fEmPhysicsList; 187 delete fEmPhysicsList; 182 fEmPhysicsList = new G4EmStandardPhysics_o 188 fEmPhysicsList = new G4EmStandardPhysics_option2(); 183 } << 189 184 else if (name == "emstandard_opt3") { << 190 } else if (name == "emstandard_opt3") { >> 191 185 fEmName = name; 192 fEmName = name; 186 delete fEmPhysicsList; 193 delete fEmPhysicsList; 187 fEmPhysicsList = new G4EmStandardPhysics_o 194 fEmPhysicsList = new G4EmStandardPhysics_option3(); 188 } << 195 189 else if (name == "emstandard_opt4") { << 196 } else if (name == "emstandard_opt4") { >> 197 190 fEmName = name; 198 fEmName = name; 191 delete fEmPhysicsList; 199 delete fEmPhysicsList; 192 fEmPhysicsList = new G4EmStandardPhysics_o 200 fEmPhysicsList = new G4EmStandardPhysics_option4(); 193 } << 201 194 else if (name == "emstandardSS") { << 202 } else if (name == "emstandardSS") { >> 203 195 fEmName = name; 204 fEmName = name; 196 delete fEmPhysicsList; 205 delete fEmPhysicsList; 197 fEmPhysicsList = new G4EmStandardPhysicsSS 206 fEmPhysicsList = new G4EmStandardPhysicsSS(); 198 } << 207 199 else if (name == "standardSSM") { << 208 } else if (name == "standardSSM") { >> 209 200 fEmName = name; 210 fEmName = name; 201 delete fEmPhysicsList; 211 delete fEmPhysicsList; 202 fEmPhysicsList = new PhysListEmStandardSSM 212 fEmPhysicsList = new PhysListEmStandardSSM(name); 203 } << 213 204 else if (name == "emstandardWVI") { << 214 } else if (name == "emstandardWVI") { >> 215 205 fEmName = name; 216 fEmName = name; 206 delete fEmPhysicsList; 217 delete fEmPhysicsList; 207 fEmPhysicsList = new G4EmStandardPhysicsWV 218 fEmPhysicsList = new G4EmStandardPhysicsWVI(); 208 } << 219 209 else if (name == "standardGS") { << 220 } else if (name == "standardGS") { >> 221 210 fEmName = name; 222 fEmName = name; 211 delete fEmPhysicsList; 223 delete fEmPhysicsList; 212 fEmPhysicsList = new G4EmStandardPhysicsGS 224 fEmPhysicsList = new G4EmStandardPhysicsGS(); 213 } << 225 214 else if (name == "emlivermore") { << 226 } else if (name == "emlivermore") { 215 fEmName = name; 227 fEmName = name; 216 delete fEmPhysicsList; 228 delete fEmPhysicsList; 217 fEmPhysicsList = new G4EmLivermorePhysics( 229 fEmPhysicsList = new G4EmLivermorePhysics(); 218 } << 230 219 else if (name == "empenelope") { << 231 } else if (name == "empenelope") { 220 fEmName = name; 232 fEmName = name; 221 delete fEmPhysicsList; 233 delete fEmPhysicsList; 222 fEmPhysicsList = new G4EmPenelopePhysics() 234 fEmPhysicsList = new G4EmPenelopePhysics(); 223 } << 235 224 else if (name == "emlowenergy") { << 236 } else if (name == "emlowenergy") { 225 fEmName = name; 237 fEmName = name; 226 delete fEmPhysicsList; 238 delete fEmPhysicsList; 227 fEmPhysicsList = new G4EmLowEPPhysics(); 239 fEmPhysicsList = new G4EmLowEPPhysics(); 228 } << 240 229 else if (name == "dna") { << 241 } else if (name == "dna") { 230 fEmName = name; 242 fEmName = name; 231 delete fEmPhysicsList; 243 delete fEmPhysicsList; 232 fEmPhysicsList = new G4EmDNAPhysics(); 244 fEmPhysicsList = new G4EmDNAPhysics(); 233 } << 245 234 else if (name == "dna_opt1") { << 246 } else if (name == "dna_opt1") { 235 fEmName = name; 247 fEmName = name; 236 delete fEmPhysicsList; 248 delete fEmPhysicsList; 237 fEmPhysicsList = new G4EmDNAPhysics_option 249 fEmPhysicsList = new G4EmDNAPhysics_option1(); 238 } << 250 239 else if (name == "dna_opt2") { << 251 } else if (name == "dna_opt2") { 240 fEmName = name; 252 fEmName = name; 241 delete fEmPhysicsList; 253 delete fEmPhysicsList; 242 fEmPhysicsList = new G4EmDNAPhysics_option 254 fEmPhysicsList = new G4EmDNAPhysics_option2(); 243 } << 255 244 else if (name == "dna_opt3") { << 256 } else if (name == "dna_opt3") { 245 fEmName = name; 257 fEmName = name; 246 delete fEmPhysicsList; 258 delete fEmPhysicsList; 247 fEmPhysicsList = new G4EmDNAPhysics_option 259 fEmPhysicsList = new G4EmDNAPhysics_option3(); 248 } << 260 249 else if (name == "dna_opt4") { << 261 } else if (name == "dna_opt4") { 250 fEmName = name; 262 fEmName = name; 251 delete fEmPhysicsList; 263 delete fEmPhysicsList; 252 fEmPhysicsList = new G4EmDNAPhysics_option 264 fEmPhysicsList = new G4EmDNAPhysics_option4(); 253 } << 265 254 else if (name == "dna_opt5") { << 266 } else if (name == "dna_opt5") { 255 fEmName = name; 267 fEmName = name; 256 delete fEmPhysicsList; 268 delete fEmPhysicsList; 257 fEmPhysicsList = new G4EmDNAPhysics_option 269 fEmPhysicsList = new G4EmDNAPhysics_option5(); 258 } << 270 259 else if (name == "dna_opt6") { << 271 } else if (name == "dna_opt6") { 260 fEmName = name; 272 fEmName = name; 261 delete fEmPhysicsList; 273 delete fEmPhysicsList; 262 fEmPhysicsList = new G4EmDNAPhysics_option 274 fEmPhysicsList = new G4EmDNAPhysics_option6(); 263 } << 275 264 else if (name == "dna_opt7") { << 276 } else if (name == "dna_opt7") { 265 fEmName = name; 277 fEmName = name; 266 delete fEmPhysicsList; 278 delete fEmPhysicsList; 267 fEmPhysicsList = new G4EmDNAPhysics_option 279 fEmPhysicsList = new G4EmDNAPhysics_option7(); 268 } << 280 269 else { << 281 } else { >> 282 270 G4cout << "PhysicsList::AddPhysicsList: <" 283 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" 271 << " is not defined" << G4endl; << 284 << " is not defined" >> 285 << G4endl; 272 } 286 } 273 G4EmParameters::Instance()->SetBuildCSDARang 287 G4EmParameters::Instance()->SetBuildCSDARange(true); 274 } 288 } 275 289 276 //....oooOO0OOooo........oooOO0OOooo........oo 290 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 277 291 278 #include "G4Decay.hh" 292 #include "G4Decay.hh" 279 293 280 void PhysicsList::AddDecay() 294 void PhysicsList::AddDecay() 281 { 295 { 282 // decay process 296 // decay process 283 // 297 // 284 G4Decay* fDecayProcess = new G4Decay(); 298 G4Decay* fDecayProcess = new G4Decay(); 285 299 286 auto particleIterator = GetParticleIterator( << 300 auto particleIterator=GetParticleIterator(); 287 particleIterator->reset(); 301 particleIterator->reset(); 288 while ((*particleIterator)()) { << 302 while( (*particleIterator)() ){ 289 G4ParticleDefinition* particle = particleI 303 G4ParticleDefinition* particle = particleIterator->value(); 290 G4ProcessManager* pmanager = particle->Get 304 G4ProcessManager* pmanager = particle->GetProcessManager(); 291 305 292 if (fDecayProcess->IsApplicable(*particle) << 306 if (fDecayProcess->IsApplicable(*particle) && !particle->IsShortLived()) { 293 pmanager->AddProcess(fDecayProcess); << 307 >> 308 pmanager ->AddProcess(fDecayProcess); 294 309 295 // set ordering for PostStepDoIt and AtR 310 // set ordering for PostStepDoIt and AtRestDoIt 296 pmanager->SetProcessOrdering(fDecayProce << 311 pmanager ->SetProcessOrdering(fDecayProcess, idxPostStep); 297 pmanager->SetProcessOrdering(fDecayProce << 312 pmanager ->SetProcessOrdering(fDecayProcess, idxAtRest); >> 313 298 } 314 } 299 } 315 } 300 } 316 } 301 317 302 //....oooOO0OOooo........oooOO0OOooo........oo 318 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 303 319 304 #include "StepMax.hh" 320 #include "StepMax.hh" 305 321 306 void PhysicsList::AddStepMax() 322 void PhysicsList::AddStepMax() 307 { 323 { 308 // Step limitation seen as a process 324 // Step limitation seen as a process 309 fStepMaxProcess = new StepMax(); 325 fStepMaxProcess = new StepMax(); 310 326 311 auto particleIterator = GetParticleIterator( << 327 auto particleIterator=GetParticleIterator(); 312 particleIterator->reset(); 328 particleIterator->reset(); 313 while ((*particleIterator)()) { << 329 while ((*particleIterator)()){ 314 G4ParticleDefinition* particle = particleI << 330 G4ParticleDefinition* particle = particleIterator->value(); 315 G4ProcessManager* pmanager = particle->Get << 331 G4ProcessManager* pmanager = particle->GetProcessManager(); 316 << 332 317 if (fStepMaxProcess->IsApplicable(*particl << 333 if (fStepMaxProcess->IsApplicable(*particle)) 318 pmanager->AddDiscreteProcess(fStepMaxPro << 334 { 319 } << 335 pmanager ->AddDiscreteProcess(fStepMaxProcess); >> 336 } 320 } 337 } 321 } 338 } 322 339 323 //....oooOO0OOooo........oooOO0OOooo........oo 340 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 324 341