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