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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 ]

Diff markup

Differences between /processes/electromagnetic/utils/include/G4EnergyLossTables.hh (Version 11.3.0) and /processes/electromagnetic/utils/include/G4EnergyLossTables.hh (Version 10.7.p4)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 //                                                 26 //
 27 //                                                 27 //
 28 //                                                 28 //
 29 // -------------------------------------------     29 // -----------------------------------------------------------------------------
 30                                                    30 
 31 #ifndef included_G4EnergyLossTables                31 #ifndef included_G4EnergyLossTables
 32 #define included_G4EnergyLossTables                32 #define included_G4EnergyLossTables
 33                                                    33 
 34 #include <map>                                     34 #include <map>
 35 #include "globals.hh"                              35 #include "globals.hh"
 36                                                    36 
 37 #include "G4PhysicsTable.hh"                       37 #include "G4PhysicsTable.hh"
 38 #include "G4ParticleDefinition.hh"                 38 #include "G4ParticleDefinition.hh"
 39 #include "G4Material.hh"                           39 #include "G4Material.hh"
 40 #include "G4ios.hh"                                40 #include "G4ios.hh"
 41                                                    41 
 42 //--------------------------------------------     42 //------------------------------------------------------------------------------
 43 // A utility class, containing the energy loss     43 // A utility class, containing the energy loss tables
 44 // for each particle                               44 // for each particle
 45 //                                                 45 //
 46 // Energy loss processes have to register thei     46 // Energy loss processes have to register their tables with this
 47 // class. The responsibility of creating and d     47 // class. The responsibility of creating and deleting the tables
 48 // remains with the energy loss classes.           48 // remains with the energy loss classes.
 49 // -------------------------------------------     49 // -----------------------------------------------------------------------------
 50 //                                                 50 //
 51 // P. Urban, 06/04/1998                            51 // P. Urban, 06/04/1998
 52 // L. Urban, 27/05/1988 , modifications + new      52 // L. Urban, 27/05/1988 , modifications + new functions added
 53 // L.Urban , 13/10/98 , revision                   53 // L.Urban , 13/10/98 , revision
 54 // L.Urban,  26/10/98 , revision, Interpolate      54 // L.Urban,  26/10/98 , revision, Interpolate removed
 55 // L.Urban , 08/02/99,  cache mechanism            55 // L.Urban , 08/02/99,  cache mechanism
 56 // L.Urban , 12/04/99 , bug fixed                  56 // L.Urban , 12/04/99 , bug fixed
 57 // don't use the helper class.                     57 // don't use the helper class.
 58 // It can't be hidden for Rogue Wave uses it.      58 // It can't be hidden for Rogue Wave uses it.
 59 // 10.11.99: moved from RWT hash dictionary to     59 // 10.11.99: moved from RWT hash dictionary to STL map, G.Barrand, M.Maire
 60 // 26.10.01: all static functions movev from .     60 // 26.10.01: all static functions movev from .icc to .cc file (mma)
 61 // 15.01.03 Add interfaces required for "cut p     61 // 15.01.03 Add interfaces required for "cut per region" (V.Ivanchenko)
 62 // 12.03.03 Add warnings to obsolete interface     62 // 12.03.03 Add warnings to obsolete interfaces (V.Ivanchenko)
 63 // 12.04.03 move exception to new method (V.Iv     63 // 12.04.03 move exception to new method (V.Ivanchenko)
 64 //                                                 64 //
 65 // -------------------------------------------     65 // -----------------------------------------------------------------------------
 66                                                    66 
 67 //....oooOO0OOooo........oooOO0OOooo........oo     67 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 68                                                    68 
 69 class G4EnergyLossTablesHelper {                   69 class G4EnergyLossTablesHelper {
 70                                                    70 
 71 friend class G4EnergyLossTables;                   71 friend class G4EnergyLossTables;
 72   // the only instances are within the class G     72   // the only instances are within the class G4EnergyLossTables
 73                                                    73 
 74 public:                                            74 public:
 75   G4EnergyLossTablesHelper();                      75   G4EnergyLossTablesHelper();
 76                                                    76 
 77 private:                                           77 private:
 78   G4EnergyLossTablesHelper(const G4PhysicsTabl     78   G4EnergyLossTablesHelper(const G4PhysicsTable* aDEDXTable,
 79          const G4PhysicsTable* aRangeTable,        79          const G4PhysicsTable* aRangeTable,
 80                            const G4PhysicsTabl     80                            const G4PhysicsTable* anInverseRangeTable,
 81                            const G4PhysicsTabl     81                            const G4PhysicsTable* aLabTimeTable,
 82                            const G4PhysicsTabl     82                            const G4PhysicsTable* aProperTimeTable,
 83          G4double aLowestKineticEnergy,            83          G4double aLowestKineticEnergy,
 84          G4double aHighestKineticEnergy,           84          G4double aHighestKineticEnergy,
 85          G4double aMassRatio,                      85          G4double aMassRatio,
 86                            G4int aNumberOfBins     86                            G4int aNumberOfBins);
 87   // data to be stored in the dictionary           87   // data to be stored in the dictionary
 88   const G4PhysicsTable* theDEDXTable;              88   const G4PhysicsTable* theDEDXTable;
 89   const G4PhysicsTable* theRangeTable;             89   const G4PhysicsTable* theRangeTable;
 90   const G4PhysicsTable* theInverseRangeTable;      90   const G4PhysicsTable* theInverseRangeTable;
 91   const G4PhysicsTable* theLabTimeTable;           91   const G4PhysicsTable* theLabTimeTable;
 92   const G4PhysicsTable* theProperTimeTable;        92   const G4PhysicsTable* theProperTimeTable;
 93   G4double theLowestKineticEnergy;                 93   G4double theLowestKineticEnergy;
 94   G4double theHighestKineticEnergy;                94   G4double theHighestKineticEnergy;
 95   G4double theMassRatio;                           95   G4double theMassRatio;
 96   G4int theNumberOfBins;                           96   G4int theNumberOfBins;
 97 };                                                 97 };
 98                                                    98 
 99 //....oooOO0OOooo........oooOO0OOooo........oo     99 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
100                                                   100 
101 class G4MaterialCutsCouple;                       101 class G4MaterialCutsCouple;
102                                                   102 
103 class G4EnergyLossTables {                        103 class G4EnergyLossTables {
104                                                   104 
105 public:                                           105 public:
106                                                   106 
107   // get the table for a given particle           107   // get the table for a given particle
108   // (0 if the table was not found)               108   // (0 if the table was not found)
109   static const G4PhysicsTable* GetDEDXTable(      109   static const G4PhysicsTable* GetDEDXTable(
110     const G4ParticleDefinition* p);               110     const G4ParticleDefinition* p);
111   static const G4PhysicsTable* GetRangeTable(     111   static const G4PhysicsTable* GetRangeTable(
112     const G4ParticleDefinition* p);               112     const G4ParticleDefinition* p);
113   static const G4PhysicsTable* GetInverseRange    113   static const G4PhysicsTable* GetInverseRangeTable(
114     const G4ParticleDefinition* p);               114     const G4ParticleDefinition* p);
115   static const G4PhysicsTable* GetLabTimeTable    115   static const G4PhysicsTable* GetLabTimeTable(
116     const G4ParticleDefinition* p);               116     const G4ParticleDefinition* p);
117   static const G4PhysicsTable* GetProperTimeTa    117   static const G4PhysicsTable* GetProperTimeTable(
118     const G4ParticleDefinition* p);               118     const G4ParticleDefinition* p);
119                                                   119 
120   // get the DEDX or the range for a given par    120   // get the DEDX or the range for a given particle/energy/material
121   static G4double GetDEDX(                        121   static G4double GetDEDX(
122     const G4ParticleDefinition *aParticle,        122     const G4ParticleDefinition *aParticle,
123     G4double KineticEnergy,                       123     G4double KineticEnergy,
124     const G4Material *aMaterial);                 124     const G4Material *aMaterial);
125   static G4double GetRange(                       125   static G4double GetRange(
126     const G4ParticleDefinition *aParticle,        126     const G4ParticleDefinition *aParticle,
127     G4double KineticEnergy,                       127     G4double KineticEnergy,
128     const G4Material *aMaterial);                 128     const G4Material *aMaterial);
129   static G4double GetLabTime(                     129   static G4double GetLabTime(
130     const G4ParticleDefinition *aParticle,        130     const G4ParticleDefinition *aParticle,
131     G4double KineticEnergy,                       131     G4double KineticEnergy,
132     const G4Material *aMaterial);                 132     const G4Material *aMaterial);
133   static G4double GetDeltaLabTime(                133   static G4double GetDeltaLabTime(
134     const G4ParticleDefinition *aParticle,        134     const G4ParticleDefinition *aParticle,
135     G4double KineticEnergyStart,                  135     G4double KineticEnergyStart,
136     G4double KineticEnergyEnd,                    136     G4double KineticEnergyEnd,
137     const G4Material *aMaterial);                 137     const G4Material *aMaterial);
138   static G4double GetProperTime(                  138   static G4double GetProperTime(
139     const G4ParticleDefinition *aParticle,        139     const G4ParticleDefinition *aParticle,
140     G4double KineticEnergy,                       140     G4double KineticEnergy,
141     const G4Material *aMaterial);                 141     const G4Material *aMaterial);
142   static G4double GetDeltaProperTime(             142   static G4double GetDeltaProperTime(
143     const G4ParticleDefinition *aParticle,        143     const G4ParticleDefinition *aParticle,
144     G4double KineticEnergyStart,                  144     G4double KineticEnergyStart,
145     G4double KineticEnergyEnd,                    145     G4double KineticEnergyEnd,
146     const G4Material *aMaterial);                 146     const G4Material *aMaterial);
147                                                   147 
148   static G4double GetPreciseDEDX(                 148   static G4double GetPreciseDEDX(
149     const G4ParticleDefinition *aParticle,        149     const G4ParticleDefinition *aParticle,
150     G4double KineticEnergy,                       150     G4double KineticEnergy,
151     const G4Material *aMaterial);                 151     const G4Material *aMaterial);
152   static G4double GetPreciseRangeFromEnergy(      152   static G4double GetPreciseRangeFromEnergy(
153     const G4ParticleDefinition *aParticle,        153     const G4ParticleDefinition *aParticle,
154     G4double KineticEnergy,                       154     G4double KineticEnergy,
155     const G4Material *aMaterial);                 155     const G4Material *aMaterial);
156   static G4double GetPreciseEnergyFromRange(      156   static G4double GetPreciseEnergyFromRange(
157     const G4ParticleDefinition *aParticle,        157     const G4ParticleDefinition *aParticle,
158     G4double range,                               158     G4double range,
159     const G4Material *aMaterial);                 159     const G4Material *aMaterial);
160                                                   160 
161   // get the DEDX or the range for a given par    161   // get the DEDX or the range for a given particle/energy/materialCutsCouple
162   static G4double GetDEDX(                        162   static G4double GetDEDX(
163     const G4ParticleDefinition *aParticle,        163     const G4ParticleDefinition *aParticle,
164     G4double KineticEnergy,                       164     G4double KineticEnergy,
165     const G4MaterialCutsCouple *couple,           165     const G4MaterialCutsCouple *couple,
166     G4bool check = true);                         166     G4bool check = true);
167   static G4double GetRange(                       167   static G4double GetRange(
168     const G4ParticleDefinition *aParticle,        168     const G4ParticleDefinition *aParticle,
169     G4double KineticEnergy,                       169     G4double KineticEnergy,
170     const G4MaterialCutsCouple *couple,           170     const G4MaterialCutsCouple *couple,
171     G4bool check = true);                         171     G4bool check = true);
172                                                   172 
173   static G4double GetPreciseDEDX(                 173   static G4double GetPreciseDEDX(
174     const G4ParticleDefinition *aParticle,        174     const G4ParticleDefinition *aParticle,
175     G4double KineticEnergy,                       175     G4double KineticEnergy,
176     const G4MaterialCutsCouple *couple);          176     const G4MaterialCutsCouple *couple);
177   static G4double GetPreciseRangeFromEnergy(      177   static G4double GetPreciseRangeFromEnergy(
178     const G4ParticleDefinition *aParticle,        178     const G4ParticleDefinition *aParticle,
179     G4double KineticEnergy,                       179     G4double KineticEnergy,
180     const G4MaterialCutsCouple *couple);          180     const G4MaterialCutsCouple *couple);
181   static G4double GetPreciseEnergyFromRange(      181   static G4double GetPreciseEnergyFromRange(
182     const G4ParticleDefinition *aParticle,        182     const G4ParticleDefinition *aParticle,
183     G4double range,                               183     G4double range,
184     const G4MaterialCutsCouple *couple,           184     const G4MaterialCutsCouple *couple,
185     G4bool check = true);                         185     G4bool check = true);
186                                                   186 
187   // to be called only by energy loss processe    187   // to be called only by energy loss processes
188   static void Register(                           188   static void Register(
189     const G4ParticleDefinition* p,                189     const G4ParticleDefinition* p,
190     const G4PhysicsTable* tDEDX,                  190     const G4PhysicsTable* tDEDX,
191     const G4PhysicsTable* tRange,                 191     const G4PhysicsTable* tRange,
192     const G4PhysicsTable* tInverseRange,          192     const G4PhysicsTable* tInverseRange,
193     const G4PhysicsTable* tLabTime,               193     const G4PhysicsTable* tLabTime,
194     const G4PhysicsTable* tProperTime,            194     const G4PhysicsTable* tProperTime,
195     G4double lowestKineticEnergy,                 195     G4double lowestKineticEnergy,
196     G4double highestKineticEnergy,                196     G4double highestKineticEnergy,
197     G4double massRatio,                           197     G4double massRatio,
198     G4int NumberOfBins);                          198     G4int NumberOfBins);
199                                                   199 
200 public:                                           200 public:
201   typedef const G4ParticleDefinition* K;          201   typedef const G4ParticleDefinition* K;
202                                                   202 
203 private:                                          203 private:
204                                                   204 
205   static void CPRWarning();                       205   static void CPRWarning();
206   static void ParticleHaveNoLoss(const G4Parti    206   static void ParticleHaveNoLoss(const G4ParticleDefinition* aParticle,
207                                  const G4Strin    207                                  const G4String&);
208                                                   208 
209   /*                                              209   /*
210   typedef std::map<K,G4EnergyLossTablesHelper,    210   typedef std::map<K,G4EnergyLossTablesHelper,std::less<K> > helper_map;
211   static G4ThreadLocal helper_map *dict;          211   static G4ThreadLocal helper_map *dict;
212                                                   212 
213   static G4EnergyLossTablesHelper GetTables(co    213   static G4EnergyLossTablesHelper GetTables(const G4ParticleDefinition* p);
214                                                   214 
215   static G4ThreadLocal G4EnergyLossTablesHelpe    215   static G4ThreadLocal G4EnergyLossTablesHelper *t;
216   static G4ThreadLocal G4EnergyLossTablesHelpe    216   static G4ThreadLocal G4EnergyLossTablesHelper *null_loss;
217   static G4ThreadLocal G4ParticleDefinition* l    217   static G4ThreadLocal G4ParticleDefinition* lastParticle ;
218   static G4ThreadLocal G4double QQPositron ;      218   static G4ThreadLocal G4double QQPositron ;
219   static G4ThreadLocal G4double Chargesquare ;    219   static G4ThreadLocal G4double Chargesquare ;
220   static G4ThreadLocal G4int oldIndex ;           220   static G4ThreadLocal G4int oldIndex ;
221   static G4ThreadLocal G4double rmin,rmax,Thig    221   static G4ThreadLocal G4double rmin,rmax,Thigh ;
222   static G4ThreadLocal G4int  let_counter;        222   static G4ThreadLocal G4int  let_counter;
223   static G4ThreadLocal G4int  let_max_num_warn    223   static G4ThreadLocal G4int  let_max_num_warnings;
224   static G4ThreadLocal G4bool first_loss;         224   static G4ThreadLocal G4bool first_loss;
225   */                                              225   */
226   using helper_map = std::map<K, G4EnergyLossT << 226   typedef std::map<K,G4EnergyLossTablesHelper,std::less<K> > helper_map;
227   static helper_map *dict;                        227   static helper_map *dict;
228                                                   228 
229   static G4EnergyLossTablesHelper GetTables(co    229   static G4EnergyLossTablesHelper GetTables(const G4ParticleDefinition* p);
230                                                   230 
231   static G4EnergyLossTablesHelper *t;             231   static G4EnergyLossTablesHelper *t;
232   static G4EnergyLossTablesHelper *null_loss;     232   static G4EnergyLossTablesHelper *null_loss;
233   static G4ParticleDefinition* lastParticle ;     233   static G4ParticleDefinition* lastParticle ;
234   static G4double QQPositron ;                    234   static G4double QQPositron ;
235   static G4double Chargesquare ;                  235   static G4double Chargesquare ;
236   static G4int oldIndex ;                         236   static G4int oldIndex ;
237   static G4double rmin,rmax,Thigh ;               237   static G4double rmin,rmax,Thigh ;
238   static G4int  let_counter;                      238   static G4int  let_counter;
239   static G4int  let_max_num_warnings;             239   static G4int  let_max_num_warnings;
240   static G4bool first_loss;                       240   static G4bool first_loss;
241                                                   241 
242 };                                                242 };
243                                                   243 
244 //....oooOO0OOooo........oooOO0OOooo........oo    244 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
245                                                   245 
246 #endif                                            246 #endif
247                                                   247