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