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