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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 electromagnetic/TestEm7/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 "PhysListEmStandard.hh"
 36 #include "PhysListEmStandardNR.hh"
 37 #include "PhysicsListMessenger.hh"
 38 #include "StepMax.hh"
 39 
 40 #include "G4BetheBlochIonGasModel.hh"
 41 #include "G4BraggIonGasModel.hh"
 42 #include "G4Decay.hh"
 43 #include "G4DecayPhysics.hh"
 44 #include "G4EmConfigurator.hh"
 45 #include "G4EmLivermorePhysics.hh"
 46 #include "G4EmLowEPPhysics.hh"
 47 #include "G4EmPenelopePhysics.hh"
 48 #include "G4EmStandardPhysics.hh"
 49 #include "G4EmStandardPhysicsGS.hh"
 50 #include "G4EmStandardPhysicsSS.hh"
 51 #include "G4EmStandardPhysicsWVI.hh"
 52 #include "G4EmStandardPhysics_option1.hh"
 53 #include "G4EmStandardPhysics_option2.hh"
 54 #include "G4EmStandardPhysics_option3.hh"
 55 #include "G4EmStandardPhysics_option4.hh"
 56 #include "G4HadronDElasticPhysics.hh"
 57 #include "G4HadronElasticPhysics.hh"
 58 #include "G4HadronHElasticPhysics.hh"
 59 #include "G4HadronInelasticQBBC.hh"
 60 #include "G4IonFluctuations.hh"
 61 #include "G4IonParametrisedLossModel.hh"
 62 #include "G4IonPhysics.hh"
 63 #include "G4LossTableManager.hh"
 64 #include "G4PhysicalConstants.hh"
 65 #include "G4ProcessManager.hh"
 66 #include "G4SystemOfUnits.hh"
 67 #include "G4UnitsTable.hh"
 68 #include "G4UniversalFluctuation.hh"
 69 
 70 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 71 
 72 PhysicsList::PhysicsList() : G4VModularPhysicsList(), fStepMaxProcess(nullptr)
 73 {
 74   fHelIsRegisted = false;
 75   fBicIsRegisted = false;
 76   fBiciIsRegisted = false;
 77 
 78   // protected member of the base class
 79   verboseLevel = 1;
 80 
 81   fMessenger = new PhysicsListMessenger(this);
 82 
 83   // EM physics
 84   fEmName = G4String("emstandard_opt0");
 85   fEmPhysicsList = new G4EmStandardPhysics(verboseLevel);
 86 
 87   // Deacy physics and all particles
 88   fDecPhysicsList = new G4DecayPhysics(verboseLevel);
 89 }
 90 
 91 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 92 
 93 PhysicsList::~PhysicsList()
 94 {
 95   delete fMessenger;
 96   delete fEmPhysicsList;
 97   delete fDecPhysicsList;
 98   for (size_t i = 0; i < fHadronPhys.size(); i++) {
 99     delete fHadronPhys[i];
100   }
101 }
102 
103 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
104 
105 void PhysicsList::ConstructParticle()
106 {
107   fDecPhysicsList->ConstructParticle();
108 }
109 
110 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
111 
112 void PhysicsList::ConstructProcess()
113 {
114   // transportation
115   //
116   AddTransportation();
117 
118   // electromagnetic physics list
119   //
120   fEmPhysicsList->ConstructProcess();
121 
122   // decay physics list
123   //
124   fDecPhysicsList->ConstructProcess();
125 
126   // hadronic physics lists
127   for (size_t i = 0; i < fHadronPhys.size(); i++) {
128     fHadronPhys[i]->ConstructProcess();
129   }
130 
131   // step limitation (as a full process)
132   //
133   AddStepMax();
134 }
135 
136 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
137 
138 void PhysicsList::AddPhysicsList(const G4String& name)
139 {
140   if (verboseLevel > 1) {
141     G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
142   }
143 
144   if (name == fEmName) return;
145 
146   if (name == "local") {
147     fEmName = name;
148     delete fEmPhysicsList;
149     fEmPhysicsList = new PhysListEmStandard(name);
150   }
151   else if (name == "emstandard_opt0") {
152     fEmName = name;
153     delete fEmPhysicsList;
154     fEmPhysicsList = new G4EmStandardPhysics(verboseLevel);
155   }
156   else if (name == "emstandard_opt1") {
157     fEmName = name;
158     delete fEmPhysicsList;
159     fEmPhysicsList = new G4EmStandardPhysics_option1(verboseLevel);
160   }
161   else if (name == "emstandard_opt2") {
162     fEmName = name;
163     delete fEmPhysicsList;
164     fEmPhysicsList = new G4EmStandardPhysics_option2(verboseLevel);
165   }
166   else if (name == "emstandard_opt3") {
167     fEmName = name;
168     delete fEmPhysicsList;
169     fEmPhysicsList = new G4EmStandardPhysics_option3(verboseLevel);
170   }
171   else if (name == "emstandard_opt4") {
172     fEmName = name;
173     delete fEmPhysicsList;
174     fEmPhysicsList = new G4EmStandardPhysics_option4(verboseLevel);
175   }
176   else if (name == "ionGasModels") {
177     AddPhysicsList("emstandard_opt0");
178     fEmName = name;
179     AddIonGasModels();
180   }
181   else if (name == "standardNR") {
182     fEmName = name;
183     delete fEmPhysicsList;
184     fEmPhysicsList = new PhysListEmStandardNR(name);
185   }
186   else if (name == "emlivermore") {
187     fEmName = name;
188     delete fEmPhysicsList;
189     fEmPhysicsList = new G4EmLivermorePhysics(verboseLevel);
190   }
191   else if (name == "empenelope") {
192     fEmName = name;
193     delete fEmPhysicsList;
194     fEmPhysicsList = new G4EmPenelopePhysics(verboseLevel);
195   }
196   else if (name == "emlowenergy") {
197     fEmName = name;
198     delete fEmPhysicsList;
199     fEmPhysicsList = new G4EmLowEPPhysics(verboseLevel);
200   }
201   else if (name == "emstandardSS") {
202     fEmName = name;
203     delete fEmPhysicsList;
204     fEmPhysicsList = new G4EmStandardPhysicsSS(verboseLevel);
205   }
206   else if (name == "emstandardWVI") {
207     fEmName = name;
208     delete fEmPhysicsList;
209     fEmPhysicsList = new G4EmStandardPhysicsWVI(verboseLevel);
210   }
211   else if (name == "emstandardGS") {
212     fEmName = name;
213     delete fEmPhysicsList;
214     fEmPhysicsList = new G4EmStandardPhysicsGS(verboseLevel);
215   }
216   else if (name == "elastic" && !fHelIsRegisted) {
217     fHadronPhys.push_back(new G4HadronElasticPhysics(verboseLevel));
218     fHelIsRegisted = true;
219   }
220   else if (name == "DElastic" && !fHelIsRegisted) {
221     fHadronPhys.push_back(new G4HadronDElasticPhysics(verboseLevel));
222     fHelIsRegisted = true;
223   }
224   else if (name == "HElastic" && !fHelIsRegisted) {
225     fHadronPhys.push_back(new G4HadronHElasticPhysics(verboseLevel));
226     fHelIsRegisted = true;
227   }
228   else if (name == "binary" && !fBicIsRegisted) {
229     fHadronPhys.push_back(new G4HadronInelasticQBBC(verboseLevel));
230     fBicIsRegisted = true;
231   }
232   else if (name == "binary_ion" && !fBiciIsRegisted) {
233     fHadronPhys.push_back(new G4IonPhysics(verboseLevel));
234     fBiciIsRegisted = true;
235   }
236   else {
237     G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
238            << " is not defined" << G4endl;
239   }
240 }
241 
242 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
243 
244 void PhysicsList::AddStepMax()
245 {
246   // Step limitation seen as a process
247   fStepMaxProcess = new StepMax();
248 
249   auto particleIterator = GetParticleIterator();
250   particleIterator->reset();
251   while ((*particleIterator)()) {
252     G4ParticleDefinition* particle = particleIterator->value();
253     G4ProcessManager* pmanager = particle->GetProcessManager();
254 
255     if (fStepMaxProcess->IsApplicable(*particle) && pmanager) {
256       pmanager->AddDiscreteProcess(fStepMaxProcess);
257     }
258   }
259 }
260 
261 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
262 
263 void PhysicsList::AddIonGasModels()
264 {
265   G4EmConfigurator* em_config = G4LossTableManager::Instance()->EmConfigurator();
266   auto particleIterator = GetParticleIterator();
267   particleIterator->reset();
268   while ((*particleIterator)()) {
269     G4ParticleDefinition* particle = particleIterator->value();
270     G4String partname = particle->GetParticleName();
271     if (partname == "alpha" || partname == "He3" || partname == "GenericIon") {
272       G4BraggIonGasModel* mod1 = new G4BraggIonGasModel();
273       G4BetheBlochIonGasModel* mod2 = new G4BetheBlochIonGasModel();
274       G4double eth = 2. * MeV * particle->GetPDGMass() / proton_mass_c2;
275       em_config->SetExtraEmModel(partname, "ionIoni", mod1, "", 0.0, eth, new G4IonFluctuations());
276       em_config->SetExtraEmModel(partname, "ionIoni", mod2, "", eth, 100 * TeV,
277                                  new G4UniversalFluctuation());
278     }
279   }
280 }
281 
282 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
283