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10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

  1 //
  2 // ********************************************************************
  3 // * License and Disclaimer                                           *
  4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.                             *
 10 // *                                                                  *
 11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                                                  *
 18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // ********************************************************************
 25 //
 26 /// \file medical/electronScattering/src/PhysicsList.cc
 27 /// \brief Implementation of the PhysicsList class
 28 //
 29 //
 30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 32 
 33 #include "PhysicsList.hh"
 34 
 35 #include "PhysicsListMessenger.hh"
 36 #include "StepMax.hh"
 37 
 38 #include "G4Decay.hh"
 39 #include "G4EmStandardPhysics.hh"
 40 #include "G4EmStandardPhysicsGS.hh"
 41 #include "G4EmStandardPhysicsSS.hh"
 42 #include "G4EmStandardPhysicsWVI.hh"
 43 #include "G4EmStandardPhysics_option1.hh"
 44 #include "G4EmStandardPhysics_option2.hh"
 45 #include "G4EmStandardPhysics_option3.hh"
 46 #include "G4EmStandardPhysics_option4.hh"
 47 #include "G4ParticleDefinition.hh"
 48 #include "G4ProcessManager.hh"
 49 #include "G4UnitsTable.hh"
 50 
 51 // Bosons
 52 #include "G4ChargedGeantino.hh"
 53 #include "G4Gamma.hh"
 54 #include "G4Geantino.hh"
 55 #include "G4OpticalPhoton.hh"
 56 
 57 // leptons
 58 #include "G4AntiNeutrinoE.hh"
 59 #include "G4AntiNeutrinoMu.hh"
 60 #include "G4Electron.hh"
 61 #include "G4MuonMinus.hh"
 62 #include "G4MuonPlus.hh"
 63 #include "G4NeutrinoE.hh"
 64 #include "G4NeutrinoMu.hh"
 65 #include "G4Positron.hh"
 66 
 67 // Hadrons
 68 #include "G4BaryonConstructor.hh"
 69 #include "G4IonConstructor.hh"
 70 #include "G4MesonConstructor.hh"
 71 #include "G4SystemOfUnits.hh"
 72 
 73 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 74 
 75 PhysicsList::PhysicsList()
 76   : G4VModularPhysicsList(), fMessenger(0), fEmName("emstandard_opt0"), fEmPhysicsList(0)
 77 {
 78   fMessenger = new PhysicsListMessenger(this);
 79 
 80   // EM physics
 81   fEmPhysicsList = new G4EmStandardPhysics();
 82 
 83   SetDefaultCutValue(1. * mm);
 84   SetVerboseLevel(1);
 85 }
 86 
 87 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 88 
 89 PhysicsList::~PhysicsList()
 90 {
 91   delete fEmPhysicsList;
 92   delete fMessenger;
 93 }
 94 
 95 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 96 
 97 void PhysicsList::ConstructParticle()
 98 {
 99   // pseudo-particles
100   G4Geantino::GeantinoDefinition();
101   G4ChargedGeantino::ChargedGeantinoDefinition();
102 
103   // gamma
104   G4Gamma::GammaDefinition();
105 
106   // optical photon
107   G4OpticalPhoton::OpticalPhotonDefinition();
108 
109   // leptons
110   G4Electron::ElectronDefinition();
111   G4Positron::PositronDefinition();
112   G4MuonPlus::MuonPlusDefinition();
113   G4MuonMinus::MuonMinusDefinition();
114 
115   G4NeutrinoE::NeutrinoEDefinition();
116   G4AntiNeutrinoE::AntiNeutrinoEDefinition();
117   G4NeutrinoMu::NeutrinoMuDefinition();
118   G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
119 
120   // mesons
121   G4MesonConstructor mConstructor;
122   mConstructor.ConstructParticle();
123 
124   // barions
125   G4BaryonConstructor bConstructor;
126   bConstructor.ConstructParticle();
127 
128   // ions
129   G4IonConstructor iConstructor;
130   iConstructor.ConstructParticle();
131 }
132 
133 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
134 
135 void PhysicsList::ConstructProcess()
136 {
137   AddTransportation();
138   fEmPhysicsList->ConstructProcess();
139   AddDecay();
140   AddStepMax();
141 }
142 
143 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
144 
145 void PhysicsList::AddDecay()
146 {
147   // Add Decay Process
148 
149   G4Decay* fDecayProcess = new G4Decay();
150 
151   auto particleIterator = GetParticleIterator();
152   particleIterator->reset();
153   while ((*particleIterator)()) {
154     G4ParticleDefinition* particle = particleIterator->value();
155     G4ProcessManager* pmanager = particle->GetProcessManager();
156 
157     if (fDecayProcess->IsApplicable(*particle) && !particle->IsShortLived()) {
158       pmanager->AddProcess(fDecayProcess);
159 
160       // set ordering for PostStepDoIt and AtRestDoIt
161       pmanager->SetProcessOrdering(fDecayProcess, idxPostStep);
162       pmanager->SetProcessOrdering(fDecayProcess, idxAtRest);
163     }
164   }
165 }
166 
167 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
168 
169 void PhysicsList::AddStepMax()
170 {
171   // Step limitation seen as a process
172   StepMax* stepMaxProcess = new StepMax();
173 
174   auto particleIterator = GetParticleIterator();
175   particleIterator->reset();
176   while ((*particleIterator)()) {
177     G4ParticleDefinition* particle = particleIterator->value();
178     G4ProcessManager* pmanager = particle->GetProcessManager();
179 
180     if (stepMaxProcess->IsApplicable(*particle)) {
181       pmanager->AddDiscreteProcess(stepMaxProcess);
182     }
183   }
184 }
185 
186 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
187 
188 void PhysicsList::AddPhysicsList(const G4String& name)
189 {
190   if (verboseLevel > -1) {
191     G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
192   }
193 
194   if (name == fEmName) return;
195 
196   if (name == "emstandard_opt0") {
197     fEmName = name;
198     delete fEmPhysicsList;
199     fEmPhysicsList = new G4EmStandardPhysics();
200   }
201   else if (name == "emstandard_opt1") {
202     fEmName = name;
203     delete fEmPhysicsList;
204     fEmPhysicsList = new G4EmStandardPhysics_option1();
205   }
206   else if (name == "emstandard_opt2") {
207     fEmName = name;
208     delete fEmPhysicsList;
209     fEmPhysicsList = new G4EmStandardPhysics_option2();
210   }
211   else if (name == "emstandard_opt3") {
212     fEmName = name;
213     delete fEmPhysicsList;
214     fEmPhysicsList = new G4EmStandardPhysics_option3();
215   }
216   else if (name == "emstandard_opt4") {
217     fEmName = name;
218     delete fEmPhysicsList;
219     fEmPhysicsList = new G4EmStandardPhysics_option4();
220   }
221   else if (name == "standardSS") {
222     fEmName = name;
223     delete fEmPhysicsList;
224     fEmPhysicsList = new G4EmStandardPhysicsSS();
225   }
226   else if (name == "standardGS") {
227     fEmName = name;
228     delete fEmPhysicsList;
229     fEmPhysicsList = new G4EmStandardPhysicsGS();
230   }
231   else if (name == "standardWVI") {
232     fEmName = name;
233     delete fEmPhysicsList;
234     fEmPhysicsList = new G4EmStandardPhysicsWVI();
235   }
236   else {
237     G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
238            << " is not defined" << G4endl;
239   }
240 }
241 
242 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
243