ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4LossTableManager.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4LossTableManager.hh
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 // -------------------------------------------------------------------
27 //
28 // GEANT4 Class header file
29 //
30 //
31 // File name: G4LossTableManager
32 //
33 // Author: Vladimir Ivanchenko on base of G4LossTables class
34 // and Maria Grazia Pia ideas
35 //
36 // Creation date: 03.01.2002
37 //
38 // Modifications by V.Ivanchenko
39 //
40 // Class Description:
41 //
42 // A utility static class, responsable for the energy loss tables
43 // for each particle
44 //
45 // Energy loss processes have to register their tables with this
46 // class. The responsibility of creating and deleting the tables
47 // remains with the energy loss classes.
48 
49 // -------------------------------------------------------------------
50 //
51 
52 #ifndef G4LossTableManager_h
53 #define G4LossTableManager_h 1
54 
55 #include <map>
56 #include <vector>
57 #include "globals.hh"
59 #include "G4VEnergyLossProcess.hh"
60 
61 class G4PhysicsTable;
64 class G4Region;
65 class G4EmSaturation;
66 class G4EmConfigurator;
67 class G4ElectronIonPair;
68 class G4NIELCalculator;
70 class G4VEmProcess;
71 class G4EmCorrections;
72 class G4LossTableBuilder;
74 class G4VSubCutProducer;
75 
77 {
78 
80 
81 public:
82 
83  static G4LossTableManager* Instance();
84 
86 
87  //-------------------------------------------------
88  // initialisation before a new run
89  //-------------------------------------------------
90 
91  void PreparePhysicsTable(const G4ParticleDefinition* aParticle,
92  G4VEnergyLossProcess* p, G4bool theMaster);
93 
94  void PreparePhysicsTable(const G4ParticleDefinition* aParticle,
95  G4VEmProcess* p, G4bool theMaster);
96 
97  void PreparePhysicsTable(const G4ParticleDefinition* aParticle,
98  G4VMultipleScattering* p, G4bool theMaster);
99 
100  void BuildPhysicsTable(const G4ParticleDefinition* aParticle);
101 
102  void BuildPhysicsTable(const G4ParticleDefinition* aParticle,
104 
105  void LocalPhysicsTables(const G4ParticleDefinition* aParticle,
107 
108  void DumpHtml();
109 
110  //-------------------------------------------------
111  // Run time access to DEDX, range, energy for a given particle,
112  // energy, and G4MaterialCutsCouple
113  //-------------------------------------------------
114 
115  inline G4double GetDEDX(
116  const G4ParticleDefinition *aParticle,
117  G4double kineticEnergy,
118  const G4MaterialCutsCouple *couple);
119 
120  inline G4double GetSubDEDX(
121  const G4ParticleDefinition *aParticle,
122  G4double kineticEnergy,
123  const G4MaterialCutsCouple *couple);
124 
125  inline G4double GetRange(
126  const G4ParticleDefinition *aParticle,
127  G4double kineticEnergy,
128  const G4MaterialCutsCouple *couple);
129 
130  inline G4double GetCSDARange(
131  const G4ParticleDefinition *aParticle,
132  G4double kineticEnergy,
133  const G4MaterialCutsCouple *couple);
134 
136  const G4ParticleDefinition *aParticle,
137  G4double kineticEnergy,
138  const G4MaterialCutsCouple *couple);
139 
140  inline G4double GetEnergy(
141  const G4ParticleDefinition *aParticle,
142  G4double range,
143  const G4MaterialCutsCouple *couple);
144 
146  const G4MaterialCutsCouple *couple,
147  const G4DynamicParticle* dp,
148  G4double& length);
149 
150  //-------------------------------------------------
151  // Methods to be called only at initialisation
152  // and at the end of the job
153  //-------------------------------------------------
154 
156 
158 
160 
162 
163  void Register(G4VEmProcess* p);
164 
165  void DeRegister(G4VEmProcess* p);
166 
167  void Register(G4VProcess* p);
168 
169  void DeRegister(G4VProcess* p);
170 
171  void Register(G4VEmModel* p);
172 
173  void DeRegister(G4VEmModel* p);
174 
176 
178 
179  void RegisterExtraParticle(const G4ParticleDefinition* aParticle,
181 
182  void SetVerbose(G4int val);
183 
185 
187 
189 
190  //-------------------------------------------------
191  // Access methods
192  //-------------------------------------------------
193 
194  inline G4bool IsMaster() const;
195 
197 
198  const std::vector<G4VEnergyLossProcess*>& GetEnergyLossProcessVector();
199 
200  const std::vector<G4VEmProcess*>& GetEmProcessVector();
201 
202  const std::vector<G4VMultipleScattering*>& GetMultipleScatteringVector();
203 
205 
207 
209 
211 
212  inline G4EmCorrections* EmCorrections();
213 
215 
217 
219 
220  inline void SetGammaGeneralProcess(G4VEmProcess*);
221 
223 
225 
227 
228 private:
229 
230  //-------------------------------------------------
231  // Private methods and members
232  //-------------------------------------------------
233 
235 
236  void Clear();
237 
238  void ResetParameters();
239 
241 
242  void CopyTables(const G4ParticleDefinition* aParticle,
244 
245  void ParticleHaveNoLoss(const G4ParticleDefinition* aParticle);
246 
247  void CopyDEDXTables();
248 
250 
253 
255 
256  typedef const G4ParticleDefinition* PD;
257 
258  std::map<PD,G4VEnergyLossProcess*,std::less<PD> > loss_map;
259 
260  std::vector<G4VEnergyLossProcess*> loss_vector;
261  std::vector<PD> part_vector;
262  std::vector<PD> base_part_vector;
263  std::vector<G4bool> tables_are_built;
264  std::vector<G4bool> isActive;
265  std::vector<G4PhysicsTable*> dedx_vector;
266  std::vector<G4PhysicsTable*> range_vector;
267  std::vector<G4PhysicsTable*> inv_range_vector;
268  std::vector<G4VMultipleScattering*> msc_vector;
269  std::vector<G4VEmProcess*> emp_vector;
270  std::vector<G4VEmModel*> mod_vector;
271  std::vector<G4VEmFluctuationModel*> fmod_vector;
272  std::vector<G4VProcess*> p_vector;
273 
274  // cache
280 
283 
294 
298 
300 };
301 
302 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
303 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
304 
305 inline
307  G4double kineticEnergy,
308  const G4MaterialCutsCouple *couple)
309 {
310  if(aParticle != currentParticle) { GetEnergyLossProcess(aParticle); }
311  return currentLoss ? currentLoss->GetDEDX(kineticEnergy, couple) : 0.0;
312 }
313 
314 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
315 
316 inline
318  G4double kineticEnergy,
319  const G4MaterialCutsCouple *couple)
320 {
321  if(aParticle != currentParticle) { GetEnergyLossProcess(aParticle); }
322  return currentLoss ? currentLoss->GetDEDXForSubsec(kineticEnergy, couple) : 0.0;
323 }
324 
325 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
326 
327 inline
329  G4double kineticEnergy,
330  const G4MaterialCutsCouple *couple)
331 {
332  if(aParticle != currentParticle) { GetEnergyLossProcess(aParticle); }
333  return currentLoss ? currentLoss->GetCSDARange(kineticEnergy, couple) : DBL_MAX;
334 }
335 
336 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
337 
338 inline
340  const G4ParticleDefinition *aParticle,
341  G4double kineticEnergy,
342  const G4MaterialCutsCouple *couple)
343 {
344  if(aParticle != currentParticle) { GetEnergyLossProcess(aParticle); }
345  return currentLoss ? currentLoss->GetRangeForLoss(kineticEnergy, couple) : DBL_MAX;
346 }
347 
348 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
349 
350 inline
352  G4double kineticEnergy,
353  const G4MaterialCutsCouple *couple)
354 {
355  if(aParticle != currentParticle) { GetEnergyLossProcess(aParticle); }
356  return currentLoss ? currentLoss->GetRange(kineticEnergy, couple) : DBL_MAX;
357 }
358 
359 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
360 
361 inline
363  G4double range,
364  const G4MaterialCutsCouple *couple)
365 {
366  if(aParticle != currentParticle) { GetEnergyLossProcess(aParticle); }
367  return currentLoss ? currentLoss->GetKineticEnergy(range, couple) : 0.0;
368 }
369 
370 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
371 
372 inline
374  const G4MaterialCutsCouple *couple,
375  const G4DynamicParticle* dp,
376  G4double& length)
377 {
378  const G4ParticleDefinition* aParticle = dp->GetParticleDefinition();
379  if(aParticle != currentParticle) { GetEnergyLossProcess(aParticle); }
380  return currentLoss ? currentLoss->GetDEDXDispersion(couple, dp, length) : 0.0;
381 }
382 
383 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
384 
386 {
387  return isMaster;
388 }
389 
390 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
391 
393 {
394  return emCorrections;
395 }
396 
397 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
398 
400 {
401  return atomDeexcitation;
402 }
403 
404 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
405 
407 {
408  return subcutProducer;
409 }
410 
411 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
412 
414 {
415  return tableBuilder;
416 }
417 
418 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
419 
421 {
422  gGeneral = ptr;
423 }
424 
425 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
426 
428 {
429  return gGeneral;
430 }
431 
432 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
433 
434 inline
436 {
437  eGeneral = ptr;
438 }
439 
440 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
441 
443 {
444  return eGeneral;
445 }
446 
447 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
448 
449 #endif
450