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