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.55.2.1 2010/04/06 09:05:17 gcosmo Exp $ >> 27 // GEANT4 tag $Name: geant4-09-03-patch-01 $ >> 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 // Access to the current G4Element << 228 const G4Element* GetCurrentElement() const; << 229 << 230 // Biasing parameters << 231 void SetCrossSectionBiasingFactor(G4double f << 232 inline G4double CrossSectionBiasingFactor() << 233 227 234 // Activate forced interaction << 228 inline void SetLambdaFactor(G4double val); 235 void ActivateForcedInteraction(G4double leng << 236 const G4Strin << 237 G4bool flag = << 238 229 239 void ActivateSecondaryBiasing(const G4String << 230 inline void SetIntegral(G4bool val); 240 G4double energ << 231 inline G4bool IsIntegral() const; 241 232 242 inline void SetEmMasterProcess(const G4VEmPr << 233 inline void SetApplyCuts(G4bool val); 243 234 244 inline void SetBuildTableFlag(G4bool val); 235 inline void SetBuildTableFlag(G4bool val); 245 236 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 //------------------------------------------ 237 //------------------------------------------------------------------------ 260 // Other generic methods 238 // Other generic methods 261 //------------------------------------------ 239 //------------------------------------------------------------------------ 262 240 263 protected: 241 protected: 264 242 265 G4double GetMeanFreePath(const G4Track& trac 243 G4double GetMeanFreePath(const G4Track& track, 266 G4double previousSt << 244 G4double previousStepSize, 267 G4ForceCondition* c << 245 G4ForceCondition* condition); 268 246 269 G4PhysicsVector* LambdaPhysicsVector(const G 247 G4PhysicsVector* LambdaPhysicsVector(const G4MaterialCutsCouple*); 270 248 271 inline void DefineMaterial(const G4MaterialC << 249 inline G4double RecalculateLambda(G4double kinEnergy, 272 << 250 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 251 282 inline G4ParticleChangeForGamma* GetParticle 252 inline G4ParticleChangeForGamma* GetParticleChange(); 283 253 284 inline void SetParticle(const G4ParticleDefi 254 inline void SetParticle(const G4ParticleDefinition* p); 285 255 286 inline void SetSecondaryParticle(const G4Par 256 inline void SetSecondaryParticle(const G4ParticleDefinition* p); 287 257 288 inline std::size_t CurrentMaterialCutsCouple << 258 inline size_t CurrentMaterialCutsCoupleIndex() const; 289 << 290 inline const G4MaterialCutsCouple* MaterialC << 291 << 292 inline G4bool ApplyCuts() const; << 293 259 294 inline G4double GetGammaEnergyCut(); 260 inline G4double GetGammaEnergyCut(); 295 261 296 inline G4double GetElectronEnergyCut(); 262 inline G4double GetElectronEnergyCut(); 297 263 298 inline void SetStartFromNullFlag(G4bool val) 264 inline void SetStartFromNullFlag(G4bool val); 299 265 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: 266 private: 312 267 313 void PrintWarning(G4String tit, G4double val << 268 void Clear(); 314 269 315 void ComputeIntegralLambda(G4double kinEnerg << 270 void BuildLambdaTable(); 316 271 317 inline G4double LogEkin(const G4Track&); << 272 void FindLambdaMax(); 318 273 319 inline G4double GetLambdaFromTable(G4double << 274 inline void InitialiseStep(const G4Track&); 320 275 321 inline G4double GetLambdaFromTable(G4double << 276 inline void DefineMaterial(const G4MaterialCutsCouple* couple); 322 277 323 inline G4double GetLambdaFromTablePrim(G4dou << 278 inline void ComputeIntegralLambda(G4double kinEnergy); 324 279 325 inline G4double GetLambdaFromTablePrim(G4dou << 280 inline G4double GetLambdaFromTable(G4double kinEnergy); 326 281 327 inline G4double GetCurrentLambda(G4double ki 282 inline G4double GetCurrentLambda(G4double kinEnergy); 328 283 329 inline G4double GetCurrentLambda(G4double ki << 330 << 331 inline G4double ComputeCurrentLambda(G4doubl 284 inline G4double ComputeCurrentLambda(G4double kinEnergy); 332 285 333 // ======== pointers ========= << 286 // copy constructor and hide assignment operator >> 287 G4VEmProcess(G4VEmProcess &); >> 288 G4VEmProcess & operator=(const G4VEmProcess &right); 334 289 335 G4EmModelManager* modelManager = << 290 // ======== 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 291 358 protected: << 292 G4EmModelManager* modelManager; >> 293 const G4ParticleDefinition* theGamma; >> 294 const G4ParticleDefinition* theElectron; >> 295 const G4ParticleDefinition* thePositron; >> 296 const G4ParticleDefinition* secondaryParticle; 359 297 360 // ======== pointers ========= << 298 G4bool buildLambdaTable; 361 299 362 const G4MaterialCutsCouple* currentCouple = << 300 // ======== Parameters of the class fixed at initialisation ======= 363 const G4Material* currentMaterial << 364 G4EmBiasingManager* biasManager = n << 365 std::vector<G4double>* theEnergyOfCros << 366 301 367 private: << 302 std::vector<G4VEmModel*> emModels; 368 303 369 const std::vector<G4double>* theDensityFacto << 304 // tables and vectors 370 const std::vector<G4int>* theDensityIdx = nu << 305 G4PhysicsTable* theLambdaTable; >> 306 G4double* theEnergyOfCrossSectionMax; >> 307 G4double* theCrossSectionMax; 371 308 372 // ======== parameters ========= << 309 const std::vector<G4double>* theCuts; 373 G4double minKinEnergy; << 310 const std::vector<G4double>* theCutsGamma; 374 G4double maxKinEnergy; << 311 const std::vector<G4double>* theCutsElectron; 375 G4double minKinEnergyPrim = DBL_MAX; << 312 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 313 384 protected: << 314 G4int nLambdaBins; 385 315 386 G4double mfpKinEnergy = DBL_MAX; << 316 G4double minKinEnergy; 387 G4double preStepKinEnergy = 0.0; << 317 G4double maxKinEnergy; 388 G4double preStepLambda = 0.0; << 318 G4double lambdaFactor; >> 319 G4double polarAngleLimit; 389 320 390 private: << 321 G4bool integral; >> 322 G4bool applyCuts; >> 323 G4bool startFromNull; >> 324 G4bool useDeexcitation; 391 325 392 G4CrossSectionType fXSType = fEmNoIntegral; << 326 G4int nDERegions; >> 327 std::vector<const G4Region*> deRegions; >> 328 G4bool* idxDERegions; 393 329 394 G4int numberOfModels = 0; << 330 // ======== Cashed values - may be state dependent ================ 395 G4int nLambdaBins = 84; << 396 331 397 protected: 332 protected: 398 333 399 G4int mainSecondaries = 1; << 334 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 335 413 private: 336 private: 414 337 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 338 std::vector<G4DynamicParticle*> secParticles; 430 G4ParticleChangeForGamma fParticleChange; << 431 339 432 private: << 340 G4VEmModel* currentModel; 433 341 434 // ======== local vectors ========= << 342 const G4ParticleDefinition* particle; 435 std::vector<G4VEmModel*> emModels; << 343 const G4ParticleDefinition* currentParticle; >> 344 >> 345 // cash >> 346 const G4Material* currentMaterial; >> 347 const G4MaterialCutsCouple* currentCouple; >> 348 size_t currentCoupleIndex; >> 349 >> 350 G4double mfpKinEnergy; >> 351 G4double preStepKinEnergy; >> 352 G4double preStepLambda; 436 353 437 }; 354 }; 438 355 439 // ======== Run time inline methods ========== 356 // ======== Run time inline methods ================ 440 357 441 //....oooOO0OOooo........oooOO0OOooo........oo << 358 inline size_t G4VEmProcess::CurrentMaterialCutsCoupleIndex() const 442 << 443 inline std::size_t G4VEmProcess::CurrentMateri << 444 { 359 { 445 return currentCoupleIndex; 360 return currentCoupleIndex; 446 } 361 } 447 362 448 //....oooOO0OOooo........oooOO0OOooo........oo 363 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 449 364 450 inline const G4MaterialCutsCouple* G4VEmProces << 451 { << 452 return currentCouple; << 453 } << 454 << 455 //....oooOO0OOooo........oooOO0OOooo........oo << 456 << 457 inline G4double G4VEmProcess::GetGammaEnergyCu 365 inline G4double G4VEmProcess::GetGammaEnergyCut() 458 { 366 { 459 return (*theCutsGamma)[currentCoupleIndex]; 367 return (*theCutsGamma)[currentCoupleIndex]; 460 } 368 } 461 369 462 //....oooOO0OOooo........oooOO0OOooo........oo 370 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 463 371 464 inline G4double G4VEmProcess::GetElectronEnerg 372 inline G4double G4VEmProcess::GetElectronEnergyCut() 465 { 373 { 466 return (*theCutsElectron)[currentCoupleIndex 374 return (*theCutsElectron)[currentCoupleIndex]; 467 } 375 } 468 376 469 //....oooOO0OOooo........oooOO0OOooo........oo 377 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 470 378 471 inline void G4VEmProcess::DefineMaterial(const 379 inline void G4VEmProcess::DefineMaterial(const G4MaterialCutsCouple* couple) 472 { 380 { 473 if (couple != currentCouple) { << 381 if(couple != currentCouple) { 474 currentCouple = couple; << 382 currentCouple = couple; 475 baseMaterial = currentMaterial = couple->G << 383 currentMaterial = couple->GetMaterial(); 476 basedCoupleIndex = currentCoupleIndex = co << 384 currentCoupleIndex = couple->GetIndex(); 477 fFactor = biasFactor; << 478 mfpKinEnergy = DBL_MAX; 385 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 } 386 } 486 } 387 } 487 388 488 //....oooOO0OOooo........oooOO0OOooo........oo 389 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 489 390 490 inline 391 inline 491 G4VEmModel* G4VEmProcess::SelectModel(G4double << 392 G4VEmModel* G4VEmProcess::SelectModel(G4double& kinEnergy, size_t index) 492 { 393 { 493 if(1 < numberOfModels) { << 394 currentModel = modelManager->SelectModel(kinEnergy, index); 494 currentModel = modelManager->SelectModel(k << 495 } << 496 currentModel->SetCurrentCouple(currentCouple 395 currentModel->SetCurrentCouple(currentCouple); 497 return currentModel; 396 return currentModel; 498 } 397 } 499 398 500 //....oooOO0OOooo........oooOO0OOooo........oo 399 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 501 400 502 inline 401 inline 503 G4VEmModel* G4VEmProcess::SelectModelForMateri 402 G4VEmModel* G4VEmProcess::SelectModelForMaterial(G4double kinEnergy, 504 << 403 size_t& idxRegion) const 505 { << 506 return modelManager->SelectModel(kinEnergy, << 507 } << 508 << 509 //....oooOO0OOooo........oooOO0OOooo........oo << 510 << 511 inline G4double G4VEmProcess::GetLambdaFromTab << 512 { << 513 return ((*theLambdaTable)[basedCoupleIndex]) << 514 } << 515 << 516 //....oooOO0OOooo........oooOO0OOooo........oo << 517 << 518 inline G4double G4VEmProcess::LogEkin(const G4 << 519 { 404 { 520 return track.GetDynamicParticle()->GetLogKin << 405 return modelManager->SelectModel(kinEnergy, idxRegion); 521 } 406 } 522 407 523 //....oooOO0OOooo........oooOO0OOooo........oo 408 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 524 409 525 inline G4double G4VEmProcess::GetLambdaFromTab << 410 inline void G4VEmProcess::InitialiseStep(const G4Track& track) 526 { 411 { 527 return ((*theLambdaTable)[basedCoupleIndex]) << 412 currentParticle = track.GetDefinition(); >> 413 preStepKinEnergy = track.GetKineticEnergy(); >> 414 DefineMaterial(track.GetMaterialCutsCouple()); >> 415 SelectModel(preStepKinEnergy, currentCoupleIndex); >> 416 if (theNumberOfInteractionLengthLeft < 0.0) mfpKinEnergy = DBL_MAX; 528 } 417 } 529 418 530 //....oooOO0OOooo........oooOO0OOooo........oo 419 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 531 420 532 inline G4double G4VEmProcess::GetLambdaFromTab << 421 inline G4double G4VEmProcess::GetLambdaFromTable(G4double e) 533 { << 534 return ((*theLambdaTablePrim)[basedCoupleInd << 535 } << 536 << 537 //....oooOO0OOooo........oooOO0OOooo........oo << 538 << 539 inline G4double G4VEmProcess::GetLambdaFromTab << 540 { 422 { 541 return ((*theLambdaTablePrim)[basedCoupleInd << 423 return (((*theLambdaTable)[currentCoupleIndex])->Value(e)); 542 } 424 } 543 425 544 //....oooOO0OOooo........oooOO0OOooo........oo 426 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 545 427 546 inline G4double G4VEmProcess::ComputeCurrentLa 428 inline G4double G4VEmProcess::ComputeCurrentLambda(G4double e) 547 { 429 { 548 return currentModel->CrossSectionPerVolume(b << 430 SelectModel(e, currentCoupleIndex); >> 431 return currentModel->CrossSectionPerVolume(currentMaterial,currentParticle, >> 432 e,(*theCuts)[currentCoupleIndex]); 549 } 433 } 550 434 551 //....oooOO0OOooo........oooOO0OOooo........oo 435 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 552 436 553 inline G4double G4VEmProcess::GetCurrentLambda 437 inline G4double G4VEmProcess::GetCurrentLambda(G4double e) 554 { 438 { 555 if(currentCoupleIndex != coupleIdxLambda || << 439 G4double x = 0.0; 556 coupleIdxLambda = currentCoupleIndex; << 440 if(theLambdaTable) { x = GetLambdaFromTable(e); } 557 fLambdaEnergy = e; << 441 else { x = ComputeCurrentLambda(e); } 558 if(e >= minKinEnergyPrim) { fLambda = GetL << 442 return x; 559 else if(nullptr != theLambdaTable) { fLamb << 560 else { fLambda = ComputeCurrentLambda(e); << 561 fLambda *= fFactor; << 562 } << 563 return fLambda; << 564 } 443 } 565 444 566 //....oooOO0OOooo........oooOO0OOooo........oo 445 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 567 446 568 inline G4double G4VEmProcess::GetCurrentLambda << 447 inline G4double G4VEmProcess::GetLambda(G4double& kineticEnergy, >> 448 const G4MaterialCutsCouple* couple) 569 { 449 { 570 if(currentCoupleIndex != coupleIdxLambda || << 450 DefineMaterial(couple); 571 coupleIdxLambda = currentCoupleIndex; << 451 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 } 452 } 580 453 581 //....oooOO0OOooo........oooOO0OOooo........oo 454 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 582 455 583 inline void << 456 inline G4double G4VEmProcess::RecalculateLambda(G4double e, 584 G4VEmProcess::CurrentSetup(const G4MaterialCut << 457 const G4MaterialCutsCouple* couple) 585 { 458 { 586 DefineMaterial(couple); 459 DefineMaterial(couple); 587 SelectModel(energy*massRatio, currentCoupleI << 460 return ComputeCurrentLambda(e); 588 } 461 } 589 462 590 //....oooOO0OOooo........oooOO0OOooo........oo 463 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 591 464 592 inline G4double << 465 inline void G4VEmProcess::ComputeIntegralLambda(G4double e) 593 G4VEmProcess::GetLambda(G4double kinEnergy, co << 594 G4double logKinEnergy) << 595 { 466 { 596 CurrentSetup(couple, kinEnergy); << 467 mfpKinEnergy = theEnergyOfCrossSectionMax[currentCoupleIndex]; 597 return GetCurrentLambda(kinEnergy, logKinEne << 468 if (e <= mfpKinEnergy) { 598 } << 469 preStepLambda = GetLambdaFromTable(e); 599 470 600 //....oooOO0OOooo........oooOO0OOooo........oo << 471 } else { 601 << 472 G4double e1 = e*lambdaFactor; 602 G4double G4VEmProcess::MeanFreePath(const G4Tr << 473 if(e1 > mfpKinEnergy) { 603 { << 474 preStepLambda = GetLambdaFromTable(e); 604 const G4double kinEnergy = track.GetKineticE << 475 G4double preStepLambda1 = GetLambdaFromTable(e1); 605 CurrentSetup(track.GetMaterialCutsCouple(), << 476 if(preStepLambda1 > preStepLambda) { 606 const G4double xs = GetCurrentLambda(kinEner << 477 mfpKinEnergy = e1; 607 track.GetDynamicP << 478 preStepLambda = preStepLambda1; 608 return (0.0 < xs) ? 1.0/xs : DBL_MAX; << 479 } >> 480 } else { >> 481 preStepLambda = theCrossSectionMax[currentCoupleIndex]; >> 482 } >> 483 } 609 } 484 } 610 485 611 // ======== Get/Set inline methods used at ini 486 // ======== Get/Set inline methods used at initialisation ================ 612 487 613 inline G4bool G4VEmProcess::ApplyCuts() const << 488 inline void G4VEmProcess::SetLambdaBinning(G4int nbins) 614 { 489 { 615 return applyCuts; << 490 nLambdaBins = nbins; 616 } 491 } 617 492 618 //....oooOO0OOooo........oooOO0OOooo........oo 493 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 619 494 620 inline G4int G4VEmProcess::LambdaBinning() con 495 inline G4int G4VEmProcess::LambdaBinning() const 621 { 496 { 622 return nLambdaBins; 497 return nLambdaBins; 623 } 498 } 624 499 625 //....oooOO0OOooo........oooOO0OOooo........oo 500 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 626 501 627 inline G4double G4VEmProcess::MinKinEnergy() c << 502 inline void G4VEmProcess::SetMinKinEnergy(G4double e) 628 { 503 { 629 return minKinEnergy; << 504 minKinEnergy = e; 630 } 505 } 631 506 632 //....oooOO0OOooo........oooOO0OOooo........oo 507 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 633 508 634 inline G4double G4VEmProcess::MaxKinEnergy() c << 509 inline G4double G4VEmProcess::MinKinEnergy() const 635 { 510 { 636 return maxKinEnergy; << 511 return minKinEnergy; 637 } 512 } 638 513 639 //....oooOO0OOooo........oooOO0OOooo........oo 514 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 640 515 641 inline G4double G4VEmProcess::CrossSectionBias << 516 inline void G4VEmProcess::SetMaxKinEnergy(G4double e) 642 { 517 { 643 return biasFactor; << 518 maxKinEnergy = e; 644 } 519 } 645 520 646 //....oooOO0OOooo........oooOO0OOooo........oo 521 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 647 522 648 inline G4PhysicsTable* G4VEmProcess::LambdaTab << 523 inline G4double G4VEmProcess::MaxKinEnergy() const 649 { 524 { 650 return theLambdaTable; << 525 return maxKinEnergy; 651 } 526 } 652 527 653 //....oooOO0OOooo........oooOO0OOooo........oo 528 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 654 529 655 inline G4PhysicsTable* G4VEmProcess::LambdaTab << 530 inline void G4VEmProcess::SetPolarAngleLimit(G4double val) 656 { 531 { 657 return theLambdaTablePrim; << 532 if(val < 0.0) polarAngleLimit = 0.0; >> 533 else if(val > pi) polarAngleLimit = pi; >> 534 else polarAngleLimit = val; 658 } 535 } 659 536 660 //....oooOO0OOooo........oooOO0OOooo........oo 537 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 661 538 662 inline void G4VEmProcess::SetLambdaTable(G4Phy << 539 inline G4double G4VEmProcess::PolarAngleLimit() const 663 { 540 { 664 theLambdaTable = ptr; << 541 return polarAngleLimit; 665 } 542 } 666 543 667 //....oooOO0OOooo........oooOO0OOooo........oo 544 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 668 545 669 inline void G4VEmProcess::SetLambdaTablePrim(G << 546 inline const G4PhysicsTable* G4VEmProcess::LambdaTable() const 670 { 547 { 671 theLambdaTablePrim = ptr; << 548 return theLambdaTable; 672 } 549 } 673 550 674 //....oooOO0OOooo........oooOO0OOooo........oo 551 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 675 552 676 inline std::vector<G4double>* G4VEmProcess::En << 553 inline const G4ParticleDefinition* G4VEmProcess::Particle() const 677 { 554 { 678 return theEnergyOfCrossSectionMax; << 555 return particle; 679 } 556 } 680 557 681 //....oooOO0OOooo........oooOO0OOooo........oo 558 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 682 559 683 inline void << 560 inline const G4ParticleDefinition* G4VEmProcess::SecondaryParticle() const 684 G4VEmProcess::SetEnergyOfCrossSectionMax(std:: << 685 { 561 { 686 theEnergyOfCrossSectionMax = ptr; << 562 return secondaryParticle; 687 } 563 } 688 564 689 //....oooOO0OOooo........oooOO0OOooo........oo 565 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 690 566 691 inline const G4ParticleDefinition* G4VEmProces << 567 inline void G4VEmProcess::SetLambdaFactor(G4double val) 692 { 568 { 693 return particle; << 569 if(val > 0.0 && val <= 1.0) { lambdaFactor = val; } 694 } 570 } 695 571 696 //....oooOO0OOooo........oooOO0OOooo........oo 572 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 697 573 698 inline const G4ParticleDefinition* G4VEmProces << 574 inline void G4VEmProcess::SetIntegral(G4bool val) 699 { 575 { 700 return secondaryParticle; << 576 if(particle && particle != theGamma) { integral = val; } >> 577 if(integral) { buildLambdaTable = true; } 701 } 578 } 702 579 703 //....oooOO0OOooo........oooOO0OOooo........oo 580 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 704 581 705 inline void G4VEmProcess::SetCrossSectionType( << 582 inline G4bool G4VEmProcess::IsIntegral() const 706 { 583 { 707 fXSType = val; << 584 return integral; 708 } 585 } 709 586 710 //....oooOO0OOooo........oooOO0OOooo........oo 587 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 711 588 712 inline G4CrossSectionType G4VEmProcess::CrossS << 589 inline void G4VEmProcess::SetApplyCuts(G4bool val) 713 { 590 { 714 return fXSType; << 591 applyCuts = val; 715 } 592 } 716 593 717 //....oooOO0OOooo........oooOO0OOooo........oo 594 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 718 595 719 inline void G4VEmProcess::SetBuildTableFlag(G4 596 inline void G4VEmProcess::SetBuildTableFlag(G4bool val) 720 { 597 { 721 buildLambdaTable = val; 598 buildLambdaTable = val; >> 599 if(!val) { integral = false; } 722 } 600 } 723 601 724 //....oooOO0OOooo........oooOO0OOooo........oo 602 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 725 603 726 inline G4ParticleChangeForGamma* G4VEmProcess: 604 inline G4ParticleChangeForGamma* G4VEmProcess::GetParticleChange() 727 { 605 { 728 return &fParticleChange; 606 return &fParticleChange; 729 } 607 } 730 608 731 //....oooOO0OOooo........oooOO0OOooo........oo 609 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 732 610 733 inline void G4VEmProcess::SetParticle(const G4 611 inline void G4VEmProcess::SetParticle(const G4ParticleDefinition* p) 734 { 612 { 735 particle = p; 613 particle = p; 736 currentParticle = p; 614 currentParticle = p; 737 } 615 } 738 616 739 //....oooOO0OOooo........oooOO0OOooo........oo 617 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 740 618 741 inline void G4VEmProcess::SetSecondaryParticle 619 inline void G4VEmProcess::SetSecondaryParticle(const G4ParticleDefinition* p) 742 { 620 { 743 secondaryParticle = p; 621 secondaryParticle = p; 744 } 622 } 745 623 746 //....oooOO0OOooo........oooOO0OOooo........oo 624 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 747 625 748 inline void G4VEmProcess::SetStartFromNullFlag 626 inline void G4VEmProcess::SetStartFromNullFlag(G4bool val) 749 { 627 { 750 startFromNull = val; 628 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 } 629 } 815 630 816 //....oooOO0OOooo........oooOO0OOooo........oo 631 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 817 632 818 #endif 633 #endif 819 634