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