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 102356 2017-01-23 16:22:42Z 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 = 0; 73 70 74 //....oooOO0OOooo........oooOO0OOooo........oo 71 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 75 72 76 PhysicsList::PhysicsList() << 73 PhysicsList::PhysicsList() : G4VModularPhysicsList(), >> 74 fEmPhysicsList(0), fMessenger(0) 77 { 75 { 78 fMessenger = new PhysicsListMessenger(this); 76 fMessenger = new PhysicsListMessenger(this); 79 77 80 SetVerboseLevel(1); 78 SetVerboseLevel(1); 81 79 82 // EM physics 80 // EM physics 83 fEmPhysicsList = new PhysListEmStandard(fEmN 81 fEmPhysicsList = new PhysListEmStandard(fEmName = "local"); >> 82 >> 83 G4LossTableManager::Instance(); >> 84 SetDefaultCutValue(1.*mm); 84 85 85 // Em options << 86 fStepMaxProcess = 0; 86 // << 87 G4EmParameters::Instance()->SetBuildCSDARang << 88 << 89 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" >> 131 #include "G4EmProcessOptions.hh" 134 132 135 void PhysicsList::ConstructProcess() 133 void PhysicsList::ConstructProcess() 136 { 134 { 137 // transportation 135 // transportation 138 // 136 // 139 AddTransportation(); 137 AddTransportation(); 140 << 138 141 // electromagnetic physics list 139 // electromagnetic physics list 142 // 140 // 143 fEmPhysicsList->ConstructProcess(); 141 fEmPhysicsList->ConstructProcess(); 144 << 142 >> 143 // Em options >> 144 // >> 145 G4EmProcessOptions emOptions; >> 146 emOptions.SetBuildCSDARange(true); >> 147 emOptions.SetDEDXBinningForCSDARange(8*10); >> 148 145 // decay process 149 // decay process 146 // 150 // 147 AddDecay(); 151 AddDecay(); 148 << 152 149 // step limitation (as a full process) 153 // step limitation (as a full process) 150 // << 154 // 151 AddStepMax(); 155 AddStepMax(); 152 } 156 } 153 157 154 //....oooOO0OOooo........oooOO0OOooo........oo 158 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 155 159 156 void PhysicsList::AddPhysicsList(const G4Strin 160 void PhysicsList::AddPhysicsList(const G4String& name) 157 { 161 { 158 if (verboseLevel > -1) { << 162 if (verboseLevel>-1) { 159 G4cout << "PhysicsList::AddPhysicsList: <" 163 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl; 160 } 164 } 161 165 162 if (name == fEmName) return; 166 if (name == fEmName) return; 163 167 164 if (name == "local") { 168 if (name == "local") { >> 169 165 fEmName = name; 170 fEmName = name; 166 delete fEmPhysicsList; 171 delete fEmPhysicsList; 167 fEmPhysicsList = new PhysListEmStandard(na 172 fEmPhysicsList = new PhysListEmStandard(name); 168 } << 173 169 else if (name == "emstandard_opt0") { << 174 } else if (name == "emstandard_opt0") { >> 175 170 fEmName = name; 176 fEmName = name; 171 delete fEmPhysicsList; 177 delete fEmPhysicsList; 172 fEmPhysicsList = new G4EmStandardPhysics() 178 fEmPhysicsList = new G4EmStandardPhysics(); 173 } << 179 174 else if (name == "emstandard_opt1") { << 180 } else if (name == "emstandard_opt1") { >> 181 175 fEmName = name; 182 fEmName = name; 176 delete fEmPhysicsList; 183 delete fEmPhysicsList; 177 fEmPhysicsList = new G4EmStandardPhysics_o 184 fEmPhysicsList = new G4EmStandardPhysics_option1(); 178 } << 185 179 else if (name == "emstandard_opt2") { << 186 } else if (name == "emstandard_opt2") { >> 187 180 fEmName = name; 188 fEmName = name; 181 delete fEmPhysicsList; 189 delete fEmPhysicsList; 182 fEmPhysicsList = new G4EmStandardPhysics_o 190 fEmPhysicsList = new G4EmStandardPhysics_option2(); 183 } << 191 184 else if (name == "emstandard_opt3") { << 192 } else if (name == "emstandard_opt3") { >> 193 185 fEmName = name; 194 fEmName = name; 186 delete fEmPhysicsList; 195 delete fEmPhysicsList; 187 fEmPhysicsList = new G4EmStandardPhysics_o 196 fEmPhysicsList = new G4EmStandardPhysics_option3(); 188 } << 197 189 else if (name == "emstandard_opt4") { << 198 } else if (name == "emstandard_opt4") { >> 199 190 fEmName = name; 200 fEmName = name; 191 delete fEmPhysicsList; 201 delete fEmPhysicsList; 192 fEmPhysicsList = new G4EmStandardPhysics_o 202 fEmPhysicsList = new G4EmStandardPhysics_option4(); 193 } << 203 194 else if (name == "emstandardSS") { << 204 } else if (name == "emstandardSS") { >> 205 195 fEmName = name; 206 fEmName = name; 196 delete fEmPhysicsList; 207 delete fEmPhysicsList; 197 fEmPhysicsList = new G4EmStandardPhysicsSS 208 fEmPhysicsList = new G4EmStandardPhysicsSS(); 198 } << 209 199 else if (name == "standardSSM") { << 210 } else if (name == "standardSSM") { >> 211 200 fEmName = name; 212 fEmName = name; 201 delete fEmPhysicsList; 213 delete fEmPhysicsList; 202 fEmPhysicsList = new PhysListEmStandardSSM 214 fEmPhysicsList = new PhysListEmStandardSSM(name); 203 } << 215 204 else if (name == "emstandardWVI") { << 216 } else if (name == "emstandardWVI") { >> 217 205 fEmName = name; 218 fEmName = name; 206 delete fEmPhysicsList; 219 delete fEmPhysicsList; 207 fEmPhysicsList = new G4EmStandardPhysicsWV 220 fEmPhysicsList = new G4EmStandardPhysicsWVI(); 208 } << 221 209 else if (name == "standardGS") { << 222 } else if (name == "standardGS") { >> 223 210 fEmName = name; 224 fEmName = name; 211 delete fEmPhysicsList; 225 delete fEmPhysicsList; 212 fEmPhysicsList = new G4EmStandardPhysicsGS 226 fEmPhysicsList = new G4EmStandardPhysicsGS(); 213 } << 227 214 else if (name == "emlivermore") { << 228 } else if (name == "emlivermore") { 215 fEmName = name; 229 fEmName = name; 216 delete fEmPhysicsList; 230 delete fEmPhysicsList; 217 fEmPhysicsList = new G4EmLivermorePhysics( 231 fEmPhysicsList = new G4EmLivermorePhysics(); 218 } << 232 219 else if (name == "empenelope") { << 233 } else if (name == "empenelope") { 220 fEmName = name; 234 fEmName = name; 221 delete fEmPhysicsList; 235 delete fEmPhysicsList; 222 fEmPhysicsList = new G4EmPenelopePhysics() 236 fEmPhysicsList = new G4EmPenelopePhysics(); 223 } << 237 224 else if (name == "emlowenergy") { << 238 } else if (name == "emlowenergy") { 225 fEmName = name; 239 fEmName = name; 226 delete fEmPhysicsList; 240 delete fEmPhysicsList; 227 fEmPhysicsList = new G4EmLowEPPhysics(); 241 fEmPhysicsList = new G4EmLowEPPhysics(); 228 } << 242 229 else if (name == "dna") { << 243 } else if (name == "dna") { 230 fEmName = name; 244 fEmName = name; 231 delete fEmPhysicsList; 245 delete fEmPhysicsList; 232 fEmPhysicsList = new G4EmDNAPhysics(); 246 fEmPhysicsList = new G4EmDNAPhysics(); 233 } << 247 234 else if (name == "dna_opt1") { << 248 } else if (name == "dna_opt1") { 235 fEmName = name; 249 fEmName = name; 236 delete fEmPhysicsList; 250 delete fEmPhysicsList; 237 fEmPhysicsList = new G4EmDNAPhysics_option 251 fEmPhysicsList = new G4EmDNAPhysics_option1(); 238 } << 252 239 else if (name == "dna_opt2") { << 253 } else { 240 fEmName = name; << 254 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: <" 255 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" 271 << " is not defined" << G4endl; << 256 << " is not defined" >> 257 << G4endl; 272 } 258 } 273 G4EmParameters::Instance()->SetBuildCSDARang << 274 } 259 } 275 260 276 //....oooOO0OOooo........oooOO0OOooo........oo 261 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 277 262 278 #include "G4Decay.hh" 263 #include "G4Decay.hh" 279 264 280 void PhysicsList::AddDecay() 265 void PhysicsList::AddDecay() 281 { 266 { 282 // decay process 267 // decay process 283 // 268 // 284 G4Decay* fDecayProcess = new G4Decay(); 269 G4Decay* fDecayProcess = new G4Decay(); 285 270 286 auto particleIterator = GetParticleIterator( << 271 auto particleIterator=GetParticleIterator(); 287 particleIterator->reset(); 272 particleIterator->reset(); 288 while ((*particleIterator)()) { << 273 while( (*particleIterator)() ){ 289 G4ParticleDefinition* particle = particleI 274 G4ParticleDefinition* particle = particleIterator->value(); 290 G4ProcessManager* pmanager = particle->Get 275 G4ProcessManager* pmanager = particle->GetProcessManager(); 291 276 292 if (fDecayProcess->IsApplicable(*particle) << 277 if (fDecayProcess->IsApplicable(*particle) && !particle->IsShortLived()) { 293 pmanager->AddProcess(fDecayProcess); << 278 >> 279 pmanager ->AddProcess(fDecayProcess); 294 280 295 // set ordering for PostStepDoIt and AtR 281 // set ordering for PostStepDoIt and AtRestDoIt 296 pmanager->SetProcessOrdering(fDecayProce << 282 pmanager ->SetProcessOrdering(fDecayProcess, idxPostStep); 297 pmanager->SetProcessOrdering(fDecayProce << 283 pmanager ->SetProcessOrdering(fDecayProcess, idxAtRest); >> 284 298 } 285 } 299 } 286 } 300 } 287 } 301 288 302 //....oooOO0OOooo........oooOO0OOooo........oo 289 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 303 290 304 #include "StepMax.hh" 291 #include "StepMax.hh" 305 292 306 void PhysicsList::AddStepMax() 293 void PhysicsList::AddStepMax() 307 { 294 { 308 // Step limitation seen as a process 295 // Step limitation seen as a process 309 fStepMaxProcess = new StepMax(); 296 fStepMaxProcess = new StepMax(); 310 297 311 auto particleIterator = GetParticleIterator( << 298 auto particleIterator=GetParticleIterator(); 312 particleIterator->reset(); 299 particleIterator->reset(); 313 while ((*particleIterator)()) { << 300 while ((*particleIterator)()){ 314 G4ParticleDefinition* particle = particleI << 301 G4ParticleDefinition* particle = particleIterator->value(); 315 G4ProcessManager* pmanager = particle->Get << 302 G4ProcessManager* pmanager = particle->GetProcessManager(); 316 << 303 317 if (fStepMaxProcess->IsApplicable(*particl << 304 if (fStepMaxProcess->IsApplicable(*particle)) 318 pmanager->AddDiscreteProcess(fStepMaxPro << 305 { 319 } << 306 pmanager ->AddDiscreteProcess(fStepMaxProcess); >> 307 } 320 } 308 } 321 } 309 } 322 310 323 //....oooOO0OOooo........oooOO0OOooo........oo 311 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 324 312