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