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