ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PhysicsList.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PhysicsList.cc
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 //
28 //
29 //
30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32 
33 #include "PhysicsList.hh"
34 #include "PhysicsListMessenger.hh"
35 
36 #include "PhysListEmStandard.hh"
37 
38 #include "G4EmStandardPhysics.hh"
43 #include "G4EmStandardPhysicsSS.hh"
44 #include "G4EmStandardPhysicsGS.hh"
46 #include "G4EmLivermorePhysics.hh"
47 #include "G4EmPenelopePhysics.hh"
48 #include "G4EmLowEPPhysics.hh"
49 
50 #include "DetectorConstruction.hh"
51 
52 #include "G4LossTableManager.hh"
53 #include "G4UnitsTable.hh"
54 #include "G4SystemOfUnits.hh"
55 #include "G4EmParameters.hh"
56 
57 // particles
58 
59 #include "G4BosonConstructor.hh"
60 #include "G4LeptonConstructor.hh"
61 #include "G4MesonConstructor.hh"
62 #include "G4BosonConstructor.hh"
63 #include "G4BaryonConstructor.hh"
64 #include "G4IonConstructor.hh"
66 
67 #include "G4PhysicsListHelper.hh"
68 #include "G4Decay.hh"
69 #include "G4RadioactiveDecay.hh"
70 #include "G4GenericIon.hh"
71 #include "G4NuclideTable.hh"
72 
73 #include "G4ProcessManager.hh"
74 #include "StepMax.hh"
75 #include "G4Material.hh"
76 
77 #include "G4Gamma.hh"
78 #include "G4Electron.hh"
79 #include "G4Proton.hh"
80 #include "G4GenericIon.hh"
81 
82 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
83 
85  : G4VModularPhysicsList(), fEmPhysicsList(nullptr), fEmName(" "), fDet(det)
86 {
87  fMessenger = new PhysicsListMessenger(this);
88  SetVerboseLevel(1);
89 
90  // EM physics
91  AddPhysicsList("emstandard_opt3");
92 
93  // fix lower limit for cut
96 }
97 
98 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
99 
101 {
102  delete fMessenger;
103 }
104 
105 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
106 
108 {
109  G4BosonConstructor pBosonConstructor;
110  pBosonConstructor.ConstructParticle();
111 
112  G4LeptonConstructor pLeptonConstructor;
113  pLeptonConstructor.ConstructParticle();
114 
115  G4MesonConstructor pMesonConstructor;
116  pMesonConstructor.ConstructParticle();
117 
118  G4BaryonConstructor pBaryonConstructor;
119  pBaryonConstructor.ConstructParticle();
120 
121  G4IonConstructor pIonConstructor;
122  pIonConstructor.ConstructParticle();
123 
124  G4ShortLivedConstructor pShortLivedConstructor;
125  pShortLivedConstructor.ConstructParticle();
126 }
127 
128 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
129 
131 {
132  // Transportation
133  //
135 
136  // Electromagnetic physics list
137  //
139 
140  // Decay Process
141  //
142  AddDecay();
143 
144  // Decay Process
145  //
147 
148  // step limitation (as a full process)
149  //
150  AddStepMax();
151 
152  // example of Get process
153  auto process = GetProcess("RadioactiveDecay");
154  if (process != nullptr) {
155  G4cout << "\n GetProcess : " << process->GetProcessName() << G4endl;
156  }
157 }
158 
159 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
160 
162 {
163  if (verboseLevel>0) {
164  G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
165  }
166 
167  if (name == fEmName) return;
168 
169  if (name == "local") {
170  fEmName = name;
171  delete fEmPhysicsList;
173 
174  } else if (name == "emstandard_opt0") {
175  fEmName = name;
176  delete fEmPhysicsList;
178 
179  } else if (name == "emstandard_opt1") {
180  fEmName = name;
181  delete fEmPhysicsList;
183 
184  } else if (name == "emstandard_opt2") {
185  fEmName = name;
186  delete fEmPhysicsList;
188 
189  } else if (name == "emstandard_opt3") {
190  fEmName = name;
191  delete fEmPhysicsList;
193 
194  } else if (name == "emstandard_opt4") {
195  fEmName = name;
196  delete fEmPhysicsList;
198 
199  } else if (name == "emstandardSS") {
200  fEmName = name;
201  delete fEmPhysicsList;
203 
204  } else if (name == "emstandardGS") {
205  fEmName = name;
206  delete fEmPhysicsList;
208 
209  } else if (name == "emstandardWVI") {
210  fEmName = name;
211  delete fEmPhysicsList;
213 
214  } else if (name == "emlivermore") {
215  fEmName = name;
216  delete fEmPhysicsList;
218 
219  } else if (name == "empenelope") {
220  fEmName = name;
221  delete fEmPhysicsList;
223 
224  } else if (name == "emlowenergy") {
225  fEmName = name;
226  delete fEmPhysicsList;
228 
229  } else {
230 
231  G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
232  << " is not defined"
233  << G4endl;
234  }
235 
236  // Em options
237  //
240 }
241 
242 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
243 
245 {
247 
248  // Decay Process
249  //
250  G4Decay* fDecayProcess = new G4Decay();
251 
253  particleIterator->reset();
254  while( (*particleIterator)() ){
256  if (fDecayProcess->IsApplicable(*particle))
257  ph->RegisterProcess(fDecayProcess, particle);
258  }
259 }
260 
261 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
262 
264 {
265  G4RadioactiveDecay* radioactiveDecay = new G4RadioactiveDecay();
266 
267  radioactiveDecay->SetARM(true); //Atomic Rearangement
268 
270  ph->RegisterProcess(radioactiveDecay, G4GenericIon::GenericIon());
271 
272  // mandatory for G4NuclideTable
273  //
275 }
276 
277 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
278 
280 {
281  // Step limitation seen as a process
282  StepMax* stepMaxProcess = new StepMax();
283 
285  particleIterator->reset();
286  while ((*particleIterator)()){
288  G4ProcessManager* pmanager = particle->GetProcessManager();
289 
290  if (stepMaxProcess->IsApplicable(*particle))
291  {
292  pmanager ->AddDiscreteProcess(stepMaxProcess);
293  }
294  }
295 }
296 
297 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
298 
300 {
302  const G4MaterialCutsCouple* couple = lBox->GetMaterialCutsCouple();
303  const G4Material* currMat = lBox->GetMaterial();
304 
306  G4double cut;
307  part = G4Electron::Electron();
308  cut = G4LossTableManager::Instance()->GetRange(part,val,couple);
309  G4cout << "material : " << currMat->GetName() << G4endl;
310  G4cout << "particle : " << part->GetParticleName() << G4endl;
311  G4cout << "energy : " << G4BestUnit(val,"Energy") << G4endl;
312  G4cout << "range : " << G4BestUnit(cut,"Length") << G4endl;
313 }
314 
315 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
316 
317 G4VProcess* PhysicsList::GetProcess(const G4String& processName) const
318 {
320  G4ProcessVector* procList = particle->GetProcessManager()->GetProcessList();
321  G4int nbProc = particle->GetProcessManager()->GetProcessListLength();
322  for (G4int k=0; k<nbProc; k++) {
323  G4VProcess* process = (*procList)[k];
324  if (process->GetProcessName() == processName) return process;
325  }
326  return nullptr;
327 }
328 
329 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......