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