Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4EnergyLossTables.hh
Go to the documentation of this file.
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 // $Id: G4EnergyLossTables.hh 77290 2013-11-22 10:57:50Z gcosmo $
28 //
29 // $Id:
30 //
31 // -----------------------------------------------------------------------------
32 
33 #ifndef included_G4EnergyLossTables
34 #define included_G4EnergyLossTables
35 
36 #include <map>
37 #include "globals.hh"
38 
39 #include "G4PhysicsTable.hh"
40 #include "G4ParticleDefinition.hh"
41 #include "G4Material.hh"
42 #include "G4ios.hh"
43 
44 //------------------------------------------------------------------------------
45 // A utility class, containing the energy loss tables
46 // for each particle
47 //
48 // Energy loss processes have to register their tables with this
49 // class. The responsibility of creating and deleting the tables
50 // remains with the energy loss classes.
51 // -----------------------------------------------------------------------------
52 //
53 // P. Urban, 06/04/1998
54 // L. Urban, 27/05/1988 , modifications + new functions added
55 // L.Urban , 13/10/98 , revision
56 // L.Urban, 26/10/98 , revision, Interpolate removed
57 // L.Urban , 08/02/99, cache mechanism
58 // L.Urban , 12/04/99 , bug fixed
59 // don't use the helper class.
60 // It can't be hidden for Rogue Wave uses it.
61 // 10.11.99: moved from RWT hash dictionary to STL map, G.Barrand, M.Maire
62 // 26.10.01: all static functions movev from .icc to .cc file (mma)
63 // 15.01.03 Add interfaces required for "cut per region" (V.Ivanchenko)
64 // 12.03.03 Add warnings to obsolete interfaces (V.Ivanchenko)
65 // 12.04.03 move exception to new method (V.Ivanchenko)
66 //
67 // -----------------------------------------------------------------------------
68 
69 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
70 
72 
73 friend class G4EnergyLossTables;
74  // the only instances are within the class G4EnergyLossTables
75 
76 public:
78 
79 private:
80  G4EnergyLossTablesHelper(const G4PhysicsTable* aDEDXTable,
81  const G4PhysicsTable* aRangeTable,
82  const G4PhysicsTable* anInverseRangeTable,
83  const G4PhysicsTable* aLabTimeTable,
84  const G4PhysicsTable* aProperTimeTable,
85  G4double aLowestKineticEnergy,
86  G4double aHighestKineticEnergy,
87  G4double aMassRatio,
88  G4int aNumberOfBins);
89  // data to be stored in the dictionary
90  const G4PhysicsTable* theDEDXTable;
91  const G4PhysicsTable* theRangeTable;
92  const G4PhysicsTable* theInverseRangeTable;
93  const G4PhysicsTable* theLabTimeTable;
94  const G4PhysicsTable* theProperTimeTable;
95  G4double theLowestKineticEnergy;
96  G4double theHighestKineticEnergy;
97  G4double theMassRatio;
98  G4int theNumberOfBins;
99 };
100 
101 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
102 
104 
106 
107 public:
108 
109  // get the table for a given particle
110  // (0 if the table was not found)
111  static const G4PhysicsTable* GetDEDXTable(
112  const G4ParticleDefinition* p);
113  static const G4PhysicsTable* GetRangeTable(
114  const G4ParticleDefinition* p);
115  static const G4PhysicsTable* GetInverseRangeTable(
116  const G4ParticleDefinition* p);
117  static const G4PhysicsTable* GetLabTimeTable(
118  const G4ParticleDefinition* p);
119  static const G4PhysicsTable* GetProperTimeTable(
120  const G4ParticleDefinition* p);
121 
122  // get the DEDX or the range for a given particle/energy/material
123  static G4double GetDEDX(
124  const G4ParticleDefinition *aParticle,
125  G4double KineticEnergy,
126  const G4Material *aMaterial);
127  static G4double GetRange(
128  const G4ParticleDefinition *aParticle,
129  G4double KineticEnergy,
130  const G4Material *aMaterial);
131  static G4double GetLabTime(
132  const G4ParticleDefinition *aParticle,
133  G4double KineticEnergy,
134  const G4Material *aMaterial);
135  static G4double GetDeltaLabTime(
136  const G4ParticleDefinition *aParticle,
137  G4double KineticEnergyStart,
138  G4double KineticEnergyEnd,
139  const G4Material *aMaterial);
140  static G4double GetProperTime(
141  const G4ParticleDefinition *aParticle,
142  G4double KineticEnergy,
143  const G4Material *aMaterial);
145  const G4ParticleDefinition *aParticle,
146  G4double KineticEnergyStart,
147  G4double KineticEnergyEnd,
148  const G4Material *aMaterial);
149 
150  static G4double GetPreciseDEDX(
151  const G4ParticleDefinition *aParticle,
152  G4double KineticEnergy,
153  const G4Material *aMaterial);
155  const G4ParticleDefinition *aParticle,
156  G4double KineticEnergy,
157  const G4Material *aMaterial);
159  const G4ParticleDefinition *aParticle,
160  G4double range,
161  const G4Material *aMaterial);
162 
163  // get the DEDX or the range for a given particle/energy/materialCutsCouple
164  static G4double GetDEDX(
165  const G4ParticleDefinition *aParticle,
166  G4double KineticEnergy,
167  const G4MaterialCutsCouple *couple,
168  G4bool check = true);
169  static G4double GetRange(
170  const G4ParticleDefinition *aParticle,
171  G4double KineticEnergy,
172  const G4MaterialCutsCouple *couple,
173  G4bool check = true);
174 
175  static G4double GetPreciseDEDX(
176  const G4ParticleDefinition *aParticle,
177  G4double KineticEnergy,
178  const G4MaterialCutsCouple *couple);
180  const G4ParticleDefinition *aParticle,
181  G4double KineticEnergy,
182  const G4MaterialCutsCouple *couple);
184  const G4ParticleDefinition *aParticle,
185  G4double range,
186  const G4MaterialCutsCouple *couple,
187  G4bool check = true);
188 
189  // to be called only by energy loss processes
190  static void Register(
191  const G4ParticleDefinition* p,
192  const G4PhysicsTable* tDEDX,
193  const G4PhysicsTable* tRange,
194  const G4PhysicsTable* tInverseRange,
195  const G4PhysicsTable* tLabTime,
196  const G4PhysicsTable* tProperTime,
197  G4double lowestKineticEnergy,
198  G4double highestKineticEnergy,
199  G4double massRatio,
200  G4int NumberOfBins);
201 
202 public:
203  typedef const G4ParticleDefinition* K;
204 
205 private:
206 
207  static void CPRWarning();
208  static void ParticleHaveNoLoss(const G4ParticleDefinition* aParticle,
209  const G4String&);
210 
211  /*
212  typedef std::map<K,G4EnergyLossTablesHelper,std::less<K> > helper_map;
213  static G4ThreadLocal helper_map *dict;
214 
215  static G4EnergyLossTablesHelper GetTables(const G4ParticleDefinition* p);
216 
217  static G4ThreadLocal G4EnergyLossTablesHelper *t;
218  static G4ThreadLocal G4EnergyLossTablesHelper *null_loss;
219  static G4ThreadLocal G4ParticleDefinition* lastParticle ;
220  static G4ThreadLocal G4double QQPositron ;
221  static G4ThreadLocal G4double Chargesquare ;
222  static G4ThreadLocal G4int oldIndex ;
223  static G4ThreadLocal G4double rmin,rmax,Thigh ;
224  static G4ThreadLocal G4int let_counter;
225  static G4ThreadLocal G4int let_max_num_warnings;
226  static G4ThreadLocal G4bool first_loss;
227  */
228  typedef std::map<K,G4EnergyLossTablesHelper,std::less<K> > helper_map;
229  static helper_map *dict;
230 
231  static G4EnergyLossTablesHelper GetTables(const G4ParticleDefinition* p);
232 
233  static G4EnergyLossTablesHelper *t;
234  static G4EnergyLossTablesHelper *null_loss;
235  static G4ParticleDefinition* lastParticle ;
236  static G4double QQPositron ;
237  static G4double Chargesquare ;
238  static G4int oldIndex ;
239  static G4double rmin,rmax,Thigh ;
240  static G4int let_counter;
241  static G4int let_max_num_warnings;
242  static G4bool first_loss;
243 
244 };
245 
246 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
247 
248 #endif
static G4double GetDeltaProperTime(const G4ParticleDefinition *aParticle, G4double KineticEnergyStart, G4double KineticEnergyEnd, const G4Material *aMaterial)
static const G4PhysicsTable * GetDEDXTable(const G4ParticleDefinition *p)
const char * p
Definition: xmltok.h:285
static G4double GetDeltaLabTime(const G4ParticleDefinition *aParticle, G4double KineticEnergyStart, G4double KineticEnergyEnd, const G4Material *aMaterial)
int G4int
Definition: G4Types.hh:78
bool G4bool
Definition: G4Types.hh:79
static G4double GetLabTime(const G4ParticleDefinition *aParticle, G4double KineticEnergy, const G4Material *aMaterial)
static G4double GetPreciseRangeFromEnergy(const G4ParticleDefinition *aParticle, G4double KineticEnergy, const G4Material *aMaterial)
static const G4PhysicsTable * GetLabTimeTable(const G4ParticleDefinition *p)
static const G4PhysicsTable * GetRangeTable(const G4ParticleDefinition *p)
const G4ParticleDefinition * K
static G4double GetDEDX(const G4ParticleDefinition *aParticle, G4double KineticEnergy, const G4Material *aMaterial)
static G4double GetProperTime(const G4ParticleDefinition *aParticle, G4double KineticEnergy, const G4Material *aMaterial)
double G4double
Definition: G4Types.hh:76
static void Register(const G4ParticleDefinition *p, const G4PhysicsTable *tDEDX, const G4PhysicsTable *tRange, const G4PhysicsTable *tInverseRange, const G4PhysicsTable *tLabTime, const G4PhysicsTable *tProperTime, G4double lowestKineticEnergy, G4double highestKineticEnergy, G4double massRatio, G4int NumberOfBins)
static const G4PhysicsTable * GetInverseRangeTable(const G4ParticleDefinition *p)
static G4double GetPreciseEnergyFromRange(const G4ParticleDefinition *aParticle, G4double range, const G4Material *aMaterial)
static G4double GetPreciseDEDX(const G4ParticleDefinition *aParticle, G4double KineticEnergy, const G4Material *aMaterial)
static const G4PhysicsTable * GetProperTimeTable(const G4ParticleDefinition *p)
static G4double GetRange(const G4ParticleDefinition *aParticle, G4double KineticEnergy, const G4Material *aMaterial)