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