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 // $Id: G4LossTableManager.hh,v 1.55.2.1 2010/04/06 09:05:17 gcosmo Exp $ >> 27 // GEANT4 tag $Name: geant4-09-03-patch-01 $ >> 28 // >> 29 // 26 // ------------------------------------------- 30 // ------------------------------------------------------------------- 27 // 31 // 28 // GEANT4 Class header file 32 // GEANT4 Class header file 29 // 33 // 30 // 34 // 31 // File name: G4LossTableManager 35 // File name: G4LossTableManager 32 // 36 // 33 // Author: Vladimir Ivanchenko on base 37 // Author: Vladimir Ivanchenko on base of G4LossTables class 34 // and Maria Grazia Pia ideas 38 // and Maria Grazia Pia ideas 35 // 39 // 36 // Creation date: 03.01.2002 40 // Creation date: 03.01.2002 37 // 41 // 38 // Modifications by V.Ivanchenko << 42 // Modifications: >> 43 // >> 44 // 20-01-03 Migrade to cut per region (V.Ivanchenko) >> 45 // 17-02-03 Fix problem of store/restore tables for ions (V.Ivanchenko) >> 46 // 10-03-03 Add Ion registration (V.Ivanchenko) >> 47 // 25-03-03 Add deregistration (V.Ivanchenko) >> 48 // 26-03-03 Add GetDEDXDispersion (V.Ivanchenko) >> 49 // 02-04-03 Change messenger (V.Ivanchenko) >> 50 // 23-07-03 Add exchange with G4EnergyLossTables (V.Ivanchenko) >> 51 // 05-10-03 Add G4VEmProcesses registration (V.Ivanchenko) >> 52 // 17-10-03 Add SetParameters method (V.Ivanchenko) >> 53 // 12-11-03 G4EnergyLossSTD -> G4EnergyLossProcess (V.Ivanchenko) >> 54 // 14-01-04 Activate precise range calculation (V.Ivanchenko) >> 55 // 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivantchenko) >> 56 // 10-01-06 PreciseRange -> CSDARange (V.Ivantchenko) >> 57 // 20-01-06 Introduce GetSubDEDX method (VI) >> 58 // 26-01-06 Rename GetRange -> GetRangeFromRestricteDEDX (V.Ivanchenko) >> 59 // 10-05-06 Add methods SetMscStepLimitation, FacRange and MscFlag (VI) >> 60 // 22-05-06 Add methods Set/Get bremsTh (VI) >> 61 // 12-02-07 Add SetSkin, SetLinearLossLimit (V.Ivanchenko) >> 62 // 18-06-07 Move definition of msc parameters to G4EmProcessOptions (V.Ivanchenko) 39 // 63 // 40 // Class Description: 64 // Class Description: 41 // 65 // 42 // A utility static class, responsable for the 66 // A utility static class, responsable for the energy loss tables 43 // for each particle 67 // for each particle 44 // 68 // 45 // Energy loss processes have to register thei 69 // Energy loss processes have to register their tables with this 46 // class. The responsibility of creating and d 70 // class. The responsibility of creating and deleting the tables 47 // remains with the energy loss classes. 71 // remains with the energy loss classes. 48 72 49 // ------------------------------------------- 73 // ------------------------------------------------------------------- 50 // 74 // 51 75 52 #ifndef G4LossTableManager_h 76 #ifndef G4LossTableManager_h 53 #define G4LossTableManager_h 1 77 #define G4LossTableManager_h 1 54 78 55 #include <map> 79 #include <map> 56 #include <vector> 80 #include <vector> 57 #include "globals.hh" 81 #include "globals.hh" 58 #include "G4ThreadLocalSingleton.hh" << 59 #include "G4VEnergyLossProcess.hh" 82 #include "G4VEnergyLossProcess.hh" 60 #include "G4EmParameters.hh" << 83 #include "G4EnergyLossTables.hh" 61 84 62 class G4PhysicsTable; 85 class G4PhysicsTable; 63 class G4MaterialCutsCouple; 86 class G4MaterialCutsCouple; >> 87 class G4EnergyLossMessenger; 64 class G4ParticleDefinition; 88 class G4ParticleDefinition; 65 class G4Region; << 66 class G4EmSaturation; << 67 class G4EmConfigurator; << 68 class G4ElectronIonPair; << 69 class G4NIELCalculator; << 70 class G4VMultipleScattering; 89 class G4VMultipleScattering; 71 class G4VEmProcess; 90 class G4VEmProcess; 72 class G4EmCorrections; 91 class G4EmCorrections; >> 92 class G4EmSaturation; >> 93 class G4EmConfigurator; 73 class G4LossTableBuilder; 94 class G4LossTableBuilder; 74 class G4VAtomDeexcitation; << 75 class G4VSubCutProducer; << 76 95 77 class G4LossTableManager 96 class G4LossTableManager 78 { 97 { 79 98 80 friend class G4ThreadLocalSingleton<G4LossTabl << 81 << 82 public: 99 public: 83 100 84 static G4LossTableManager* Instance(); 101 static G4LossTableManager* Instance(); 85 102 86 ~G4LossTableManager(); 103 ~G4LossTableManager(); 87 104 88 //------------------------------------------ << 105 void Clear(); 89 // initialisation before a new run << 90 //------------------------------------------ << 91 << 92 void PreparePhysicsTable(const G4ParticleDef << 93 G4VEnergyLossProces << 94 << 95 void PreparePhysicsTable(const G4ParticleDef << 96 G4VEmProcess* p); << 97 << 98 void PreparePhysicsTable(const G4ParticleDef << 99 G4VMultipleScatteri << 100 << 101 void BuildPhysicsTable(const G4ParticleDefin << 102 << 103 void BuildPhysicsTable(const G4ParticleDefin << 104 G4VEnergyLossProcess* << 105 << 106 void LocalPhysicsTables(const G4ParticleDefi << 107 G4VEnergyLossProcess << 108 << 109 void DumpHtml(); << 110 << 111 //------------------------------------------ << 112 // Run time access to DEDX, range, energy fo << 113 // energy, and G4MaterialCutsCouple << 114 //------------------------------------------ << 115 106 >> 107 // get the DEDX or the range for a given particle/energy/material 116 inline G4double GetDEDX( 108 inline G4double GetDEDX( 117 const G4ParticleDefinition *aParticle, 109 const G4ParticleDefinition *aParticle, 118 G4double kineticEnergy, 110 G4double kineticEnergy, 119 const G4MaterialCutsCouple *couple); 111 const G4MaterialCutsCouple *couple); 120 112 >> 113 inline G4double GetSubDEDX( >> 114 const G4ParticleDefinition *aParticle, >> 115 G4double kineticEnergy, >> 116 const G4MaterialCutsCouple *couple); >> 117 121 inline G4double GetRange( 118 inline G4double GetRange( 122 const G4ParticleDefinition *aParticle, 119 const G4ParticleDefinition *aParticle, 123 G4double kineticEnergy, 120 G4double kineticEnergy, 124 const G4MaterialCutsCouple *couple); 121 const G4MaterialCutsCouple *couple); 125 122 126 inline G4double GetCSDARange( 123 inline G4double GetCSDARange( 127 const G4ParticleDefinition *aParticle, 124 const G4ParticleDefinition *aParticle, 128 G4double kineticEnergy, 125 G4double kineticEnergy, 129 const G4MaterialCutsCouple *couple); 126 const G4MaterialCutsCouple *couple); 130 127 131 inline G4double GetRangeFromRestricteDEDX( 128 inline G4double GetRangeFromRestricteDEDX( 132 const G4ParticleDefinition *aParticle, 129 const G4ParticleDefinition *aParticle, 133 G4double kineticEnergy, 130 G4double kineticEnergy, 134 const G4MaterialCutsCouple *couple); 131 const G4MaterialCutsCouple *couple); 135 132 136 inline G4double GetEnergy( 133 inline G4double GetEnergy( 137 const G4ParticleDefinition *aParticle, 134 const G4ParticleDefinition *aParticle, 138 G4double range, 135 G4double range, 139 const G4MaterialCutsCouple *couple); 136 const G4MaterialCutsCouple *couple); 140 137 141 inline G4double GetDEDXDispersion( 138 inline G4double GetDEDXDispersion( 142 const G4MaterialCutsCouple *couple, 139 const G4MaterialCutsCouple *couple, 143 const G4DynamicParticle* dp, 140 const G4DynamicParticle* dp, 144 G4double& length); 141 G4double& length); 145 142 146 //------------------------------------------ << 143 // to be called only by energy loss processes 147 // Methods to be called only at initialisati << 148 // and at the end of the job << 149 //------------------------------------------ << 150 << 151 void Register(G4VEnergyLossProcess* p); 144 void Register(G4VEnergyLossProcess* p); 152 145 153 void DeRegister(G4VEnergyLossProcess* p); 146 void DeRegister(G4VEnergyLossProcess* p); 154 147 155 void Register(G4VMultipleScattering* p); 148 void Register(G4VMultipleScattering* p); 156 149 157 void DeRegister(G4VMultipleScattering* p); 150 void DeRegister(G4VMultipleScattering* p); 158 151 159 void Register(G4VEmProcess* p); 152 void Register(G4VEmProcess* p); 160 153 161 void DeRegister(G4VEmProcess* p); 154 void DeRegister(G4VEmProcess* p); 162 155 163 void Register(G4VProcess* p); << 164 << 165 void DeRegister(G4VProcess* p); << 166 << 167 void Register(G4VEmModel* p); 156 void Register(G4VEmModel* p); 168 157 169 void DeRegister(G4VEmModel* p); 158 void DeRegister(G4VEmModel* p); 170 159 171 void Register(G4VEmFluctuationModel* p); 160 void Register(G4VEmFluctuationModel* p); 172 161 173 void DeRegister(G4VEmFluctuationModel* p); 162 void DeRegister(G4VEmFluctuationModel* p); 174 163 >> 164 void EnergyLossProcessIsInitialised(const G4ParticleDefinition* aParticle, >> 165 G4VEnergyLossProcess* p); >> 166 >> 167 void RegisterIon(const G4ParticleDefinition* aParticle, >> 168 G4VEnergyLossProcess* p); >> 169 175 void RegisterExtraParticle(const G4ParticleD 170 void RegisterExtraParticle(const G4ParticleDefinition* aParticle, 176 G4VEnergyLossProc << 171 G4VEnergyLossProcess* p); 177 172 178 void SetVerbose(G4int val); << 173 void BuildPhysicsTable(const G4ParticleDefinition* aParticle, >> 174 G4VEnergyLossProcess* p); 179 175 180 void ResetParameters(); << 176 void SetLossFluctuations(G4bool val); 181 177 182 void SetAtomDeexcitation(G4VAtomDeexcitation << 178 void SetSubCutoff(G4bool val); 183 179 184 void SetSubCutProducer(G4VSubCutProducer*); << 180 void SetIntegral(G4bool val); 185 181 186 void SetNIELCalculator(G4NIELCalculator*); << 182 void SetRandomStep(G4bool val); 187 183 188 //------------------------------------------ << 184 void SetMinSubRange(G4double val); 189 // Access methods << 190 //------------------------------------------ << 191 185 192 inline G4bool IsMaster() const; << 186 void SetMinEnergy(G4double val); 193 187 194 G4VEnergyLossProcess* GetEnergyLossProcess(c << 188 void SetMaxEnergy(G4double val); 195 << 196 const std::vector<G4VEnergyLossProcess*>& Ge << 197 189 198 const std::vector<G4VEmProcess*>& GetEmProce << 190 void SetMaxEnergyForCSDARange(G4double val); 199 191 200 const std::vector<G4VMultipleScattering*>& G << 192 void SetMaxEnergyForMuons(G4double val); 201 193 202 G4EmSaturation* EmSaturation(); << 194 void SetDEDXBinning(G4int val); 203 195 204 G4EmConfigurator* EmConfigurator(); << 196 void SetDEDXBinningForCSDARange(G4int val); 205 197 206 G4ElectronIonPair* ElectronIonPair(); << 198 void SetLambdaBinning(G4int val); 207 199 208 G4NIELCalculator* NIELCalculator(); << 200 void SetStepFunction(G4double v1, G4double v2); 209 201 210 inline G4EmCorrections* EmCorrections(); << 202 void SetBuildCSDARange(G4bool val); 211 203 212 inline G4VAtomDeexcitation* AtomDeexcitation << 204 void SetLPMFlag(G4bool val); 213 205 214 inline G4VSubCutProducer* SubCutProducer(); << 206 void SetSplineFlag(G4bool val); 215 207 216 inline G4LossTableBuilder* GetTableBuilder() << 208 void SetLinearLossLimit(G4double val); 217 209 218 inline void SetGammaGeneralProcess(G4VEmProc << 210 void SetBremsstrahlungTh(G4double val); 219 211 220 inline G4VEmProcess* GetGammaGeneralProcess( << 212 void SetFactorForAngleLimit(G4double val); 221 213 222 inline void SetElectronGeneralProcess(G4VEmP << 214 void SetVerbose(G4int val); 223 215 224 inline G4VEmProcess* GetElectronGeneralProce << 216 G4EnergyLossMessenger* GetMessenger(); 225 217 226 inline void SetPositronGeneralProcess(G4VEmP << 218 G4bool BuildCSDARange() const; 227 219 228 inline G4VEmProcess* GetPositronGeneralProce << 220 G4bool LPMFlag() const; 229 221 230 G4LossTableManager(G4LossTableManager &) = d << 222 G4bool SplineFlag() const; 231 G4LossTableManager & operator=(const G4LossT << 232 223 233 private: << 224 G4double BremsstrahlungTh() const; 234 225 235 //------------------------------------------ << 226 G4double FactorForAngleLimit() const; 236 // Private methods and members << 237 //------------------------------------------ << 238 227 239 G4LossTableManager(); << 228 const std::vector<G4VEnergyLossProcess*>& GetEnergyLossProcessVector(); 240 229 241 void Clear(); << 230 const std::vector<G4VEmProcess*>& GetEmProcessVector(); >> 231 >> 232 const std::vector<G4VMultipleScattering*>& GetMultipleScatteringVector(); >> 233 >> 234 inline G4VEnergyLossProcess* GetEnergyLossProcess(const G4ParticleDefinition*); >> 235 >> 236 G4EmCorrections* EmCorrections(); >> 237 >> 238 G4EmSaturation* EmSaturation(); >> 239 >> 240 G4EmConfigurator* EmConfigurator(); >> 241 >> 242 private: >> 243 >> 244 G4LossTableManager(); 242 245 243 G4VEnergyLossProcess* BuildTables(const G4Pa 246 G4VEnergyLossProcess* BuildTables(const G4ParticleDefinition* aParticle); 244 247 245 void CopyTables(const G4ParticleDefinition* 248 void CopyTables(const G4ParticleDefinition* aParticle, 246 G4VEnergyLossProcess*); << 249 G4VEnergyLossProcess*); 247 250 248 void ParticleHaveNoLoss(const G4ParticleDefi 251 void ParticleHaveNoLoss(const G4ParticleDefinition* aParticle); 249 252 >> 253 void SetParameters(G4VEnergyLossProcess*); >> 254 250 void CopyDEDXTables(); 255 void CopyDEDXTables(); 251 256 252 void PrintEWarning(G4String, G4double); << 257 private: 253 258 254 static G4ThreadLocal G4LossTableManager* ins << 259 static G4LossTableManager* theInstance; 255 260 256 typedef const G4ParticleDefinition* PD; 261 typedef const G4ParticleDefinition* PD; 257 << 262 std::map<PD,G4VEnergyLossProcess*,std::less<PD> > loss_map; 258 // cache << 259 G4VEnergyLossProcess* currentLoss{nullptr}; << 260 PD currentParticle{nullptr}; << 261 PD theElectron; << 262 PD theGenericIon{nullptr}; << 263 PD firstParticle{nullptr}; << 264 << 265 G4LossTableBuilder* tableBuilder; << 266 G4EmCorrections* emCorrections; << 267 G4EmConfigurator* emConfigurator{nullptr}; << 268 G4ElectronIonPair* emElectronIonPair{nullptr << 269 G4NIELCalculator* nielCalculator{nullptr}; << 270 G4VAtomDeexcitation* atomDeexcitation{nullpt << 271 G4VSubCutProducer* subcutProducer{nullptr}; << 272 << 273 G4EmParameters* theParameters; << 274 G4VEmProcess* gGeneral{nullptr}; << 275 G4VEmProcess* eGeneral{nullptr}; << 276 G4VEmProcess* pGeneral{nullptr}; << 277 << 278 G4int verbose; << 279 G4int n_loss{0}; << 280 G4int run{-1}; << 281 << 282 G4bool all_tables_are_built{false}; << 283 G4bool startInitialisation{false}; << 284 G4bool resetParam{true}; << 285 G4bool isMaster{false}; << 286 263 287 std::vector<G4VEnergyLossProcess*> loss_vect 264 std::vector<G4VEnergyLossProcess*> loss_vector; 288 std::vector<PD> part_vector; 265 std::vector<PD> part_vector; 289 std::vector<PD> base_part_vector; 266 std::vector<PD> base_part_vector; >> 267 std::vector<G4bool> tables_are_built; >> 268 std::vector<G4bool> isActive; 290 std::vector<G4PhysicsTable*> dedx_vector; 269 std::vector<G4PhysicsTable*> dedx_vector; 291 std::vector<G4PhysicsTable*> range_vector; 270 std::vector<G4PhysicsTable*> range_vector; 292 std::vector<G4PhysicsTable*> inv_range_vecto 271 std::vector<G4PhysicsTable*> inv_range_vector; 293 std::vector<G4bool> tables_are_built; << 294 std::vector<G4bool> isActive; << 295 std::vector<G4VMultipleScattering*> msc_vect 272 std::vector<G4VMultipleScattering*> msc_vector; 296 std::vector<G4VEmProcess*> emp_vector; 273 std::vector<G4VEmProcess*> emp_vector; 297 std::vector<G4VEmModel*> mod_vector; 274 std::vector<G4VEmModel*> mod_vector; 298 std::vector<G4VEmFluctuationModel*> fmod_vec 275 std::vector<G4VEmFluctuationModel*> fmod_vector; 299 std::vector<G4VProcess*> p_vector; << 300 276 301 std::map<PD,G4VEnergyLossProcess*,std::less< << 277 // cash 302 }; << 278 G4VEnergyLossProcess* currentLoss; >> 279 PD currentParticle; >> 280 PD theElectron; >> 281 >> 282 G4int n_loss; >> 283 G4int run; >> 284 >> 285 G4bool all_tables_are_built; >> 286 // G4bool first_entry; >> 287 G4bool lossFluctuationFlag; >> 288 G4bool subCutoffFlag; >> 289 G4bool rndmStepFlag; >> 290 G4bool integral; >> 291 G4bool integralActive; >> 292 G4bool all_tables_are_stored; >> 293 G4bool buildCSDARange; >> 294 G4bool minEnergyActive; >> 295 G4bool maxEnergyActive; >> 296 G4bool maxEnergyForMuonsActive; >> 297 G4bool stepFunctionActive; >> 298 G4bool flagLPM; >> 299 G4bool splineFlag; >> 300 >> 301 G4double minSubRange; >> 302 G4double maxRangeVariation; >> 303 G4double maxFinalStep; >> 304 G4double minKinEnergy; >> 305 G4double maxKinEnergy; >> 306 G4double maxKinEnergyForMuons; >> 307 G4double bremsTh; >> 308 G4double factorForAngleLimit; >> 309 >> 310 G4LossTableBuilder* tableBuilder; >> 311 G4EnergyLossMessenger* theMessenger; >> 312 G4EmCorrections* emCorrections; >> 313 G4EmSaturation* emSaturation; >> 314 G4EmConfigurator* emConfigurator; 303 315 304 //....oooOO0OOooo........oooOO0OOooo........oo << 316 const G4ParticleDefinition* firstParticle; 305 //....oooOO0OOooo........oooOO0OOooo........oo << 317 G4int verbose; 306 318 307 inline << 319 }; 308 G4double G4LossTableManager::GetDEDX(const G4P << 309 G4double << 310 const G4M << 311 { << 312 if(aParticle != currentParticle) { GetEnergy << 313 return currentLoss ? currentLoss->GetDEDX(ki << 314 } << 315 320 >> 321 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 316 //....oooOO0OOooo........oooOO0OOooo........oo 322 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 317 323 318 inline << 324 inline G4VEnergyLossProcess* G4LossTableManager::GetEnergyLossProcess( 319 G4double G4LossTableManager::GetCSDARange(cons << 325 const G4ParticleDefinition *aParticle) 320 G4do << 321 cons << 322 { 326 { 323 if(aParticle != currentParticle) { GetEnergy << 327 if(aParticle != currentParticle) { 324 return currentLoss ? currentLoss->GetCSDARan << 328 currentParticle = aParticle; >> 329 std::map<PD,G4VEnergyLossProcess*,std::less<PD> >::const_iterator pos; >> 330 if ((pos = loss_map.find(aParticle)) != loss_map.end()) { >> 331 currentLoss = (*pos).second; >> 332 } else { >> 333 currentLoss = 0; >> 334 // ParticleHaveNoLoss(aParticle); >> 335 } >> 336 } >> 337 return currentLoss; 325 } 338 } 326 339 327 //....oooOO0OOooo........oooOO0OOooo........oo << 340 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 328 341 329 inline << 342 inline G4double G4LossTableManager::GetDEDX( 330 G4double G4LossTableManager::GetRangeFromRestr << 343 const G4ParticleDefinition *aParticle, 331 const G4ParticleD << 344 G4double kineticEnergy, 332 G4double kineticE << 345 const G4MaterialCutsCouple *couple) 333 const G4MaterialC << 334 { 346 { 335 if(aParticle != currentParticle) { GetEnergy 347 if(aParticle != currentParticle) { GetEnergyLossProcess(aParticle); } 336 return currentLoss ? currentLoss->GetRange(k << 348 G4double x; >> 349 if(currentLoss) { x = currentLoss->GetDEDX(kineticEnergy, couple); } >> 350 else { x = G4EnergyLossTables::GetDEDX(currentParticle, >> 351 kineticEnergy,couple,false); } >> 352 return x; 337 } 353 } 338 354 339 //....oooOO0OOooo........oooOO0OOooo........oo 355 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 340 356 341 inline << 357 inline G4double G4LossTableManager::GetSubDEDX( 342 G4double G4LossTableManager::GetRange(const G4 << 358 const G4ParticleDefinition *aParticle, 343 G4double << 359 G4double kineticEnergy, 344 const G4 << 360 const G4MaterialCutsCouple *couple) 345 { 361 { 346 if(aParticle != currentParticle) { GetEnergy 362 if(aParticle != currentParticle) { GetEnergyLossProcess(aParticle); } 347 return currentLoss ? currentLoss->GetRange(k << 363 G4double x = 0.0; >> 364 if(currentLoss) { x = currentLoss->GetDEDXForSubsec(kineticEnergy, couple); } >> 365 return x; 348 } 366 } 349 367 350 //....oooOO0OOooo........oooOO0OOooo........oo << 368 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 351 369 352 inline << 370 inline G4double G4LossTableManager::GetCSDARange( 353 G4double G4LossTableManager::GetEnergy(const G << 371 const G4ParticleDefinition *aParticle, 354 G4doubl << 372 G4double kineticEnergy, 355 const G << 373 const G4MaterialCutsCouple *couple) 356 { 374 { 357 if(aParticle != currentParticle) { GetEnergy 375 if(aParticle != currentParticle) { GetEnergyLossProcess(aParticle); } 358 return currentLoss ? currentLoss->GetKinetic << 376 G4double x = DBL_MAX; >> 377 if(currentLoss) { x = currentLoss->GetCSDARange(kineticEnergy, couple); } >> 378 return x; 359 } 379 } 360 380 361 //....oooOO0OOooo........oooOO0OOooo........oo << 381 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 362 382 363 inline << 383 inline G4double G4LossTableManager::GetRangeFromRestricteDEDX( 364 G4double G4LossTableManager::GetDEDXDispersion << 384 const G4ParticleDefinition *aParticle, 365 const G4MaterialC << 385 G4double kineticEnergy, 366 const G4DynamicPa << 386 const G4MaterialCutsCouple *couple) 367 G4double& length) << 368 { 387 { 369 const G4ParticleDefinition* aParticle = dp-> << 370 if(aParticle != currentParticle) { GetEnergy 388 if(aParticle != currentParticle) { GetEnergyLossProcess(aParticle); } 371 return currentLoss ? currentLoss->GetDEDXDis << 389 G4double x; >> 390 if(currentLoss) { x = currentLoss->GetRangeForLoss(kineticEnergy, couple); } >> 391 else { x = G4EnergyLossTables::GetRange(currentParticle,kineticEnergy, >> 392 couple,false); } >> 393 return x; 372 } 394 } 373 395 374 //....oooOO0OOooo........oooOO0OOooo........oo 396 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 375 397 376 inline G4bool G4LossTableManager::IsMaster() c << 398 inline G4double G4LossTableManager::GetRange( >> 399 const G4ParticleDefinition *aParticle, >> 400 G4double kineticEnergy, >> 401 const G4MaterialCutsCouple *couple) 377 { 402 { 378 return isMaster; << 403 if(aParticle != currentParticle) { GetEnergyLossProcess(aParticle); } >> 404 G4double x; >> 405 if(currentLoss) { x = currentLoss->GetRange(kineticEnergy, couple); } >> 406 else { x = G4EnergyLossTables::GetRange(currentParticle,kineticEnergy, >> 407 couple,false); } >> 408 return x; 379 } 409 } 380 410 381 //....oooOO0OOooo........oooOO0OOooo........oo 411 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 382 412 383 inline G4EmCorrections* G4LossTableManager::Em << 413 inline G4double G4LossTableManager::GetEnergy( 384 { << 414 const G4ParticleDefinition *aParticle, 385 return emCorrections; << 415 G4double range, 386 } << 416 const G4MaterialCutsCouple *couple) 387 << 388 //....oooOO0OOooo........oooOO0OOooo........oo << 389 << 390 inline G4VAtomDeexcitation* G4LossTableManager << 391 { 417 { 392 return atomDeexcitation; << 418 if(aParticle != currentParticle) { GetEnergyLossProcess(aParticle); } 393 } << 419 G4double x; 394 << 420 if(currentLoss) { x = currentLoss->GetKineticEnergy(range, couple); } 395 //....oooOO0OOooo........oooOO0OOooo........oo << 421 else { x = G4EnergyLossTables::GetPreciseEnergyFromRange(currentParticle,range, 396 << 422 couple,false); } 397 inline G4VSubCutProducer* G4LossTableManager:: << 423 return x; 398 { << 399 return subcutProducer; << 400 } 424 } 401 425 402 //....oooOO0OOooo........oooOO0OOooo........oo << 426 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 403 427 404 inline G4LossTableBuilder* G4LossTableManager: << 428 inline G4double G4LossTableManager::GetDEDXDispersion( >> 429 const G4MaterialCutsCouple *couple, >> 430 const G4DynamicParticle* dp, >> 431 G4double& length) 405 { 432 { 406 return tableBuilder; << 433 const G4ParticleDefinition* aParticle = dp->GetDefinition(); >> 434 if(aParticle != currentParticle) { >> 435 std::map<PD,G4VEnergyLossProcess*,std::less<PD> >::const_iterator pos; >> 436 if ((pos = loss_map.find(aParticle)) != loss_map.end()) { >> 437 currentParticle = aParticle; >> 438 currentLoss = (*pos).second; >> 439 } else { >> 440 ParticleHaveNoLoss(aParticle); >> 441 } >> 442 } >> 443 return currentLoss->GetDEDXDispersion(couple, dp, length); 407 } 444 } 408 445 409 //....oooOO0OOooo........oooOO0OOooo........oo << 446 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 410 << 411 inline void G4LossTableManager::SetGammaGenera << 412 { << 413 gGeneral = ptr; << 414 } << 415 << 416 //....oooOO0OOooo........oooOO0OOooo........oo << 417 << 418 inline G4VEmProcess* G4LossTableManager::GetGa << 419 { << 420 return gGeneral; << 421 } << 422 << 423 //....oooOO0OOooo........oooOO0OOooo........oo << 424 << 425 inline void G4LossTableManager::SetElectronGen << 426 { << 427 eGeneral = ptr; << 428 } << 429 << 430 //....oooOO0OOooo........oooOO0OOooo........oo << 431 << 432 inline G4VEmProcess* G4LossTableManager::GetEl << 433 { << 434 return eGeneral; << 435 } << 436 << 437 //....oooOO0OOooo........oooOO0OOooo........oo << 438 << 439 inline void G4LossTableManager::SetPositronGen << 440 { << 441 pGeneral = ptr; << 442 } << 443 << 444 //....oooOO0OOooo........oooOO0OOooo........oo << 445 << 446 inline G4VEmProcess* G4LossTableManager::GetPo << 447 { << 448 return pGeneral; << 449 } << 450 //....oooOO0OOooo........oooOO0OOooo........oo << 451 447 452 #endif 448 #endif >> 449 453 450