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