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.56 2006/06/29 19:54:49 gunter Exp $ >> 27 // GEANT4 tag $Name: geant4-08-01 $ 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 << 321 // Binning for dEdx, range, inverse range an << 322 void SetDEDXBinning(G4int nbins); << 323 320 324 // Min kinetic energy for tables << 321 // Access to models 325 void SetMinKinEnergy(G4double e); << 322 G4VEmModel* GetModelByIndex(G4int idx = 0); 326 inline G4double MinKinEnergy() const; << 327 323 328 // Max kinetic energy for tables << 324 G4int NumberOfModels(); 329 void SetMaxKinEnergy(G4double e); << 330 inline G4double MaxKinEnergy() const; << 331 325 332 // Biasing parameters << 326 protected: 333 inline G4double CrossSectionBiasingFactor() << 334 327 335 // Return values for given G4MaterialCutsCou << 328 void SetParticle(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 329 365 inline G4bool UseBaseMaterial() const; << 330 void SetSecondaryParticle(const G4ParticleDefinition* p); 366 331 367 //------------------------------------------ << 332 G4VEmModel* SelectModel(G4double kinEnergy); 368 // Run time method for simulation of ionisat << 369 //------------------------------------------ << 370 333 371 // access atom on which interaction happens << 334 size_t CurrentMaterialCutsCoupleIndex() const; 372 const G4Element* GetCurrentElement() const; << 373 335 374 // Set scaling parameters for ions is needed << 336 G4double GetCurrentRange() const; 375 void SetDynamicMassCharge(G4double massratio << 376 337 377 private: 338 private: 378 339 379 void FillSecondariesAlongStep(G4double weigh << 340 // Clear tables >> 341 void Clear(); 380 342 381 void PrintWarning(const G4String&, G4double << 343 void DefineMaterial(const G4MaterialCutsCouple* couple); >> 344 G4PhysicsVector* LambdaPhysicsVector(const G4MaterialCutsCouple*, G4double cut); 382 345 383 // define material and indexes << 346 // Returnd values for scaled energy and base particles mass 384 inline void DefineMaterial(const G4MaterialC << 347 // >> 348 G4double GetDEDXForScaledEnergy(G4double scaledKinEnergy); >> 349 G4double GetSubDEDXForScaledEnergy(G4double scaledKinEnergy); >> 350 G4double GetScaledRangeForScaledEnergy(G4double scaledKinEnergy); >> 351 G4double GetLimitScaledRangeForScaledEnergy(G4double scaledKinEnergy); >> 352 G4double GetLambdaForScaledEnergy(G4double scaledKinEnergy); >> 353 G4double ScaledKinEnergyForLoss(G4double range); >> 354 void ComputeLambdaForScaledEnergy(G4double scaledKinEnergy); 385 355 386 //------------------------------------------ << 356 // 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 357 406 inline G4double LogScaledEkin(const G4Track& << 358 G4VEnergyLossProcess(G4VEnergyLossProcess &); 407 << 359 G4VEnergyLossProcess & operator=(const G4VEnergyLossProcess &right); 408 void ComputeLambdaForScaledEnergy(G4double s << 409 const G4Tr << 410 360 411 G4bool IsRegionForCubcutProcessor(const G4Tr << 361 // ===================================================================== 412 362 413 protected: 363 protected: 414 364 415 G4ParticleChangeForLoss fParticleChange; << 365 G4ParticleChangeForLoss fParticleChange; 416 const G4Material* currentMaterial << 417 const G4MaterialCutsCouple* currentCouple = << 418 366 419 private: 367 private: 420 368 421 G4LossTableManager* lManager; << 369 G4EmModelManager* modelManager; 422 G4EmModelManager* modelManager; << 370 std::vector<const G4Region*> scoffRegions; 423 G4VEmModel* currentModel = n << 371 G4int nSCoffRegions; 424 G4EmBiasingManager* biasManager = nu << 372 G4int* idxSCoffRegions; 425 G4SafetyHelper* safetyHelper; << 373 std::vector<G4Track*> scTracks; 426 G4EmParameters* theParameters; << 374 std::vector<G4VEnergyLossProcess*> scProcesses; 427 G4VEmFluctuationModel* fluctModel = nul << 375 G4int nProcesses; 428 G4VAtomDeexcitation* atomDeexcitation << 376 429 G4VSubCutProducer* subcutProducer = << 377 // tables and vectors 430 << 378 G4PhysicsTable* theDEDXTable; 431 const G4ParticleDefinition* particle = nullp << 379 G4PhysicsTable* theDEDXSubTable; 432 const G4ParticleDefinition* baseParticle = n << 380 G4PhysicsTable* theDEDXunRestrictedTable; 433 const G4ParticleDefinition* secondaryParticl << 381 G4PhysicsTable* theRangeTableForLoss; 434 G4EmDataHandler* theData = nullptr; << 382 G4PhysicsTable* theCSDARangeTable; 435 << 383 G4PhysicsTable* theSecondaryRangeTable; 436 G4PhysicsTable* theDEDXTable = nullptr; << 384 G4PhysicsTable* theInverseRangeTable; 437 G4PhysicsTable* theDEDXunRestrictedTable = n << 385 G4PhysicsTable* theLambdaTable; 438 G4PhysicsTable* theIonisationTable = nullptr << 386 G4PhysicsTable* theSubLambdaTable; 439 G4PhysicsTable* theRangeTableForLoss = nullp << 387 G4double* theDEDXAtMaxEnergy; 440 G4PhysicsTable* theCSDARangeTable = nullptr; << 388 G4double* theRangeAtMaxEnergy; 441 G4PhysicsTable* theInverseRangeTable = nullp << 389 G4double* theEnergyOfCrossSectionMax; 442 G4PhysicsTable* theLambdaTable = nullptr; << 390 G4double* theCrossSectionMax; 443 << 391 444 std::vector<const G4Region*>* scoffRegions = << 392 const G4DataVector* theCuts; 445 std::vector<G4VEmModel*>* emModels = nul << 393 const G4DataVector* theSubCuts; 446 const std::vector<G4int>* theDensityIdx << 394 447 const std::vector<G4double>* theDensityFact << 395 G4Navigator* navigator; 448 const G4DataVector* theCuts = null << 396 449 << 397 const G4ParticleDefinition* particle; 450 std::vector<G4double>* theEnergyOfCrossSecti << 398 const G4ParticleDefinition* baseParticle; 451 std::vector<G4TwoPeaksXS*>* fXSpeaks = nullp << 399 const G4ParticleDefinition* secondaryParticle; >> 400 const G4ParticleDefinition* thePositron; >> 401 >> 402 G4PhysicsVector* vstrag; >> 403 >> 404 // cash >> 405 const G4Material* currentMaterial; >> 406 const G4MaterialCutsCouple* currentCouple; >> 407 size_t currentMaterialIndex; >> 408 >> 409 G4int nBins; >> 410 G4int nBinsCSDA; >> 411 G4int nWarnings; 452 412 453 G4double lowestKinEnergy; 413 G4double lowestKinEnergy; 454 G4double minKinEnergy; 414 G4double minKinEnergy; 455 G4double maxKinEnergy; 415 G4double maxKinEnergy; 456 G4double maxKinEnergyCSDA; 416 G4double maxKinEnergyCSDA; 457 417 458 G4double linLossLimit = 0.01; << 418 G4double massRatio; 459 G4double dRoverRange = 0.2; << 419 G4double reduceFactor; >> 420 G4double chargeSquare; >> 421 G4double chargeSqRatio; >> 422 >> 423 G4double preStepLambda; >> 424 G4double preStepMFP; >> 425 G4double fRange; >> 426 G4double preStepKinEnergy; >> 427 G4double preStepScaledEnergy; >> 428 G4double linLossLimit; >> 429 G4double minSubRange; >> 430 G4double dRoverRange; 460 G4double finalRange; 431 G4double finalRange; 461 G4double lambdaFactor = 0.8; << 432 G4double lambdaFactor; 462 G4double invLambdaFactor; << 433 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 << 484 G4int nBins; << 485 G4int nBinsCSDA; << 486 G4int numberOfModels = 0; << 487 G4int nSCoffRegions = 0; << 488 G4int secID = _DeltaElectron; << 489 G4int tripletID = _TripletElectron; << 490 G4int biasID = _DeltaEBelowCut; << 491 G4int epixeID = _ePIXE; << 492 G4int gpixeID = _GammaPIXE; << 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 434 526 std::vector<G4DynamicParticle*> secParticles << 435 G4bool lossFluctuationFlag; 527 std::vector<G4Track*> scTracks; << 436 G4bool lossFluctuationArePossible; >> 437 G4bool rndmStepFlag; >> 438 G4bool tablesAreBuilt; >> 439 G4bool integral; >> 440 G4bool meanFreePath; >> 441 G4bool aboveCSmax; >> 442 G4bool isIonisation; >> 443 G4bool useSubCutoff; 528 }; 444 }; 529 445 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 446 //....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 447 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 554 448 555 inline void << 449 inline void G4VEnergyLossProcess::DefineMaterial( 556 G4VEnergyLossProcess::DefineMaterial(const G4M << 450 const G4MaterialCutsCouple* couple) 557 { 451 { 558 if(couple != currentCouple) { 452 if(couple != currentCouple) { 559 currentCouple = couple; << 453 currentCouple = couple; 560 currentMaterial = couple->GetMaterial(); 454 currentMaterial = couple->GetMaterial(); 561 basedCoupleIndex = currentCoupleIndex = co << 455 currentMaterialIndex = couple->GetIndex(); 562 fFactor = chargeSqRatio*biasFactor; << 456 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 } 457 } 571 } 458 } 572 459 573 //....oooOO0OOooo........oooOO0OOooo........oo 460 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 574 461 575 inline G4double G4VEnergyLossProcess::GetDEDXF << 462 inline G4double G4VEnergyLossProcess::GetDEDX(G4double& kineticEnergy, >> 463 const G4MaterialCutsCouple* couple) 576 { 464 { 577 /* << 465 DefineMaterial(couple); 578 G4cout << "G4VEnergyLossProcess::GetDEDX: Id << 466 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 } 467 } 586 468 587 //....oooOO0OOooo........oooOO0OOooo........oo 469 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 588 470 589 inline << 471 inline G4double G4VEnergyLossProcess::GetDEDXForSubsec(G4double& kineticEnergy, 590 G4double G4VEnergyLossProcess::GetDEDXForScale << 472 const G4MaterialCutsCouple* couple) 591 { 473 { 592 /* << 474 DefineMaterial(couple); 593 G4cout << "G4VEnergyLossProcess::GetDEDX: Id << 475 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 } 476 } 601 477 602 //....oooOO0OOooo........oooOO0OOooo........oo 478 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 603 479 604 inline G4double G4VEnergyLossProcess::GetIonis << 480 inline G4double G4VEnergyLossProcess::GetDEDXForScaledEnergy(G4double e) 605 { 481 { >> 482 G4bool b; 606 G4double x = 483 G4double x = 607 fFactor*(*theIonisationTable)[basedCoupleI << 484 ((*theDEDXTable)[currentMaterialIndex]->GetValue(e, b))*chargeSqRatio; 608 if(e < minKinEnergy) { x *= std::sqrt(e/minK << 485 if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy); 609 return x; 486 return x; 610 } 487 } 611 488 612 //....oooOO0OOooo........oooOO0OOooo........oo 489 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 613 490 614 inline G4double G4VEnergyLossProcess::GetScale << 491 inline G4double G4VEnergyLossProcess::GetSubDEDXForScaledEnergy(G4double e) 615 { 492 { 616 //G4cout << "G4VEnergyLossProcess::GetScaled << 493 G4bool b; 617 // << basedCoupleIndex << " E(MeV)= << 494 G4double x = 618 // << " lastIdx= " << lastIdx << " << 495 ((*theDEDXSubTable)[currentMaterialIndex]->GetValue(e, b))*chargeSqRatio; 619 if(currentCoupleIndex != coupleIdxRange || f << 496 if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy); 620 coupleIdxRange = currentCoupleIndex; << 497 return x; 621 fRangeEnergy = e; << 622 fRange = reduceFactor*((*theRangeTableForL << 623 if (fRange < 0.0) { fRange = 0.0; } << 624 else if (e < minKinEnergy) { fRange *= std << 625 } << 626 //G4cout << "G4VEnergyLossProcess::GetScaled << 627 // << basedCoupleIndex << " E(MeV)= << 628 // << " R= " << computedRange << " << 629 return fRange; << 630 } << 631 << 632 inline G4double << 633 G4VEnergyLossProcess::GetScaledRangeForScaledE << 634 { << 635 //G4cout << "G4VEnergyLossProcess::GetScaled << 636 // << basedCoupleIndex << " E(MeV)= << 637 // << " lastIdx= " << lastIdx << " << 638 if(currentCoupleIndex != coupleIdxRange || f << 639 coupleIdxRange = currentCoupleIndex; << 640 fRangeEnergy = e; << 641 fRange = reduceFactor*((*theRangeTableForL << 642 if (fRange < 0.0) { fRange = 0.0; } << 643 else if (e < minKinEnergy) { fRange *= std << 644 } << 645 //G4cout << "G4VEnergyLossProcess::GetScaled << 646 // << basedCoupleIndex << " E(MeV)= << 647 // << " R= " << fRange << " " << t << 648 return fRange; << 649 } 498 } 650 499 651 //....oooOO0OOooo........oooOO0OOooo........oo 500 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 652 501 653 inline G4double << 502 inline G4double G4VEnergyLossProcess::GetRange(G4double& kineticEnergy, 654 G4VEnergyLossProcess::GetLimitScaledRangeForSc << 503 const G4MaterialCutsCouple* couple) 655 { 504 { 656 G4double x = ((*theCSDARangeTable)[basedCoup << 505 G4double x = fRange; 657 if (x < 0.0) { x = 0.0; } << 506 if(kineticEnergy != preStepKinEnergy || couple != currentCouple) { 658 else if (e < minKinEnergy) { x *= std::sqrt( << 507 DefineMaterial(couple); >> 508 if(theCSDARangeTable) >> 509 x = GetLimitScaledRangeForScaledEnergy(kineticEnergy*massRatio) >> 510 * reduceFactor; >> 511 else if(theRangeTableForLoss) >> 512 x = GetScaledRangeForScaledEnergy(kineticEnergy*massRatio)*reduceFactor; >> 513 } 659 return x; 514 return x; 660 } 515 } 661 516 662 //....oooOO0OOooo........oooOO0OOooo........oo 517 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 663 518 664 inline G4double << 519 inline G4double G4VEnergyLossProcess::GetCSDARange( 665 G4VEnergyLossProcess::GetLimitScaledRangeForSc << 520 G4double& kineticEnergy, const G4MaterialCutsCouple* couple) 666 << 521 { 667 { << 522 DefineMaterial(couple); 668 G4double x = ((*theCSDARangeTable)[basedCoup << 523 G4double x = DBL_MAX; 669 if (x < 0.0) { x = 0.0; } << 524 if(theCSDARangeTable) 670 else if (e < minKinEnergy) { x *= std::sqrt( << 525 x = GetLimitScaledRangeForScaledEnergy(kineticEnergy*massRatio) >> 526 * reduceFactor; 671 return x; 527 return x; 672 } 528 } 673 529 674 //....oooOO0OOooo........oooOO0OOooo........oo 530 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 675 531 676 inline G4double G4VEnergyLossProcess::ScaledKi << 532 inline G4double G4VEnergyLossProcess::GetLimitScaledRangeForScaledEnergy( >> 533 G4double e) 677 { 534 { 678 //G4cout << "G4VEnergyLossProcess::GetEnergy << 535 G4bool b; 679 // << basedCoupleIndex << " R(mm)= " << 536 G4double x; 680 // << theInverseRangeTable << G4endl << 537 681 G4PhysicsVector* v = (*theInverseRangeTable) << 538 if (e < maxKinEnergyCSDA) { 682 G4double rmin = v->Energy(0); << 539 x = ((*theCSDARangeTable)[currentMaterialIndex])->GetValue(e, b); 683 G4double e = 0.0; << 540 if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy); 684 if(r >= rmin) { e = v->Value(r, idxInverseRa << 541 } else { 685 else if(r > 0.0) { << 542 x = theRangeAtMaxEnergy[currentMaterialIndex] + 686 G4double x = r/rmin; << 543 (e - maxKinEnergyCSDA)/theDEDXAtMaxEnergy[currentMaterialIndex]; 687 e = minKinEnergy*x*x; << 688 } 544 } 689 return e; << 545 return x; 690 } 546 } 691 547 692 //....oooOO0OOooo........oooOO0OOooo........oo 548 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 693 549 694 inline G4double G4VEnergyLossProcess::GetLambd << 550 inline G4double G4VEnergyLossProcess::GetRangeForLoss( >> 551 G4double& kineticEnergy, >> 552 const G4MaterialCutsCouple* couple) 695 { 553 { 696 return fFactor*((*theLambdaTable)[basedCoupl << 554 DefineMaterial(couple); >> 555 G4double x = DBL_MAX; >> 556 if(theRangeTableForLoss) >> 557 x = GetScaledRangeForScaledEnergy(kineticEnergy*massRatio)*reduceFactor; >> 558 // G4cout << "Range from " << GetProcessName() << " e= " << kineticEnergy << " r= " << x << G4endl; >> 559 return x; 697 } 560 } 698 561 699 //....oooOO0OOooo........oooOO0OOooo........oo 562 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 700 563 701 inline G4double << 564 inline G4double G4VEnergyLossProcess::GetScaledRangeForScaledEnergy(G4double e) 702 G4VEnergyLossProcess::GetLambdaForScaledEnergy << 703 { 565 { 704 return fFactor*((*theLambdaTable)[basedCoupl << 566 G4bool b; >> 567 G4double x = ((*theRangeTableForLoss)[currentMaterialIndex])->GetValue(e, b); >> 568 if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy); >> 569 return x; 705 } 570 } 706 571 707 //....oooOO0OOooo........oooOO0OOooo........oo 572 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 708 573 709 inline G4double G4VEnergyLossProcess::LogScale << 574 inline G4double G4VEnergyLossProcess::GetKineticEnergy( >> 575 G4double& range, >> 576 const G4MaterialCutsCouple* couple) 710 { 577 { 711 return track.GetDynamicParticle()->GetLogKin << 578 DefineMaterial(couple); >> 579 G4double r = range/reduceFactor; >> 580 G4double e = ScaledKinEnergyForLoss(r)/massRatio; >> 581 return e; 712 } 582 } 713 583 714 //....oooOO0OOooo........oooOO0OOooo........oo 584 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 715 585 716 inline G4double << 586 inline G4double G4VEnergyLossProcess::ScaledKinEnergyForLoss(G4double r) 717 G4VEnergyLossProcess::GetDEDX(G4double kinEner << 718 const G4Material << 719 { 587 { 720 DefineMaterial(couple); << 588 G4PhysicsVector* v = (*theInverseRangeTable)[currentMaterialIndex]; 721 return GetDEDXForScaledEnergy(kinEnergy*mass << 589 G4double rmin = v->GetLowEdgeEnergy(0); >> 590 G4double e = minKinEnergy; >> 591 if(r <= rmin) { >> 592 r /= rmin; >> 593 e *= r*r; >> 594 } else { >> 595 G4bool b; >> 596 e = v->GetValue(r, b); >> 597 } >> 598 return e; 722 } 599 } 723 600 724 //....oooOO0OOooo........oooOO0OOooo........oo 601 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 725 602 726 inline G4double << 603 inline G4double G4VEnergyLossProcess::GetDEDXDispersion( 727 G4VEnergyLossProcess::GetDEDX(G4double kinEner << 604 const G4MaterialCutsCouple *couple, 728 const G4Material << 605 const G4DynamicParticle* dp, 729 G4double logKinE << 606 G4double length) 730 { 607 { 731 DefineMaterial(couple); 608 DefineMaterial(couple); 732 return GetDEDXForScaledEnergy(kinEnergy*mass << 609 G4double ekin = dp->GetKineticEnergy(); >> 610 G4VEmModel* currentModel = SelectModel(ekin*massRatio); >> 611 G4double tmax = currentModel->MaxSecondaryKinEnergy(dp); >> 612 tmax = std::min(tmax,(*theCuts)[currentMaterialIndex]); >> 613 G4double d = 0.0; >> 614 G4VEmFluctuationModel* fm = currentModel->GetModelOfFluctuations(); >> 615 if(fm) d = fm->Dispersion(currentMaterial,dp,tmax,length); >> 616 return d; 733 } 617 } 734 618 735 //....oooOO0OOooo........oooOO0OOooo........oo 619 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 736 620 737 inline G4double << 621 inline G4double G4VEnergyLossProcess::GetLambda(G4double& kineticEnergy, 738 G4VEnergyLossProcess::GetRange(G4double kinEne << 622 const G4MaterialCutsCouple* couple) 739 const G4Materia << 740 { 623 { 741 DefineMaterial(couple); 624 DefineMaterial(couple); 742 return GetScaledRangeForScaledEnergy(kinEner << 625 G4double x = 0.0; >> 626 if(theLambdaTable) x = GetLambdaForScaledEnergy(kineticEnergy*massRatio); >> 627 return x; 743 } 628 } 744 629 745 //....oooOO0OOooo........oooOO0OOooo........oo 630 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 746 631 747 inline G4double << 632 inline G4double G4VEnergyLossProcess::GetLambdaForScaledEnergy(G4double e) 748 G4VEnergyLossProcess::GetRange(G4double kinEne << 749 const G4Materia << 750 G4double logKin << 751 { 633 { 752 DefineMaterial(couple); << 634 G4bool b; 753 return GetScaledRangeForScaledEnergy(kinEner << 635 return >> 636 chargeSqRatio*(((*theLambdaTable)[currentMaterialIndex])->GetValue(e, b)); 754 } 637 } 755 638 756 //....oooOO0OOooo........oooOO0OOooo........oo 639 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 757 640 758 inline G4double << 641 inline void G4VEnergyLossProcess::ComputeLambdaForScaledEnergy(G4double e) 759 G4VEnergyLossProcess::GetCSDARange(G4double ki << 642 { 760 const G4Mat << 643 meanFreePath = false; 761 { << 644 aboveCSmax = false; 762 DefineMaterial(couple); << 645 mfpKinEnergy = theEnergyOfCrossSectionMax[currentMaterialIndex]; 763 return (nullptr == theCSDARangeTable) ? DBL_ << 646 if (e <= mfpKinEnergy) { 764 GetLimitScaledRangeForScaledEnergy(kinetic << 647 preStepLambda = GetLambdaForScaledEnergy(e); >> 648 } else { >> 649 aboveCSmax = true; >> 650 G4double e1 = e*lambdaFactor; >> 651 if(e1 > mfpKinEnergy) { >> 652 preStepLambda = GetLambdaForScaledEnergy(e); >> 653 G4double preStepLambda1 = GetLambdaForScaledEnergy(e1); >> 654 if(preStepLambda1 > preStepLambda) { >> 655 mfpKinEnergy = e1; >> 656 preStepLambda = preStepLambda1; >> 657 } >> 658 } else { >> 659 preStepLambda = chargeSqRatio*theCrossSectionMax[currentMaterialIndex]; >> 660 } >> 661 } 765 } 662 } 766 663 767 //....oooOO0OOooo........oooOO0OOooo........oo 664 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 768 665 769 inline G4double << 666 inline G4double G4VEnergyLossProcess::GetMeanFreePath( 770 G4VEnergyLossProcess::GetKineticEnergy(G4doubl << 667 const G4Track& track, G4double, G4ForceCondition* condition) 771 const G << 772 { 668 { 773 DefineMaterial(couple); << 669 *condition = NotForced; 774 return ScaledKinEnergyForLoss(range/reduceFa << 670 preStepKinEnergy = track.GetKineticEnergy(); >> 671 preStepScaledEnergy = preStepKinEnergy*massRatio; >> 672 if(aboveCSmax && preStepScaledEnergy < mfpKinEnergy) >> 673 ResetNumberOfInteractionLengthLeft(); >> 674 DefineMaterial(track.GetMaterialCutsCouple()); >> 675 if (meanFreePath) { >> 676 if (integral) ComputeLambdaForScaledEnergy(preStepScaledEnergy); >> 677 else preStepLambda = GetLambdaForScaledEnergy(preStepScaledEnergy); >> 678 if(0.0 < preStepLambda) preStepMFP = 1.0/preStepLambda; >> 679 else preStepMFP = DBL_MAX; >> 680 } >> 681 // G4cout<<GetProcessName()<<": e= "<<preStepKinEnergy<< " eCSmax= " >> 682 //<<mfpKinEnergy<< " mfp= "<<preStepMFP<<G4endl; >> 683 return preStepMFP; 775 } 684 } 776 685 777 //....oooOO0OOooo........oooOO0OOooo........oo 686 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 778 687 779 inline G4double << 688 inline G4double G4VEnergyLossProcess::GetContinuousStepLimit(const G4Track&, 780 G4VEnergyLossProcess::GetLambda(G4double kinEn << 689 G4double, G4double currentMinStep, G4double&) 781 const G4Materi << 782 { 690 { 783 DefineMaterial(couple); << 691 G4double x = DBL_MAX; 784 return (nullptr != theLambdaTable) ? << 692 if(isIonisation) { 785 GetLambdaForScaledEnergy(kinEnergy*massRat << 693 fRange = GetScaledRangeForScaledEnergy(preStepScaledEnergy)*reduceFactor; 786 } << 787 694 788 //....oooOO0OOooo........oooOO0OOooo........oo << 695 x = fRange; >> 696 G4double y = x*dRoverRange; 789 697 790 inline G4double << 698 if(x > finalRange && y < currentMinStep ) { 791 G4VEnergyLossProcess::GetLambda(G4double kinEn << 699 x = y + finalRange*(1.0 - dRoverRange)*(2.0 - finalRange/fRange); 792 const G4Materi << 700 // G4cout<<GetProcessName()<<": e= "<<preStepKinEnergy 793 G4double logKi << 701 // <<" range= "<<fRange <<" cMinSt="<<currentMinStep<< G4endl; 794 { << 702 } else if (rndmStepFlag) x = SampleRange(); 795 DefineMaterial(couple); << 703 } 796 return (nullptr != theLambdaTable) ? << 704 // G4cout<<GetProcessName()<<": e= "<<preStepKinEnergy 797 GetLambdaForScaledEnergy(kinEnergy*massRat << 705 // <<" stepLimit= "<<x<<G4endl; 798 : 0.0; << 706 return x; 799 } 707 } 800 708 801 // ======== Get/Set inline methods used at ini << 709 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 802 710 803 inline void G4VEnergyLossProcess::SetFluctMode << 711 inline G4double G4VEnergyLossProcess::SampleRange() 804 { 712 { 805 fluctModel = p; << 713 G4double e = amu_c2*preStepKinEnergy/particle->GetPDGMass(); >> 714 G4bool b; >> 715 G4double s = fRange*std::pow(10.,vstrag->GetValue(e,b)); >> 716 G4double x = fRange + G4RandGauss::shoot(0.0,s); >> 717 if(x > 0.0) fRange = x; >> 718 return fRange; 806 } 719 } 807 720 808 //....oooOO0OOooo........oooOO0OOooo........oo 721 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 809 722 810 inline G4VEmFluctuationModel* G4VEnergyLossPro << 723 inline void G4VEnergyLossProcess::ResetNumberOfInteractionLengthLeft() 811 { 724 { 812 return fluctModel; << 725 meanFreePath = true; >> 726 aboveCSmax = false; >> 727 G4VProcess::ResetNumberOfInteractionLengthLeft(); 813 } 728 } 814 729 815 //....oooOO0OOooo........oooOO0OOooo........oo 730 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 816 731 817 inline void G4VEnergyLossProcess::SetParticle( << 732 inline G4double G4VEnergyLossProcess::MinPrimaryEnergy( >> 733 const G4ParticleDefinition*, const G4Material*, G4double cut) 818 { 734 { 819 particle = p; << 735 return cut; 820 } 736 } 821 737 822 //....oooOO0OOooo........oooOO0OOooo........oo 738 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 823 739 824 inline void << 740 inline G4VEmModel* G4VEnergyLossProcess::SelectModel(G4double kinEnergy) 825 G4VEnergyLossProcess::SetSecondaryParticle(con << 826 { 741 { 827 secondaryParticle = p; << 742 return modelManager->SelectModel(kinEnergy, currentMaterialIndex); 828 } 743 } 829 744 830 //....oooOO0OOooo........oooOO0OOooo........oo 745 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 831 746 832 inline void << 747 inline G4VEmModel* G4VEnergyLossProcess::SelectModelForMaterial( 833 G4VEnergyLossProcess::SetBaseParticle(const G4 << 748 G4double kinEnergy, size_t& idx) const 834 { 749 { 835 baseParticle = p; << 750 return modelManager->SelectModel(kinEnergy, idx); 836 } 751 } 837 752 838 //....oooOO0OOooo........oooOO0OOooo........oo 753 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 839 754 840 inline const G4ParticleDefinition* G4VEnergyLo 755 inline const G4ParticleDefinition* G4VEnergyLossProcess::Particle() const 841 { 756 { 842 return particle; 757 return particle; 843 } 758 } 844 759 845 //....oooOO0OOooo........oooOO0OOooo........oo 760 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 846 761 847 inline const G4ParticleDefinition* G4VEnergyLo 762 inline const G4ParticleDefinition* G4VEnergyLossProcess::BaseParticle() const 848 { 763 { 849 return baseParticle; 764 return baseParticle; 850 } 765 } 851 766 852 //....oooOO0OOooo........oooOO0OOooo........oo 767 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 853 768 854 inline const G4ParticleDefinition* 769 inline const G4ParticleDefinition* 855 G4VEnergyLossProcess::SecondaryParticle() cons << 770 G4VEnergyLossProcess::SecondaryParticle() const 856 { 771 { 857 return secondaryParticle; 772 return secondaryParticle; 858 } 773 } 859 774 860 //....oooOO0OOooo........oooOO0OOooo........oo 775 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 861 776 862 inline void G4VEnergyLossProcess::SetLossFluct << 777 inline void G4VEnergyLossProcess::CorrectionsAlongStep( 863 { << 778 const G4MaterialCutsCouple*, 864 lossFluctuationFlag = val; << 779 const G4DynamicParticle*, 865 actLossFluc = true; << 780 G4double&, 866 } << 781 G4double&) 867 << 782 {} 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 783 931 //....oooOO0OOooo........oooOO0OOooo........oo 784 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 932 785 933 inline G4PhysicsTable* G4VEnergyLossProcess::D 786 inline G4PhysicsTable* G4VEnergyLossProcess::DEDXTable() const 934 { 787 { 935 return theDEDXTable; 788 return theDEDXTable; 936 } 789 } 937 790 938 //....oooOO0OOooo........oooOO0OOooo........oo 791 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 939 792 940 inline G4PhysicsTable* G4VEnergyLossProcess::D << 793 inline G4PhysicsTable* G4VEnergyLossProcess::DEDXTableForSubsec() const 941 { 794 { 942 return theDEDXunRestrictedTable; << 795 return theDEDXSubTable; 943 } 796 } 944 797 945 //....oooOO0OOooo........oooOO0OOooo........oo 798 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 946 799 947 inline G4PhysicsTable* G4VEnergyLossProcess::I << 800 inline G4PhysicsTable* G4VEnergyLossProcess::DEDXunRestrictedTable() const 948 { 801 { 949 return theIonisationTable; << 802 return theDEDXunRestrictedTable; 950 } 803 } 951 804 952 //....oooOO0OOooo........oooOO0OOooo........oo 805 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 953 806 954 inline G4PhysicsTable* G4VEnergyLossProcess::C 807 inline G4PhysicsTable* G4VEnergyLossProcess::CSDARangeTable() const 955 { 808 { 956 return theCSDARangeTable; 809 return theCSDARangeTable; 957 } 810 } 958 811 959 //....oooOO0OOooo........oooOO0OOooo........oo 812 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 960 813 961 inline G4PhysicsTable* G4VEnergyLossProcess::R 814 inline G4PhysicsTable* G4VEnergyLossProcess::RangeTableForLoss() const 962 { 815 { 963 return theRangeTableForLoss; 816 return theRangeTableForLoss; 964 } 817 } 965 818 966 //....oooOO0OOooo........oooOO0OOooo........oo 819 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 967 820 968 inline G4PhysicsTable* G4VEnergyLossProcess::I 821 inline G4PhysicsTable* G4VEnergyLossProcess::InverseRangeTable() const 969 { 822 { 970 return theInverseRangeTable; 823 return theInverseRangeTable; 971 } 824 } 972 825 973 //....oooOO0OOooo........oooOO0OOooo........oo 826 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 974 827 975 inline G4PhysicsTable* G4VEnergyLossProcess::L << 828 inline G4PhysicsTable* G4VEnergyLossProcess::LambdaTable() 976 { 829 { 977 return theLambdaTable; 830 return theLambdaTable; 978 } 831 } 979 832 980 //....oooOO0OOooo........oooOO0OOooo........oo 833 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 981 834 982 inline G4bool G4VEnergyLossProcess::UseBaseMat << 835 inline G4PhysicsTable* G4VEnergyLossProcess::SubLambdaTable() 983 { 836 { 984 return baseMat; << 837 return theSubLambdaTable; 985 } 838 } 986 839 987 //....oooOO0OOooo........oooOO0OOooo........oo 840 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 988 << 841 989 inline std::vector<G4double>* << 842 inline G4bool G4VEnergyLossProcess::IsIntegral() const 990 G4VEnergyLossProcess::EnergyOfCrossSectionMax( << 991 { 843 { 992 return theEnergyOfCrossSectionMax; << 844 return integral; 993 } 845 } 994 846 995 //....oooOO0OOooo........oooOO0OOooo........oo 847 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 996 848 997 inline std::vector<G4TwoPeaksXS*>* G4VEnergyLo << 849 inline size_t G4VEnergyLossProcess::CurrentMaterialCutsCoupleIndex() const 998 { 850 { 999 return fXSpeaks; << 851 return currentMaterialIndex; 1000 } 852 } 1001 853 1002 //....oooOO0OOooo........oooOO0OOooo........o 854 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 1003 855 1004 inline std::size_t G4VEnergyLossProcess::Numb << 856 inline void G4VEnergyLossProcess::SetDynamicMassCharge(G4double massratio, >> 857 G4double charge2ratio) >> 858 { >> 859 massRatio = massratio; >> 860 chargeSqRatio = charge2ratio; >> 861 chargeSquare = charge2ratio*eplus*eplus; >> 862 reduceFactor = 1.0/(chargeSqRatio*massRatio); >> 863 } >> 864 >> 865 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 866 >> 867 inline G4double G4VEnergyLossProcess::GetCurrentRange() const >> 868 { >> 869 return fRange; >> 870 } >> 871 >> 872 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 873 >> 874 inline void G4VEnergyLossProcess::AddCollaborativeProcess( >> 875 G4VEnergyLossProcess* p) 1005 { 876 { 1006 return numberOfModels; << 877 scProcesses.push_back(p); 1007 } 878 } 1008 879 1009 //....oooOO0OOooo........oooOO0OOooo........o 880 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 1010 881 1011 inline G4VEmModel* G4VEnergyLossProcess::EmMo << 882 inline G4VEmModel* G4VEnergyLossProcess::GetModelByIndex(G4int idx) 1012 { 883 { 1013 return (index < emModels->size()) ? (*emMod << 884 return modelManager->GetModel(idx); 1014 } 885 } 1015 886 1016 //....oooOO0OOooo........oooOO0OOooo........o 887 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 1017 888 1018 inline G4VEmModel* << 889 inline G4int G4VEnergyLossProcess::NumberOfModels() 1019 G4VEnergyLossProcess::GetModelByIndex(std::si << 1020 { 890 { 1021 return modelManager->GetModel((G4int)idx, v << 891 return modelManager->NumberOfModels(); 1022 } 892 } 1023 893 1024 //....oooOO0OOooo........oooOO0OOooo........o 894 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 1025 895 1026 #endif 896 #endif 1027 897