Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // >> 26 // $Id: G4VEmProcess.hh,v 1.61 2010-08-17 17:36:59 vnivanch Exp $ >> 27 // GEANT4 tag $Name: geant4-09-04-patch-02 $ >> 28 // 26 // ------------------------------------------- 29 // ------------------------------------------------------------------- 27 // 30 // 28 // GEANT4 Class header file 31 // GEANT4 Class header file 29 // 32 // 30 // 33 // 31 // File name: G4VEmProcess 34 // File name: G4VEmProcess 32 // 35 // 33 // Author: Vladimir Ivanchenko 36 // Author: Vladimir Ivanchenko 34 // 37 // 35 // Creation date: 01.10.2003 38 // Creation date: 01.10.2003 36 // 39 // 37 // Modifications: Vladimir Ivanchenko << 40 // Modifications: >> 41 // 30-06-04 make destructor virtual (V.Ivanchenko) >> 42 // 09-08-04 optimise integral option (V.Ivanchenko) >> 43 // 11-08-04 add protected methods to access cuts (V.Ivanchenko) >> 44 // 09-09-04 Bug fix for the integral mode with 2 peaks (V.Ivanchneko) >> 45 // 16-09-04 Add flag for LambdaTable and method RecalculateLambda (VI) >> 46 // 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivantchenko) >> 47 // 08-04-05 Major optimisation of internal interfaces (V.Ivantchenko) >> 48 // 18-04-05 Use G4ParticleChangeForGamma (V.Ivantchenko) >> 49 // 09-05-05 Fix problem in logic when path boundary between materials (VI) >> 50 // 11-01-06 add A to parameters of ComputeCrossSectionPerAtom (VI) >> 51 // 01-02-06 put default value A=0. to keep compatibility with v5.2 (mma) >> 52 // 13-05-06 Add method to access model by index (V.Ivanchenko) >> 53 // 12-09-06 add SetModel() (mma) >> 54 // 25-09-07 More accurate handling zero xsect in >> 55 // PostStepGetPhysicalInteractionLength (V.Ivanchenko) >> 56 // 27-10-07 Virtual functions moved to source (V.Ivanchenko) >> 57 // 15-07-08 Reorder class members for further multi-thread development (VI) >> 58 // 17-02-10 Added pointer currentParticle (VI) 38 // 59 // 39 // Class Description: 60 // Class Description: 40 // 61 // 41 // It is the base class - EM discrete and rest << 62 // It is the unified Discrete process 42 63 43 // ------------------------------------------- 64 // ------------------------------------------------------------------- 44 // 65 // 45 66 46 #ifndef G4VEmProcess_h 67 #ifndef G4VEmProcess_h 47 #define G4VEmProcess_h 1 68 #define G4VEmProcess_h 1 48 69 49 #include <CLHEP/Units/SystemOfUnits.h> << 50 << 51 #include "G4VDiscreteProcess.hh" 70 #include "G4VDiscreteProcess.hh" 52 #include "globals.hh" 71 #include "globals.hh" 53 #include "G4Material.hh" 72 #include "G4Material.hh" 54 #include "G4MaterialCutsCouple.hh" 73 #include "G4MaterialCutsCouple.hh" 55 #include "G4Track.hh" 74 #include "G4Track.hh" >> 75 #include "G4EmModelManager.hh" 56 #include "G4UnitsTable.hh" 76 #include "G4UnitsTable.hh" 57 #include "G4ParticleDefinition.hh" 77 #include "G4ParticleDefinition.hh" 58 #include "G4ParticleChangeForGamma.hh" 78 #include "G4ParticleChangeForGamma.hh" 59 #include "G4EmParameters.hh" << 60 #include "G4EmDataHandler.hh" << 61 #include "G4EmTableType.hh" << 62 #include "G4EmModelManager.hh" << 63 #include "G4EmSecondaryParticleType.hh" << 64 79 65 class G4Step; 80 class G4Step; 66 class G4VEmModel; 81 class G4VEmModel; 67 class G4DataVector; 82 class G4DataVector; 68 class G4VParticleChange; 83 class G4VParticleChange; 69 class G4PhysicsTable; 84 class G4PhysicsTable; 70 class G4PhysicsVector; 85 class G4PhysicsVector; 71 class G4EmBiasingManager; << 72 class G4LossTableManager; << 73 86 74 //....oooOO0OOooo........oooOO0OOooo........oo 87 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 75 88 76 class G4VEmProcess : public G4VDiscreteProcess 89 class G4VEmProcess : public G4VDiscreteProcess 77 { 90 { 78 public: 91 public: 79 92 80 G4VEmProcess(const G4String& name, G4Process << 93 G4VEmProcess(const G4String& name, >> 94 G4ProcessType type = fElectromagnetic); 81 95 82 ~G4VEmProcess() override; << 96 virtual ~G4VEmProcess(); 83 97 84 //------------------------------------------ 98 //------------------------------------------------------------------------ 85 // Virtual methods to be implemented in conc 99 // Virtual methods to be implemented in concrete processes 86 //------------------------------------------ 100 //------------------------------------------------------------------------ 87 101 88 void ProcessDescription(std::ostream& outFil << 102 virtual G4bool IsApplicable(const G4ParticleDefinition& p) = 0; 89 103 90 protected: << 104 virtual void PrintInfo() = 0; 91 105 92 virtual void StreamProcessInfo(std::ostream& << 106 protected: 93 107 94 virtual void InitialiseProcess(const G4Parti 108 virtual void InitialiseProcess(const G4ParticleDefinition*) = 0; 95 109 96 //------------------------------------------ 110 //------------------------------------------------------------------------ 97 // Implementation of virtual methods common 111 // Implementation of virtual methods common to all Discrete processes 98 //------------------------------------------ 112 //------------------------------------------------------------------------ 99 113 100 public: 114 public: 101 115 102 // Initialise for build of tables 116 // Initialise for build of tables 103 void PreparePhysicsTable(const G4ParticleDef << 117 void PreparePhysicsTable(const G4ParticleDefinition&); 104 118 105 // Build physics table during initialisation 119 // Build physics table during initialisation 106 void BuildPhysicsTable(const G4ParticleDefin << 120 void BuildPhysicsTable(const G4ParticleDefinition&); 107 121 108 // Called before tracking of each new G4Trac << 122 void PrintInfoDefinition(); 109 void StartTracking(G4Track*) override; << 110 123 111 // implementation of virtual method, specifi 124 // implementation of virtual method, specific for G4VEmProcess 112 G4double PostStepGetPhysicalInteractionLengt 125 G4double PostStepGetPhysicalInteractionLength( 113 const G4Track& tr 126 const G4Track& track, 114 G4double previo 127 G4double previousStepSize, 115 G4ForceCondition* << 128 G4ForceCondition* condition >> 129 ); 116 130 117 // implementation of virtual method, specifi 131 // implementation of virtual method, specific for G4VEmProcess 118 G4VParticleChange* PostStepDoIt(const G4Trac << 132 G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&); 119 133 120 // Store PhysicsTable in a file. 134 // Store PhysicsTable in a file. 121 // Return false in case of failure at I/O 135 // Return false in case of failure at I/O 122 G4bool StorePhysicsTable(const G4ParticleDef 136 G4bool StorePhysicsTable(const G4ParticleDefinition*, 123 const G4String& dir << 137 const G4String& directory, 124 G4bool ascii = fals << 138 G4bool ascii = false); 125 139 126 // Retrieve Physics from a file. 140 // Retrieve Physics from a file. 127 // (return true if the Physics Table can be 141 // (return true if the Physics Table can be build by using file) 128 // (return false if the process has no funct 142 // (return false if the process has no functionality or in case of failure) 129 // File name should is constructed as proces 143 // File name should is constructed as processName+particleName and the 130 // should be placed under the directory spec << 144 // should be placed under the directory specifed by the argument. 131 G4bool RetrievePhysicsTable(const G4Particle 145 G4bool RetrievePhysicsTable(const G4ParticleDefinition*, 132 const G4String& << 146 const G4String& directory, 133 G4bool ascii) ov << 147 G4bool ascii); 134 148 135 // allowing check process name << 149 // deexcitation activated per G4Region 136 virtual G4VEmProcess* GetEmProcess(const G4S << 150 void ActivateDeexcitation(G4bool, const G4Region* r = 0); 137 151 138 //------------------------------------------ 152 //------------------------------------------------------------------------ 139 // Specific methods for Discrete EM post ste 153 // Specific methods for Discrete EM post step simulation 140 //------------------------------------------ 154 //------------------------------------------------------------------------ 141 155 142 // The main method to access cross section p << 156 // It returns the cross section per volume for energy/ material 143 inline G4double GetLambda(G4double kinEnergy << 157 G4double CrossSectionPerVolume(G4double kineticEnergy, 144 const G4MaterialCu << 158 const G4MaterialCutsCouple* couple); 145 G4double logKinEne << 146 << 147 // It returns the cross section per volume f << 148 G4double GetCrossSection(const G4double kinE << 149 const G4MaterialCut << 150 159 151 // It returns the cross section of the proce 160 // It returns the cross section of the process per atom 152 G4double ComputeCrossSectionPerAtom(G4double 161 G4double ComputeCrossSectionPerAtom(G4double kineticEnergy, 153 G4double << 162 G4double Z, G4double A=0., 154 G4double << 163 G4double cut=0.0); >> 164 >> 165 G4double MeanFreePath(const G4Track& track); 155 166 156 inline G4double MeanFreePath(const G4Track& << 167 // It returns cross section per volume >> 168 inline G4double GetLambda(G4double& kinEnergy, >> 169 const G4MaterialCutsCouple* couple); 157 170 158 //------------------------------------------ 171 //------------------------------------------------------------------------ 159 // Specific methods to build and access Phys 172 // Specific methods to build and access Physics Tables 160 //------------------------------------------ 173 //------------------------------------------------------------------------ 161 174 162 // Binning for lambda table 175 // Binning for lambda table 163 void SetLambdaBinning(G4int nbins); << 176 inline void SetLambdaBinning(G4int nbins); >> 177 inline G4int LambdaBinning() const; 164 178 165 // Min kinetic energy for tables 179 // Min kinetic energy for tables 166 void SetMinKinEnergy(G4double e); << 180 inline void SetMinKinEnergy(G4double e); 167 << 181 inline G4double MinKinEnergy() const; 168 // Min kinetic energy for high energy table << 169 void SetMinKinEnergyPrim(G4double e); << 170 182 171 // Max kinetic energy for tables 183 // Max kinetic energy for tables 172 void SetMaxKinEnergy(G4double e); << 184 inline void SetMaxKinEnergy(G4double e); >> 185 inline G4double MaxKinEnergy() const; >> 186 >> 187 inline void SetPolarAngleLimit(G4double a); >> 188 inline G4double PolarAngleLimit() const; 173 189 174 // Cross section table pointers << 190 inline const G4PhysicsTable* LambdaTable() const; 175 inline G4PhysicsTable* LambdaTable() const; << 176 inline G4PhysicsTable* LambdaTablePrim() con << 177 inline void SetLambdaTable(G4PhysicsTable*); << 178 inline void SetLambdaTablePrim(G4PhysicsTabl << 179 << 180 // Integral method type and peak positions << 181 inline std::vector<G4double>* EnergyOfCrossS << 182 inline void SetEnergyOfCrossSectionMax(std:: << 183 inline G4CrossSectionType CrossSectionType() << 184 inline void SetCrossSectionType(G4CrossSecti << 185 191 186 //------------------------------------------ 192 //------------------------------------------------------------------------ 187 // Define and access particle type 193 // Define and access particle type 188 //------------------------------------------ 194 //------------------------------------------------------------------------ 189 195 190 inline const G4ParticleDefinition* Particle( 196 inline const G4ParticleDefinition* Particle() const; 191 inline const G4ParticleDefinition* Secondary 197 inline const G4ParticleDefinition* SecondaryParticle() const; 192 198 193 protected: << 194 << 195 //------------------------------------------ 199 //------------------------------------------------------------------------ 196 // Specific methods to set, access, modify m 200 // Specific methods to set, access, modify models and basic parameters 197 //------------------------------------------ 201 //------------------------------------------------------------------------ 198 << 202 >> 203 protected: 199 // Select model in run time 204 // Select model in run time 200 inline G4VEmModel* SelectModel(G4double kinE << 205 inline G4VEmModel* SelectModel(G4double& kinEnergy, size_t index); 201 206 202 public: 207 public: 203 << 208 // Select model by energy and region index 204 // Select model by energy and couple index << 205 inline G4VEmModel* SelectModelForMaterial(G4 209 inline G4VEmModel* SelectModelForMaterial(G4double kinEnergy, 206 st << 210 size_t& idxRegion) const; 207 211 208 // Add model for region, smaller value of or 212 // Add model for region, smaller value of order defines which 209 // model will be selected for a given energy 213 // model will be selected for a given energy interval 210 void AddEmModel(G4int, G4VEmModel*, const G4 << 214 void AddEmModel(G4int, G4VEmModel*, const G4Region* region = 0); 211 << 212 // Assign a model to a process local list, t << 213 // the derived process should execute AddEmM << 214 void SetEmModel(G4VEmModel*, G4int index = 0 << 215 << 216 inline G4int NumberOfModels() const; << 217 << 218 // return a model from the local list << 219 inline G4VEmModel* EmModel(std::size_t index << 220 215 221 // Access to active model << 216 // Assign a model to a process 222 inline const G4VEmModel* GetCurrentModel() c << 217 void SetModel(G4VEmModel*, G4int index = 1); >> 218 >> 219 // return the assigned model >> 220 G4VEmModel* Model(G4int index = 1); >> 221 >> 222 // Define new energy range for the model identified by the name >> 223 void UpdateEmModel(const G4String&, G4double, G4double); 223 224 224 // Access to models 225 // Access to models 225 inline G4VEmModel* GetModelByIndex(G4int idx << 226 G4VEmModel* GetModelByIndex(G4int idx = 0, G4bool ver = false); 226 227 227 // Access to the current G4Element << 228 // access atom on which interaction happens 228 const G4Element* GetCurrentElement() const; 229 const G4Element* GetCurrentElement() const; 229 230 230 // Biasing parameters << 231 inline void SetLambdaFactor(G4double val); 231 void SetCrossSectionBiasingFactor(G4double f << 232 inline G4double CrossSectionBiasingFactor() << 233 << 234 // Activate forced interaction << 235 void ActivateForcedInteraction(G4double leng << 236 const G4Strin << 237 G4bool flag = << 238 232 239 void ActivateSecondaryBiasing(const G4String << 233 inline void SetIntegral(G4bool val); 240 G4double energ << 234 inline G4bool IsIntegral() const; 241 235 242 inline void SetEmMasterProcess(const G4VEmPr << 236 inline void SetApplyCuts(G4bool val); 243 237 244 inline void SetBuildTableFlag(G4bool val); 238 inline void SetBuildTableFlag(G4bool val); 245 239 246 inline void CurrentSetup(const G4MaterialCut << 247 << 248 inline G4bool UseBaseMaterial() const; << 249 << 250 void BuildLambdaTable(); << 251 << 252 void StreamInfo(std::ostream& outFile, const << 253 G4bool rst=false) const; << 254 << 255 // hide copy constructor and assignment oper << 256 G4VEmProcess(G4VEmProcess &) = delete; << 257 G4VEmProcess & operator=(const G4VEmProcess << 258 << 259 //------------------------------------------ 240 //------------------------------------------------------------------------ 260 // Other generic methods 241 // Other generic methods 261 //------------------------------------------ 242 //------------------------------------------------------------------------ 262 243 263 protected: 244 protected: 264 245 265 G4double GetMeanFreePath(const G4Track& trac 246 G4double GetMeanFreePath(const G4Track& track, 266 G4double previousSt << 247 G4double previousStepSize, 267 G4ForceCondition* c << 248 G4ForceCondition* condition); 268 249 269 G4PhysicsVector* LambdaPhysicsVector(const G 250 G4PhysicsVector* LambdaPhysicsVector(const G4MaterialCutsCouple*); 270 251 271 inline void DefineMaterial(const G4MaterialC << 252 inline G4double RecalculateLambda(G4double kinEnergy, 272 << 253 const G4MaterialCutsCouple* couple); 273 inline G4int LambdaBinning() const; << 274 << 275 inline G4double MinKinEnergy() const; << 276 << 277 inline G4double MaxKinEnergy() const; << 278 << 279 // Single scattering parameters << 280 inline G4double PolarAngleLimit() const; << 281 254 282 inline G4ParticleChangeForGamma* GetParticle 255 inline G4ParticleChangeForGamma* GetParticleChange(); 283 256 284 inline void SetParticle(const G4ParticleDefi 257 inline void SetParticle(const G4ParticleDefinition* p); 285 258 286 inline void SetSecondaryParticle(const G4Par 259 inline void SetSecondaryParticle(const G4ParticleDefinition* p); 287 260 288 inline std::size_t CurrentMaterialCutsCouple << 261 inline size_t CurrentMaterialCutsCoupleIndex() const; 289 << 290 inline const G4MaterialCutsCouple* MaterialC << 291 << 292 inline G4bool ApplyCuts() const; << 293 262 294 inline G4double GetGammaEnergyCut(); 263 inline G4double GetGammaEnergyCut(); 295 264 296 inline G4double GetElectronEnergyCut(); 265 inline G4double GetElectronEnergyCut(); 297 266 298 inline void SetStartFromNullFlag(G4bool val) 267 inline void SetStartFromNullFlag(G4bool val); 299 268 300 inline void SetSplineFlag(G4bool val); << 301 << 302 const G4Element* GetTargetElement() const; << 303 << 304 const G4Isotope* GetTargetIsotope() const; << 305 << 306 // these two methods assume that vectors are << 307 // and idx is within vector length << 308 inline G4int DensityIndex(G4int idx) const; << 309 inline G4double DensityFactor(G4int idx) con << 310 << 311 private: 269 private: 312 270 313 void PrintWarning(G4String tit, G4double val << 271 void Clear(); 314 272 315 void ComputeIntegralLambda(G4double kinEnerg << 273 void BuildLambdaTable(); 316 274 317 inline G4double LogEkin(const G4Track&); << 275 void FindLambdaMax(); 318 276 319 inline G4double GetLambdaFromTable(G4double << 277 inline void InitialiseStep(const G4Track&); 320 278 321 inline G4double GetLambdaFromTable(G4double << 279 inline void DefineMaterial(const G4MaterialCutsCouple* couple); 322 280 323 inline G4double GetLambdaFromTablePrim(G4dou << 281 inline void ComputeIntegralLambda(G4double kinEnergy); 324 282 325 inline G4double GetLambdaFromTablePrim(G4dou << 283 inline G4double GetLambdaFromTable(G4double kinEnergy); 326 284 327 inline G4double GetCurrentLambda(G4double ki 285 inline G4double GetCurrentLambda(G4double kinEnergy); 328 286 329 inline G4double GetCurrentLambda(G4double ki << 330 << 331 inline G4double ComputeCurrentLambda(G4doubl 287 inline G4double ComputeCurrentLambda(G4double kinEnergy); 332 288 333 // ======== pointers ========= << 289 // copy constructor and hide assignment operator >> 290 G4VEmProcess(G4VEmProcess &); >> 291 G4VEmProcess & operator=(const G4VEmProcess &right); 334 292 335 G4EmModelManager* modelManager = << 293 // ======== Parameters of the class fixed at construction ========= 336 const G4ParticleDefinition* particle = null << 337 const G4ParticleDefinition* currentParticle << 338 const G4ParticleDefinition* theGamma = null << 339 const G4ParticleDefinition* theElectron = n << 340 const G4ParticleDefinition* thePositron = n << 341 const G4ParticleDefinition* secondaryPartic << 342 const G4VEmProcess* masterProc = nu << 343 G4EmDataHandler* theData = nullp << 344 G4VEmModel* currentModel = << 345 G4LossTableManager* lManager = null << 346 G4EmParameters* theParameters = << 347 const G4Material* baseMaterial = << 348 << 349 // ======== tables and vectors ======== << 350 G4PhysicsTable* theLambdaTable << 351 G4PhysicsTable* theLambdaTableP << 352 << 353 const std::vector<G4double>* theCuts = nullp << 354 const std::vector<G4double>* theCutsGamma = << 355 const std::vector<G4double>* theCutsElectron << 356 const std::vector<G4double>* theCutsPositron << 357 294 358 protected: << 295 G4EmModelManager* modelManager; >> 296 const G4ParticleDefinition* theGamma; >> 297 const G4ParticleDefinition* theElectron; >> 298 const G4ParticleDefinition* thePositron; >> 299 const G4ParticleDefinition* secondaryParticle; 359 300 360 // ======== pointers ========= << 301 G4bool buildLambdaTable; 361 302 362 const G4MaterialCutsCouple* currentCouple = << 303 // ======== Parameters of the class fixed at initialisation ======= 363 const G4Material* currentMaterial << 364 G4EmBiasingManager* biasManager = n << 365 std::vector<G4double>* theEnergyOfCros << 366 304 367 private: << 305 std::vector<G4VEmModel*> emModels; 368 306 369 const std::vector<G4double>* theDensityFacto << 307 // tables and vectors 370 const std::vector<G4int>* theDensityIdx = nu << 308 G4PhysicsTable* theLambdaTable; >> 309 G4double* theEnergyOfCrossSectionMax; >> 310 G4double* theCrossSectionMax; 371 311 372 // ======== parameters ========= << 312 const std::vector<G4double>* theCuts; 373 G4double minKinEnergy; << 313 const std::vector<G4double>* theCutsGamma; 374 G4double maxKinEnergy; << 314 const std::vector<G4double>* theCutsElectron; 375 G4double minKinEnergyPrim = DBL_MAX; << 315 const std::vector<G4double>* theCutsPositron; 376 G4double lambdaFactor = 0.8; << 377 G4double invLambdaFactor; << 378 G4double biasFactor = 1.0; << 379 G4double massRatio = 1.0; << 380 G4double fFactor = 1.0; << 381 G4double fLambda = 0.0; << 382 G4double fLambdaEnergy = 0.0; << 383 316 384 protected: << 317 G4int nLambdaBins; 385 318 386 G4double mfpKinEnergy = DBL_MAX; << 319 G4double minKinEnergy; 387 G4double preStepKinEnergy = 0.0; << 320 G4double maxKinEnergy; 388 G4double preStepLambda = 0.0; << 321 G4double lambdaFactor; >> 322 G4double polarAngleLimit; 389 323 390 private: << 324 G4bool integral; >> 325 G4bool applyCuts; >> 326 G4bool startFromNull; >> 327 G4bool useDeexcitation; 391 328 392 G4CrossSectionType fXSType = fEmNoIntegral; << 329 G4int nDERegions; >> 330 std::vector<const G4Region*> deRegions; >> 331 G4bool* idxDERegions; 393 332 394 G4int numberOfModels = 0; << 333 // ======== Cashed values - may be state dependent ================ 395 G4int nLambdaBins = 84; << 396 334 397 protected: 335 protected: 398 336 399 G4int mainSecondaries = 1; << 337 G4ParticleChangeForGamma fParticleChange; 400 G4int secID = _EM; << 401 G4int fluoID = _Fluorescence; << 402 G4int augerID = _AugerElectron; << 403 G4int biasID = _EM; << 404 G4int tripletID = _TripletElectron; << 405 std::size_t currentCoupleIndex = 0; << 406 std::size_t basedCoupleIndex = 0; << 407 std::size_t coupleIdxLambda = 0; << 408 std::size_t idxLambda = 0; << 409 << 410 G4bool isTheMaster = false; << 411 G4bool baseMat = false; << 412 338 413 private: 339 private: 414 340 415 G4bool buildLambdaTable = true; << 416 G4bool applyCuts = false; << 417 G4bool startFromNull = false; << 418 G4bool splineFlag = true; << 419 G4bool actMinKinEnergy = false; << 420 G4bool actMaxKinEnergy = false; << 421 G4bool actBinning = false; << 422 G4bool isIon = false; << 423 G4bool biasFlag = false; << 424 G4bool weightFlag = false; << 425 << 426 protected: << 427 << 428 // ======== particle change ========= << 429 std::vector<G4DynamicParticle*> secParticles 341 std::vector<G4DynamicParticle*> secParticles; 430 G4ParticleChangeForGamma fParticleChange; << 431 342 432 private: << 343 G4VEmModel* currentModel; >> 344 >> 345 const G4ParticleDefinition* particle; >> 346 const G4ParticleDefinition* currentParticle; 433 347 434 // ======== local vectors ========= << 348 // cash 435 std::vector<G4VEmModel*> emModels; << 349 const G4Material* currentMaterial; >> 350 const G4MaterialCutsCouple* currentCouple; >> 351 size_t currentCoupleIndex; >> 352 >> 353 G4double mfpKinEnergy; >> 354 G4double preStepKinEnergy; >> 355 G4double preStepLambda; 436 356 437 }; 357 }; 438 358 439 // ======== Run time inline methods ========== 359 // ======== Run time inline methods ================ 440 360 441 //....oooOO0OOooo........oooOO0OOooo........oo << 361 inline size_t G4VEmProcess::CurrentMaterialCutsCoupleIndex() const 442 << 443 inline std::size_t G4VEmProcess::CurrentMateri << 444 { 362 { 445 return currentCoupleIndex; 363 return currentCoupleIndex; 446 } 364 } 447 365 448 //....oooOO0OOooo........oooOO0OOooo........oo 366 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 449 367 450 inline const G4MaterialCutsCouple* G4VEmProces << 451 { << 452 return currentCouple; << 453 } << 454 << 455 //....oooOO0OOooo........oooOO0OOooo........oo << 456 << 457 inline G4double G4VEmProcess::GetGammaEnergyCu 368 inline G4double G4VEmProcess::GetGammaEnergyCut() 458 { 369 { 459 return (*theCutsGamma)[currentCoupleIndex]; 370 return (*theCutsGamma)[currentCoupleIndex]; 460 } 371 } 461 372 462 //....oooOO0OOooo........oooOO0OOooo........oo 373 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 463 374 464 inline G4double G4VEmProcess::GetElectronEnerg 375 inline G4double G4VEmProcess::GetElectronEnergyCut() 465 { 376 { 466 return (*theCutsElectron)[currentCoupleIndex 377 return (*theCutsElectron)[currentCoupleIndex]; 467 } 378 } 468 379 469 //....oooOO0OOooo........oooOO0OOooo........oo 380 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 470 381 471 inline void G4VEmProcess::DefineMaterial(const 382 inline void G4VEmProcess::DefineMaterial(const G4MaterialCutsCouple* couple) 472 { 383 { 473 if (couple != currentCouple) { << 384 if(couple != currentCouple) { 474 currentCouple = couple; << 385 currentCouple = couple; 475 baseMaterial = currentMaterial = couple->G << 386 currentMaterial = couple->GetMaterial(); 476 basedCoupleIndex = currentCoupleIndex = co << 387 currentCoupleIndex = couple->GetIndex(); 477 fFactor = biasFactor; << 478 mfpKinEnergy = DBL_MAX; 388 mfpKinEnergy = DBL_MAX; 479 if (baseMat) { << 480 basedCoupleIndex = (*theDensityIdx)[curr << 481 if (nullptr != currentMaterial->GetBaseM << 482 baseMaterial = currentMaterial->GetBas << 483 fFactor *= (*theDensityFactor)[currentCo << 484 } << 485 } 389 } 486 } 390 } 487 391 488 //....oooOO0OOooo........oooOO0OOooo........oo 392 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 489 393 490 inline 394 inline 491 G4VEmModel* G4VEmProcess::SelectModel(G4double << 395 G4VEmModel* G4VEmProcess::SelectModel(G4double& kinEnergy, size_t index) 492 { 396 { 493 if(1 < numberOfModels) { << 397 currentModel = modelManager->SelectModel(kinEnergy, index); 494 currentModel = modelManager->SelectModel(k << 495 } << 496 currentModel->SetCurrentCouple(currentCouple 398 currentModel->SetCurrentCouple(currentCouple); 497 return currentModel; 399 return currentModel; 498 } 400 } 499 401 500 //....oooOO0OOooo........oooOO0OOooo........oo 402 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 501 403 502 inline 404 inline 503 G4VEmModel* G4VEmProcess::SelectModelForMateri 405 G4VEmModel* G4VEmProcess::SelectModelForMaterial(G4double kinEnergy, 504 << 406 size_t& idxRegion) const 505 { 407 { 506 return modelManager->SelectModel(kinEnergy, << 408 return modelManager->SelectModel(kinEnergy, idxRegion); 507 } 409 } 508 410 509 //....oooOO0OOooo........oooOO0OOooo........oo 411 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 510 412 511 inline G4double G4VEmProcess::GetLambdaFromTab << 413 inline void G4VEmProcess::InitialiseStep(const G4Track& track) 512 { 414 { 513 return ((*theLambdaTable)[basedCoupleIndex]) << 415 currentParticle = track.GetParticleDefinition(); >> 416 preStepKinEnergy = track.GetKineticEnergy(); >> 417 DefineMaterial(track.GetMaterialCutsCouple()); >> 418 SelectModel(preStepKinEnergy, currentCoupleIndex); >> 419 if (theNumberOfInteractionLengthLeft < 0.0) mfpKinEnergy = DBL_MAX; 514 } 420 } 515 421 516 //....oooOO0OOooo........oooOO0OOooo........oo 422 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 517 423 518 inline G4double G4VEmProcess::LogEkin(const G4 << 424 inline G4double G4VEmProcess::GetLambdaFromTable(G4double e) 519 { << 520 return track.GetDynamicParticle()->GetLogKin << 521 } << 522 << 523 //....oooOO0OOooo........oooOO0OOooo........oo << 524 << 525 inline G4double G4VEmProcess::GetLambdaFromTab << 526 { << 527 return ((*theLambdaTable)[basedCoupleIndex]) << 528 } << 529 << 530 //....oooOO0OOooo........oooOO0OOooo........oo << 531 << 532 inline G4double G4VEmProcess::GetLambdaFromTab << 533 { << 534 return ((*theLambdaTablePrim)[basedCoupleInd << 535 } << 536 << 537 //....oooOO0OOooo........oooOO0OOooo........oo << 538 << 539 inline G4double G4VEmProcess::GetLambdaFromTab << 540 { 425 { 541 return ((*theLambdaTablePrim)[basedCoupleInd << 426 return (((*theLambdaTable)[currentCoupleIndex])->Value(e)); 542 } 427 } 543 428 544 //....oooOO0OOooo........oooOO0OOooo........oo 429 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 545 430 546 inline G4double G4VEmProcess::ComputeCurrentLa 431 inline G4double G4VEmProcess::ComputeCurrentLambda(G4double e) 547 { 432 { 548 return currentModel->CrossSectionPerVolume(b << 433 SelectModel(e, currentCoupleIndex); >> 434 return currentModel->CrossSectionPerVolume(currentMaterial,currentParticle, >> 435 e,(*theCuts)[currentCoupleIndex]); 549 } 436 } 550 437 551 //....oooOO0OOooo........oooOO0OOooo........oo 438 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 552 439 553 inline G4double G4VEmProcess::GetCurrentLambda 440 inline G4double G4VEmProcess::GetCurrentLambda(G4double e) 554 { 441 { 555 if(currentCoupleIndex != coupleIdxLambda || << 442 G4double x = 0.0; 556 coupleIdxLambda = currentCoupleIndex; << 443 if(theLambdaTable) { x = GetLambdaFromTable(e); } 557 fLambdaEnergy = e; << 444 else { x = ComputeCurrentLambda(e); } 558 if(e >= minKinEnergyPrim) { fLambda = GetL << 445 return x; 559 else if(nullptr != theLambdaTable) { fLamb << 560 else { fLambda = ComputeCurrentLambda(e); << 561 fLambda *= fFactor; << 562 } << 563 return fLambda; << 564 } 446 } 565 447 566 //....oooOO0OOooo........oooOO0OOooo........oo 448 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 567 449 568 inline G4double G4VEmProcess::GetCurrentLambda << 450 inline G4double G4VEmProcess::GetLambda(G4double& kineticEnergy, >> 451 const G4MaterialCutsCouple* couple) 569 { 452 { 570 if(currentCoupleIndex != coupleIdxLambda || << 453 DefineMaterial(couple); 571 coupleIdxLambda = currentCoupleIndex; << 454 return GetCurrentLambda(kineticEnergy); 572 fLambdaEnergy = e; << 573 if(e >= minKinEnergyPrim) { fLambda = GetL << 574 else if(nullptr != theLambdaTable) { fLamb << 575 else { fLambda = ComputeCurrentLambda(e); << 576 fLambda *= fFactor; << 577 } << 578 return fLambda; << 579 } 455 } 580 456 581 //....oooOO0OOooo........oooOO0OOooo........oo 457 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 582 458 583 inline void << 459 inline G4double G4VEmProcess::RecalculateLambda(G4double e, 584 G4VEmProcess::CurrentSetup(const G4MaterialCut << 460 const G4MaterialCutsCouple* couple) 585 { 461 { 586 DefineMaterial(couple); 462 DefineMaterial(couple); 587 SelectModel(energy*massRatio, currentCoupleI << 463 return ComputeCurrentLambda(e); 588 } 464 } 589 465 590 //....oooOO0OOooo........oooOO0OOooo........oo 466 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 591 467 592 inline G4double << 468 inline void G4VEmProcess::ComputeIntegralLambda(G4double e) 593 G4VEmProcess::GetLambda(G4double kinEnergy, co << 594 G4double logKinEnergy) << 595 { 469 { 596 CurrentSetup(couple, kinEnergy); << 470 mfpKinEnergy = theEnergyOfCrossSectionMax[currentCoupleIndex]; 597 return GetCurrentLambda(kinEnergy, logKinEne << 471 if (e <= mfpKinEnergy) { 598 } << 472 preStepLambda = GetLambdaFromTable(e); 599 << 600 //....oooOO0OOooo........oooOO0OOooo........oo << 601 473 602 G4double G4VEmProcess::MeanFreePath(const G4Tr << 474 } else { 603 { << 475 G4double e1 = e*lambdaFactor; 604 const G4double kinEnergy = track.GetKineticE << 476 if(e1 > mfpKinEnergy) { 605 CurrentSetup(track.GetMaterialCutsCouple(), << 477 preStepLambda = GetLambdaFromTable(e); 606 const G4double xs = GetCurrentLambda(kinEner << 478 G4double preStepLambda1 = GetLambdaFromTable(e1); 607 track.GetDynamicP << 479 if(preStepLambda1 > preStepLambda) { 608 return (0.0 < xs) ? 1.0/xs : DBL_MAX; << 480 mfpKinEnergy = e1; >> 481 preStepLambda = preStepLambda1; >> 482 } >> 483 } else { >> 484 preStepLambda = theCrossSectionMax[currentCoupleIndex]; >> 485 } >> 486 } 609 } 487 } 610 488 611 // ======== Get/Set inline methods used at ini 489 // ======== Get/Set inline methods used at initialisation ================ 612 490 613 inline G4bool G4VEmProcess::ApplyCuts() const << 491 inline void G4VEmProcess::SetLambdaBinning(G4int nbins) 614 { 492 { 615 return applyCuts; << 493 nLambdaBins = nbins; 616 } 494 } 617 495 618 //....oooOO0OOooo........oooOO0OOooo........oo 496 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 619 497 620 inline G4int G4VEmProcess::LambdaBinning() con 498 inline G4int G4VEmProcess::LambdaBinning() const 621 { 499 { 622 return nLambdaBins; 500 return nLambdaBins; 623 } 501 } 624 502 625 //....oooOO0OOooo........oooOO0OOooo........oo 503 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 626 504 627 inline G4double G4VEmProcess::MinKinEnergy() c << 505 inline void G4VEmProcess::SetMinKinEnergy(G4double e) 628 { 506 { 629 return minKinEnergy; << 507 minKinEnergy = e; 630 } 508 } 631 509 632 //....oooOO0OOooo........oooOO0OOooo........oo 510 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 633 511 634 inline G4double G4VEmProcess::MaxKinEnergy() c << 512 inline G4double G4VEmProcess::MinKinEnergy() const 635 { 513 { 636 return maxKinEnergy; << 514 return minKinEnergy; 637 } 515 } 638 516 639 //....oooOO0OOooo........oooOO0OOooo........oo 517 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 640 518 641 inline G4double G4VEmProcess::CrossSectionBias << 519 inline void G4VEmProcess::SetMaxKinEnergy(G4double e) 642 { 520 { 643 return biasFactor; << 521 maxKinEnergy = e; 644 } 522 } 645 523 646 //....oooOO0OOooo........oooOO0OOooo........oo 524 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 647 525 648 inline G4PhysicsTable* G4VEmProcess::LambdaTab << 526 inline G4double G4VEmProcess::MaxKinEnergy() const 649 { 527 { 650 return theLambdaTable; << 528 return maxKinEnergy; 651 } 529 } 652 530 653 //....oooOO0OOooo........oooOO0OOooo........oo 531 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 654 532 655 inline G4PhysicsTable* G4VEmProcess::LambdaTab << 533 inline void G4VEmProcess::SetPolarAngleLimit(G4double val) 656 { 534 { 657 return theLambdaTablePrim; << 535 if(val < 0.0) polarAngleLimit = 0.0; >> 536 else if(val > pi) polarAngleLimit = pi; >> 537 else polarAngleLimit = val; 658 } 538 } 659 539 660 //....oooOO0OOooo........oooOO0OOooo........oo 540 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 661 541 662 inline void G4VEmProcess::SetLambdaTable(G4Phy << 542 inline G4double G4VEmProcess::PolarAngleLimit() const 663 { 543 { 664 theLambdaTable = ptr; << 544 return polarAngleLimit; 665 } 545 } 666 546 667 //....oooOO0OOooo........oooOO0OOooo........oo 547 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 668 548 669 inline void G4VEmProcess::SetLambdaTablePrim(G << 549 inline const G4PhysicsTable* G4VEmProcess::LambdaTable() const 670 { 550 { 671 theLambdaTablePrim = ptr; << 551 return theLambdaTable; 672 } 552 } 673 553 674 //....oooOO0OOooo........oooOO0OOooo........oo 554 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 675 555 676 inline std::vector<G4double>* G4VEmProcess::En << 556 inline const G4ParticleDefinition* G4VEmProcess::Particle() const 677 { 557 { 678 return theEnergyOfCrossSectionMax; << 558 return particle; 679 } 559 } 680 560 681 //....oooOO0OOooo........oooOO0OOooo........oo 561 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 682 562 683 inline void << 563 inline const G4ParticleDefinition* G4VEmProcess::SecondaryParticle() const 684 G4VEmProcess::SetEnergyOfCrossSectionMax(std:: << 685 { 564 { 686 theEnergyOfCrossSectionMax = ptr; << 565 return secondaryParticle; 687 } 566 } 688 567 689 //....oooOO0OOooo........oooOO0OOooo........oo 568 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 690 569 691 inline const G4ParticleDefinition* G4VEmProces << 570 inline void G4VEmProcess::SetLambdaFactor(G4double val) 692 { 571 { 693 return particle; << 572 if(val > 0.0 && val <= 1.0) { lambdaFactor = val; } 694 } 573 } 695 574 696 //....oooOO0OOooo........oooOO0OOooo........oo 575 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 697 576 698 inline const G4ParticleDefinition* G4VEmProces << 577 inline void G4VEmProcess::SetIntegral(G4bool val) 699 { 578 { 700 return secondaryParticle; << 579 if(particle && particle != theGamma) { integral = val; } >> 580 if(integral) { buildLambdaTable = true; } 701 } 581 } 702 582 703 //....oooOO0OOooo........oooOO0OOooo........oo 583 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 704 584 705 inline void G4VEmProcess::SetCrossSectionType( << 585 inline G4bool G4VEmProcess::IsIntegral() const 706 { 586 { 707 fXSType = val; << 587 return integral; 708 } 588 } 709 589 710 //....oooOO0OOooo........oooOO0OOooo........oo 590 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 711 591 712 inline G4CrossSectionType G4VEmProcess::CrossS << 592 inline void G4VEmProcess::SetApplyCuts(G4bool val) 713 { 593 { 714 return fXSType; << 594 applyCuts = val; 715 } 595 } 716 596 717 //....oooOO0OOooo........oooOO0OOooo........oo 597 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 718 598 719 inline void G4VEmProcess::SetBuildTableFlag(G4 599 inline void G4VEmProcess::SetBuildTableFlag(G4bool val) 720 { 600 { 721 buildLambdaTable = val; 601 buildLambdaTable = val; >> 602 if(!val) { integral = false; } 722 } 603 } 723 604 724 //....oooOO0OOooo........oooOO0OOooo........oo 605 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 725 606 726 inline G4ParticleChangeForGamma* G4VEmProcess: 607 inline G4ParticleChangeForGamma* G4VEmProcess::GetParticleChange() 727 { 608 { 728 return &fParticleChange; 609 return &fParticleChange; 729 } 610 } 730 611 731 //....oooOO0OOooo........oooOO0OOooo........oo 612 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 732 613 733 inline void G4VEmProcess::SetParticle(const G4 614 inline void G4VEmProcess::SetParticle(const G4ParticleDefinition* p) 734 { 615 { 735 particle = p; 616 particle = p; 736 currentParticle = p; 617 currentParticle = p; 737 } 618 } 738 619 739 //....oooOO0OOooo........oooOO0OOooo........oo 620 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 740 621 741 inline void G4VEmProcess::SetSecondaryParticle 622 inline void G4VEmProcess::SetSecondaryParticle(const G4ParticleDefinition* p) 742 { 623 { 743 secondaryParticle = p; 624 secondaryParticle = p; 744 } 625 } 745 626 746 //....oooOO0OOooo........oooOO0OOooo........oo 627 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 747 628 748 inline void G4VEmProcess::SetStartFromNullFlag 629 inline void G4VEmProcess::SetStartFromNullFlag(G4bool val) 749 { 630 { 750 startFromNull = val; 631 startFromNull = val; 751 } << 752 << 753 //....oooOO0OOooo........oooOO0OOooo........oo << 754 << 755 inline void G4VEmProcess::SetSplineFlag(G4bool << 756 { << 757 splineFlag = val; << 758 } << 759 << 760 //....oooOO0OOooo........oooOO0OOooo........oo << 761 << 762 inline G4int G4VEmProcess::DensityIndex(G4int << 763 { << 764 return (*theDensityIdx)[idx]; << 765 } << 766 << 767 //....oooOO0OOooo........oooOO0OOooo........oo << 768 << 769 inline G4double G4VEmProcess::DensityFactor(G4 << 770 { << 771 return (*theDensityFactor)[idx]; << 772 } << 773 << 774 //....oooOO0OOooo........oooOO0OOooo........oo << 775 << 776 inline G4bool G4VEmProcess::UseBaseMaterial() << 777 { << 778 return baseMat; << 779 } << 780 << 781 //....oooOO0OOooo........oooOO0OOooo........oo << 782 << 783 inline const G4VEmModel* G4VEmProcess::GetCurr << 784 { << 785 return currentModel; << 786 } << 787 << 788 //....oooOO0OOooo........oooOO0OOooo........oo << 789 << 790 inline void G4VEmProcess::SetEmMasterProcess(c << 791 { << 792 masterProc = ptr; << 793 } << 794 << 795 //....oooOO0OOooo........oooOO0OOooo........oo << 796 << 797 inline G4int G4VEmProcess::NumberOfModels() co << 798 { << 799 return numberOfModels; << 800 } << 801 << 802 //....oooOO0OOooo........oooOO0OOooo........oo << 803 << 804 inline G4VEmModel* G4VEmProcess::EmModel(std:: << 805 { << 806 return (index < emModels.size()) ? emModels[ << 807 } << 808 << 809 //....oooOO0OOooo........oooOO0OOooo........oo << 810 << 811 inline G4VEmModel* G4VEmProcess::GetModelByInd << 812 { << 813 return modelManager->GetModel(idx, ver); << 814 } 632 } 815 633 816 //....oooOO0OOooo........oooOO0OOooo........oo 634 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 817 635 818 #endif 636 #endif 819 637