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