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