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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/TestEm12/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 "PhysListEmStandardSSM.hh"
 37 #include "PhysicsListMessenger.hh"
 38 
 39 #include "G4EmDNAPhysics.hh"
 40 #include "G4EmDNAPhysics_option1.hh"
 41 #include "G4EmDNAPhysics_option2.hh"
 42 #include "G4EmDNAPhysics_option3.hh"
 43 #include "G4EmDNAPhysics_option4.hh"
 44 #include "G4EmDNAPhysics_option5.hh"
 45 #include "G4EmDNAPhysics_option6.hh"
 46 #include "G4EmDNAPhysics_option7.hh"
 47 #include "G4EmLivermorePhysics.hh"
 48 #include "G4EmLowEPPhysics.hh"
 49 #include "G4EmPenelopePhysics.hh"
 50 #include "G4EmStandardPhysics.hh"
 51 #include "G4EmStandardPhysicsGS.hh"
 52 #include "G4EmStandardPhysicsSS.hh"
 53 #include "G4EmStandardPhysicsWVI.hh"
 54 #include "G4EmStandardPhysics_option1.hh"
 55 #include "G4EmStandardPhysics_option2.hh"
 56 #include "G4EmStandardPhysics_option3.hh"
 57 #include "G4EmStandardPhysics_option4.hh"
 58 #include "G4LossTableManager.hh"
 59 #include "G4SystemOfUnits.hh"
 60 #include "G4UnitsTable.hh"
 61 
 62 // particles
 63 
 64 #include "G4BaryonConstructor.hh"
 65 #include "G4BosonConstructor.hh"
 66 #include "G4DNAGenericIonsManager.hh"
 67 #include "G4IonConstructor.hh"
 68 #include "G4LeptonConstructor.hh"
 69 #include "G4MesonConstructor.hh"
 70 #include "G4ShortLivedConstructor.hh"
 71 
 72 G4ThreadLocal StepMax* PhysicsList::fStepMaxProcess = nullptr;
 73 
 74 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 75 
 76 PhysicsList::PhysicsList()
 77 {
 78   fMessenger = new PhysicsListMessenger(this);
 79 
 80   SetVerboseLevel(1);
 81 
 82   // EM physics
 83   fEmPhysicsList = new PhysListEmStandard(fEmName = "local");
 84 
 85   // Em options
 86   //
 87   G4EmParameters::Instance()->SetBuildCSDARange(true);
 88 
 89   SetDefaultCutValue(1. * mm);
 90 }
 91 
 92 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 93 
 94 PhysicsList::~PhysicsList()
 95 {
 96   delete fMessenger;
 97   delete fEmPhysicsList;
 98 }
 99 
100 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
101 
102 void PhysicsList::ConstructParticle()
103 {
104   G4BosonConstructor pBosonConstructor;
105   pBosonConstructor.ConstructParticle();
106 
107   G4LeptonConstructor pLeptonConstructor;
108   pLeptonConstructor.ConstructParticle();
109 
110   G4MesonConstructor pMesonConstructor;
111   pMesonConstructor.ConstructParticle();
112 
113   G4BaryonConstructor pBaryonConstructor;
114   pBaryonConstructor.ConstructParticle();
115 
116   G4IonConstructor pIonConstructor;
117   pIonConstructor.ConstructParticle();
118 
119   G4ShortLivedConstructor pShortLivedConstructor;
120   pShortLivedConstructor.ConstructParticle();
121 
122   // DNA
123   G4DNAGenericIonsManager* genericIonsManager;
124   genericIonsManager = G4DNAGenericIonsManager::Instance();
125   genericIonsManager->GetIon("alpha++");
126   genericIonsManager->GetIon("alpha+");
127   genericIonsManager->GetIon("helium");
128   genericIonsManager->GetIon("hydrogen");
129 }
130 
131 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
132 
133 #include "G4ProcessManager.hh"
134 
135 void PhysicsList::ConstructProcess()
136 {
137   // transportation
138   //
139   AddTransportation();
140 
141   // electromagnetic physics list
142   //
143   fEmPhysicsList->ConstructProcess();
144 
145   // decay process
146   //
147   AddDecay();
148 
149   // step limitation (as a full process)
150   //
151   AddStepMax();
152 }
153 
154 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
155 
156 void PhysicsList::AddPhysicsList(const G4String& name)
157 {
158   if (verboseLevel > -1) {
159     G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
160   }
161 
162   if (name == fEmName) return;
163 
164   if (name == "local") {
165     fEmName = name;
166     delete fEmPhysicsList;
167     fEmPhysicsList = new PhysListEmStandard(name);
168   }
169   else if (name == "emstandard_opt0") {
170     fEmName = name;
171     delete fEmPhysicsList;
172     fEmPhysicsList = new G4EmStandardPhysics();
173   }
174   else if (name == "emstandard_opt1") {
175     fEmName = name;
176     delete fEmPhysicsList;
177     fEmPhysicsList = new G4EmStandardPhysics_option1();
178   }
179   else if (name == "emstandard_opt2") {
180     fEmName = name;
181     delete fEmPhysicsList;
182     fEmPhysicsList = new G4EmStandardPhysics_option2();
183   }
184   else if (name == "emstandard_opt3") {
185     fEmName = name;
186     delete fEmPhysicsList;
187     fEmPhysicsList = new G4EmStandardPhysics_option3();
188   }
189   else if (name == "emstandard_opt4") {
190     fEmName = name;
191     delete fEmPhysicsList;
192     fEmPhysicsList = new G4EmStandardPhysics_option4();
193   }
194   else if (name == "emstandardSS") {
195     fEmName = name;
196     delete fEmPhysicsList;
197     fEmPhysicsList = new G4EmStandardPhysicsSS();
198   }
199   else if (name == "standardSSM") {
200     fEmName = name;
201     delete fEmPhysicsList;
202     fEmPhysicsList = new PhysListEmStandardSSM(name);
203   }
204   else if (name == "emstandardWVI") {
205     fEmName = name;
206     delete fEmPhysicsList;
207     fEmPhysicsList = new G4EmStandardPhysicsWVI();
208   }
209   else if (name == "standardGS") {
210     fEmName = name;
211     delete fEmPhysicsList;
212     fEmPhysicsList = new G4EmStandardPhysicsGS();
213   }
214   else if (name == "emlivermore") {
215     fEmName = name;
216     delete fEmPhysicsList;
217     fEmPhysicsList = new G4EmLivermorePhysics();
218   }
219   else if (name == "empenelope") {
220     fEmName = name;
221     delete fEmPhysicsList;
222     fEmPhysicsList = new G4EmPenelopePhysics();
223   }
224   else if (name == "emlowenergy") {
225     fEmName = name;
226     delete fEmPhysicsList;
227     fEmPhysicsList = new G4EmLowEPPhysics();
228   }
229   else if (name == "dna") {
230     fEmName = name;
231     delete fEmPhysicsList;
232     fEmPhysicsList = new G4EmDNAPhysics();
233   }
234   else if (name == "dna_opt1") {
235     fEmName = name;
236     delete fEmPhysicsList;
237     fEmPhysicsList = new G4EmDNAPhysics_option1();
238   }
239   else if (name == "dna_opt2") {
240     fEmName = name;
241     delete fEmPhysicsList;
242     fEmPhysicsList = new G4EmDNAPhysics_option2();
243   }
244   else if (name == "dna_opt3") {
245     fEmName = name;
246     delete fEmPhysicsList;
247     fEmPhysicsList = new G4EmDNAPhysics_option3();
248   }
249   else if (name == "dna_opt4") {
250     fEmName = name;
251     delete fEmPhysicsList;
252     fEmPhysicsList = new G4EmDNAPhysics_option4();
253   }
254   else if (name == "dna_opt5") {
255     fEmName = name;
256     delete fEmPhysicsList;
257     fEmPhysicsList = new G4EmDNAPhysics_option5();
258   }
259   else if (name == "dna_opt6") {
260     fEmName = name;
261     delete fEmPhysicsList;
262     fEmPhysicsList = new G4EmDNAPhysics_option6();
263   }
264   else if (name == "dna_opt7") {
265     fEmName = name;
266     delete fEmPhysicsList;
267     fEmPhysicsList = new G4EmDNAPhysics_option7();
268   }
269   else {
270     G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
271            << " is not defined" << G4endl;
272   }
273   G4EmParameters::Instance()->SetBuildCSDARange(true);
274 }
275 
276 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
277 
278 #include "G4Decay.hh"
279 
280 void PhysicsList::AddDecay()
281 {
282   // decay process
283   //
284   G4Decay* fDecayProcess = new G4Decay();
285 
286   auto particleIterator = GetParticleIterator();
287   particleIterator->reset();
288   while ((*particleIterator)()) {
289     G4ParticleDefinition* particle = particleIterator->value();
290     G4ProcessManager* pmanager = particle->GetProcessManager();
291 
292     if (fDecayProcess->IsApplicable(*particle) && !particle->IsShortLived()) {
293       pmanager->AddProcess(fDecayProcess);
294 
295       // set ordering for PostStepDoIt and AtRestDoIt
296       pmanager->SetProcessOrdering(fDecayProcess, idxPostStep);
297       pmanager->SetProcessOrdering(fDecayProcess, idxAtRest);
298     }
299   }
300 }
301 
302 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
303 
304 #include "StepMax.hh"
305 
306 void PhysicsList::AddStepMax()
307 {
308   // Step limitation seen as a process
309   fStepMaxProcess = new StepMax();
310 
311   auto particleIterator = GetParticleIterator();
312   particleIterator->reset();
313   while ((*particleIterator)()) {
314     G4ParticleDefinition* particle = particleIterator->value();
315     G4ProcessManager* pmanager = particle->GetProcessManager();
316 
317     if (fStepMaxProcess->IsApplicable(*particle)) {
318       pmanager->AddDiscreteProcess(fStepMaxProcess);
319     }
320   }
321 }
322 
323 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
324