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