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