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