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$ 27 // 28 // 28 // ------------------------------------------- 29 // ------------------------------------------------------------------- 29 // first version created by P.Urban , 06/04/19 30 // first version created by P.Urban , 06/04/1998 30 // modifications + "precise" functions added b 31 // modifications + "precise" functions added by L.Urban , 27/05/98 31 // modifications , TOF functions , 26/10/98, L 32 // modifications , TOF functions , 26/10/98, L.Urban 32 // cache mechanism in order to gain time, 11/0 33 // cache mechanism in order to gain time, 11/02/99, L.Urban 33 // bug fixed , 12/04/99 , L.Urban 34 // bug fixed , 12/04/99 , L.Urban 34 // 10.11.99: moved from RWT hash dictionary to 35 // 10.11.99: moved from RWT hash dictionary to STL map, G.Barrand, M.Maire 35 // 27.09.01 L.Urban , bug fixed (negative ener 36 // 27.09.01 L.Urban , bug fixed (negative energy deposit) 36 // 26.10.01 all static functions moved from .i 37 // 26.10.01 all static functions moved from .icc files (mma) 37 // 15.01.03 Add interfaces required for "cut p 38 // 15.01.03 Add interfaces required for "cut per region" (V.Ivanchenko) 38 // 12.03.03 Add warnings to obsolete interface 39 // 12.03.03 Add warnings to obsolete interfaces (V.Ivanchenko) 39 // 10.04.03 Add call to G4LossTableManager is 40 // 10.04.03 Add call to G4LossTableManager is particle is not registered (V.Ivanchenko) 40 // 41 // 41 // ------------------------------------------- 42 // ------------------------------------------------------------------- 42 43 43 #include "G4EnergyLossTables.hh" 44 #include "G4EnergyLossTables.hh" 44 #include "G4SystemOfUnits.hh" 45 #include "G4SystemOfUnits.hh" 45 #include "G4MaterialCutsCouple.hh" 46 #include "G4MaterialCutsCouple.hh" 46 #include "G4RegionStore.hh" 47 #include "G4RegionStore.hh" 47 #include "G4LossTableManager.hh" 48 #include "G4LossTableManager.hh" 48 49 49 50 50 //....oooOO0OOooo........oooOO0OOooo........oo 51 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 51 52 52 G4EnergyLossTablesHelper *G4EnergyLossTables:: << 53 G4EnergyLossTablesHelper G4EnergyLossTables::t ; 53 G4EnergyLossTablesHelper *G4EnergyLossTables:: << 54 G4EnergyLossTablesHelper G4EnergyLossTables::null_loss ; 54 G4ParticleDefinition* G4EnergyLossTables::last << 55 const G4ParticleDefinition* G4EnergyLossTables::lastParticle = 0; 55 G4double G4EnergyLossTables::QQPositron = 1.0; << 56 G4double G4EnergyLossTables::QQPositron = eplus*eplus ; 56 G4double G4EnergyLossTables::Chargesquare ; 57 G4double G4EnergyLossTables::Chargesquare ; 57 G4int G4EnergyLossTables::oldIndex = -1 ; 58 G4int G4EnergyLossTables::oldIndex = -1 ; 58 G4double G4EnergyLossTables::rmin = 0. ; 59 G4double G4EnergyLossTables::rmin = 0. ; 59 G4double G4EnergyLossTables::rmax = 0. ; 60 G4double G4EnergyLossTables::rmax = 0. ; 60 G4double G4EnergyLossTables::Thigh = 0. ; 61 G4double G4EnergyLossTables::Thigh = 0. ; 61 G4int G4EnergyLossTables::let_counter = 0; 62 G4int G4EnergyLossTables::let_counter = 0; 62 G4int G4EnergyLossTables::let_max_num_warni 63 G4int G4EnergyLossTables::let_max_num_warnings = 100; 63 G4bool G4EnergyLossTables::first_loss = true 64 G4bool G4EnergyLossTables::first_loss = true; 64 65 65 G4EnergyLossTables::helper_map *G4EnergyLossTa << 66 G4EnergyLossTables::helper_map G4EnergyLossTables::dict; 66 67 67 //....oooOO0OOooo........oooOO0OOooo........oo 68 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 68 69 69 G4EnergyLossTablesHelper::G4EnergyLossTablesHe 70 G4EnergyLossTablesHelper::G4EnergyLossTablesHelper( 70 const G4PhysicsTable* aDEDXTable, 71 const G4PhysicsTable* aDEDXTable, 71 const G4PhysicsTable* aRangeTable, 72 const G4PhysicsTable* aRangeTable, 72 const G4PhysicsTable* anInverseRangeTable, 73 const G4PhysicsTable* anInverseRangeTable, 73 const G4PhysicsTable* aLabTimeTable, 74 const G4PhysicsTable* aLabTimeTable, 74 const G4PhysicsTable* aProperTimeTable, 75 const G4PhysicsTable* aProperTimeTable, 75 G4double aLowestKineticEnergy, 76 G4double aLowestKineticEnergy, 76 G4double aHighestKineticEnergy, 77 G4double aHighestKineticEnergy, 77 G4double aMassRatio, 78 G4double aMassRatio, 78 G4int aNumberOfBins) 79 G4int aNumberOfBins) 79 : 80 : 80 theDEDXTable(aDEDXTable), theRangeTable(aRan 81 theDEDXTable(aDEDXTable), theRangeTable(aRangeTable), 81 theInverseRangeTable(anInverseRangeTable), 82 theInverseRangeTable(anInverseRangeTable), 82 theLabTimeTable(aLabTimeTable), 83 theLabTimeTable(aLabTimeTable), 83 theProperTimeTable(aProperTimeTable), 84 theProperTimeTable(aProperTimeTable), 84 theLowestKineticEnergy(aLowestKineticEnergy) 85 theLowestKineticEnergy(aLowestKineticEnergy), 85 theHighestKineticEnergy(aHighestKineticEnerg 86 theHighestKineticEnergy(aHighestKineticEnergy), 86 theMassRatio(aMassRatio), 87 theMassRatio(aMassRatio), 87 theNumberOfBins(aNumberOfBins) 88 theNumberOfBins(aNumberOfBins) 88 { } 89 { } 89 90 90 //....oooOO0OOooo........oooOO0OOooo........oo 91 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 91 92 92 G4EnergyLossTablesHelper::G4EnergyLossTablesHe 93 G4EnergyLossTablesHelper::G4EnergyLossTablesHelper() 93 { 94 { 94 theLowestKineticEnergy = 0.0; 95 theLowestKineticEnergy = 0.0; 95 theHighestKineticEnergy= 0.0; 96 theHighestKineticEnergy= 0.0; 96 theMassRatio = 0.0; 97 theMassRatio = 0.0; 97 theNumberOfBins = 0; 98 theNumberOfBins = 0; 98 theDEDXTable = theRangeTable = theInverseRan << 99 = theProperTimeTable = nullptr; << 100 } 99 } 101 100 102 //....oooOO0OOooo........oooOO0OOooo........oo 101 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 103 102 104 void G4EnergyLossTables::Register( 103 void G4EnergyLossTables::Register( 105 const G4ParticleDefinition* p, 104 const G4ParticleDefinition* p, 106 const G4PhysicsTable* tDEDX, 105 const G4PhysicsTable* tDEDX, 107 const G4PhysicsTable* tRange, 106 const G4PhysicsTable* tRange, 108 const G4PhysicsTable* tInverseRange, 107 const G4PhysicsTable* tInverseRange, 109 const G4PhysicsTable* tLabTime, 108 const G4PhysicsTable* tLabTime, 110 const G4PhysicsTable* tProperTime, 109 const G4PhysicsTable* tProperTime, 111 G4double lowestKineticEnergy, 110 G4double lowestKineticEnergy, 112 G4double highestKineticEnergy, 111 G4double highestKineticEnergy, 113 G4double massRatio, 112 G4double massRatio, 114 G4int NumberOfBins) 113 G4int NumberOfBins) 115 { 114 { 116 if (!dict) dict = new G4EnergyLossTables::he << 115 dict[p]= G4EnergyLossTablesHelper(tDEDX, tRange,tInverseRange, 117 if (!null_loss) null_loss = new G4EnergyLoss << 118 if (!t) t = new G4EnergyLossTablesHelper; << 119 << 120 (*dict)[p]= G4EnergyLossTablesHelper(tDEDX, << 121 tLabTime,tProperTime,lowes 116 tLabTime,tProperTime,lowestKineticEnergy, 122 highestKineticEnergy, massRatio,Number 117 highestKineticEnergy, massRatio,NumberOfBins); 123 118 124 *t = GetTables(p) ; // important for cach << 119 t = GetTables(p) ; // important for cache !!!!! 125 lastParticle = (G4ParticleDefinition*) p ; << 120 lastParticle = p ; 126 Chargesquare = (p->GetPDGCharge())*(p->GetPD 121 Chargesquare = (p->GetPDGCharge())*(p->GetPDGCharge())/ 127 QQPositron ; 122 QQPositron ; 128 if (first_loss ) { 123 if (first_loss ) { 129 *null_loss = G4EnergyLossTablesHelper( << 124 null_loss = G4EnergyLossTablesHelper(0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0); 130 nullptr, nullptr, nullptr, nu << 131 first_loss = false; 125 first_loss = false; 132 } 126 } 133 } 127 } 134 128 135 //....oooOO0OOooo........oooOO0OOooo........oo 129 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 136 130 137 const G4PhysicsTable* G4EnergyLossTables::GetD 131 const G4PhysicsTable* G4EnergyLossTables::GetDEDXTable( 138 const G4ParticleDefinition* p) 132 const G4ParticleDefinition* p) 139 { 133 { 140 if (!dict) dict = new G4EnergyLossTables::he << 141 helper_map::iterator it; 134 helper_map::iterator it; 142 if((it=dict->find(p))==dict->end()) return n << 135 if((it=dict.find(p))==dict.end()) return 0; 143 return (*it).second.theDEDXTable; 136 return (*it).second.theDEDXTable; 144 } 137 } 145 138 146 //....oooOO0OOooo........oooOO0OOooo........oo 139 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 147 140 148 const G4PhysicsTable* G4EnergyLossTables::GetR 141 const G4PhysicsTable* G4EnergyLossTables::GetRangeTable( 149 const G4ParticleDefinition* p) 142 const G4ParticleDefinition* p) 150 { 143 { 151 if (!dict) dict = new G4EnergyLossTables::he << 152 helper_map::iterator it; 144 helper_map::iterator it; 153 if((it=dict->find(p))==dict->end()) return n << 145 if((it=dict.find(p))==dict.end()) return 0; 154 return (*it).second.theRangeTable; 146 return (*it).second.theRangeTable; 155 } 147 } 156 148 157 //....oooOO0OOooo........oooOO0OOooo........oo 149 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 158 150 159 const G4PhysicsTable* G4EnergyLossTables::GetI 151 const G4PhysicsTable* G4EnergyLossTables::GetInverseRangeTable( 160 const G4ParticleDefinition* p) 152 const G4ParticleDefinition* p) 161 { 153 { 162 if (!dict) dict = new G4EnergyLossTables::he << 163 helper_map::iterator it; 154 helper_map::iterator it; 164 if((it=dict->find(p))==dict->end()) return n << 155 if((it=dict.find(p))==dict.end()) return 0; 165 return (*it).second.theInverseRangeTable; 156 return (*it).second.theInverseRangeTable; 166 } 157 } 167 158 168 //....oooOO0OOooo........oooOO0OOooo........oo 159 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 169 160 170 const G4PhysicsTable* G4EnergyLossTables::GetL 161 const G4PhysicsTable* G4EnergyLossTables::GetLabTimeTable( 171 const G4ParticleDefinition* p) 162 const G4ParticleDefinition* p) 172 { 163 { 173 if (!dict) dict = new G4EnergyLossTables::he << 174 helper_map::iterator it; 164 helper_map::iterator it; 175 if((it=dict->find(p))==dict->end()) return n << 165 if((it=dict.find(p))==dict.end()) return 0; 176 return (*it).second.theLabTimeTable; 166 return (*it).second.theLabTimeTable; 177 } 167 } 178 168 179 //....oooOO0OOooo........oooOO0OOooo........oo 169 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 180 170 181 const G4PhysicsTable* G4EnergyLossTables::GetP 171 const G4PhysicsTable* G4EnergyLossTables::GetProperTimeTable( 182 const G4ParticleDefinition* p) 172 const G4ParticleDefinition* p) 183 { 173 { 184 if (!dict) dict = new G4EnergyLossTables::he << 185 helper_map::iterator it; 174 helper_map::iterator it; 186 if((it=dict->find(p))==dict->end()) return n << 175 if((it=dict.find(p))==dict.end()) return 0; 187 return (*it).second.theProperTimeTable; 176 return (*it).second.theProperTimeTable; 188 } 177 } 189 178 190 //....oooOO0OOooo........oooOO0OOooo........oo 179 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 191 180 192 G4EnergyLossTablesHelper G4EnergyLossTables::G 181 G4EnergyLossTablesHelper G4EnergyLossTables::GetTables( 193 const G4ParticleDefinition* p) 182 const G4ParticleDefinition* p) 194 { 183 { 195 if (!dict) dict = new G4EnergyLossTables::he << 196 if (!null_loss) null_loss = new G4EnergyLoss << 197 << 198 helper_map::iterator it; 184 helper_map::iterator it; 199 if ((it=dict->find(p))==dict->end()) { << 185 if ((it=dict.find(p))==dict.end()) { 200 return *null_loss; << 186 // G4cout << "Table is not found out for " << p->GetParticleName() << G4endl; >> 187 // G4Exception("G4EnergyLossTables::GetTables: table not found!"); >> 188 // exit(1); >> 189 return null_loss; 201 } 190 } 202 return (*it).second; 191 return (*it).second; 203 } 192 } 204 193 205 //....oooOO0OOooo........oooOO0OOooo........oo 194 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 206 195 207 G4double G4EnergyLossTables::GetDEDX( 196 G4double G4EnergyLossTables::GetDEDX( 208 const G4ParticleDefinition *aParticle, 197 const G4ParticleDefinition *aParticle, 209 G4double KineticEnergy, 198 G4double KineticEnergy, 210 const G4Material *aMaterial) 199 const G4Material *aMaterial) 211 { 200 { 212 if (!t) t = new G4EnergyLossTablesHelper; << 213 << 214 CPRWarning(); 201 CPRWarning(); 215 if(aParticle != (const G4ParticleDefinition* << 202 if(aParticle != lastParticle) 216 { 203 { 217 *t= GetTables(aParticle); << 204 t= GetTables(aParticle); 218 lastParticle = (G4ParticleDefinition*) aPa << 205 lastParticle = aParticle ; 219 Chargesquare = (aParticle->GetPDGCharge()) 206 Chargesquare = (aParticle->GetPDGCharge())* 220 (aParticle->GetPDGCharge()) 207 (aParticle->GetPDGCharge())/ 221 QQPositron ; 208 QQPositron ; 222 oldIndex = -1 ; 209 oldIndex = -1 ; 223 } 210 } 224 const G4PhysicsTable* dEdxTable= t->theDEDX << 211 const G4PhysicsTable* dEdxTable= t.theDEDXTable; 225 if (!dEdxTable) { 212 if (!dEdxTable) { 226 ParticleHaveNoLoss(aParticle,"dEdx"); 213 ParticleHaveNoLoss(aParticle,"dEdx"); 227 return 0.0; 214 return 0.0; 228 } 215 } 229 216 230 G4int materialIndex = (G4int)aMaterial->GetI << 217 G4int materialIndex = aMaterial->GetIndex(); 231 G4double scaledKineticEnergy = KineticEnergy << 218 G4double scaledKineticEnergy = KineticEnergy*t.theMassRatio; 232 G4double dEdx; 219 G4double dEdx; 233 G4bool isOut; 220 G4bool isOut; 234 221 235 if (scaledKineticEnergy<t->theLowestKineticE << 222 if (scaledKineticEnergy<t.theLowestKineticEnergy) { 236 223 237 dEdx =(*dEdxTable)(materialIndex)->GetVal 224 dEdx =(*dEdxTable)(materialIndex)->GetValue( 238 t->theLowestKineticEnergy,isOut) << 225 t.theLowestKineticEnergy,isOut) 239 *std::sqrt(scaledKineticEnergy/t->t << 226 *std::sqrt(scaledKineticEnergy/t.theLowestKineticEnergy); 240 227 241 } else if (scaledKineticEnergy>t->theHighest << 228 } else if (scaledKineticEnergy>t.theHighestKineticEnergy) { 242 229 243 dEdx = (*dEdxTable)(materialIndex)->GetVa 230 dEdx = (*dEdxTable)(materialIndex)->GetValue( 244 t->theHighestKineticEnergy,isOut); << 231 t.theHighestKineticEnergy,isOut); 245 232 246 } else { 233 } else { 247 234 248 dEdx = (*dEdxTable)(materialIndex)->GetVal 235 dEdx = (*dEdxTable)(materialIndex)->GetValue( 249 scaledKineticEnergy,isOut); 236 scaledKineticEnergy,isOut); 250 237 251 } 238 } 252 239 253 return dEdx*Chargesquare; 240 return dEdx*Chargesquare; 254 } 241 } 255 242 256 //....oooOO0OOooo........oooOO0OOooo........oo 243 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 257 244 258 G4double G4EnergyLossTables::GetLabTime( 245 G4double G4EnergyLossTables::GetLabTime( 259 const G4ParticleDefinition *aParticle, 246 const G4ParticleDefinition *aParticle, 260 G4double KineticEnergy, 247 G4double KineticEnergy, 261 const G4Material *aMaterial) 248 const G4Material *aMaterial) 262 { 249 { 263 if (!t) t = new G4EnergyLossTablesHelper; << 264 << 265 CPRWarning(); 250 CPRWarning(); 266 if(aParticle != (const G4ParticleDefinition* << 251 if(aParticle != lastParticle) 267 { 252 { 268 *t= GetTables(aParticle); << 253 t= GetTables(aParticle); 269 lastParticle = (G4ParticleDefinition*) aPa << 254 lastParticle = aParticle ; 270 oldIndex = -1 ; 255 oldIndex = -1 ; 271 } 256 } 272 const G4PhysicsTable* labtimeTable= t->theLa << 257 const G4PhysicsTable* labtimeTable= t.theLabTimeTable; 273 if (!labtimeTable) { 258 if (!labtimeTable) { 274 ParticleHaveNoLoss(aParticle,"LabTime"); 259 ParticleHaveNoLoss(aParticle,"LabTime"); 275 return 0.0; 260 return 0.0; 276 } 261 } 277 262 278 const G4double parlowen=0.4 , ppar=0.5-parlo 263 const G4double parlowen=0.4 , ppar=0.5-parlowen ; 279 G4int materialIndex = (G4int)aMaterial->GetI << 264 G4int materialIndex = aMaterial->GetIndex(); 280 G4double scaledKineticEnergy = KineticEnergy << 265 G4double scaledKineticEnergy = KineticEnergy*t.theMassRatio; 281 G4double time; 266 G4double time; 282 G4bool isOut; 267 G4bool isOut; 283 268 284 if (scaledKineticEnergy<t->theLowestKineticE << 269 if (scaledKineticEnergy<t.theLowestKineticEnergy) { 285 270 286 time = std::exp(ppar*std::log(scaledKinet << 271 time = std::exp(ppar*std::log(scaledKineticEnergy/t.theLowestKineticEnergy))* 287 (*labtimeTable)(materialIndex)->Ge 272 (*labtimeTable)(materialIndex)->GetValue( 288 t->theLowestKineticEnergy,isOut) << 273 t.theLowestKineticEnergy,isOut); 289 274 290 275 291 } else if (scaledKineticEnergy>t->theHighest << 276 } else if (scaledKineticEnergy>t.theHighestKineticEnergy) { 292 277 293 time = (*labtimeTable)(materialIndex)->Ge 278 time = (*labtimeTable)(materialIndex)->GetValue( 294 t->theHighestKineticEnergy,isOut << 279 t.theHighestKineticEnergy,isOut); 295 280 296 } else { 281 } else { 297 282 298 time = (*labtimeTable)(materialIndex)->Get 283 time = (*labtimeTable)(materialIndex)->GetValue( 299 scaledKineticEnergy,isOut); 284 scaledKineticEnergy,isOut); 300 285 301 } 286 } 302 287 303 return time/t->theMassRatio ; << 288 return time/t.theMassRatio ; 304 } 289 } 305 290 306 //....oooOO0OOooo........oooOO0OOooo........oo 291 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 307 292 308 G4double G4EnergyLossTables::GetDeltaLabTime( 293 G4double G4EnergyLossTables::GetDeltaLabTime( 309 const G4ParticleDefinition *aParticle, 294 const G4ParticleDefinition *aParticle, 310 G4double KineticEnergyStart, 295 G4double KineticEnergyStart, 311 G4double KineticEnergyEnd, 296 G4double KineticEnergyEnd, 312 const G4Material *aMaterial) 297 const G4Material *aMaterial) 313 { 298 { 314 if (!t) t = new G4EnergyLossTablesHelper; << 315 << 316 CPRWarning(); 299 CPRWarning(); 317 if(aParticle != (const G4ParticleDefinition* << 300 if(aParticle != lastParticle) 318 { 301 { 319 *t= GetTables(aParticle); << 302 t= GetTables(aParticle); 320 lastParticle = (G4ParticleDefinition*) aPa << 303 lastParticle = aParticle ; 321 oldIndex = -1 ; 304 oldIndex = -1 ; 322 } 305 } 323 const G4PhysicsTable* labtimeTable= t->theLa << 306 const G4PhysicsTable* labtimeTable= t.theLabTimeTable; 324 if (!labtimeTable) { 307 if (!labtimeTable) { 325 ParticleHaveNoLoss(aParticle,"LabTime"); 308 ParticleHaveNoLoss(aParticle,"LabTime"); 326 return 0.0; 309 return 0.0; 327 } 310 } 328 311 329 const G4double parlowen=0.4 , ppar=0.5-parlo 312 const G4double parlowen=0.4 , ppar=0.5-parlowen ; 330 const G4double dToverT = 0.05 , facT = 1. -d 313 const G4double dToverT = 0.05 , facT = 1. -dToverT ; 331 G4double timestart,timeend,deltatime,dTT; 314 G4double timestart,timeend,deltatime,dTT; 332 G4bool isOut; 315 G4bool isOut; 333 316 334 G4int materialIndex = (G4int)aMaterial->GetI << 317 G4int materialIndex = aMaterial->GetIndex(); 335 G4double scaledKineticEnergy = KineticEnergy << 318 G4double scaledKineticEnergy = KineticEnergyStart*t.theMassRatio; 336 319 337 if (scaledKineticEnergy<t->theLowestKineticE << 320 if (scaledKineticEnergy<t.theLowestKineticEnergy) { 338 321 339 timestart = std::exp(ppar*std::log(scaled << 322 timestart = std::exp(ppar*std::log(scaledKineticEnergy/t.theLowestKineticEnergy))* 340 (*labtimeTable)(materialIndex) 323 (*labtimeTable)(materialIndex)->GetValue( 341 t->theLowestKineticEnergy,isOu << 324 t.theLowestKineticEnergy,isOut); 342 325 343 326 344 } else if (scaledKineticEnergy>t->theHighest << 327 } else if (scaledKineticEnergy>t.theHighestKineticEnergy) { 345 328 346 timestart = (*labtimeTable)(materialIndex 329 timestart = (*labtimeTable)(materialIndex)->GetValue( 347 t->theHighestKineticEnergy,isO << 330 t.theHighestKineticEnergy,isOut); 348 331 349 } else { 332 } else { 350 333 351 timestart = (*labtimeTable)(materialIndex) 334 timestart = (*labtimeTable)(materialIndex)->GetValue( 352 scaledKineticEnergy,isOut); 335 scaledKineticEnergy,isOut); 353 336 354 } 337 } 355 338 356 dTT = (KineticEnergyStart - KineticEnergyEnd 339 dTT = (KineticEnergyStart - KineticEnergyEnd)/KineticEnergyStart ; 357 340 358 if( dTT < dToverT ) 341 if( dTT < dToverT ) 359 scaledKineticEnergy = facT*KineticEnergySt << 342 scaledKineticEnergy = facT*KineticEnergyStart*t.theMassRatio; 360 else 343 else 361 scaledKineticEnergy = KineticEnergyEnd*t-> << 344 scaledKineticEnergy = KineticEnergyEnd*t.theMassRatio; 362 345 363 if (scaledKineticEnergy<t->theLowestKineticE << 346 if (scaledKineticEnergy<t.theLowestKineticEnergy) { 364 347 365 timeend = std::exp(ppar*std::log(scaledKi << 348 timeend = std::exp(ppar*std::log(scaledKineticEnergy/t.theLowestKineticEnergy))* 366 (*labtimeTable)(materialIndex) 349 (*labtimeTable)(materialIndex)->GetValue( 367 t->theLowestKineticEnergy,isOu << 350 t.theLowestKineticEnergy,isOut); 368 351 369 352 370 } else if (scaledKineticEnergy>t->theHighest << 353 } else if (scaledKineticEnergy>t.theHighestKineticEnergy) { 371 354 372 timeend = (*labtimeTable)(materialIndex)- 355 timeend = (*labtimeTable)(materialIndex)->GetValue( 373 t->theHighestKineticEnergy,isO << 356 t.theHighestKineticEnergy,isOut); 374 357 375 } else { 358 } else { 376 359 377 timeend = (*labtimeTable)(materialIndex)-> 360 timeend = (*labtimeTable)(materialIndex)->GetValue( 378 scaledKineticEnergy,isOut); 361 scaledKineticEnergy,isOut); 379 362 380 } 363 } 381 364 382 deltatime = timestart - timeend ; 365 deltatime = timestart - timeend ; 383 366 384 if( dTT < dToverT ) 367 if( dTT < dToverT ) 385 deltatime *= dTT/dToverT; 368 deltatime *= dTT/dToverT; 386 369 387 return deltatime/t->theMassRatio ; << 370 return deltatime/t.theMassRatio ; 388 } 371 } 389 372 390 //....oooOO0OOooo........oooOO0OOooo........oo 373 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 391 374 392 G4double G4EnergyLossTables::GetProperTime( 375 G4double G4EnergyLossTables::GetProperTime( 393 const G4ParticleDefinition *aParticle, 376 const G4ParticleDefinition *aParticle, 394 G4double KineticEnergy, 377 G4double KineticEnergy, 395 const G4Material *aMaterial) 378 const G4Material *aMaterial) 396 { 379 { 397 if (!t) t = new G4EnergyLossTablesHelper; << 398 << 399 CPRWarning(); 380 CPRWarning(); 400 if(aParticle != (const G4ParticleDefinition* << 381 if(aParticle != lastParticle) 401 { 382 { 402 *t= GetTables(aParticle); << 383 t= GetTables(aParticle); 403 lastParticle = (G4ParticleDefinition*) aPa << 384 lastParticle = aParticle ; 404 oldIndex = -1 ; 385 oldIndex = -1 ; 405 } 386 } 406 const G4PhysicsTable* propertimeTable= t->th << 387 const G4PhysicsTable* propertimeTable= t.theProperTimeTable; 407 if (!propertimeTable) { 388 if (!propertimeTable) { 408 ParticleHaveNoLoss(aParticle,"ProperTime") 389 ParticleHaveNoLoss(aParticle,"ProperTime"); 409 return 0.0; 390 return 0.0; 410 } 391 } 411 392 412 const G4double parlowen=0.4 , ppar=0.5-parlo 393 const G4double parlowen=0.4 , ppar=0.5-parlowen ; 413 G4int materialIndex = (G4int)aMaterial->GetI << 394 G4int materialIndex = aMaterial->GetIndex(); 414 G4double scaledKineticEnergy = KineticEnergy << 395 G4double scaledKineticEnergy = KineticEnergy*t.theMassRatio; 415 G4double time; 396 G4double time; 416 G4bool isOut; 397 G4bool isOut; 417 398 418 if (scaledKineticEnergy<t->theLowestKineticE << 399 if (scaledKineticEnergy<t.theLowestKineticEnergy) { 419 400 420 time = std::exp(ppar*std::log(scaledKinet << 401 time = std::exp(ppar*std::log(scaledKineticEnergy/t.theLowestKineticEnergy))* 421 (*propertimeTable)(materialIndex)- 402 (*propertimeTable)(materialIndex)->GetValue( 422 t->theLowestKineticEnergy,isOut) << 403 t.theLowestKineticEnergy,isOut); 423 404 424 405 425 } else if (scaledKineticEnergy>t->theHighest << 406 } else if (scaledKineticEnergy>t.theHighestKineticEnergy) { 426 407 427 time = (*propertimeTable)(materialIndex)- 408 time = (*propertimeTable)(materialIndex)->GetValue( 428 t->theHighestKineticEnergy,isOut << 409 t.theHighestKineticEnergy,isOut); 429 410 430 } else { 411 } else { 431 412 432 time = (*propertimeTable)(materialIndex)-> 413 time = (*propertimeTable)(materialIndex)->GetValue( 433 scaledKineticEnergy,isOut); 414 scaledKineticEnergy,isOut); 434 415 435 } 416 } 436 417 437 return time/t->theMassRatio ; << 418 return time/t.theMassRatio ; 438 } 419 } 439 420 440 //....oooOO0OOooo........oooOO0OOooo........oo 421 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 441 422 442 G4double G4EnergyLossTables::GetDeltaProperTim 423 G4double G4EnergyLossTables::GetDeltaProperTime( 443 const G4ParticleDefinition *aParticle, 424 const G4ParticleDefinition *aParticle, 444 G4double KineticEnergyStart, 425 G4double KineticEnergyStart, 445 G4double KineticEnergyEnd, 426 G4double KineticEnergyEnd, 446 const G4Material *aMaterial) 427 const G4Material *aMaterial) 447 { 428 { 448 if (!t) t = new G4EnergyLossTablesHelper; << 449 << 450 CPRWarning(); 429 CPRWarning(); 451 if(aParticle != (const G4ParticleDefinition* << 430 if(aParticle != lastParticle) 452 { 431 { 453 *t= GetTables(aParticle); << 432 t= GetTables(aParticle); 454 lastParticle = (G4ParticleDefinition*) aPa << 433 lastParticle = aParticle ; 455 oldIndex = -1 ; 434 oldIndex = -1 ; 456 } 435 } 457 const G4PhysicsTable* propertimeTable= t->th << 436 const G4PhysicsTable* propertimeTable= t.theProperTimeTable; 458 if (!propertimeTable) { 437 if (!propertimeTable) { 459 ParticleHaveNoLoss(aParticle,"ProperTime") 438 ParticleHaveNoLoss(aParticle,"ProperTime"); 460 return 0.0; 439 return 0.0; 461 } 440 } 462 441 463 const G4double parlowen=0.4 , ppar=0.5-parlo 442 const G4double parlowen=0.4 , ppar=0.5-parlowen ; 464 const G4double dToverT = 0.05 , facT = 1. -d 443 const G4double dToverT = 0.05 , facT = 1. -dToverT ; 465 G4double timestart,timeend,deltatime,dTT; 444 G4double timestart,timeend,deltatime,dTT; 466 G4bool isOut; 445 G4bool isOut; 467 446 468 G4int materialIndex = (G4int)aMaterial->GetI << 447 G4int materialIndex = aMaterial->GetIndex(); 469 G4double scaledKineticEnergy = KineticEnergy << 448 G4double scaledKineticEnergy = KineticEnergyStart*t.theMassRatio; 470 449 471 if (scaledKineticEnergy<t->theLowestKineticE << 450 if (scaledKineticEnergy<t.theLowestKineticEnergy) { 472 451 473 timestart = std::exp(ppar*std::log(scaled << 452 timestart = std::exp(ppar*std::log(scaledKineticEnergy/t.theLowestKineticEnergy))* 474 (*propertimeTable)(materialInd 453 (*propertimeTable)(materialIndex)->GetValue( 475 t->theLowestKineticEnergy,isOu << 454 t.theLowestKineticEnergy,isOut); 476 455 477 456 478 } else if (scaledKineticEnergy>t->theHighest << 457 } else if (scaledKineticEnergy>t.theHighestKineticEnergy) { 479 458 480 timestart = (*propertimeTable)(materialIn 459 timestart = (*propertimeTable)(materialIndex)->GetValue( 481 t->theHighestKineticEnergy,isO << 460 t.theHighestKineticEnergy,isOut); 482 461 483 } else { 462 } else { 484 463 485 timestart = (*propertimeTable)(materialInd 464 timestart = (*propertimeTable)(materialIndex)->GetValue( 486 scaledKineticEnergy,isOut); 465 scaledKineticEnergy,isOut); 487 466 488 } 467 } 489 468 490 dTT = (KineticEnergyStart - KineticEnergyEnd 469 dTT = (KineticEnergyStart - KineticEnergyEnd)/KineticEnergyStart ; 491 470 492 if( dTT < dToverT ) 471 if( dTT < dToverT ) 493 scaledKineticEnergy = facT*KineticEnergySt << 472 scaledKineticEnergy = facT*KineticEnergyStart*t.theMassRatio; 494 else 473 else 495 scaledKineticEnergy = KineticEnergyEnd*t-> << 474 scaledKineticEnergy = KineticEnergyEnd*t.theMassRatio; 496 475 497 if (scaledKineticEnergy<t->theLowestKineticE << 476 if (scaledKineticEnergy<t.theLowestKineticEnergy) { 498 477 499 timeend = std::exp(ppar*std::log(scaledKi << 478 timeend = std::exp(ppar*std::log(scaledKineticEnergy/t.theLowestKineticEnergy))* 500 (*propertimeTable)(materialInd 479 (*propertimeTable)(materialIndex)->GetValue( 501 t->theLowestKineticEnergy,isOu << 480 t.theLowestKineticEnergy,isOut); 502 481 503 482 504 } else if (scaledKineticEnergy>t->theHighest << 483 } else if (scaledKineticEnergy>t.theHighestKineticEnergy) { 505 484 506 timeend = (*propertimeTable)(materialInde 485 timeend = (*propertimeTable)(materialIndex)->GetValue( 507 t->theHighestKineticEnergy,isO << 486 t.theHighestKineticEnergy,isOut); 508 487 509 } else { 488 } else { 510 489 511 timeend = (*propertimeTable)(materialIndex 490 timeend = (*propertimeTable)(materialIndex)->GetValue( 512 scaledKineticEnergy,isOut); 491 scaledKineticEnergy,isOut); 513 492 514 } 493 } 515 494 516 deltatime = timestart - timeend ; 495 deltatime = timestart - timeend ; 517 496 518 if( dTT < dToverT ) 497 if( dTT < dToverT ) 519 deltatime *= dTT/dToverT ; 498 deltatime *= dTT/dToverT ; 520 499 521 return deltatime/t->theMassRatio ; << 500 return deltatime/t.theMassRatio ; 522 } 501 } 523 502 524 //....oooOO0OOooo........oooOO0OOooo........oo 503 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 525 504 526 G4double G4EnergyLossTables::GetRange( 505 G4double G4EnergyLossTables::GetRange( 527 const G4ParticleDefinition *aParticle, 506 const G4ParticleDefinition *aParticle, 528 G4double KineticEnergy, 507 G4double KineticEnergy, 529 const G4Material *aMaterial) 508 const G4Material *aMaterial) 530 { 509 { 531 if (!t) t = new G4EnergyLossTablesHelper; << 532 << 533 CPRWarning(); 510 CPRWarning(); 534 if(aParticle != (const G4ParticleDefinition* << 511 if(aParticle != lastParticle) 535 { 512 { 536 *t= GetTables(aParticle); << 513 t= GetTables(aParticle); 537 lastParticle = (G4ParticleDefinition*) aPa << 514 lastParticle = aParticle ; 538 Chargesquare = (aParticle->GetPDGCharge()) 515 Chargesquare = (aParticle->GetPDGCharge())* 539 (aParticle->GetPDGCharge()) 516 (aParticle->GetPDGCharge())/ 540 QQPositron ; 517 QQPositron ; 541 oldIndex = -1 ; 518 oldIndex = -1 ; 542 } 519 } 543 const G4PhysicsTable* rangeTable= t->theRang << 520 const G4PhysicsTable* rangeTable= t.theRangeTable; 544 const G4PhysicsTable* dEdxTable= t->theDEDX << 521 const G4PhysicsTable* dEdxTable= t.theDEDXTable; 545 if (!rangeTable) { 522 if (!rangeTable) { 546 ParticleHaveNoLoss(aParticle,"Range"); 523 ParticleHaveNoLoss(aParticle,"Range"); 547 return 0.0; 524 return 0.0; 548 } 525 } 549 526 550 G4int materialIndex = (G4int)aMaterial->GetI << 527 G4int materialIndex = aMaterial->GetIndex(); 551 G4double scaledKineticEnergy = KineticEnergy << 528 G4double scaledKineticEnergy = KineticEnergy*t.theMassRatio; 552 G4double Range; 529 G4double Range; 553 G4bool isOut; 530 G4bool isOut; 554 531 555 if (scaledKineticEnergy<t->theLowestKineticE << 532 if (scaledKineticEnergy<t.theLowestKineticEnergy) { 556 533 557 Range = std::sqrt(scaledKineticEnergy/t->t << 534 Range = std::sqrt(scaledKineticEnergy/t.theLowestKineticEnergy)* 558 (*rangeTable)(materialIndex)->GetV 535 (*rangeTable)(materialIndex)->GetValue( 559 t->theLowestKineticEnergy,isOut) << 536 t.theLowestKineticEnergy,isOut); 560 537 561 } else if (scaledKineticEnergy>t->theHighest << 538 } else if (scaledKineticEnergy>t.theHighestKineticEnergy) { 562 539 563 Range = (*rangeTable)(materialIndex)->GetV 540 Range = (*rangeTable)(materialIndex)->GetValue( 564 t->theHighestKineticEnergy,isOut)+ << 541 t.theHighestKineticEnergy,isOut)+ 565 (scaledKineticEnergy-t->theHighest << 542 (scaledKineticEnergy-t.theHighestKineticEnergy)/ 566 (*dEdxTable)(materialIndex)->GetVa 543 (*dEdxTable)(materialIndex)->GetValue( 567 t->theHighestKineticEnergy,isOut << 544 t.theHighestKineticEnergy,isOut); 568 545 569 } else { 546 } else { 570 547 571 Range = (*rangeTable)(materialIndex)->GetV 548 Range = (*rangeTable)(materialIndex)->GetValue( 572 scaledKineticEnergy,isOut); 549 scaledKineticEnergy,isOut); 573 550 574 } 551 } 575 552 576 return Range/(Chargesquare*t->theMassRatio); << 553 return Range/(Chargesquare*t.theMassRatio); 577 } 554 } 578 555 579 //....oooOO0OOooo........oooOO0OOooo........oo 556 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 580 557 581 G4double G4EnergyLossTables::GetPreciseEnergyF 558 G4double G4EnergyLossTables::GetPreciseEnergyFromRange( 582 const G4P 559 const G4ParticleDefinition *aParticle, 583 G4d 560 G4double range, 584 const G4M 561 const G4Material *aMaterial) 585 // it returns the value of the kinetic energy 562 // it returns the value of the kinetic energy for a given range 586 { 563 { 587 if (!t) t = new G4EnergyLossTablesHelper; << 588 << 589 CPRWarning(); 564 CPRWarning(); 590 if( aParticle != (const G4ParticleDefinition << 565 if( aParticle != lastParticle) 591 { 566 { 592 *t= GetTables(aParticle); << 567 t= GetTables(aParticle); 593 lastParticle = (G4ParticleDefinition*) aPa << 568 lastParticle = aParticle; 594 Chargesquare = (aParticle->GetPDGCharge()) 569 Chargesquare = (aParticle->GetPDGCharge())* 595 (aParticle->GetPDGCharge()) 570 (aParticle->GetPDGCharge())/ 596 QQPositron ; 571 QQPositron ; 597 oldIndex = -1 ; 572 oldIndex = -1 ; 598 } 573 } 599 const G4PhysicsTable* dEdxTable= t->theDEDX << 574 const G4PhysicsTable* dEdxTable= t.theDEDXTable; 600 const G4PhysicsTable* inverseRangeTable= t- << 575 const G4PhysicsTable* inverseRangeTable= t.theInverseRangeTable; 601 if (!inverseRangeTable) { 576 if (!inverseRangeTable) { 602 ParticleHaveNoLoss(aParticle,"InverseRange 577 ParticleHaveNoLoss(aParticle,"InverseRange"); 603 return 0.0; 578 return 0.0; 604 } 579 } 605 580 606 G4double scaledrange,scaledKineticEnergy ; 581 G4double scaledrange,scaledKineticEnergy ; 607 G4bool isOut ; 582 G4bool isOut ; 608 583 609 G4int materialIndex = (G4int)aMaterial->GetI << 584 G4int materialIndex = aMaterial->GetIndex() ; 610 585 611 if(materialIndex != oldIndex) 586 if(materialIndex != oldIndex) 612 { 587 { 613 oldIndex = materialIndex ; 588 oldIndex = materialIndex ; 614 rmin = (*inverseRangeTable)(materialIndex) 589 rmin = (*inverseRangeTable)(materialIndex)-> 615 GetLowEdgeEnergy 590 GetLowEdgeEnergy(0) ; 616 rmax = (*inverseRangeTable)(materialIndex) 591 rmax = (*inverseRangeTable)(materialIndex)-> 617 GetLowEdgeEnergy(t->theNumb << 592 GetLowEdgeEnergy(t.theNumberOfBins-2) ; 618 Thigh = (*inverseRangeTable)(materialIndex 593 Thigh = (*inverseRangeTable)(materialIndex)-> 619 GetValue(rmax,is 594 GetValue(rmax,isOut) ; 620 } 595 } 621 596 622 scaledrange = range*Chargesquare*t->theMassR << 597 scaledrange = range*Chargesquare*t.theMassRatio ; 623 598 624 if(scaledrange < rmin) 599 if(scaledrange < rmin) 625 { 600 { 626 scaledKineticEnergy = t->theLowestKineticE << 601 scaledKineticEnergy = t.theLowestKineticEnergy* 627 scaledrange*scaledrange/(rm 602 scaledrange*scaledrange/(rmin*rmin) ; 628 } 603 } 629 else 604 else 630 { 605 { 631 if(scaledrange < rmax) 606 if(scaledrange < rmax) 632 { 607 { 633 scaledKineticEnergy = (*inverseRangeTabl 608 scaledKineticEnergy = (*inverseRangeTable)(materialIndex)-> 634 GetValue( scaled 609 GetValue( scaledrange,isOut) ; 635 } 610 } 636 else 611 else 637 { 612 { 638 scaledKineticEnergy = Thigh + 613 scaledKineticEnergy = Thigh + 639 (scaledrange-rmax)* 614 (scaledrange-rmax)* 640 (*dEdxTable)(materialInd 615 (*dEdxTable)(materialIndex)-> 641 GetValue(Thig 616 GetValue(Thigh,isOut) ; 642 } 617 } 643 } 618 } 644 619 645 return scaledKineticEnergy/t->theMassRatio ; << 620 return scaledKineticEnergy/t.theMassRatio ; 646 } 621 } 647 622 648 //....oooOO0OOooo........oooOO0OOooo........oo 623 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 649 624 650 G4double G4EnergyLossTables::GetPreciseDEDX( 625 G4double G4EnergyLossTables::GetPreciseDEDX( 651 const G4ParticleDefinition *aParticle, 626 const G4ParticleDefinition *aParticle, 652 G4double KineticEnergy, 627 G4double KineticEnergy, 653 const G4Material *aMaterial) 628 const G4Material *aMaterial) 654 { 629 { 655 if (!t) t = new G4EnergyLossTablesHelper; << 656 << 657 CPRWarning(); 630 CPRWarning(); 658 if( aParticle != (const G4ParticleDefinition << 631 if( aParticle != lastParticle) 659 { 632 { 660 *t= GetTables(aParticle); << 633 t= GetTables(aParticle); 661 lastParticle = (G4ParticleDefinition*) aPa << 634 lastParticle = aParticle; 662 Chargesquare = (aParticle->GetPDGCharge()) 635 Chargesquare = (aParticle->GetPDGCharge())* 663 (aParticle->GetPDGCharge()) 636 (aParticle->GetPDGCharge())/ 664 QQPositron ; 637 QQPositron ; 665 oldIndex = -1 ; 638 oldIndex = -1 ; 666 } 639 } 667 const G4PhysicsTable* dEdxTable= t->theDEDX << 640 const G4PhysicsTable* dEdxTable= t.theDEDXTable; 668 if (!dEdxTable) { 641 if (!dEdxTable) { 669 ParticleHaveNoLoss(aParticle,"dEdx"); 642 ParticleHaveNoLoss(aParticle,"dEdx"); 670 return 0.0; 643 return 0.0; 671 } 644 } 672 645 673 G4int materialIndex = (G4int)aMaterial->GetI << 646 G4int materialIndex = aMaterial->GetIndex(); 674 G4double scaledKineticEnergy = KineticEnergy << 647 G4double scaledKineticEnergy = KineticEnergy*t.theMassRatio; 675 G4double dEdx; 648 G4double dEdx; 676 G4bool isOut; 649 G4bool isOut; 677 650 678 if (scaledKineticEnergy<t->theLowestKineticE << 651 if (scaledKineticEnergy<t.theLowestKineticEnergy) { 679 652 680 dEdx = std::sqrt(scaledKineticEnergy/t->t << 653 dEdx = std::sqrt(scaledKineticEnergy/t.theLowestKineticEnergy) 681 *(*dEdxTable)(materialIndex)->GetV 654 *(*dEdxTable)(materialIndex)->GetValue( 682 t->theLowestKineticEnergy,isOut) << 655 t.theLowestKineticEnergy,isOut); 683 656 684 } else if (scaledKineticEnergy>t->theHighest << 657 } else if (scaledKineticEnergy>t.theHighestKineticEnergy) { 685 658 686 dEdx = (*dEdxTable)(materialIndex)->GetVa 659 dEdx = (*dEdxTable)(materialIndex)->GetValue( 687 t->theHighestKineticEnergy,isOut); << 660 t.theHighestKineticEnergy,isOut); 688 661 689 } else { 662 } else { 690 663 691 dEdx = (*dEdxTable)(materialIndex)->GetV 664 dEdx = (*dEdxTable)(materialIndex)->GetValue( 692 scaledKineticEnergy, 665 scaledKineticEnergy,isOut) ; 693 666 694 } 667 } 695 668 696 return dEdx*Chargesquare; 669 return dEdx*Chargesquare; 697 } 670 } 698 671 699 //....oooOO0OOooo........oooOO0OOooo........oo 672 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 700 673 701 G4double G4EnergyLossTables::GetPreciseRangeF 674 G4double G4EnergyLossTables::GetPreciseRangeFromEnergy( 702 const G4ParticleDefinition *aParticle, 675 const G4ParticleDefinition *aParticle, 703 G4double KineticEnergy, 676 G4double KineticEnergy, 704 const G4Material *aMaterial) 677 const G4Material *aMaterial) 705 { 678 { 706 if (!t) t = new G4EnergyLossTablesHelper; << 707 << 708 CPRWarning(); 679 CPRWarning(); 709 if( aParticle != (const G4ParticleDefinition << 680 if( aParticle != lastParticle) 710 { 681 { 711 *t= GetTables(aParticle); << 682 t= GetTables(aParticle); 712 lastParticle = (G4ParticleDefinition*) aPa << 683 lastParticle = aParticle; 713 Chargesquare = (aParticle->GetPDGCharge()) 684 Chargesquare = (aParticle->GetPDGCharge())* 714 (aParticle->GetPDGCharge()) 685 (aParticle->GetPDGCharge())/ 715 QQPositron ; 686 QQPositron ; 716 oldIndex = -1 ; 687 oldIndex = -1 ; 717 } 688 } 718 const G4PhysicsTable* rangeTable= t->theRang << 689 const G4PhysicsTable* rangeTable= t.theRangeTable; 719 const G4PhysicsTable* dEdxTable= t->theDEDX << 690 const G4PhysicsTable* dEdxTable= t.theDEDXTable; 720 if (!rangeTable) { 691 if (!rangeTable) { 721 ParticleHaveNoLoss(aParticle,"Range"); 692 ParticleHaveNoLoss(aParticle,"Range"); 722 return 0.0; 693 return 0.0; 723 } 694 } 724 G4int materialIndex = (G4int)aMaterial->GetI << 695 G4int materialIndex = aMaterial->GetIndex(); 725 696 726 G4double Thighr = t->theHighestKineticEnergy << 697 G4double Thighr = t.theHighestKineticEnergy*t.theLowestKineticEnergy/ 727 (*rangeTable)(materialIndex 698 (*rangeTable)(materialIndex)-> 728 GetLowEdgeEnergy(1) ; 699 GetLowEdgeEnergy(1) ; 729 700 730 G4double scaledKineticEnergy = KineticEnergy << 701 G4double scaledKineticEnergy = KineticEnergy*t.theMassRatio; 731 G4double Range; 702 G4double Range; 732 G4bool isOut; 703 G4bool isOut; 733 704 734 if (scaledKineticEnergy<t->theLowestKineticE << 705 if (scaledKineticEnergy<t.theLowestKineticEnergy) { 735 706 736 Range = std::sqrt(scaledKineticEnergy/t->t << 707 Range = std::sqrt(scaledKineticEnergy/t.theLowestKineticEnergy)* 737 (*rangeTable)(materialIndex)->GetV 708 (*rangeTable)(materialIndex)->GetValue( 738 t->theLowestKineticEnergy,isOut) << 709 t.theLowestKineticEnergy,isOut); 739 710 740 } else if (scaledKineticEnergy>Thighr) { 711 } else if (scaledKineticEnergy>Thighr) { 741 712 742 Range = (*rangeTable)(materialIndex)->GetV 713 Range = (*rangeTable)(materialIndex)->GetValue( 743 Thighr,isOut)+ 714 Thighr,isOut)+ 744 (scaledKineticEnergy-Thighr)/ 715 (scaledKineticEnergy-Thighr)/ 745 (*dEdxTable)(materialIndex)->GetVa 716 (*dEdxTable)(materialIndex)->GetValue( 746 Thighr,isOut); 717 Thighr,isOut); 747 718 748 } else { 719 } else { 749 720 750 Range = (*rangeTable)(materialIndex)->Get 721 Range = (*rangeTable)(materialIndex)->GetValue( 751 scaledKineticEnergy,isO 722 scaledKineticEnergy,isOut) ; 752 723 753 } 724 } 754 725 755 return Range/(Chargesquare*t->theMassRatio); << 726 return Range/(Chargesquare*t.theMassRatio); 756 } 727 } 757 728 758 //....oooOO0OOooo........oooOO0OOooo........oo 729 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 759 730 760 G4double G4EnergyLossTables::GetDEDX( 731 G4double G4EnergyLossTables::GetDEDX( 761 const G4ParticleDefinition *aParticle, 732 const G4ParticleDefinition *aParticle, 762 G4double KineticEnergy, 733 G4double KineticEnergy, 763 const G4MaterialCutsCouple *couple, 734 const G4MaterialCutsCouple *couple, 764 G4bool check) 735 G4bool check) 765 { 736 { 766 if (!t) t = new G4EnergyLossTablesHelper; << 737 if(aParticle != lastParticle) 767 << 768 if(aParticle != (const G4ParticleDefinition* << 769 { 738 { 770 *t= GetTables(aParticle); << 739 t= GetTables(aParticle); 771 lastParticle = (G4ParticleDefinition*) aPa << 740 lastParticle = aParticle ; 772 Chargesquare = (aParticle->GetPDGCharge()) 741 Chargesquare = (aParticle->GetPDGCharge())* 773 (aParticle->GetPDGCharge()) 742 (aParticle->GetPDGCharge())/ 774 QQPositron ; 743 QQPositron ; 775 oldIndex = -1 ; 744 oldIndex = -1 ; 776 } 745 } 777 const G4PhysicsTable* dEdxTable= t->theDEDX << 746 const G4PhysicsTable* dEdxTable= t.theDEDXTable; 778 747 779 if (!dEdxTable ) { 748 if (!dEdxTable ) { 780 if (check) return G4LossTableManager::Inst 749 if (check) return G4LossTableManager::Instance()->GetDEDX(aParticle,KineticEnergy,couple); 781 else ParticleHaveNoLoss(aParticle, " 750 else ParticleHaveNoLoss(aParticle, "dEdx"); 782 return 0.0; 751 return 0.0; 783 } 752 } 784 753 785 G4int materialIndex = couple->GetIndex(); 754 G4int materialIndex = couple->GetIndex(); 786 G4double scaledKineticEnergy = KineticEnergy << 755 G4double scaledKineticEnergy = KineticEnergy*t.theMassRatio; 787 G4double dEdx; 756 G4double dEdx; 788 G4bool isOut; 757 G4bool isOut; 789 758 790 if (scaledKineticEnergy<t->theLowestKineticE << 759 if (scaledKineticEnergy<t.theLowestKineticEnergy) { 791 760 792 dEdx =(*dEdxTable)(materialIndex)->GetVal 761 dEdx =(*dEdxTable)(materialIndex)->GetValue( 793 t->theLowestKineticEnergy,isOut) << 762 t.theLowestKineticEnergy,isOut) 794 *std::sqrt(scaledKineticEnergy/t->t << 763 *std::sqrt(scaledKineticEnergy/t.theLowestKineticEnergy); 795 764 796 } else if (scaledKineticEnergy>t->theHighest << 765 } else if (scaledKineticEnergy>t.theHighestKineticEnergy) { 797 766 798 dEdx = (*dEdxTable)(materialIndex)->GetVa 767 dEdx = (*dEdxTable)(materialIndex)->GetValue( 799 t->theHighestKineticEnergy,isOut); << 768 t.theHighestKineticEnergy,isOut); 800 769 801 } else { 770 } else { 802 771 803 dEdx = (*dEdxTable)(materialIndex)->GetVal 772 dEdx = (*dEdxTable)(materialIndex)->GetValue( 804 scaledKineticEnergy,isOut); 773 scaledKineticEnergy,isOut); 805 774 806 } 775 } 807 776 808 return dEdx*Chargesquare; 777 return dEdx*Chargesquare; 809 } 778 } 810 779 811 //....oooOO0OOooo........oooOO0OOooo........oo 780 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 812 781 813 G4double G4EnergyLossTables::GetRange( 782 G4double G4EnergyLossTables::GetRange( 814 const G4ParticleDefinition *aParticle, 783 const G4ParticleDefinition *aParticle, 815 G4double KineticEnergy, 784 G4double KineticEnergy, 816 const G4MaterialCutsCouple *couple, 785 const G4MaterialCutsCouple *couple, 817 G4bool check) 786 G4bool check) 818 { 787 { 819 if (!t) t = new G4EnergyLossTablesHelper; << 788 if(aParticle != lastParticle) 820 << 821 if(aParticle != (const G4ParticleDefinition* << 822 { 789 { 823 *t= GetTables(aParticle); << 790 t= GetTables(aParticle); 824 lastParticle = (G4ParticleDefinition*) aPa << 791 lastParticle = aParticle ; 825 Chargesquare = (aParticle->GetPDGCharge()) 792 Chargesquare = (aParticle->GetPDGCharge())* 826 (aParticle->GetPDGCharge()) 793 (aParticle->GetPDGCharge())/ 827 QQPositron ; 794 QQPositron ; 828 oldIndex = -1 ; 795 oldIndex = -1 ; 829 } 796 } 830 const G4PhysicsTable* rangeTable= t->theRang << 797 const G4PhysicsTable* rangeTable= t.theRangeTable; 831 const G4PhysicsTable* dEdxTable= t->theDEDX << 798 const G4PhysicsTable* dEdxTable= t.theDEDXTable; 832 if (!rangeTable) { 799 if (!rangeTable) { 833 if(check) return G4LossTableManager::Insta 800 if(check) return G4LossTableManager::Instance()->GetRange(aParticle,KineticEnergy,couple); 834 else return DBL_MAX; 801 else return DBL_MAX; 835 //ParticleHaveNoLoss(aParticle,"Range"); 802 //ParticleHaveNoLoss(aParticle,"Range"); 836 } 803 } 837 804 838 G4int materialIndex = couple->GetIndex(); 805 G4int materialIndex = couple->GetIndex(); 839 G4double scaledKineticEnergy = KineticEnergy << 806 G4double scaledKineticEnergy = KineticEnergy*t.theMassRatio; 840 G4double Range; 807 G4double Range; 841 G4bool isOut; 808 G4bool isOut; 842 809 843 if (scaledKineticEnergy<t->theLowestKineticE << 810 if (scaledKineticEnergy<t.theLowestKineticEnergy) { 844 811 845 Range = std::sqrt(scaledKineticEnergy/t->t << 812 Range = std::sqrt(scaledKineticEnergy/t.theLowestKineticEnergy)* 846 (*rangeTable)(materialIndex)->GetV 813 (*rangeTable)(materialIndex)->GetValue( 847 t->theLowestKineticEnergy,isOut) << 814 t.theLowestKineticEnergy,isOut); 848 815 849 } else if (scaledKineticEnergy>t->theHighest << 816 } else if (scaledKineticEnergy>t.theHighestKineticEnergy) { 850 817 851 Range = (*rangeTable)(materialIndex)->GetV 818 Range = (*rangeTable)(materialIndex)->GetValue( 852 t->theHighestKineticEnergy,isOut)+ << 819 t.theHighestKineticEnergy,isOut)+ 853 (scaledKineticEnergy-t->theHighest << 820 (scaledKineticEnergy-t.theHighestKineticEnergy)/ 854 (*dEdxTable)(materialIndex)->GetVa 821 (*dEdxTable)(materialIndex)->GetValue( 855 t->theHighestKineticEnergy,isOut << 822 t.theHighestKineticEnergy,isOut); 856 823 857 } else { 824 } else { 858 825 859 Range = (*rangeTable)(materialIndex)->GetV 826 Range = (*rangeTable)(materialIndex)->GetValue( 860 scaledKineticEnergy,isOut); 827 scaledKineticEnergy,isOut); 861 828 862 } 829 } 863 830 864 return Range/(Chargesquare*t->theMassRatio); << 831 return Range/(Chargesquare*t.theMassRatio); 865 } 832 } 866 833 867 //....oooOO0OOooo........oooOO0OOooo........oo 834 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 868 835 869 G4double G4EnergyLossTables::GetPreciseEnergyF 836 G4double G4EnergyLossTables::GetPreciseEnergyFromRange( 870 const G4P 837 const G4ParticleDefinition *aParticle, 871 G4d 838 G4double range, 872 const G4M 839 const G4MaterialCutsCouple *couple, 873 G4bool check) 840 G4bool check) 874 // it returns the value of the kinetic energy 841 // it returns the value of the kinetic energy for a given range 875 { 842 { 876 if (!t) t = new G4EnergyLossTablesHelper; << 843 if( aParticle != lastParticle) 877 << 878 if( aParticle != (const G4ParticleDefinition << 879 { 844 { 880 *t= GetTables(aParticle); << 845 t= GetTables(aParticle); 881 lastParticle = (G4ParticleDefinition*) aPa << 846 lastParticle = aParticle; 882 Chargesquare = (aParticle->GetPDGCharge()) 847 Chargesquare = (aParticle->GetPDGCharge())* 883 (aParticle->GetPDGCharge()) 848 (aParticle->GetPDGCharge())/ 884 QQPositron ; 849 QQPositron ; 885 oldIndex = -1 ; 850 oldIndex = -1 ; 886 } 851 } 887 const G4PhysicsTable* dEdxTable= t->theDEDX << 852 const G4PhysicsTable* dEdxTable= t.theDEDXTable; 888 const G4PhysicsTable* inverseRangeTable= t- << 853 const G4PhysicsTable* inverseRangeTable= t.theInverseRangeTable; 889 854 890 if (!inverseRangeTable) { 855 if (!inverseRangeTable) { 891 if(check) return G4LossTableManager::Insta 856 if(check) return G4LossTableManager::Instance()->GetEnergy(aParticle,range,couple); 892 else return DBL_MAX; 857 else return DBL_MAX; 893 // else ParticleHaveNoLoss(aPartic 858 // else ParticleHaveNoLoss(aParticle,"InverseRange"); 894 } 859 } 895 860 896 G4double scaledrange,scaledKineticEnergy ; 861 G4double scaledrange,scaledKineticEnergy ; 897 G4bool isOut ; 862 G4bool isOut ; 898 863 899 G4int materialIndex = couple->GetIndex() ; 864 G4int materialIndex = couple->GetIndex() ; 900 865 901 if(materialIndex != oldIndex) 866 if(materialIndex != oldIndex) 902 { 867 { 903 oldIndex = materialIndex ; 868 oldIndex = materialIndex ; 904 rmin = (*inverseRangeTable)(materialIndex) 869 rmin = (*inverseRangeTable)(materialIndex)-> 905 GetLowEdgeEnergy 870 GetLowEdgeEnergy(0) ; 906 rmax = (*inverseRangeTable)(materialIndex) 871 rmax = (*inverseRangeTable)(materialIndex)-> 907 GetLowEdgeEnergy(t->theNumb << 872 GetLowEdgeEnergy(t.theNumberOfBins-2) ; 908 Thigh = (*inverseRangeTable)(materialIndex 873 Thigh = (*inverseRangeTable)(materialIndex)-> 909 GetValue(rmax,is 874 GetValue(rmax,isOut) ; 910 } 875 } 911 876 912 scaledrange = range*Chargesquare*t->theMassR << 877 scaledrange = range*Chargesquare*t.theMassRatio ; 913 878 914 if(scaledrange < rmin) 879 if(scaledrange < rmin) 915 { 880 { 916 scaledKineticEnergy = t->theLowestKineticE << 881 scaledKineticEnergy = t.theLowestKineticEnergy* 917 scaledrange*scaledrange/(rm 882 scaledrange*scaledrange/(rmin*rmin) ; 918 } 883 } 919 else 884 else 920 { 885 { 921 if(scaledrange < rmax) 886 if(scaledrange < rmax) 922 { 887 { 923 scaledKineticEnergy = (*inverseRangeTabl 888 scaledKineticEnergy = (*inverseRangeTable)(materialIndex)-> 924 GetValue( scaled 889 GetValue( scaledrange,isOut) ; 925 } 890 } 926 else 891 else 927 { 892 { 928 scaledKineticEnergy = Thigh + 893 scaledKineticEnergy = Thigh + 929 (scaledrange-rmax)* 894 (scaledrange-rmax)* 930 (*dEdxTable)(materialInd 895 (*dEdxTable)(materialIndex)-> 931 GetValue(Thig 896 GetValue(Thigh,isOut) ; 932 } 897 } 933 } 898 } 934 899 935 return scaledKineticEnergy/t->theMassRatio ; << 900 return scaledKineticEnergy/t.theMassRatio ; 936 } 901 } 937 902 938 //....oooOO0OOooo........oooOO0OOooo........oo 903 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 939 904 940 G4double G4EnergyLossTables::GetPreciseDEDX( 905 G4double G4EnergyLossTables::GetPreciseDEDX( 941 const G4ParticleDefinition *aParticle, 906 const G4ParticleDefinition *aParticle, 942 G4double KineticEnergy, 907 G4double KineticEnergy, 943 const G4MaterialCutsCouple *couple) 908 const G4MaterialCutsCouple *couple) 944 { 909 { 945 if (!t) t = new G4EnergyLossTablesHelper; << 946 910 947 if( aParticle != (const G4ParticleDefinition << 911 if( aParticle != lastParticle) 948 { 912 { 949 *t= GetTables(aParticle); << 913 t= GetTables(aParticle); 950 lastParticle = (G4ParticleDefinition*) aPa << 914 lastParticle = aParticle; 951 Chargesquare = (aParticle->GetPDGCharge()) 915 Chargesquare = (aParticle->GetPDGCharge())* 952 (aParticle->GetPDGCharge()) 916 (aParticle->GetPDGCharge())/ 953 QQPositron ; 917 QQPositron ; 954 oldIndex = -1 ; 918 oldIndex = -1 ; 955 } 919 } 956 const G4PhysicsTable* dEdxTable= t->theDEDX << 920 const G4PhysicsTable* dEdxTable= t.theDEDXTable; 957 if ( !dEdxTable ) 921 if ( !dEdxTable ) 958 return G4LossTableManager::Instance()->Get 922 return G4LossTableManager::Instance()->GetDEDX(aParticle,KineticEnergy,couple); 959 923 960 G4int materialIndex = couple->GetIndex(); 924 G4int materialIndex = couple->GetIndex(); 961 G4double scaledKineticEnergy = KineticEnergy << 925 G4double scaledKineticEnergy = KineticEnergy*t.theMassRatio; 962 G4double dEdx; 926 G4double dEdx; 963 G4bool isOut; 927 G4bool isOut; 964 928 965 if (scaledKineticEnergy<t->theLowestKineticE << 929 if (scaledKineticEnergy<t.theLowestKineticEnergy) { 966 930 967 dEdx = std::sqrt(scaledKineticEnergy/t->t << 931 dEdx = std::sqrt(scaledKineticEnergy/t.theLowestKineticEnergy) 968 *(*dEdxTable)(materialIndex)->GetV 932 *(*dEdxTable)(materialIndex)->GetValue( 969 t->theLowestKineticEnergy,isOut) << 933 t.theLowestKineticEnergy,isOut); 970 934 971 } else if (scaledKineticEnergy>t->theHighest << 935 } else if (scaledKineticEnergy>t.theHighestKineticEnergy) { 972 936 973 dEdx = (*dEdxTable)(materialIndex)->GetVa 937 dEdx = (*dEdxTable)(materialIndex)->GetValue( 974 t->theHighestKineticEnergy,isOut); << 938 t.theHighestKineticEnergy,isOut); 975 939 976 } else { 940 } else { 977 941 978 dEdx = (*dEdxTable)(materialIndex)->GetV 942 dEdx = (*dEdxTable)(materialIndex)->GetValue( 979 scaledKineticEnergy, 943 scaledKineticEnergy,isOut) ; 980 944 981 } 945 } 982 946 983 return dEdx*Chargesquare; 947 return dEdx*Chargesquare; 984 } 948 } 985 949 986 //....oooOO0OOooo........oooOO0OOooo........oo 950 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 987 951 988 G4double G4EnergyLossTables::GetPreciseRangeFr 952 G4double G4EnergyLossTables::GetPreciseRangeFromEnergy( 989 const G4ParticleDefinition *aParticle, 953 const G4ParticleDefinition *aParticle, 990 G4double KineticEnergy, 954 G4double KineticEnergy, 991 const G4MaterialCutsCouple *couple) 955 const G4MaterialCutsCouple *couple) 992 { 956 { 993 if (!t) t = new G4EnergyLossTablesHelper; << 957 if( aParticle != lastParticle) 994 << 995 if( aParticle != (const G4ParticleDefinition << 996 { 958 { 997 *t= GetTables(aParticle); << 959 t= GetTables(aParticle); 998 lastParticle = (G4ParticleDefinition*) aPa << 960 lastParticle = aParticle; 999 Chargesquare = (aParticle->GetPDGCharge()) 961 Chargesquare = (aParticle->GetPDGCharge())* 1000 (aParticle->GetPDGCharge() 962 (aParticle->GetPDGCharge())/ 1001 QQPositron ; 963 QQPositron ; 1002 oldIndex = -1 ; 964 oldIndex = -1 ; 1003 } 965 } 1004 const G4PhysicsTable* rangeTable= t->theRan << 966 const G4PhysicsTable* rangeTable= t.theRangeTable; 1005 const G4PhysicsTable* dEdxTable= t->theDED << 967 const G4PhysicsTable* dEdxTable= t.theDEDXTable; 1006 if ( !dEdxTable || !rangeTable) 968 if ( !dEdxTable || !rangeTable) 1007 return G4LossTableManager::Instance()->Ge 969 return G4LossTableManager::Instance()->GetDEDX(aParticle,KineticEnergy,couple); 1008 970 1009 G4int materialIndex = couple->GetIndex(); 971 G4int materialIndex = couple->GetIndex(); 1010 972 1011 G4double Thighr = t->theHighestKineticEnerg << 973 G4double Thighr = t.theHighestKineticEnergy*t.theLowestKineticEnergy/ 1012 (*rangeTable)(materialInde 974 (*rangeTable)(materialIndex)-> 1013 GetLowEdgeEnergy(1) ; 975 GetLowEdgeEnergy(1) ; 1014 976 1015 G4double scaledKineticEnergy = KineticEnerg << 977 G4double scaledKineticEnergy = KineticEnergy*t.theMassRatio; 1016 G4double Range; 978 G4double Range; 1017 G4bool isOut; 979 G4bool isOut; 1018 980 1019 if (scaledKineticEnergy<t->theLowestKinetic << 981 if (scaledKineticEnergy<t.theLowestKineticEnergy) { 1020 982 1021 Range = std::sqrt(scaledKineticEnergy/t-> << 983 Range = std::sqrt(scaledKineticEnergy/t.theLowestKineticEnergy)* 1022 (*rangeTable)(materialIndex)->Get 984 (*rangeTable)(materialIndex)->GetValue( 1023 t->theLowestKineticEnergy,isOut << 985 t.theLowestKineticEnergy,isOut); 1024 986 1025 } else if (scaledKineticEnergy>Thighr) { 987 } else if (scaledKineticEnergy>Thighr) { 1026 988 1027 Range = (*rangeTable)(materialIndex)->Get 989 Range = (*rangeTable)(materialIndex)->GetValue( 1028 Thighr,isOut)+ 990 Thighr,isOut)+ 1029 (scaledKineticEnergy-Thighr)/ 991 (scaledKineticEnergy-Thighr)/ 1030 (*dEdxTable)(materialIndex)->GetV 992 (*dEdxTable)(materialIndex)->GetValue( 1031 Thighr,isOut); 993 Thighr,isOut); 1032 994 1033 } else { 995 } else { 1034 996 1035 Range = (*rangeTable)(materialIndex)->Ge 997 Range = (*rangeTable)(materialIndex)->GetValue( 1036 scaledKineticEnergy,is 998 scaledKineticEnergy,isOut) ; 1037 999 1038 } 1000 } 1039 1001 1040 return Range/(Chargesquare*t->theMassRatio) << 1002 return Range/(Chargesquare*t.theMassRatio); 1041 } 1003 } 1042 1004 1043 //....oooOO0OOooo........oooOO0OOooo........o 1005 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 1044 1006 1045 void G4EnergyLossTables::CPRWarning() 1007 void G4EnergyLossTables::CPRWarning() 1046 { 1008 { 1047 if (let_counter < let_max_num_warnings) { 1009 if (let_counter < let_max_num_warnings) { 1048 1010 1049 G4cout << G4endl; 1011 G4cout << G4endl; 1050 G4cout << "##### G4EnergyLossTable WARNIN 1012 G4cout << "##### G4EnergyLossTable WARNING: The obsolete interface is used!" << G4endl; 1051 G4cout << "##### RESULTS ARE NOT GARANTEE 1013 G4cout << "##### RESULTS ARE NOT GARANTEED!" << G4endl; 1052 G4cout << "##### Please, substitute G4Mat 1014 G4cout << "##### Please, substitute G4Material by G4MaterialCutsCouple" << G4endl; 1053 G4cout << "##### Obsolete interface will 1015 G4cout << "##### Obsolete interface will be removed soon" << G4endl; 1054 G4cout << G4endl; 1016 G4cout << G4endl; 1055 let_counter++; 1017 let_counter++; >> 1018 // if ((G4RegionStore::GetInstance())->size() > 1) { >> 1019 // G4Exception("G4EnergyLossTables:: More than 1 region - table can't be accessed with obsolete interface"); >> 1020 // exit(1); >> 1021 // } 1056 1022 1057 } else if (let_counter == let_max_num_warni 1023 } else if (let_counter == let_max_num_warnings) { 1058 1024 1059 G4cout << "##### G4EnergyLossTable WARNIN 1025 G4cout << "##### G4EnergyLossTable WARNING closed" << G4endl; 1060 let_counter++; 1026 let_counter++; 1061 } 1027 } 1062 } 1028 } 1063 1029 1064 //....oooOO0OOooo........oooOO0OOooo........o 1030 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 1065 1031 1066 void 1032 void 1067 G4EnergyLossTables::ParticleHaveNoLoss(const 1033 G4EnergyLossTables::ParticleHaveNoLoss(const G4ParticleDefinition*, 1068 const G4String& /*q*/) 1034 const G4String& /*q*/) 1069 { 1035 { >> 1036 //G4String s = " " + q + " table not found for " >> 1037 // + aParticle->GetParticleName() + " !"; >> 1038 //G4Exception("G4EnergyLossTables::ParticleHaveNoLoss", "EM01", >> 1039 // FatalException, s); 1070 } 1040 } 1071 1041 1072 //....oooOO0OOooo........oooOO0OOooo........o 1042 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 1073 1043