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