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