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 medical/electronScattering/src/Physi 26 /// \file medical/electronScattering/src/PhysicsList.cc 27 /// \brief Implementation of the PhysicsList c 27 /// \brief Implementation of the PhysicsList class 28 // 28 // >> 29 // $Id: PhysicsList.cc 86064 2014-11-07 08:49:32Z 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" 34 << 35 #include "PhysicsListMessenger.hh" 35 #include "PhysicsListMessenger.hh" 36 #include "StepMax.hh" << 37 36 38 #include "G4Decay.hh" << 37 #include "PhysListEmStandard.hh" >> 38 #include "PhysListEmStandardSS.hh" >> 39 #include "PhysListEmStandardGS.hh" >> 40 #include "PhysListEmStandardWVI.hh" >> 41 39 #include "G4EmStandardPhysics.hh" 42 #include "G4EmStandardPhysics.hh" 40 #include "G4EmStandardPhysicsGS.hh" << 41 #include "G4EmStandardPhysicsSS.hh" << 42 #include "G4EmStandardPhysicsWVI.hh" << 43 #include "G4EmStandardPhysics_option1.hh" 43 #include "G4EmStandardPhysics_option1.hh" 44 #include "G4EmStandardPhysics_option2.hh" 44 #include "G4EmStandardPhysics_option2.hh" 45 #include "G4EmStandardPhysics_option3.hh" 45 #include "G4EmStandardPhysics_option3.hh" 46 #include "G4EmStandardPhysics_option4.hh" << 46 >> 47 #include "G4UnitsTable.hh" >> 48 47 #include "G4ParticleDefinition.hh" 49 #include "G4ParticleDefinition.hh" 48 #include "G4ProcessManager.hh" 50 #include "G4ProcessManager.hh" 49 #include "G4UnitsTable.hh" << 50 51 51 // Bosons 52 // Bosons 52 #include "G4ChargedGeantino.hh" 53 #include "G4ChargedGeantino.hh" 53 #include "G4Gamma.hh" << 54 #include "G4Geantino.hh" 54 #include "G4Geantino.hh" >> 55 #include "G4Gamma.hh" 55 #include "G4OpticalPhoton.hh" 56 #include "G4OpticalPhoton.hh" 56 57 57 // leptons 58 // leptons 58 #include "G4AntiNeutrinoE.hh" << 59 #include "G4AntiNeutrinoMu.hh" << 60 #include "G4Electron.hh" << 61 #include "G4MuonMinus.hh" << 62 #include "G4MuonPlus.hh" 59 #include "G4MuonPlus.hh" 63 #include "G4NeutrinoE.hh" << 60 #include "G4MuonMinus.hh" 64 #include "G4NeutrinoMu.hh" 61 #include "G4NeutrinoMu.hh" >> 62 #include "G4AntiNeutrinoMu.hh" >> 63 >> 64 #include "G4Electron.hh" 65 #include "G4Positron.hh" 65 #include "G4Positron.hh" >> 66 #include "G4NeutrinoE.hh" >> 67 #include "G4AntiNeutrinoE.hh" 66 68 67 // Hadrons 69 // Hadrons >> 70 #include "G4MesonConstructor.hh" 68 #include "G4BaryonConstructor.hh" 71 #include "G4BaryonConstructor.hh" 69 #include "G4IonConstructor.hh" 72 #include "G4IonConstructor.hh" 70 #include "G4MesonConstructor.hh" << 73 71 #include "G4SystemOfUnits.hh" 74 #include "G4SystemOfUnits.hh" 72 75 73 //....oooOO0OOooo........oooOO0OOooo........oo 76 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 74 77 75 PhysicsList::PhysicsList() << 78 PhysicsList::PhysicsList() : G4VModularPhysicsList(), 76 : G4VModularPhysicsList(), fMessenger(0), fE << 79 fMessenger(0), fEmName("local"), fEmPhysicsList(0) 77 { 80 { 78 fMessenger = new PhysicsListMessenger(this); << 81 fMessenger = new PhysicsListMessenger(this); 79 << 82 80 // EM physics 83 // EM physics 81 fEmPhysicsList = new G4EmStandardPhysics(); << 84 fEmName = G4String("local"); 82 << 85 fEmPhysicsList = new PhysListEmStandard(fEmName); 83 SetDefaultCutValue(1. * mm); << 86 >> 87 SetDefaultCutValue(1.*mm); 84 SetVerboseLevel(1); 88 SetVerboseLevel(1); 85 } 89 } 86 90 87 //....oooOO0OOooo........oooOO0OOooo........oo 91 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 88 92 89 PhysicsList::~PhysicsList() 93 PhysicsList::~PhysicsList() 90 { 94 { 91 delete fEmPhysicsList; 95 delete fEmPhysicsList; 92 delete fMessenger; << 96 delete fMessenger; 93 } 97 } 94 98 95 //....oooOO0OOooo........oooOO0OOooo........oo 99 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 96 100 97 void PhysicsList::ConstructParticle() 101 void PhysicsList::ConstructParticle() 98 { 102 { 99 // pseudo-particles << 103 // pseudo-particles 100 G4Geantino::GeantinoDefinition(); 104 G4Geantino::GeantinoDefinition(); 101 G4ChargedGeantino::ChargedGeantinoDefinition 105 G4ChargedGeantino::ChargedGeantinoDefinition(); 102 << 106 103 // gamma << 107 // gamma 104 G4Gamma::GammaDefinition(); 108 G4Gamma::GammaDefinition(); 105 << 109 106 // optical photon << 110 // optical photon 107 G4OpticalPhoton::OpticalPhotonDefinition(); 111 G4OpticalPhoton::OpticalPhotonDefinition(); 108 112 109 // leptons << 113 // leptons 110 G4Electron::ElectronDefinition(); 114 G4Electron::ElectronDefinition(); 111 G4Positron::PositronDefinition(); 115 G4Positron::PositronDefinition(); 112 G4MuonPlus::MuonPlusDefinition(); 116 G4MuonPlus::MuonPlusDefinition(); 113 G4MuonMinus::MuonMinusDefinition(); 117 G4MuonMinus::MuonMinusDefinition(); 114 118 115 G4NeutrinoE::NeutrinoEDefinition(); 119 G4NeutrinoE::NeutrinoEDefinition(); 116 G4AntiNeutrinoE::AntiNeutrinoEDefinition(); 120 G4AntiNeutrinoE::AntiNeutrinoEDefinition(); 117 G4NeutrinoMu::NeutrinoMuDefinition(); 121 G4NeutrinoMu::NeutrinoMuDefinition(); 118 G4AntiNeutrinoMu::AntiNeutrinoMuDefinition() << 122 G4AntiNeutrinoMu::AntiNeutrinoMuDefinition(); 119 123 120 // mesons << 124 // mesons 121 G4MesonConstructor mConstructor; 125 G4MesonConstructor mConstructor; 122 mConstructor.ConstructParticle(); 126 mConstructor.ConstructParticle(); 123 127 124 // barions << 128 // barions 125 G4BaryonConstructor bConstructor; 129 G4BaryonConstructor bConstructor; 126 bConstructor.ConstructParticle(); 130 bConstructor.ConstructParticle(); 127 131 128 // ions << 132 // ions 129 G4IonConstructor iConstructor; 133 G4IonConstructor iConstructor; 130 iConstructor.ConstructParticle(); 134 iConstructor.ConstructParticle(); 131 } 135 } 132 136 133 //....oooOO0OOooo........oooOO0OOooo........oo 137 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 134 138 135 void PhysicsList::ConstructProcess() 139 void PhysicsList::ConstructProcess() 136 { 140 { 137 AddTransportation(); 141 AddTransportation(); 138 fEmPhysicsList->ConstructProcess(); 142 fEmPhysicsList->ConstructProcess(); 139 AddDecay(); << 143 AddDecay(); 140 AddStepMax(); 144 AddStepMax(); 141 } 145 } 142 146 143 //....oooOO0OOooo........oooOO0OOooo........oo 147 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 144 148 >> 149 #include "G4Decay.hh" >> 150 145 void PhysicsList::AddDecay() 151 void PhysicsList::AddDecay() 146 { 152 { 147 // Add Decay Process 153 // Add Decay Process 148 154 149 G4Decay* fDecayProcess = new G4Decay(); 155 G4Decay* fDecayProcess = new G4Decay(); 150 156 151 auto particleIterator = GetParticleIterator( << 157 theParticleIterator->reset(); 152 particleIterator->reset(); << 158 while( (*theParticleIterator)() ){ 153 while ((*particleIterator)()) { << 159 G4ParticleDefinition* particle = theParticleIterator->value(); 154 G4ParticleDefinition* particle = particleI << 155 G4ProcessManager* pmanager = particle->Get 160 G4ProcessManager* pmanager = particle->GetProcessManager(); 156 161 157 if (fDecayProcess->IsApplicable(*particle) << 162 if (fDecayProcess->IsApplicable(*particle) && !particle->IsShortLived()) { 158 pmanager->AddProcess(fDecayProcess); << 163 >> 164 pmanager ->AddProcess(fDecayProcess); 159 165 160 // set ordering for PostStepDoIt and AtR 166 // set ordering for PostStepDoIt and AtRestDoIt 161 pmanager->SetProcessOrdering(fDecayProce << 167 pmanager ->SetProcessOrdering(fDecayProcess, idxPostStep); 162 pmanager->SetProcessOrdering(fDecayProce << 168 pmanager ->SetProcessOrdering(fDecayProcess, idxAtRest); >> 169 163 } 170 } 164 } 171 } 165 } 172 } 166 173 167 //....oooOO0OOooo........oooOO0OOooo........oo 174 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 168 175 >> 176 #include "StepMax.hh" >> 177 169 void PhysicsList::AddStepMax() 178 void PhysicsList::AddStepMax() 170 { 179 { 171 // Step limitation seen as a process 180 // Step limitation seen as a process 172 StepMax* stepMaxProcess = new StepMax(); 181 StepMax* stepMaxProcess = new StepMax(); 173 182 174 auto particleIterator = GetParticleIterator( << 183 theParticleIterator->reset(); 175 particleIterator->reset(); << 184 while ((*theParticleIterator)()){ 176 while ((*particleIterator)()) { << 185 G4ParticleDefinition* particle = theParticleIterator->value(); 177 G4ParticleDefinition* particle = particleI << 186 G4ProcessManager* pmanager = particle->GetProcessManager(); 178 G4ProcessManager* pmanager = particle->Get << 187 179 << 188 if (stepMaxProcess->IsApplicable(*particle)) 180 if (stepMaxProcess->IsApplicable(*particle << 189 { 181 pmanager->AddDiscreteProcess(stepMaxProc << 190 pmanager ->AddDiscreteProcess(stepMaxProcess); 182 } << 191 } 183 } 192 } 184 } 193 } 185 194 186 //....oooOO0OOooo........oooOO0OOooo........oo 195 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 187 196 188 void PhysicsList::AddPhysicsList(const G4Strin 197 void PhysicsList::AddPhysicsList(const G4String& name) 189 { 198 { 190 if (verboseLevel > -1) { << 199 if (verboseLevel>-1) { 191 G4cout << "PhysicsList::AddPhysicsList: <" 200 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl; 192 } 201 } 193 202 194 if (name == fEmName) return; 203 if (name == fEmName) return; 195 204 196 if (name == "emstandard_opt0") { << 205 if (name == "local") { >> 206 >> 207 fEmName = name; >> 208 delete fEmPhysicsList; >> 209 fEmPhysicsList = new PhysListEmStandard(name); >> 210 >> 211 } else if (name == "emstandard_opt0") { >> 212 197 fEmName = name; 213 fEmName = name; 198 delete fEmPhysicsList; 214 delete fEmPhysicsList; 199 fEmPhysicsList = new G4EmStandardPhysics() 215 fEmPhysicsList = new G4EmStandardPhysics(); 200 } << 216 201 else if (name == "emstandard_opt1") { << 217 } else if (name == "emstandard_opt1") { >> 218 202 fEmName = name; 219 fEmName = name; 203 delete fEmPhysicsList; 220 delete fEmPhysicsList; 204 fEmPhysicsList = new G4EmStandardPhysics_o 221 fEmPhysicsList = new G4EmStandardPhysics_option1(); 205 } << 222 206 else if (name == "emstandard_opt2") { << 223 } else if (name == "emstandard_opt2") { >> 224 207 fEmName = name; 225 fEmName = name; 208 delete fEmPhysicsList; 226 delete fEmPhysicsList; 209 fEmPhysicsList = new G4EmStandardPhysics_o 227 fEmPhysicsList = new G4EmStandardPhysics_option2(); 210 } << 228 211 else if (name == "emstandard_opt3") { << 229 } else if (name == "emstandard_opt3") { >> 230 212 fEmName = name; 231 fEmName = name; 213 delete fEmPhysicsList; 232 delete fEmPhysicsList; 214 fEmPhysicsList = new G4EmStandardPhysics_o 233 fEmPhysicsList = new G4EmStandardPhysics_option3(); 215 } << 234 216 else if (name == "emstandard_opt4") { << 235 } else if (name == "standardSS") { 217 fEmName = name; << 236 218 delete fEmPhysicsList; << 219 fEmPhysicsList = new G4EmStandardPhysics_o << 220 } << 221 else if (name == "standardSS") { << 222 fEmName = name; 237 fEmName = name; 223 delete fEmPhysicsList; 238 delete fEmPhysicsList; 224 fEmPhysicsList = new G4EmStandardPhysicsSS << 239 fEmPhysicsList = new PhysListEmStandardSS(name); 225 } << 240 226 else if (name == "standardGS") { << 241 } else if (name == "standardGS") { >> 242 227 fEmName = name; 243 fEmName = name; 228 delete fEmPhysicsList; 244 delete fEmPhysicsList; 229 fEmPhysicsList = new G4EmStandardPhysicsGS << 245 fEmPhysicsList = new PhysListEmStandardGS(name); 230 } << 246 231 else if (name == "standardWVI") { << 247 } else if (name == "standardWVI") { >> 248 232 fEmName = name; 249 fEmName = name; 233 delete fEmPhysicsList; 250 delete fEmPhysicsList; 234 fEmPhysicsList = new G4EmStandardPhysicsWV << 251 fEmPhysicsList = new PhysListEmStandardWVI(name); 235 } << 252 236 else { << 253 } else { >> 254 237 G4cout << "PhysicsList::AddPhysicsList: <" 255 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" 238 << " is not defined" << G4endl; << 256 << " is not defined" >> 257 << G4endl; 239 } 258 } 240 } 259 } 241 260 242 //....oooOO0OOooo........oooOO0OOooo........oo 261 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 243 262