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