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: G4VEnergyLossProcess.hh,v 1.89 2009/07/03 14:39:17 vnivanch Exp $ >> 27 // GEANT4 tag $Name: 26 // 28 // 27 // ------------------------------------------- 29 // ------------------------------------------------------------------- 28 // 30 // 29 // GEANT4 Class header file 31 // GEANT4 Class header file 30 // 32 // 31 // 33 // 32 // File name: G4VEnergyLossProcess 34 // File name: G4VEnergyLossProcess 33 // 35 // 34 // Author: Vladimir Ivanchenko on base 36 // Author: Vladimir Ivanchenko on base of Laszlo Urban code 35 // 37 // 36 // Creation date: 03.01.2002 38 // Creation date: 03.01.2002 37 // 39 // 38 // Modifications: Vladimir Ivanchenko << 40 // Modifications: >> 41 // >> 42 // 26-12-02 Secondary production moved to derived classes (V.Ivanchenko) >> 43 // 20-01-03 Migrade to cut per region (V.Ivanchenko) >> 44 // 24-01-03 Make models region aware (V.Ivanchenko) >> 45 // 05-02-03 Fix compilation warnings (V.Ivanchenko) >> 46 // 13-02-03 SubCutoffProcessors defined for regions (V.Ivanchenko) >> 47 // 17-02-03 Fix problem of store/restore tables (V.Ivanchenko) >> 48 // 26-02-03 Region dependent step limit (V.Ivanchenko) >> 49 // 26-03-03 Add GetDEDXDispersion (V.Ivanchenko) >> 50 // 09-04-03 Fix problem of negative range limit for non integral (V.Ivanchenko) >> 51 // 13-05-03 Add calculation of precise range (V.Ivanchenko) >> 52 // 21-07-03 Add UpdateEmModel method (V.Ivanchenko) >> 53 // 12-11-03 G4EnergyLossSTD -> G4EnergyLossProcess (V.Ivanchenko) >> 54 // 14-01-04 Activate precise range calculation (V.Ivanchenko) >> 55 // 10-03-04 Fix problem of step limit calculation (V.Ivanchenko) >> 56 // 30-06-04 make destructor virtual (V.Ivanchenko) >> 57 // 05-07-04 fix problem of GenericIons seen at small cuts (V.Ivanchenko) >> 58 // 03-08-04 Add DEDX table to all processes for control on integral range(VI) >> 59 // 06-08-04 Clear up names of member functions (V.Ivanchenko) >> 60 // 27-08-04 Add NeedBuildTables method (V.Ivanchneko) >> 61 // 09-09-04 Bug fix for the integral mode with 2 peaks (V.Ivanchneko) >> 62 // 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivanchenko) >> 63 // 08-04-05 Major optimisation of internal interfaces (V.Ivanchenko) >> 64 // 11-04-05 Use MaxSecondaryEnergy from a model (V.Ivanchenko) >> 65 // 10-01-05 Remove SetStepLimits (V.Ivanchenko) >> 66 // 10-01-06 PreciseRange -> CSDARange (V.Ivantchenko) >> 67 // 13-01-06 Remove AddSubCutSecondaries and cleanup (V.Ivantchenko) >> 68 // 20-01-06 Introduce G4EmTableType and reducing number of methods (VI) >> 69 // 26-01-06 Add public method GetCSDARange (V.Ivanchenko) >> 70 // 22-03-06 Add SetDynamicMassCharge (V.Ivanchenko) >> 71 // 23-03-06 Use isIonisation flag (V.Ivanchenko) >> 72 // 13-05-06 Add method to access model by index (V.Ivanchenko) >> 73 // 14-01-07 add SetEmModel(index) and SetFluctModel() (mma) >> 74 // 15-01-07 Add separate ionisation tables and reorganise get/set methods for >> 75 // dedx tables (V.Ivanchenko) >> 76 // 13-03-07 use SafetyHelper instead of navigator (V.Ivanchenko) >> 77 // 27-07-07 use stl vector for emModels instead of C-array (V.Ivanchenko) >> 78 // 25-09-07 More accurate handling zero xsect in >> 79 // PostStepGetPhysicalInteractionLength (V.Ivanchenko) >> 80 // 27-10-07 Virtual functions moved to source (V.Ivanchenko) >> 81 // 15-07-08 Reorder class members for further multi-thread development (VI) 39 // 82 // 40 // Class Description: 83 // Class Description: 41 // 84 // 42 // It is the unified energy loss process it ca 85 // It is the unified energy loss process it calculates the continuous 43 // energy loss for charged particles using a s 86 // energy loss for charged particles using a set of Energy Loss 44 // models valid for different energy regions. 87 // models valid for different energy regions. There are a possibility 45 // to create and access to dE/dx and range tab 88 // to create and access to dE/dx and range tables, or to calculate 46 // that information on fly. 89 // that information on fly. 47 90 48 // ------------------------------------------- 91 // ------------------------------------------------------------------- 49 // 92 // 50 93 51 #ifndef G4VEnergyLossProcess_h 94 #ifndef G4VEnergyLossProcess_h 52 #define G4VEnergyLossProcess_h 1 95 #define G4VEnergyLossProcess_h 1 53 96 54 #include "G4VContinuousDiscreteProcess.hh" 97 #include "G4VContinuousDiscreteProcess.hh" 55 #include "globals.hh" 98 #include "globals.hh" 56 #include "G4Material.hh" 99 #include "G4Material.hh" 57 #include "G4MaterialCutsCouple.hh" 100 #include "G4MaterialCutsCouple.hh" 58 #include "G4Track.hh" 101 #include "G4Track.hh" 59 #include "G4EmModelManager.hh" 102 #include "G4EmModelManager.hh" >> 103 #include "G4UnitsTable.hh" 60 #include "G4ParticleChangeForLoss.hh" 104 #include "G4ParticleChangeForLoss.hh" 61 #include "G4EmTableType.hh" 105 #include "G4EmTableType.hh" 62 #include "G4EmSecondaryParticleType.hh" << 63 #include "G4PhysicsTable.hh" 106 #include "G4PhysicsTable.hh" 64 #include "G4PhysicsVector.hh" 107 #include "G4PhysicsVector.hh" 65 108 66 class G4Step; 109 class G4Step; 67 class G4ParticleDefinition; 110 class G4ParticleDefinition; 68 class G4EmParameters; << 69 class G4VEmModel; 111 class G4VEmModel; 70 class G4VEmFluctuationModel; 112 class G4VEmFluctuationModel; 71 class G4DataVector; 113 class G4DataVector; 72 class G4Region; 114 class G4Region; 73 class G4SafetyHelper; 115 class G4SafetyHelper; 74 class G4VAtomDeexcitation; << 75 class G4VSubCutProducer; << 76 class G4EmBiasingManager; << 77 class G4LossTableManager; << 78 class G4EmDataHandler; << 79 116 80 //....oooOO0OOooo........oooOO0OOooo........oo 117 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 81 118 82 class G4VEnergyLossProcess : public G4VContinu 119 class G4VEnergyLossProcess : public G4VContinuousDiscreteProcess 83 { 120 { 84 public: 121 public: 85 122 86 G4VEnergyLossProcess(const G4String& name = 123 G4VEnergyLossProcess(const G4String& name = "EnergyLoss", 87 G4ProcessType type = fE << 124 G4ProcessType type = fElectromagnetic); >> 125 >> 126 virtual ~G4VEnergyLossProcess(); 88 127 89 ~G4VEnergyLossProcess() override; << 128 private: >> 129 // clean vectors and arrays >> 130 void Clean(); 90 131 91 //------------------------------------------ 132 //------------------------------------------------------------------------ 92 // Virtual methods to be implemented in conc 133 // Virtual methods to be implemented in concrete processes 93 //------------------------------------------ 134 //------------------------------------------------------------------------ 94 135 95 protected: << 136 public: >> 137 virtual G4bool IsApplicable(const G4ParticleDefinition& p) = 0; >> 138 >> 139 virtual void PrintInfo() = 0; 96 140 97 // description of specific process parameter << 141 protected: 98 virtual void StreamProcessInfo(std::ostream& << 99 142 100 virtual void InitialiseEnergyLossProcess(con 143 virtual void InitialiseEnergyLossProcess(const G4ParticleDefinition*, 101 con 144 const G4ParticleDefinition*) = 0; 102 145 103 public: << 146 //------------------------------------------------------------------------ >> 147 // Methods with standard implementation; may be overwritten if needed >> 148 //------------------------------------------------------------------------ 104 149 105 // used as low energy limit LambdaTable << 106 virtual G4double MinPrimaryEnergy(const G4Pa 150 virtual G4double MinPrimaryEnergy(const G4ParticleDefinition*, 107 const G4Ma << 151 const G4Material*, G4double cut); 108 152 109 // print documentation in html format << 153 //------------------------------------------------------------------------ 110 void ProcessDescription(std::ostream& outFil << 154 // Virtual methods implementation common to all EM ContinuousDiscrete >> 155 // processes. Further inheritance is not assumed >> 156 //------------------------------------------------------------------------ >> 157 >> 158 public: 111 159 112 // prepare all tables 160 // prepare all tables 113 void PreparePhysicsTable(const G4ParticleDef << 161 void PreparePhysicsTable(const G4ParticleDefinition&); 114 162 115 // build all tables 163 // build all tables 116 void BuildPhysicsTable(const G4ParticleDefin << 164 void BuildPhysicsTable(const G4ParticleDefinition&); 117 165 118 // build a table 166 // build a table 119 G4PhysicsTable* BuildDEDXTable(G4EmTableType 167 G4PhysicsTable* BuildDEDXTable(G4EmTableType tType = fRestricted); 120 168 121 // build a table 169 // build a table 122 G4PhysicsTable* BuildLambdaTable(G4EmTableTy 170 G4PhysicsTable* BuildLambdaTable(G4EmTableType tType = fRestricted); 123 171 124 // Called before tracking of each new G4Trac << 172 // summary printout after initialisation 125 void StartTracking(G4Track*) override; << 173 void PrintInfoDefinition(); >> 174 >> 175 // Add subcutoff option for the region >> 176 void ActivateSubCutoff(G4bool val, const G4Region* region = 0); >> 177 >> 178 // Activate deexcitation code for region >> 179 void ActivateDeexcitation(G4bool, const G4Region* region = 0); 126 180 127 // Step limit from AlongStep 181 // Step limit from AlongStep 128 G4double AlongStepGetPhysicalInteractionLeng << 182 G4double AlongStepGetPhysicalInteractionLength(const G4Track&, 129 const G4Trac << 183 G4double previousStepSize, 130 G4double pr << 184 G4double currentMinimumStep, 131 G4double cu << 185 G4double& currentSafety, 132 G4double& cu << 186 G4GPILSelection* selection); 133 G4GPILSelect << 134 187 135 // Step limit from cross section 188 // Step limit from cross section 136 G4double PostStepGetPhysicalInteractionLengt << 189 G4double PostStepGetPhysicalInteractionLength(const G4Track& track, 137 const G4Trac << 190 G4double previousStepSize, 138 G4double pre << 191 G4ForceCondition* condition); 139 G4ForceCondi << 140 192 141 // AlongStep computations 193 // AlongStep computations 142 G4VParticleChange* AlongStepDoIt(const G4Tra << 194 G4VParticleChange* AlongStepDoIt(const G4Track&, const G4Step&); >> 195 >> 196 // Sampling of secondaries in vicinity of geometrical boundary >> 197 void SampleSubCutSecondaries(std::vector<G4Track*>&, const G4Step&, >> 198 G4VEmModel* model, G4int matIdx, >> 199 G4double& extraEdep); 143 200 144 // PostStep sampling of secondaries 201 // PostStep sampling of secondaries 145 G4VParticleChange* PostStepDoIt(const G4Trac << 202 G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&); 146 203 147 // Store all PhysicsTable in files. 204 // Store all PhysicsTable in files. 148 // Return false in case of any fatal failure 205 // Return false in case of any fatal failure at I/O 149 G4bool StorePhysicsTable(const G4ParticleDef 206 G4bool StorePhysicsTable(const G4ParticleDefinition*, 150 const G4String& dir 207 const G4String& directory, 151 G4bool ascii = fals << 208 G4bool ascii = false); 152 209 153 // Retrieve all Physics from a files. 210 // Retrieve all Physics from a files. 154 // Return true if all the Physics Table are 211 // Return true if all the Physics Table are built. 155 // Return false if any fatal failure. 212 // Return false if any fatal failure. 156 G4bool RetrievePhysicsTable(const G4Particle 213 G4bool RetrievePhysicsTable(const G4ParticleDefinition*, 157 const G4String& 214 const G4String& directory, 158 G4bool ascii) ov << 215 G4bool ascii); 159 216 160 private: 217 private: 161 << 218 // store a table 162 // summary printout after initialisation << 219 G4bool StoreTable(const G4ParticleDefinition* p, 163 void StreamInfo(std::ostream& out, const G4P << 220 G4PhysicsTable*, G4bool ascii, 164 G4bool rst=false) const; << 221 const G4String& directory, >> 222 const G4String& tname); >> 223 >> 224 // retrieve a table >> 225 G4bool RetrieveTable(const G4ParticleDefinition* p, >> 226 G4PhysicsTable*, G4bool ascii, >> 227 const G4String& directory, >> 228 const G4String& tname, >> 229 G4bool mandatory); 165 230 166 //------------------------------------------ 231 //------------------------------------------------------------------------ 167 // Public interface to cross section, mfp an 232 // Public interface to cross section, mfp and sampling of fluctuations 168 // These methods are not used in run time 233 // These methods are not used in run time 169 //------------------------------------------ 234 //------------------------------------------------------------------------ 170 235 171 public: 236 public: 172 << 173 // access to dispersion of restricted energy 237 // access to dispersion of restricted energy loss 174 G4double GetDEDXDispersion(const G4MaterialC 238 G4double GetDEDXDispersion(const G4MaterialCutsCouple *couple, 175 const G4DynamicPa << 239 const G4DynamicParticle* dp, 176 G4double length); << 240 G4double length); 177 241 178 // Access to cross section table 242 // Access to cross section table 179 G4double CrossSectionPerVolume(G4double kine 243 G4double CrossSectionPerVolume(G4double kineticEnergy, 180 const G4Mater << 244 const G4MaterialCutsCouple* couple); 181 G4double CrossSectionPerVolume(G4double kine << 182 const G4Mater << 183 G4double logK << 184 245 185 // access to cross section 246 // access to cross section 186 G4double MeanFreePath(const G4Track& track); 247 G4double MeanFreePath(const G4Track& track); 187 248 188 // access to step limit 249 // access to step limit 189 G4double ContinuousStepLimit(const G4Track& 250 G4double ContinuousStepLimit(const G4Track& track, 190 G4double previo << 251 G4double previousStepSize, 191 G4double curren << 252 G4double currentMinimumStep, 192 G4double& curre << 253 G4double& currentSafety); 193 254 194 protected: 255 protected: 195 256 196 // implementation of the pure virtual method 257 // implementation of the pure virtual method 197 G4double GetMeanFreePath(const G4Track& trac 258 G4double GetMeanFreePath(const G4Track& track, 198 G4double previousSt << 259 G4double previousStepSize, 199 G4ForceCondition* c << 260 G4ForceCondition* condition); 200 261 201 // implementation of the pure virtual method 262 // implementation of the pure virtual method 202 G4double GetContinuousStepLimit(const G4Trac 263 G4double GetContinuousStepLimit(const G4Track& track, 203 G4double pre << 264 G4double previousStepSize, 204 G4double cur << 265 G4double currentMinimumStep, 205 G4double& cu << 266 G4double& currentSafety); 206 267 207 // creation of an empty vector for cross sec << 268 //------------------------------------------------------------------------ >> 269 // Run time method which may be also used by derived processes >> 270 //------------------------------------------------------------------------ >> 271 >> 272 // creeation of an empty vector for cross section 208 G4PhysicsVector* LambdaPhysicsVector(const G 273 G4PhysicsVector* LambdaPhysicsVector(const G4MaterialCutsCouple*, 209 G4doubl << 274 G4double cut); 210 275 211 inline std::size_t CurrentMaterialCutsCouple << 276 inline size_t CurrentMaterialCutsCoupleIndex() const; >> 277 >> 278 inline G4double GetCurrentRange() const; 212 279 213 //------------------------------------------ 280 //------------------------------------------------------------------------ 214 // Specific methods to set, access, modify m 281 // Specific methods to set, access, modify models 215 //------------------------------------------ 282 //------------------------------------------------------------------------ 216 283 217 // Select model in run time 284 // Select model in run time 218 inline void SelectModel(G4double kinEnergy); 285 inline void SelectModel(G4double kinEnergy); 219 286 220 public: 287 public: 221 // Select model by energy and couple index << 288 // Select model by energy and region index 222 // Not for run time processing << 223 inline G4VEmModel* SelectModelForMaterial(G4 289 inline G4VEmModel* SelectModelForMaterial(G4double kinEnergy, 224 st << 290 size_t& idx) const; 225 291 226 // Add EM model coupled with fluctuation mod 292 // Add EM model coupled with fluctuation model for region, smaller value 227 // of order defines which pair of models wil 293 // of order defines which pair of models will be selected for a given 228 // energy interval 294 // energy interval 229 void AddEmModel(G4int, G4VEmModel*, 295 void AddEmModel(G4int, G4VEmModel*, 230 G4VEmFluctuationModel* fluc << 296 G4VEmFluctuationModel* fluc = 0, 231 const G4Region* region = nul << 297 const G4Region* region = 0); 232 298 233 // Assign a model to a process local list, t << 299 // Define new energy range for the model identified by the name 234 // the derived process should execute AddEmM << 300 void UpdateEmModel(const G4String&, G4double, G4double); 235 void SetEmModel(G4VEmModel*, G4int index=0); << 236 301 237 // Access to models << 302 // Assign a model to a process 238 inline std::size_t NumberOfModels() const; << 303 void SetEmModel(G4VEmModel*, G4int index=1); 239 304 240 // Return a model from the local list << 305 // return the assigned model 241 inline G4VEmModel* EmModel(std::size_t index << 306 G4VEmModel* EmModel(G4int index=1); 242 307 243 // Access to models from G4EmModelManager li << 308 // Access to models 244 inline G4VEmModel* GetModelByIndex(std::size << 309 G4VEmModel* GetModelByIndex(G4int idx = 0, G4bool ver = false); >> 310 >> 311 G4int NumberOfModels(); 245 312 246 // Assign a fluctuation model to a process 313 // Assign a fluctuation model to a process 247 inline void SetFluctModel(G4VEmFluctuationMo << 314 void SetFluctModel(G4VEmFluctuationModel*); 248 315 249 // Return the assigned fluctuation model << 316 // return the assigned fluctuation model 250 inline G4VEmFluctuationModel* FluctModel() c << 317 inline G4VEmFluctuationModel* FluctModel(); 251 318 252 //------------------------------------------ 319 //------------------------------------------------------------------------ 253 // Define and access particle type 320 // Define and access particle type 254 //------------------------------------------ 321 //------------------------------------------------------------------------ 255 322 256 protected: 323 protected: 257 inline void SetParticle(const G4ParticleDefi 324 inline void SetParticle(const G4ParticleDefinition* p); 258 inline void SetSecondaryParticle(const G4Par 325 inline void SetSecondaryParticle(const G4ParticleDefinition* p); 259 326 260 public: 327 public: 261 inline void SetBaseParticle(const G4Particle 328 inline void SetBaseParticle(const G4ParticleDefinition* p); 262 inline const G4ParticleDefinition* Particle( 329 inline const G4ParticleDefinition* Particle() const; 263 inline const G4ParticleDefinition* BaseParti 330 inline const G4ParticleDefinition* BaseParticle() const; 264 inline const G4ParticleDefinition* Secondary 331 inline const G4ParticleDefinition* SecondaryParticle() const; 265 332 266 // hide assignment operator << 267 G4VEnergyLossProcess(G4VEnergyLossProcess &) << 268 G4VEnergyLossProcess & operator=(const G4VEn << 269 << 270 //------------------------------------------ 333 //------------------------------------------------------------------------ 271 // Get/set parameters to configure the proce 334 // Get/set parameters to configure the process at initialisation time 272 //------------------------------------------ 335 //------------------------------------------------------------------------ 273 336 274 // Add subcut processor for the region << 337 // Add subcutoff process (bremsstrahlung) to sample secondary 275 void ActivateSubCutoff(const G4Region* regio << 338 // particle production in vicinity of the geometry boundary 276 << 339 void AddCollaborativeProcess(G4VEnergyLossProcess*); 277 // Activate biasing << 278 void SetCrossSectionBiasingFactor(G4double f << 279 << 280 void ActivateForcedInteraction(G4double leng << 281 const G4Strin << 282 G4bool flag = << 283 << 284 void ActivateSecondaryBiasing(const G4String << 285 G4double energ << 286 340 287 inline void SetLossFluctuations(G4bool val); 341 inline void SetLossFluctuations(G4bool val); >> 342 inline void SetRandomStep(G4bool val); 288 343 289 inline void SetSpline(G4bool val); << 344 inline void SetIntegral(G4bool val); 290 inline void SetCrossSectionType(G4CrossSecti << 345 inline G4bool IsIntegral() const; 291 inline G4CrossSectionType CrossSectionType() << 292 346 293 // Set/Get flag "isIonisation" 347 // Set/Get flag "isIonisation" 294 void SetIonisation(G4bool val); << 348 inline void SetIonisation(G4bool val); 295 inline G4bool IsIonisationProcess() const; 349 inline G4bool IsIonisationProcess() const; 296 350 297 // Redefine parameteters for stepping contro 351 // Redefine parameteters for stepping control 298 void SetLinearLossLimit(G4double val); << 352 // 299 void SetStepFunction(G4double v1, G4double v << 353 inline void SetLinearLossLimit(G4double val); 300 void SetLowestEnergyLimit(G4double); << 354 inline void SetMinSubRange(G4double val); >> 355 inline void SetLambdaFactor(G4double val); >> 356 inline void SetStepFunction(G4double v1, G4double v2); >> 357 inline void SetLowestEnergyLimit(G4double); 301 358 302 inline G4int NumberOfSubCutoffRegions() cons 359 inline G4int NumberOfSubCutoffRegions() const; >> 360 inline G4int NumberOfDERegions() const; 303 361 304 //------------------------------------------ 362 //------------------------------------------------------------------------ 305 // Specific methods to path Physics Tables t 363 // Specific methods to path Physics Tables to the process 306 //------------------------------------------ 364 //------------------------------------------------------------------------ 307 365 308 void SetDEDXTable(G4PhysicsTable* p, G4EmTab 366 void SetDEDXTable(G4PhysicsTable* p, G4EmTableType tType); 309 void SetCSDARangeTable(G4PhysicsTable* pRang 367 void SetCSDARangeTable(G4PhysicsTable* pRange); 310 void SetRangeTableForLoss(G4PhysicsTable* p) 368 void SetRangeTableForLoss(G4PhysicsTable* p); >> 369 void SetSecondaryRangeTable(G4PhysicsTable* p); 311 void SetInverseRangeTable(G4PhysicsTable* p) 370 void SetInverseRangeTable(G4PhysicsTable* p); 312 void SetLambdaTable(G4PhysicsTable* p); << 313 371 314 void SetTwoPeaksXS(std::vector<G4TwoPeaksXS* << 372 void SetLambdaTable(G4PhysicsTable* p); 315 void SetEnergyOfCrossSectionMax(std::vector< << 373 void SetSubLambdaTable(G4PhysicsTable* p); 316 374 317 //------------------------------------------ << 375 // Binning for dEdx, range, inverse range and labda tables 318 // Specific methods to define custom Physics << 376 inline void SetDEDXBinning(G4int nbins); 319 //------------------------------------------ << 377 inline void SetLambdaBinning(G4int nbins); 320 378 321 // Binning for dEdx, range, inverse range an << 379 // Binning for dEdx, range, and inverse range tables 322 void SetDEDXBinning(G4int nbins); << 380 inline void SetDEDXBinningForCSDARange(G4int nbins); 323 381 324 // Min kinetic energy for tables 382 // Min kinetic energy for tables 325 void SetMinKinEnergy(G4double e); << 383 inline void SetMinKinEnergy(G4double e); 326 inline G4double MinKinEnergy() const; 384 inline G4double MinKinEnergy() const; 327 385 328 // Max kinetic energy for tables 386 // Max kinetic energy for tables 329 void SetMaxKinEnergy(G4double e); << 387 inline void SetMaxKinEnergy(G4double e); 330 inline G4double MaxKinEnergy() const; 388 inline G4double MaxKinEnergy() const; 331 389 332 // Biasing parameters << 390 // Max kinetic energy for tables 333 inline G4double CrossSectionBiasingFactor() << 391 inline void SetMaxKinEnergyForCSDARange(G4double e); 334 392 335 // Return values for given G4MaterialCutsCou 393 // Return values for given G4MaterialCutsCouple 336 inline G4double GetDEDX(G4double kineticEner << 394 inline G4double GetDEDX(G4double& kineticEnergy, const G4MaterialCutsCouple*); 337 inline G4double GetCSDADEDX(G4double kinetic << 395 inline G4double GetDEDXForSubsec(G4double& kineticEnergy, 338 const G4Material << 396 const G4MaterialCutsCouple*); 339 inline G4double GetDEDX(G4double kineticEner << 397 inline G4double GetRange(G4double& kineticEnergy, const G4MaterialCutsCouple*); 340 G4double logKineticE << 398 inline G4double GetCSDARange(G4double& kineticEnergy, const G4MaterialCutsCouple*); 341 inline G4double GetRange(G4double kineticEne << 399 inline G4double GetRangeForLoss(G4double& kineticEnergy, const G4MaterialCutsCouple*); 342 inline G4double GetRange(G4double kineticEne << 400 inline G4double GetKineticEnergy(G4double& range, const G4MaterialCutsCouple*); 343 G4double logKinetic << 401 inline G4double GetLambda(G4double& kineticEnergy, const G4MaterialCutsCouple*); 344 inline G4double GetCSDARange(G4double kineti << 345 const G4Materia << 346 inline G4double GetKineticEnergy(G4double ra << 347 const G4Mat << 348 inline G4double GetLambda(G4double kineticEn << 349 inline G4double GetLambda(G4double kineticEn << 350 G4double logKineti << 351 402 352 inline G4bool TablesAreBuilt() const; 403 inline G4bool TablesAreBuilt() const; 353 404 354 // Access to specific tables 405 // Access to specific tables 355 inline G4PhysicsTable* DEDXTable() const; 406 inline G4PhysicsTable* DEDXTable() const; >> 407 inline G4PhysicsTable* DEDXTableForSubsec() const; 356 inline G4PhysicsTable* DEDXunRestrictedTable 408 inline G4PhysicsTable* DEDXunRestrictedTable() const; 357 inline G4PhysicsTable* IonisationTable() con 409 inline G4PhysicsTable* IonisationTable() const; >> 410 inline G4PhysicsTable* IonisationTableForSubsec() const; 358 inline G4PhysicsTable* CSDARangeTable() cons 411 inline G4PhysicsTable* CSDARangeTable() const; 359 inline G4PhysicsTable* RangeTableForLoss() c 412 inline G4PhysicsTable* RangeTableForLoss() const; 360 inline G4PhysicsTable* InverseRangeTable() c 413 inline G4PhysicsTable* InverseRangeTable() const; 361 inline G4PhysicsTable* LambdaTable() const; << 414 inline G4PhysicsTable* LambdaTable(); 362 inline std::vector<G4TwoPeaksXS*>* TwoPeaksX << 415 inline G4PhysicsTable* SubLambdaTable(); 363 inline std::vector<G4double>* EnergyOfCrossS << 364 << 365 inline G4bool UseBaseMaterial() const; << 366 416 367 //------------------------------------------ 417 //------------------------------------------------------------------------ 368 // Run time method for simulation of ionisat 418 // Run time method for simulation of ionisation 369 //------------------------------------------ 419 //------------------------------------------------------------------------ 370 420 371 // access atom on which interaction happens << 421 // sample range at the end of a step 372 const G4Element* GetCurrentElement() const; << 422 inline G4double SampleRange(); 373 423 374 // Set scaling parameters for ions is needed 424 // Set scaling parameters for ions is needed to G4EmCalculator 375 void SetDynamicMassCharge(G4double massratio << 425 inline void SetDynamicMassCharge(G4double massratio, G4double charge2ratio); 376 426 377 private: 427 private: 378 428 379 void FillSecondariesAlongStep(G4double weigh << 380 << 381 void PrintWarning(const G4String&, G4double << 382 << 383 // define material and indexes 429 // define material and indexes 384 inline void DefineMaterial(const G4MaterialC 430 inline void DefineMaterial(const G4MaterialCutsCouple* couple); 385 431 386 //------------------------------------------ 432 //------------------------------------------------------------------------ 387 // Compute values using scaling relation, ma 433 // Compute values using scaling relation, mass and charge of based particle 388 //------------------------------------------ 434 //------------------------------------------------------------------------ 389 inline G4double GetDEDXForScaledEnergy(G4dou << 390 inline G4double GetDEDXForScaledEnergy(G4dou << 391 G4dou << 392 inline G4double GetIonisationForScaledEnergy << 393 inline G4double GetScaledRangeForScaledEnerg << 394 inline G4double GetScaledRangeForScaledEnerg << 395 << 396 << 397 inline G4double GetLimitScaledRangeForScaled << 398 inline G4double GetLimitScaledRangeForScaled << 399 << 400 435 >> 436 inline G4double GetDEDXForScaledEnergy(G4double scaledKinEnergy); >> 437 inline G4double GetSubDEDXForScaledEnergy(G4double scaledKinEnergy); >> 438 inline G4double GetIonisationForScaledEnergy(G4double scaledKinEnergy); >> 439 inline G4double GetSubIonisationForScaledEnergy(G4double scaledKinEnergy); >> 440 inline G4double GetScaledRangeForScaledEnergy(G4double scaledKinEnergy); >> 441 inline G4double GetLimitScaledRangeForScaledEnergy(G4double scaledKinEnergy); 401 inline G4double ScaledKinEnergyForLoss(G4dou 442 inline G4double ScaledKinEnergyForLoss(G4double range); 402 inline G4double GetLambdaForScaledEnergy(G4d << 443 inline G4double GetLambdaForScaledEnergy(G4double scaledKinEnergy); 403 inline G4double GetLambdaForScaledEnergy(G4d << 444 inline void ComputeLambdaForScaledEnergy(G4double scaledKinEnergy); 404 G4d << 405 445 406 inline G4double LogScaledEkin(const G4Track& << 446 // hide assignment operator 407 << 447 G4VEnergyLossProcess(G4VEnergyLossProcess &); 408 void ComputeLambdaForScaledEnergy(G4double s << 448 G4VEnergyLossProcess & operator=(const G4VEnergyLossProcess &right); 409 const G4Tr << 410 449 411 G4bool IsRegionForCubcutProcessor(const G4Tr << 450 // ======== Parameters of the class fixed at construction ========= 412 451 413 protected: << 452 G4EmModelManager* modelManager; >> 453 G4SafetyHelper* safetyHelper; 414 454 415 G4ParticleChangeForLoss fParticleChange; << 455 const G4ParticleDefinition* secondaryParticle; 416 const G4Material* currentMaterial << 456 const G4ParticleDefinition* theElectron; 417 const G4MaterialCutsCouple* currentCouple = << 457 const G4ParticleDefinition* thePositron; >> 458 const G4ParticleDefinition* theGenericIon; >> 459 >> 460 G4PhysicsVector* vstrag; >> 461 >> 462 // ======== Parameters of the class fixed at initialisation ======= >> 463 >> 464 std::vector<G4VEmModel*> emModels; >> 465 G4VEmFluctuationModel* fluctModel; >> 466 std::vector<const G4Region*> scoffRegions; >> 467 std::vector<const G4Region*> deRegions; >> 468 G4int nSCoffRegions; >> 469 G4int nDERegions; >> 470 G4bool* idxSCoffRegions; >> 471 G4bool* idxDERegions; >> 472 >> 473 std::vector<G4VEnergyLossProcess*> scProcesses; >> 474 G4int nProcesses; >> 475 >> 476 // tables and vectors >> 477 G4PhysicsTable* theDEDXTable; >> 478 G4PhysicsTable* theDEDXSubTable; >> 479 G4PhysicsTable* theDEDXunRestrictedTable; >> 480 G4PhysicsTable* theIonisationTable; >> 481 G4PhysicsTable* theIonisationSubTable; >> 482 G4PhysicsTable* theRangeTableForLoss; >> 483 G4PhysicsTable* theCSDARangeTable; >> 484 G4PhysicsTable* theSecondaryRangeTable; >> 485 G4PhysicsTable* theInverseRangeTable; >> 486 G4PhysicsTable* theLambdaTable; >> 487 G4PhysicsTable* theSubLambdaTable; >> 488 G4double* theDEDXAtMaxEnergy; >> 489 G4double* theRangeAtMaxEnergy; >> 490 G4double* theEnergyOfCrossSectionMax; >> 491 G4double* theCrossSectionMax; 418 492 419 private: << 493 const G4DataVector* theCuts; >> 494 const G4DataVector* theSubCuts; 420 495 421 G4LossTableManager* lManager; << 496 const G4ParticleDefinition* baseParticle; 422 G4EmModelManager* modelManager; << 423 G4VEmModel* currentModel = n << 424 G4EmBiasingManager* biasManager = nu << 425 G4SafetyHelper* safetyHelper; << 426 G4EmParameters* theParameters; << 427 G4VEmFluctuationModel* fluctModel = nul << 428 G4VAtomDeexcitation* atomDeexcitation << 429 G4VSubCutProducer* subcutProducer = << 430 << 431 const G4ParticleDefinition* particle = nullp << 432 const G4ParticleDefinition* baseParticle = n << 433 const G4ParticleDefinition* secondaryParticl << 434 G4EmDataHandler* theData = nullptr; << 435 << 436 G4PhysicsTable* theDEDXTable = nullptr; << 437 G4PhysicsTable* theDEDXunRestrictedTable = n << 438 G4PhysicsTable* theIonisationTable = nullptr << 439 G4PhysicsTable* theRangeTableForLoss = nullp << 440 G4PhysicsTable* theCSDARangeTable = nullptr; << 441 G4PhysicsTable* theInverseRangeTable = nullp << 442 G4PhysicsTable* theLambdaTable = nullptr; << 443 << 444 std::vector<const G4Region*>* scoffRegions = << 445 std::vector<G4VEmModel*>* emModels = nul << 446 const std::vector<G4int>* theDensityIdx << 447 const std::vector<G4double>* theDensityFact << 448 const G4DataVector* theCuts = null << 449 497 450 std::vector<G4double>* theEnergyOfCrossSecti << 498 G4int nBins; 451 std::vector<G4TwoPeaksXS*>* fXSpeaks = nullp << 499 G4int nBinsCSDA; 452 500 453 G4double lowestKinEnergy; 501 G4double lowestKinEnergy; 454 G4double minKinEnergy; 502 G4double minKinEnergy; 455 G4double maxKinEnergy; 503 G4double maxKinEnergy; 456 G4double maxKinEnergyCSDA; 504 G4double maxKinEnergyCSDA; 457 505 458 G4double linLossLimit = 0.01; << 506 G4double linLossLimit; 459 G4double dRoverRange = 0.2; << 507 G4double minSubRange; >> 508 G4double dRoverRange; 460 G4double finalRange; 509 G4double finalRange; 461 G4double lambdaFactor = 0.8; << 510 G4double lambdaFactor; 462 G4double invLambdaFactor; << 511 463 G4double biasFactor = 1.0; << 512 G4bool lossFluctuationFlag; 464 << 513 G4bool rndmStepFlag; 465 G4double massRatio = 1.0; << 514 G4bool tablesAreBuilt; 466 G4double logMassRatio = 0.0; << 515 G4bool integral; 467 G4double fFactor = 1.0; << 516 G4bool isIon; 468 G4double reduceFactor = 1.0; << 517 G4bool isIonisation; 469 G4double chargeSqRatio = 1.0; << 518 G4bool useSubCutoff; 470 G4double fRange = 0.0; << 519 G4bool useDeexcitation; 471 G4double fRangeEnergy = 0.0; << 472 520 473 protected: 521 protected: 474 522 475 G4double preStepLambda = 0.0; << 523 G4ParticleChangeForLoss fParticleChange; 476 G4double preStepKinEnergy = 0.0; << 477 G4double preStepScaledEnergy = 0.0; << 478 G4double mfpKinEnergy = 0.0; << 479 524 480 std::size_t currentCoupleIndex = 0; << 525 // ======== Cashed values - may be state dependent ================ 481 526 482 private: 527 private: 483 528 484 G4int nBins; << 529 std::vector<G4DynamicParticle*> secParticles; 485 G4int nBinsCSDA; << 530 std::vector<G4Track*> scTracks; 486 G4int numberOfModels = 0; << 531 487 G4int nSCoffRegions = 0; << 532 const G4ParticleDefinition* particle; 488 G4int secID = _DeltaElectron; << 533 489 G4int tripletID = _TripletElectron; << 534 G4VEmModel* currentModel; 490 G4int biasID = _DeltaEBelowCut; << 535 const G4Material* currentMaterial; 491 G4int epixeID = _ePIXE; << 536 const G4MaterialCutsCouple* currentCouple; 492 G4int gpixeID = _GammaPIXE; << 537 size_t currentMaterialIndex; 493 G4int mainSecondaries = 1; << 538 494 << 539 G4int nWarnings; 495 std::size_t basedCoupleIndex = 0; << 540 496 std::size_t coupleIdxRange = 0; << 541 G4double massRatio; 497 std::size_t idxDEDX = 0; << 542 G4double reduceFactor; 498 std::size_t idxDEDXunRestricted = 0; << 543 G4double chargeSqRatio; 499 std::size_t idxIonisation = 0; << 544 500 std::size_t idxRange = 0; << 545 G4double preStepLambda; 501 std::size_t idxCSDA = 0; << 546 G4double fRange; 502 std::size_t idxSecRange = 0; << 547 G4double preStepKinEnergy; 503 std::size_t idxInverseRange = 0; << 548 G4double preStepScaledEnergy; 504 std::size_t idxLambda = 0; << 549 G4double mfpKinEnergy; 505 << 550 506 G4GPILSelection aGPILSelection; << 551 G4GPILSelection aGPILSelection; 507 G4CrossSectionType fXSType = fEmOnePeak; << 508 << 509 G4bool lossFluctuationFlag = true; << 510 G4bool useCutAsFinalRange = false; << 511 G4bool tablesAreBuilt = false; << 512 G4bool spline = true; << 513 G4bool isIon = false; << 514 G4bool isIonisation = false; << 515 G4bool useDeexcitation = false; << 516 G4bool biasFlag = false; << 517 G4bool weightFlag = false; << 518 G4bool isMaster = false; << 519 G4bool baseMat = false; << 520 G4bool actLinLossLimit = false; << 521 G4bool actLossFluc = false; << 522 G4bool actBinning = false; << 523 G4bool actMinKinEnergy = false; << 524 G4bool actMaxKinEnergy = false; << 525 552 526 std::vector<G4DynamicParticle*> secParticles << 527 std::vector<G4Track*> scTracks; << 528 }; 553 }; 529 554 530 // ======== Run time inline methods ========== << 555 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 556 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 531 557 532 inline std::size_t G4VEnergyLossProcess::Curre << 558 inline size_t G4VEnergyLossProcess::CurrentMaterialCutsCoupleIndex() const 533 { 559 { 534 return currentCoupleIndex; << 560 return currentMaterialIndex; >> 561 } >> 562 >> 563 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 564 >> 565 inline G4double G4VEnergyLossProcess::GetCurrentRange() const >> 566 { >> 567 return fRange; 535 } 568 } 536 569 537 //....oooOO0OOooo........oooOO0OOooo........oo 570 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 538 571 539 inline void G4VEnergyLossProcess::SelectModel( 572 inline void G4VEnergyLossProcess::SelectModel(G4double kinEnergy) 540 { 573 { 541 currentModel = modelManager->SelectModel(kin << 574 currentModel = modelManager->SelectModel(kinEnergy, currentMaterialIndex); 542 currentModel->SetCurrentCouple(currentCouple 575 currentModel->SetCurrentCouple(currentCouple); 543 } 576 } 544 577 545 //....oooOO0OOooo........oooOO0OOooo........oo 578 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 546 579 547 inline G4VEmModel* G4VEnergyLossProcess::Selec 580 inline G4VEmModel* G4VEnergyLossProcess::SelectModelForMaterial( 548 G4double kinEnergy, std::si << 581 G4double kinEnergy, size_t& idx) const 549 { 582 { 550 return modelManager->SelectModel(kinEnergy, 583 return modelManager->SelectModel(kinEnergy, idx); 551 } 584 } 552 585 553 //....oooOO0OOooo........oooOO0OOooo........oo 586 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 554 587 555 inline void << 588 inline void G4VEnergyLossProcess::SetFluctModel(G4VEmFluctuationModel* p) 556 G4VEnergyLossProcess::DefineMaterial(const G4M << 557 { 589 { 558 if(couple != currentCouple) { << 590 fluctModel = p; 559 currentCouple = couple; << 560 currentMaterial = couple->GetMaterial(); << 561 basedCoupleIndex = currentCoupleIndex = co << 562 fFactor = chargeSqRatio*biasFactor; << 563 mfpKinEnergy = DBL_MAX; << 564 idxLambda = 0; << 565 if(baseMat) { << 566 basedCoupleIndex = (*theDensityIdx)[curr << 567 fFactor *= (*theDensityFactor)[currentCo << 568 } << 569 reduceFactor = 1.0/(fFactor*massRatio); << 570 } << 571 } 591 } 572 592 573 //....oooOO0OOooo........oooOO0OOooo........oo 593 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 574 594 575 inline G4double G4VEnergyLossProcess::GetDEDXF << 595 inline G4VEmFluctuationModel* G4VEnergyLossProcess::FluctModel() 576 { 596 { 577 /* << 597 return fluctModel; 578 G4cout << "G4VEnergyLossProcess::GetDEDX: Id << 579 << basedCoupleIndex << " E(MeV)= " << 580 << " Emin= " << minKinEnergy << " Fa << 581 << " " << theDEDXTable << G4endl; */ << 582 G4double x = fFactor*(*theDEDXTable)[basedCo << 583 if(e < minKinEnergy) { x *= std::sqrt(e/minK << 584 return x; << 585 } 598 } 586 599 587 //....oooOO0OOooo........oooOO0OOooo........oo 600 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 588 601 589 inline << 602 inline void G4VEnergyLossProcess::SetParticle(const G4ParticleDefinition* p) 590 G4double G4VEnergyLossProcess::GetDEDXForScale << 591 { 603 { 592 /* << 604 particle = p; 593 G4cout << "G4VEnergyLossProcess::GetDEDX: Id << 594 << basedCoupleIndex << " E(MeV)= " << 595 << " Emin= " << minKinEnergy << " Fa << 596 << " " << theDEDXTable << G4endl; */ << 597 G4double x = fFactor*(*theDEDXTable)[basedCo << 598 if(e < minKinEnergy) { x *= std::sqrt(e/minK << 599 return x; << 600 } 605 } 601 606 602 //....oooOO0OOooo........oooOO0OOooo........oo 607 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 603 608 604 inline G4double G4VEnergyLossProcess::GetIonis << 609 inline void G4VEnergyLossProcess::SetSecondaryParticle(const G4ParticleDefinition* p) 605 { 610 { 606 G4double x = << 611 secondaryParticle = p; 607 fFactor*(*theIonisationTable)[basedCoupleI << 608 if(e < minKinEnergy) { x *= std::sqrt(e/minK << 609 return x; << 610 } 612 } 611 613 612 //....oooOO0OOooo........oooOO0OOooo........oo 614 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 613 615 614 inline G4double G4VEnergyLossProcess::GetScale << 616 inline void G4VEnergyLossProcess::SetBaseParticle(const G4ParticleDefinition* p) 615 { 617 { 616 //G4cout << "G4VEnergyLossProcess::GetScaled << 618 baseParticle = p; 617 // << basedCoupleIndex << " E(MeV)= << 618 // << " lastIdx= " << lastIdx << " << 619 if(currentCoupleIndex != coupleIdxRange || f << 620 coupleIdxRange = currentCoupleIndex; << 621 fRangeEnergy = e; << 622 fRange = reduceFactor*((*theRangeTableForL << 623 if (fRange < 0.0) { fRange = 0.0; } << 624 else if (e < minKinEnergy) { fRange *= std << 625 } << 626 //G4cout << "G4VEnergyLossProcess::GetScaled << 627 // << basedCoupleIndex << " E(MeV)= << 628 // << " R= " << computedRange << " << 629 return fRange; << 630 } << 631 << 632 inline G4double << 633 G4VEnergyLossProcess::GetScaledRangeForScaledE << 634 { << 635 //G4cout << "G4VEnergyLossProcess::GetScaled << 636 // << basedCoupleIndex << " E(MeV)= << 637 // << " lastIdx= " << lastIdx << " << 638 if(currentCoupleIndex != coupleIdxRange || f << 639 coupleIdxRange = currentCoupleIndex; << 640 fRangeEnergy = e; << 641 fRange = reduceFactor*((*theRangeTableForL << 642 if (fRange < 0.0) { fRange = 0.0; } << 643 else if (e < minKinEnergy) { fRange *= std << 644 } << 645 //G4cout << "G4VEnergyLossProcess::GetScaled << 646 // << basedCoupleIndex << " E(MeV)= << 647 // << " R= " << fRange << " " << t << 648 return fRange; << 649 } 619 } 650 620 651 //....oooOO0OOooo........oooOO0OOooo........oo 621 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 652 622 653 inline G4double << 623 inline const G4ParticleDefinition* G4VEnergyLossProcess::Particle() const 654 G4VEnergyLossProcess::GetLimitScaledRangeForSc << 655 { 624 { 656 G4double x = ((*theCSDARangeTable)[basedCoup << 625 return particle; 657 if (x < 0.0) { x = 0.0; } << 658 else if (e < minKinEnergy) { x *= std::sqrt( << 659 return x; << 660 } 626 } 661 627 662 //....oooOO0OOooo........oooOO0OOooo........oo 628 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 663 629 664 inline G4double << 630 inline const G4ParticleDefinition* G4VEnergyLossProcess::BaseParticle() const 665 G4VEnergyLossProcess::GetLimitScaledRangeForSc << 631 { 666 << 632 return baseParticle; 667 { << 668 G4double x = ((*theCSDARangeTable)[basedCoup << 669 if (x < 0.0) { x = 0.0; } << 670 else if (e < minKinEnergy) { x *= std::sqrt( << 671 return x; << 672 } 633 } 673 634 674 //....oooOO0OOooo........oooOO0OOooo........oo 635 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 675 636 676 inline G4double G4VEnergyLossProcess::ScaledKi << 637 inline const G4ParticleDefinition* G4VEnergyLossProcess::SecondaryParticle() const 677 { 638 { 678 //G4cout << "G4VEnergyLossProcess::GetEnergy << 639 return secondaryParticle; 679 // << basedCoupleIndex << " R(mm)= " << 680 // << theInverseRangeTable << G4endl << 681 G4PhysicsVector* v = (*theInverseRangeTable) << 682 G4double rmin = v->Energy(0); << 683 G4double e = 0.0; << 684 if(r >= rmin) { e = v->Value(r, idxInverseRa << 685 else if(r > 0.0) { << 686 G4double x = r/rmin; << 687 e = minKinEnergy*x*x; << 688 } << 689 return e; << 690 } 640 } 691 641 692 //....oooOO0OOooo........oooOO0OOooo........oo 642 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 693 643 694 inline G4double G4VEnergyLossProcess::GetLambd << 644 inline void G4VEnergyLossProcess::SetLossFluctuations(G4bool val) 695 { 645 { 696 return fFactor*((*theLambdaTable)[basedCoupl << 646 lossFluctuationFlag = val; 697 } 647 } 698 648 699 //....oooOO0OOooo........oooOO0OOooo........oo 649 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 700 650 701 inline G4double << 651 inline void G4VEnergyLossProcess::SetRandomStep(G4bool val) 702 G4VEnergyLossProcess::GetLambdaForScaledEnergy << 703 { 652 { 704 return fFactor*((*theLambdaTable)[basedCoupl << 653 rndmStepFlag = val; 705 } 654 } 706 655 707 //....oooOO0OOooo........oooOO0OOooo........oo 656 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 708 657 709 inline G4double G4VEnergyLossProcess::LogScale << 658 inline void G4VEnergyLossProcess::SetIntegral(G4bool val) 710 { 659 { 711 return track.GetDynamicParticle()->GetLogKin << 660 integral = val; 712 } 661 } 713 662 714 //....oooOO0OOooo........oooOO0OOooo........oo 663 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 715 << 664 716 inline G4double << 665 inline G4bool G4VEnergyLossProcess::IsIntegral() const 717 G4VEnergyLossProcess::GetDEDX(G4double kinEner << 718 const G4Material << 719 { 666 { 720 DefineMaterial(couple); << 667 return integral; 721 return GetDEDXForScaledEnergy(kinEnergy*mass << 722 } 668 } 723 669 724 //....oooOO0OOooo........oooOO0OOooo........oo 670 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 725 671 726 inline G4double << 672 inline void G4VEnergyLossProcess::SetIonisation(G4bool val) 727 G4VEnergyLossProcess::GetDEDX(G4double kinEner << 728 const G4Material << 729 G4double logKinE << 730 { 673 { 731 DefineMaterial(couple); << 674 isIonisation = val; 732 return GetDEDXForScaledEnergy(kinEnergy*mass << 675 if(val) aGPILSelection = CandidateForSelection; >> 676 else aGPILSelection = NotCandidateForSelection; 733 } 677 } 734 678 735 //....oooOO0OOooo........oooOO0OOooo........oo 679 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 736 680 737 inline G4double << 681 inline G4bool G4VEnergyLossProcess::IsIonisationProcess() const 738 G4VEnergyLossProcess::GetRange(G4double kinEne << 739 const G4Materia << 740 { 682 { 741 DefineMaterial(couple); << 683 return isIonisation; 742 return GetScaledRangeForScaledEnergy(kinEner << 743 } 684 } 744 685 745 //....oooOO0OOooo........oooOO0OOooo........oo 686 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 746 687 747 inline G4double << 688 inline void G4VEnergyLossProcess::SetLinearLossLimit(G4double val) 748 G4VEnergyLossProcess::GetRange(G4double kinEne << 749 const G4Materia << 750 G4double logKin << 751 { 689 { 752 DefineMaterial(couple); << 690 linLossLimit = val; 753 return GetScaledRangeForScaledEnergy(kinEner << 754 } 691 } 755 692 756 //....oooOO0OOooo........oooOO0OOooo........oo 693 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 757 694 758 inline G4double << 695 inline void G4VEnergyLossProcess::SetMinSubRange(G4double val) 759 G4VEnergyLossProcess::GetCSDARange(G4double ki << 760 const G4Mat << 761 { 696 { 762 DefineMaterial(couple); << 697 minSubRange = val; 763 return (nullptr == theCSDARangeTable) ? DBL_ << 764 GetLimitScaledRangeForScaledEnergy(kinetic << 765 } 698 } 766 699 767 //....oooOO0OOooo........oooOO0OOooo........oo 700 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 768 701 769 inline G4double << 702 inline void G4VEnergyLossProcess::SetLambdaFactor(G4double val) 770 G4VEnergyLossProcess::GetKineticEnergy(G4doubl << 771 const G << 772 { 703 { 773 DefineMaterial(couple); << 704 if(val > 0.0 && val <= 1.0) lambdaFactor = val; 774 return ScaledKinEnergyForLoss(range/reduceFa << 775 } 705 } 776 706 777 //....oooOO0OOooo........oooOO0OOooo........oo 707 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 778 708 779 inline G4double << 709 void G4VEnergyLossProcess::SetStepFunction(G4double v1, G4double v2) 780 G4VEnergyLossProcess::GetLambda(G4double kinEn << 781 const G4Materi << 782 { 710 { 783 DefineMaterial(couple); << 711 dRoverRange = v1; 784 return (nullptr != theLambdaTable) ? << 712 finalRange = v2; 785 GetLambdaForScaledEnergy(kinEnergy*massRat << 713 if (dRoverRange > 0.999) dRoverRange = 1.0; >> 714 currentCouple = 0; >> 715 mfpKinEnergy = DBL_MAX; 786 } 716 } 787 717 788 //....oooOO0OOooo........oooOO0OOooo........oo 718 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 789 719 790 inline G4double << 720 inline void G4VEnergyLossProcess::SetLowestEnergyLimit(G4double val) 791 G4VEnergyLossProcess::GetLambda(G4double kinEn << 792 const G4Materi << 793 G4double logKi << 794 { 721 { 795 DefineMaterial(couple); << 722 lowestKinEnergy = val; 796 return (nullptr != theLambdaTable) ? << 797 GetLambdaForScaledEnergy(kinEnergy*massRat << 798 : 0.0; << 799 } 723 } 800 724 801 // ======== Get/Set inline methods used at ini << 725 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 802 726 803 inline void G4VEnergyLossProcess::SetFluctMode << 727 inline G4int G4VEnergyLossProcess::NumberOfSubCutoffRegions() const 804 { 728 { 805 fluctModel = p; << 729 return nSCoffRegions; 806 } 730 } 807 731 808 //....oooOO0OOooo........oooOO0OOooo........oo 732 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 809 733 810 inline G4VEmFluctuationModel* G4VEnergyLossPro << 734 inline G4int G4VEnergyLossProcess::NumberOfDERegions() const 811 { 735 { 812 return fluctModel; << 736 return nDERegions; 813 } 737 } 814 738 815 //....oooOO0OOooo........oooOO0OOooo........oo 739 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 816 740 817 inline void G4VEnergyLossProcess::SetParticle( << 741 inline void G4VEnergyLossProcess::SetDEDXBinning(G4int nbins) 818 { 742 { 819 particle = p; << 743 nBins = nbins; 820 } 744 } 821 745 822 //....oooOO0OOooo........oooOO0OOooo........oo 746 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 823 747 824 inline void << 748 inline void G4VEnergyLossProcess::SetLambdaBinning(G4int nbins) 825 G4VEnergyLossProcess::SetSecondaryParticle(con << 826 { 749 { 827 secondaryParticle = p; << 750 nBins = nbins; 828 } 751 } 829 752 830 //....oooOO0OOooo........oooOO0OOooo........oo 753 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 831 754 832 inline void << 755 inline void G4VEnergyLossProcess::SetDEDXBinningForCSDARange(G4int nbins) 833 G4VEnergyLossProcess::SetBaseParticle(const G4 << 834 { 756 { 835 baseParticle = p; << 757 nBinsCSDA = nbins; 836 } 758 } 837 759 838 //....oooOO0OOooo........oooOO0OOooo........oo 760 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 839 761 840 inline const G4ParticleDefinition* G4VEnergyLo << 762 inline void G4VEnergyLossProcess::SetMinKinEnergy(G4double e) 841 { 763 { 842 return particle; << 764 minKinEnergy = e; 843 } 765 } 844 766 845 //....oooOO0OOooo........oooOO0OOooo........oo 767 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 846 768 847 inline const G4ParticleDefinition* G4VEnergyLo << 769 inline G4double G4VEnergyLossProcess::MinKinEnergy() const 848 { 770 { 849 return baseParticle; << 771 return minKinEnergy; 850 } 772 } 851 773 852 //....oooOO0OOooo........oooOO0OOooo........oo 774 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 853 775 854 inline const G4ParticleDefinition* << 776 inline void G4VEnergyLossProcess::SetMaxKinEnergy(G4double e) 855 G4VEnergyLossProcess::SecondaryParticle() cons << 856 { 777 { 857 return secondaryParticle; << 778 maxKinEnergy = e; >> 779 if(e < maxKinEnergyCSDA) maxKinEnergyCSDA = e; 858 } 780 } 859 781 860 //....oooOO0OOooo........oooOO0OOooo........oo 782 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 861 783 862 inline void G4VEnergyLossProcess::SetLossFluct << 784 inline G4double G4VEnergyLossProcess::MaxKinEnergy() const 863 { 785 { 864 lossFluctuationFlag = val; << 786 return maxKinEnergy; 865 actLossFluc = true; << 866 } 787 } 867 788 868 //....oooOO0OOooo........oooOO0OOooo........oo 789 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 869 790 870 inline void G4VEnergyLossProcess::SetSpline(G4 << 791 inline void G4VEnergyLossProcess::SetMaxKinEnergyForCSDARange(G4double e) 871 { 792 { 872 spline = val; << 793 maxKinEnergyCSDA = e; 873 } 794 } 874 795 875 //....oooOO0OOooo........oooOO0OOooo........oo 796 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 876 797 877 inline void G4VEnergyLossProcess::SetCrossSect << 798 inline G4double G4VEnergyLossProcess::GetDEDX(G4double& kineticEnergy, >> 799 const G4MaterialCutsCouple* couple) 878 { 800 { 879 fXSType = val; << 801 DefineMaterial(couple); >> 802 return GetDEDXForScaledEnergy(kineticEnergy*massRatio); 880 } 803 } 881 804 882 //....oooOO0OOooo........oooOO0OOooo........oo 805 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 883 << 806 884 inline G4CrossSectionType G4VEnergyLossProcess << 807 inline G4double G4VEnergyLossProcess::GetDEDXForSubsec(G4double& kineticEnergy, >> 808 const G4MaterialCutsCouple* couple) 885 { 809 { 886 return fXSType; << 810 DefineMaterial(couple); >> 811 return GetSubDEDXForScaledEnergy(kineticEnergy*massRatio); 887 } 812 } 888 813 889 //....oooOO0OOooo........oooOO0OOooo........oo 814 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 890 815 891 inline G4bool G4VEnergyLossProcess::IsIonisati << 816 inline G4double G4VEnergyLossProcess::GetRange(G4double& kineticEnergy, >> 817 const G4MaterialCutsCouple* couple) 892 { 818 { 893 return isIonisation; << 819 G4double x = fRange; >> 820 if(kineticEnergy != preStepKinEnergy || couple != currentCouple) { >> 821 DefineMaterial(couple); >> 822 if(theCSDARangeTable) >> 823 x = GetLimitScaledRangeForScaledEnergy(kineticEnergy*massRatio) >> 824 * reduceFactor; >> 825 else if(theRangeTableForLoss) >> 826 x = GetScaledRangeForScaledEnergy(kineticEnergy*massRatio)*reduceFactor; >> 827 } >> 828 return x; 894 } 829 } 895 830 896 //....oooOO0OOooo........oooOO0OOooo........oo 831 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 897 832 898 inline G4int G4VEnergyLossProcess::NumberOfSub << 833 inline G4double G4VEnergyLossProcess::GetCSDARange( >> 834 G4double& kineticEnergy, const G4MaterialCutsCouple* couple) 899 { 835 { 900 return nSCoffRegions; << 836 DefineMaterial(couple); >> 837 G4double x = DBL_MAX; >> 838 if(theCSDARangeTable) >> 839 x = GetLimitScaledRangeForScaledEnergy(kineticEnergy*massRatio) >> 840 * reduceFactor; >> 841 return x; 901 } 842 } 902 843 903 //....oooOO0OOooo........oooOO0OOooo........oo 844 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 904 845 905 inline G4double G4VEnergyLossProcess::MinKinEn << 846 inline G4double G4VEnergyLossProcess::GetRangeForLoss( >> 847 G4double& kineticEnergy, >> 848 const G4MaterialCutsCouple* couple) 906 { 849 { 907 return minKinEnergy; << 850 DefineMaterial(couple); >> 851 G4double x = DBL_MAX; >> 852 if(theRangeTableForLoss) >> 853 x = GetScaledRangeForScaledEnergy(kineticEnergy*massRatio)*reduceFactor; >> 854 // G4cout << "Range from " << GetProcessName() >> 855 // << " e= " << kineticEnergy << " r= " << x << G4endl; >> 856 return x; 908 } 857 } 909 858 910 //....oooOO0OOooo........oooOO0OOooo........oo 859 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 911 860 912 inline G4double G4VEnergyLossProcess::MaxKinEn << 861 inline G4double G4VEnergyLossProcess::GetKineticEnergy( >> 862 G4double& range, >> 863 const G4MaterialCutsCouple* couple) 913 { 864 { 914 return maxKinEnergy; << 865 DefineMaterial(couple); >> 866 G4double r = range/reduceFactor; >> 867 G4double e = ScaledKinEnergyForLoss(r)/massRatio; >> 868 return e; 915 } 869 } 916 870 917 //....oooOO0OOooo........oooOO0OOooo........oo 871 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 918 872 919 inline G4double G4VEnergyLossProcess::CrossSec << 873 inline G4double G4VEnergyLossProcess::GetLambda(G4double& kineticEnergy, >> 874 const G4MaterialCutsCouple* couple) 920 { 875 { 921 return biasFactor; << 876 DefineMaterial(couple); >> 877 G4double x = 0.0; >> 878 if(theLambdaTable) x = GetLambdaForScaledEnergy(kineticEnergy*massRatio); >> 879 return x; 922 } 880 } 923 881 924 //....oooOO0OOooo........oooOO0OOooo........oo 882 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 925 883 926 inline G4bool G4VEnergyLossProcess::TablesAreB 884 inline G4bool G4VEnergyLossProcess::TablesAreBuilt() const 927 { 885 { 928 return tablesAreBuilt; << 886 return tablesAreBuilt; 929 } 887 } 930 888 931 //....oooOO0OOooo........oooOO0OOooo........oo 889 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 932 890 933 inline G4PhysicsTable* G4VEnergyLossProcess::D 891 inline G4PhysicsTable* G4VEnergyLossProcess::DEDXTable() const 934 { 892 { 935 return theDEDXTable; 893 return theDEDXTable; 936 } 894 } 937 895 938 //....oooOO0OOooo........oooOO0OOooo........oo 896 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 939 897 >> 898 inline G4PhysicsTable* G4VEnergyLossProcess::DEDXTableForSubsec() const >> 899 { >> 900 return theDEDXSubTable; >> 901 } >> 902 >> 903 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 904 940 inline G4PhysicsTable* G4VEnergyLossProcess::D 905 inline G4PhysicsTable* G4VEnergyLossProcess::DEDXunRestrictedTable() const 941 { 906 { 942 return theDEDXunRestrictedTable; 907 return theDEDXunRestrictedTable; 943 } 908 } 944 909 945 //....oooOO0OOooo........oooOO0OOooo........oo 910 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 946 911 947 inline G4PhysicsTable* G4VEnergyLossProcess::I 912 inline G4PhysicsTable* G4VEnergyLossProcess::IonisationTable() const 948 { 913 { 949 return theIonisationTable; << 914 G4PhysicsTable* t = theDEDXTable; >> 915 if(theIonisationTable) t = theIonisationTable; >> 916 return t; >> 917 } >> 918 >> 919 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 920 >> 921 inline G4PhysicsTable* G4VEnergyLossProcess::IonisationTableForSubsec() const >> 922 { >> 923 G4PhysicsTable* t = theDEDXSubTable; >> 924 if(theIonisationSubTable) t = theIonisationSubTable; >> 925 return t; 950 } 926 } 951 927 952 //....oooOO0OOooo........oooOO0OOooo........oo 928 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 953 929 954 inline G4PhysicsTable* G4VEnergyLossProcess::C 930 inline G4PhysicsTable* G4VEnergyLossProcess::CSDARangeTable() const 955 { 931 { 956 return theCSDARangeTable; 932 return theCSDARangeTable; 957 } 933 } 958 934 959 //....oooOO0OOooo........oooOO0OOooo........oo 935 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 960 936 961 inline G4PhysicsTable* G4VEnergyLossProcess::R 937 inline G4PhysicsTable* G4VEnergyLossProcess::RangeTableForLoss() const 962 { 938 { 963 return theRangeTableForLoss; 939 return theRangeTableForLoss; 964 } 940 } 965 941 966 //....oooOO0OOooo........oooOO0OOooo........oo 942 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 967 943 968 inline G4PhysicsTable* G4VEnergyLossProcess::I 944 inline G4PhysicsTable* G4VEnergyLossProcess::InverseRangeTable() const 969 { 945 { 970 return theInverseRangeTable; 946 return theInverseRangeTable; 971 } 947 } 972 948 973 //....oooOO0OOooo........oooOO0OOooo........oo 949 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 974 950 975 inline G4PhysicsTable* G4VEnergyLossProcess::L << 951 inline G4PhysicsTable* G4VEnergyLossProcess::LambdaTable() 976 { 952 { 977 return theLambdaTable; 953 return theLambdaTable; 978 } 954 } 979 955 980 //....oooOO0OOooo........oooOO0OOooo........oo 956 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 981 957 982 inline G4bool G4VEnergyLossProcess::UseBaseMat << 958 inline G4PhysicsTable* G4VEnergyLossProcess::SubLambdaTable() >> 959 { >> 960 return theSubLambdaTable; >> 961 } >> 962 >> 963 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 964 >> 965 inline G4double G4VEnergyLossProcess::SampleRange() >> 966 { >> 967 G4double e = amu_c2*preStepKinEnergy/particle->GetPDGMass(); >> 968 G4double s = fRange*std::pow(10.,vstrag->Value(e)); >> 969 G4double x = fRange + G4RandGauss::shoot(0.0,s); >> 970 if(x > 0.0) fRange = x; >> 971 return fRange; >> 972 } >> 973 >> 974 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 975 >> 976 inline void G4VEnergyLossProcess::SetDynamicMassCharge(G4double massratio, >> 977 G4double charge2ratio) >> 978 { >> 979 massRatio = massratio; >> 980 chargeSqRatio = charge2ratio; >> 981 reduceFactor = 1.0/(chargeSqRatio*massRatio); >> 982 } >> 983 >> 984 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 985 >> 986 inline void G4VEnergyLossProcess::DefineMaterial( >> 987 const G4MaterialCutsCouple* couple) >> 988 { >> 989 if(couple != currentCouple) { >> 990 currentCouple = couple; >> 991 currentMaterial = couple->GetMaterial(); >> 992 currentMaterialIndex = couple->GetIndex(); >> 993 mfpKinEnergy = DBL_MAX; >> 994 } >> 995 } >> 996 >> 997 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 998 >> 999 inline G4double G4VEnergyLossProcess::GetDEDXForScaledEnergy(G4double e) 983 { 1000 { 984 return baseMat; << 1001 G4double x = ((*theDEDXTable)[currentMaterialIndex]->Value(e))*chargeSqRatio; >> 1002 if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy); >> 1003 return x; 985 } 1004 } 986 1005 987 //....oooOO0OOooo........oooOO0OOooo........oo 1006 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 988 1007 989 inline std::vector<G4double>* << 1008 inline G4double G4VEnergyLossProcess::GetSubDEDXForScaledEnergy(G4double e) 990 G4VEnergyLossProcess::EnergyOfCrossSectionMax( << 991 { 1009 { 992 return theEnergyOfCrossSectionMax; << 1010 G4double x = ((*theDEDXSubTable)[currentMaterialIndex]->Value(e))*chargeSqRatio; >> 1011 if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy); >> 1012 return x; 993 } 1013 } 994 1014 995 //....oooOO0OOooo........oooOO0OOooo........oo 1015 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 996 1016 997 inline std::vector<G4TwoPeaksXS*>* G4VEnergyLo << 1017 inline G4double G4VEnergyLossProcess::GetIonisationForScaledEnergy(G4double e) 998 { 1018 { 999 return fXSpeaks; << 1019 //G4double x = 0.0; >> 1020 // if(theIonisationTable) { >> 1021 G4double x = ((*theIonisationTable)[currentMaterialIndex]->Value(e))*chargeSqRatio; >> 1022 if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy); >> 1023 //} >> 1024 return x; 1000 } 1025 } 1001 1026 1002 //....oooOO0OOooo........oooOO0OOooo........o 1027 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 1003 1028 1004 inline std::size_t G4VEnergyLossProcess::Numb << 1029 inline >> 1030 G4double G4VEnergyLossProcess::GetSubIonisationForScaledEnergy(G4double e) 1005 { 1031 { 1006 return numberOfModels; << 1032 // G4double x = 0.0; >> 1033 //if(theIonisationSubTable) { >> 1034 G4double x = ((*theIonisationSubTable)[currentMaterialIndex]->Value(e))*chargeSqRatio; >> 1035 if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy); >> 1036 //} >> 1037 return x; 1007 } 1038 } 1008 1039 1009 //....oooOO0OOooo........oooOO0OOooo........o 1040 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 1010 1041 1011 inline G4VEmModel* G4VEnergyLossProcess::EmMo << 1042 inline G4double G4VEnergyLossProcess::GetScaledRangeForScaledEnergy(G4double e) 1012 { 1043 { 1013 return (index < emModels->size()) ? (*emMod << 1044 G4double x = ((*theRangeTableForLoss)[currentMaterialIndex])->Value(e); >> 1045 if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy); >> 1046 return x; 1014 } 1047 } 1015 1048 1016 //....oooOO0OOooo........oooOO0OOooo........o 1049 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 1017 1050 1018 inline G4VEmModel* << 1051 inline G4double G4VEnergyLossProcess::GetLimitScaledRangeForScaledEnergy( 1019 G4VEnergyLossProcess::GetModelByIndex(std::si << 1052 G4double e) 1020 { 1053 { 1021 return modelManager->GetModel((G4int)idx, v << 1054 G4double x; >> 1055 >> 1056 if (e < maxKinEnergyCSDA) { >> 1057 x = ((*theCSDARangeTable)[currentMaterialIndex])->Value(e); >> 1058 if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy); >> 1059 } else { >> 1060 x = theRangeAtMaxEnergy[currentMaterialIndex] + >> 1061 (e - maxKinEnergyCSDA)/theDEDXAtMaxEnergy[currentMaterialIndex]; >> 1062 } >> 1063 return x; >> 1064 } >> 1065 >> 1066 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 1067 >> 1068 inline G4double G4VEnergyLossProcess::ScaledKinEnergyForLoss(G4double r) >> 1069 { >> 1070 G4PhysicsVector* v = (*theInverseRangeTable)[currentMaterialIndex]; >> 1071 G4double rmin = v->Energy(0); >> 1072 G4double e = 0.0; >> 1073 if(r >= rmin) { e = v->Value(r); } >> 1074 else if(r > 0.0) { >> 1075 G4double x = r/rmin; >> 1076 e = minKinEnergy*x*x; >> 1077 } >> 1078 return e; >> 1079 } >> 1080 >> 1081 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 1082 >> 1083 inline G4double G4VEnergyLossProcess::GetLambdaForScaledEnergy(G4double e) >> 1084 { >> 1085 return chargeSqRatio*(((*theLambdaTable)[currentMaterialIndex])->Value(e)); >> 1086 } >> 1087 >> 1088 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 1089 >> 1090 inline void G4VEnergyLossProcess::ComputeLambdaForScaledEnergy(G4double e) >> 1091 { >> 1092 mfpKinEnergy = theEnergyOfCrossSectionMax[currentMaterialIndex]; >> 1093 if (e <= mfpKinEnergy) { >> 1094 preStepLambda = GetLambdaForScaledEnergy(e); >> 1095 >> 1096 } else { >> 1097 G4double e1 = e*lambdaFactor; >> 1098 if(e1 > mfpKinEnergy) { >> 1099 preStepLambda = GetLambdaForScaledEnergy(e); >> 1100 G4double preStepLambda1 = GetLambdaForScaledEnergy(e1); >> 1101 if(preStepLambda1 > preStepLambda) { >> 1102 mfpKinEnergy = e1; >> 1103 preStepLambda = preStepLambda1; >> 1104 } >> 1105 } else { >> 1106 preStepLambda = chargeSqRatio*theCrossSectionMax[currentMaterialIndex]; >> 1107 } >> 1108 } 1022 } 1109 } 1023 1110 1024 //....oooOO0OOooo........oooOO0OOooo........o 1111 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 1025 1112 1026 #endif 1113 #endif 1027 1114