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.34 2006/09/13 10:34:32 maire Exp $ >> 27 // GEANT4 tag $Name: geant4-08-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) 38 // 54 // 39 // Class Description: 55 // Class Description: 40 // 56 // 41 // It is the base class - EM discrete and rest << 57 // It is the unified Discrete process 42 58 43 // ------------------------------------------- 59 // ------------------------------------------------------------------- 44 // 60 // 45 61 46 #ifndef G4VEmProcess_h 62 #ifndef G4VEmProcess_h 47 #define G4VEmProcess_h 1 63 #define G4VEmProcess_h 1 48 64 49 #include <CLHEP/Units/SystemOfUnits.h> << 50 << 51 #include "G4VDiscreteProcess.hh" 65 #include "G4VDiscreteProcess.hh" 52 #include "globals.hh" 66 #include "globals.hh" 53 #include "G4Material.hh" 67 #include "G4Material.hh" 54 #include "G4MaterialCutsCouple.hh" 68 #include "G4MaterialCutsCouple.hh" 55 #include "G4Track.hh" 69 #include "G4Track.hh" >> 70 #include "G4EmModelManager.hh" 56 #include "G4UnitsTable.hh" 71 #include "G4UnitsTable.hh" 57 #include "G4ParticleDefinition.hh" 72 #include "G4ParticleDefinition.hh" 58 #include "G4ParticleChangeForGamma.hh" 73 #include "G4ParticleChangeForGamma.hh" 59 #include "G4EmParameters.hh" << 60 #include "G4EmDataHandler.hh" << 61 #include "G4EmTableType.hh" << 62 #include "G4EmModelManager.hh" << 63 #include "G4EmSecondaryParticleType.hh" << 64 74 65 class G4Step; 75 class G4Step; 66 class G4VEmModel; 76 class G4VEmModel; 67 class G4DataVector; 77 class G4DataVector; 68 class G4VParticleChange; 78 class G4VParticleChange; 69 class G4PhysicsTable; 79 class G4PhysicsTable; 70 class G4PhysicsVector; 80 class G4PhysicsVector; 71 class G4EmBiasingManager; << 72 class G4LossTableManager; << 73 81 74 //....oooOO0OOooo........oooOO0OOooo........oo 82 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 75 83 76 class G4VEmProcess : public G4VDiscreteProcess 84 class G4VEmProcess : public G4VDiscreteProcess 77 { 85 { 78 public: 86 public: 79 87 80 G4VEmProcess(const G4String& name, G4Process << 88 G4VEmProcess(const G4String& name, >> 89 G4ProcessType type = fElectromagnetic); 81 90 82 ~G4VEmProcess() override; << 91 virtual ~G4VEmProcess(); 83 92 84 //------------------------------------------ 93 //------------------------------------------------------------------------ 85 // Virtual methods to be implemented in conc 94 // Virtual methods to be implemented in concrete processes 86 //------------------------------------------ 95 //------------------------------------------------------------------------ 87 96 88 void ProcessDescription(std::ostream& outFil << 97 virtual G4bool IsApplicable(const G4ParticleDefinition& p) = 0; 89 98 90 protected: << 99 virtual void PrintInfo() = 0; 91 100 92 virtual void StreamProcessInfo(std::ostream& << 101 protected: 93 102 94 virtual void InitialiseProcess(const G4Parti 103 virtual void InitialiseProcess(const G4ParticleDefinition*) = 0; 95 104 >> 105 virtual std::vector<G4DynamicParticle*>* SecondariesPostStep( >> 106 G4VEmModel*, >> 107 const G4MaterialCutsCouple*, >> 108 const G4DynamicParticle*) = 0; >> 109 96 //------------------------------------------ 110 //------------------------------------------------------------------------ 97 // Implementation of virtual methods common << 111 // Methods with standard implementation; may be overwritten if needed 98 //------------------------------------------ 112 //------------------------------------------------------------------------ 99 113 100 public: << 114 virtual G4double RecalculateLambda(G4double kinEnergy, 101 << 115 const G4MaterialCutsCouple* couple); 102 // Initialise for build of tables << 103 void PreparePhysicsTable(const G4ParticleDef << 104 << 105 // Build physics table during initialisation << 106 void BuildPhysicsTable(const G4ParticleDefin << 107 << 108 // Called before tracking of each new G4Trac << 109 void StartTracking(G4Track*) override; << 110 << 111 // implementation of virtual method, specifi << 112 G4double PostStepGetPhysicalInteractionLengt << 113 const G4Track& tr << 114 G4double previo << 115 G4ForceCondition* << 116 << 117 // implementation of virtual method, specifi << 118 G4VParticleChange* PostStepDoIt(const G4Trac << 119 << 120 // Store PhysicsTable in a file. << 121 // Return false in case of failure at I/O << 122 G4bool StorePhysicsTable(const G4ParticleDef << 123 const G4String& dir << 124 G4bool ascii = fals << 125 << 126 // Retrieve Physics from a file. << 127 // (return true if the Physics Table can be << 128 // (return false if the process has no funct << 129 // File name should is constructed as proces << 130 // should be placed under the directory spec << 131 G4bool RetrievePhysicsTable(const G4Particle << 132 const G4String& << 133 G4bool ascii) ov << 134 << 135 // allowing check process name << 136 virtual G4VEmProcess* GetEmProcess(const G4S << 137 116 138 //------------------------------------------ 117 //------------------------------------------------------------------------ 139 // Specific methods for Discrete EM post ste << 118 // Generic methods common to all processes 140 //------------------------------------------ 119 //------------------------------------------------------------------------ 141 120 142 // The main method to access cross section p << 121 public: 143 inline G4double GetLambda(G4double kinEnergy << 144 const G4MaterialCu << 145 G4double logKinEne << 146 << 147 // It returns the cross section per volume f << 148 G4double GetCrossSection(const G4double kinE << 149 const G4MaterialCut << 150 122 151 // It returns the cross section of the proce << 123 void PrintInfoDefinition(); 152 G4double ComputeCrossSectionPerAtom(G4double << 153 G4double << 154 G4double << 155 124 156 inline G4double MeanFreePath(const G4Track& << 125 virtual G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&); 157 126 158 //------------------------------------------ << 127 void PreparePhysicsTable(const G4ParticleDefinition&); 159 // Specific methods to build and access Phys << 128 // Initialise for build of tables 160 //------------------------------------------ << 129 >> 130 void BuildPhysicsTable(const G4ParticleDefinition&); >> 131 // Build physics table during initialisation 161 132 162 // Binning for lambda table << 163 void SetLambdaBinning(G4int nbins); 133 void SetLambdaBinning(G4int nbins); >> 134 G4int LambdaBinning() const; >> 135 // Binning for lambda table 164 136 165 // Min kinetic energy for tables << 166 void SetMinKinEnergy(G4double e); 137 void SetMinKinEnergy(G4double e); >> 138 G4double MinKinEnergy() const; >> 139 // Min kinetic energy for tables 167 140 168 // Min kinetic energy for high energy table << 169 void SetMinKinEnergyPrim(G4double e); << 170 << 171 // Max kinetic energy for tables << 172 void SetMaxKinEnergy(G4double e); 141 void SetMaxKinEnergy(G4double e); >> 142 G4double MaxKinEnergy() const; >> 143 // Max kinetic energy for tables 173 144 174 // Cross section table pointers << 145 void SetLambdaFactor(G4double val); 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 << 186 //------------------------------------------ << 187 // Define and access particle type << 188 //------------------------------------------ << 189 << 190 inline const G4ParticleDefinition* Particle( << 191 inline const G4ParticleDefinition* Secondary << 192 146 193 protected: << 147 G4bool StorePhysicsTable(const G4ParticleDefinition*, >> 148 const G4String& directory, >> 149 G4bool ascii = false); >> 150 // Store PhysicsTable in a file. >> 151 // Return false in case of failure at I/O 194 152 195 //------------------------------------------ << 153 G4bool RetrievePhysicsTable(const G4ParticleDefinition*, 196 // Specific methods to set, access, modify m << 154 const G4String& directory, 197 //------------------------------------------ << 155 G4bool ascii); >> 156 // Retrieve Physics from a file. >> 157 // (return true if the Physics Table can be build by using file) >> 158 // (return false if the process has no functionality or in case of failure) >> 159 // File name should is constructed as processName+particleName and the >> 160 // should be placed under the directory specifed by the argument. >> 161 >> 162 void SetModel(G4VEmModel*); >> 163 // Assign a model to a process 198 164 199 // Select model in run time << 165 G4VEmModel* Model(); 200 inline G4VEmModel* SelectModel(G4double kinE << 166 // return the assigned model 201 << 167 202 public: << 168 void AddEmModel(G4int, G4VEmModel*, const G4Region* region = 0); 203 << 169 // Add EM model coupled for the region 204 // Select model by energy and couple index << 170 205 inline G4VEmModel* SelectModelForMaterial(G4 << 171 void UpdateEmModel(const G4String&, G4double, G4double); 206 st << 172 // Define new energy range for the model identified by the name 207 << 173 208 // Add model for region, smaller value of or << 174 G4double GetLambda(G4double& kinEnergy, const G4MaterialCutsCouple* couple); 209 // model will be selected for a given energy << 175 // It returns the Lambda of the process 210 void AddEmModel(G4int, G4VEmModel*, const G4 << 176 211 << 177 const G4PhysicsTable* LambdaTable() const; 212 // Assign a model to a process local list, t << 178 213 // the derived process should execute AddEmM << 179 G4double MicroscopicCrossSection(G4double kineticEnergy, 214 void SetEmModel(G4VEmModel*, G4int index = 0 << 180 const G4MaterialCutsCouple* couple); 215 << 181 // It returns the cross section of the process for energy/ material 216 inline G4int NumberOfModels() const; << 217 << 218 // return a model from the local list << 219 inline G4VEmModel* EmModel(std::size_t index << 220 182 221 // Access to active model << 183 G4double ComputeCrossSectionPerAtom(G4double kineticEnergy, 222 inline const G4VEmModel* GetCurrentModel() c << 184 G4double Z, G4double A=0.); 223 << 185 // It returns the cross section of the process per atom 224 // Access to models << 225 inline G4VEmModel* GetModelByIndex(G4int idx << 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 << 234 // Activate forced interaction << 235 void ActivateForcedInteraction(G4double leng << 236 const G4Strin << 237 G4bool flag = << 238 << 239 void ActivateSecondaryBiasing(const G4String << 240 G4double energ << 241 << 242 inline void SetEmMasterProcess(const G4VEmPr << 243 186 244 inline void SetBuildTableFlag(G4bool val); << 187 G4double MeanFreePath( const G4Track& track, >> 188 G4double previousStepSize, >> 189 G4ForceCondition* condition); 245 190 246 inline void CurrentSetup(const G4MaterialCut << 191 const G4ParticleDefinition* Particle() const; >> 192 const G4ParticleDefinition* SecondaryParticle() const; 247 193 248 inline G4bool UseBaseMaterial() const; << 194 void ActivateDeexcitation(G4bool, const G4Region* r = 0); 249 195 250 void BuildLambdaTable(); << 196 G4VEmModel* SelectModelForMaterial(G4double kinEnergy, >> 197 size_t& idxRegion) const; 251 198 252 void StreamInfo(std::ostream& outFile, const << 199 void SetIntegral(G4bool val); 253 G4bool rst=false) const; << 200 G4bool IsIntegral() const; 254 201 255 // hide copy constructor and assignment oper << 202 void SetApplyCuts(G4bool val); 256 G4VEmProcess(G4VEmProcess &) = delete; << 257 G4VEmProcess & operator=(const G4VEmProcess << 258 203 259 //------------------------------------------ << 204 // Access to models 260 // Other generic methods << 205 G4VEmModel* GetModelByIndex(G4int idx = 0); 261 //------------------------------------------ << 262 206 263 protected: 207 protected: 264 208 265 G4double GetMeanFreePath(const G4Track& trac << 209 void SetParticle(const G4ParticleDefinition* p); 266 G4double previousSt << 267 G4ForceCondition* c << 268 << 269 G4PhysicsVector* LambdaPhysicsVector(const G << 270 << 271 inline void DefineMaterial(const G4MaterialC << 272 << 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 << 282 inline G4ParticleChangeForGamma* GetParticle << 283 << 284 inline void SetParticle(const G4ParticleDefi << 285 210 286 inline void SetSecondaryParticle(const G4Par << 211 void SetSecondaryParticle(const G4ParticleDefinition* p); 287 << 288 inline std::size_t CurrentMaterialCutsCouple << 289 << 290 inline const G4MaterialCutsCouple* MaterialC << 291 212 292 inline G4bool ApplyCuts() const; << 213 G4double GetMeanFreePath(const G4Track& track, >> 214 G4double previousStepSize, >> 215 G4ForceCondition* condition); 293 216 294 inline G4double GetGammaEnergyCut(); << 217 G4PhysicsVector* LambdaPhysicsVector(const G4MaterialCutsCouple*); 295 218 296 inline G4double GetElectronEnergyCut(); << 219 G4VEmModel* SelectModel(G4double& kinEnergy); 297 220 298 inline void SetStartFromNullFlag(G4bool val) << 221 size_t CurrentMaterialCutsCoupleIndex() const {return currentMaterialIndex;}; 299 222 300 inline void SetSplineFlag(G4bool val); << 223 void ResetNumberOfInteractionLengthLeft(); 301 224 302 const G4Element* GetTargetElement() const; << 225 G4double GetGammaEnergyCut(); >> 226 G4double GetElectronEnergyCut(); 303 227 304 const G4Isotope* GetTargetIsotope() const; << 228 void SetBuildTableFlag(G4bool val); 305 229 306 // these two methods assume that vectors are << 230 void SetStartFromNullFlag(G4bool val); 307 // and idx is within vector length << 308 inline G4int DensityIndex(G4int idx) const; << 309 inline G4double DensityFactor(G4int idx) con << 310 231 311 private: 232 private: 312 233 313 void PrintWarning(G4String tit, G4double val << 234 void Clear(); 314 << 315 void ComputeIntegralLambda(G4double kinEnerg << 316 << 317 inline G4double LogEkin(const G4Track&); << 318 << 319 inline G4double GetLambdaFromTable(G4double << 320 << 321 inline G4double GetLambdaFromTable(G4double << 322 << 323 inline G4double GetLambdaFromTablePrim(G4dou << 324 << 325 inline G4double GetLambdaFromTablePrim(G4dou << 326 235 327 inline G4double GetCurrentLambda(G4double ki << 236 void DefineMaterial(const G4MaterialCutsCouple* couple); 328 237 329 inline G4double GetCurrentLambda(G4double ki << 238 void ComputeIntegralLambda(G4double kinEnergy); 330 239 331 inline G4double ComputeCurrentLambda(G4doubl << 240 G4double GetLambdaFromTable(G4double kinEnergy); 332 241 333 // ======== pointers ========= << 242 G4double GetCurrentLambda(G4double kinEnergy); 334 243 335 G4EmModelManager* modelManager = << 244 G4double ComputeCurrentLambda(G4double kinEnergy); 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 245 349 // ======== tables and vectors ======== << 246 void BuildLambdaTable(); 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 << 358 protected: << 359 << 360 // ======== pointers ========= << 361 << 362 const G4MaterialCutsCouple* currentCouple = << 363 const G4Material* currentMaterial << 364 G4EmBiasingManager* biasManager = n << 365 std::vector<G4double>* theEnergyOfCros << 366 << 367 private: << 368 << 369 const std::vector<G4double>* theDensityFacto << 370 const std::vector<G4int>* theDensityIdx = nu << 371 << 372 // ======== parameters ========= << 373 G4double minKinEnergy; << 374 G4double maxKinEnergy; << 375 G4double minKinEnergyPrim = DBL_MAX; << 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 << 384 protected: << 385 247 386 G4double mfpKinEnergy = DBL_MAX; << 248 void FindLambdaMax(); 387 G4double preStepKinEnergy = 0.0; << 388 G4double preStepLambda = 0.0; << 389 249 390 private: << 250 // hide assignment operator 391 251 392 G4CrossSectionType fXSType = fEmNoIntegral; << 252 G4VEmProcess(G4VEmProcess &); >> 253 G4VEmProcess & operator=(const G4VEmProcess &right); 393 254 394 G4int numberOfModels = 0; << 255 // ===================================================================== 395 G4int nLambdaBins = 84; << 396 256 397 protected: 257 protected: 398 258 399 G4int mainSecondaries = 1; << 259 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 260 413 private: 261 private: 414 262 415 G4bool buildLambdaTable = true; << 263 G4EmModelManager* modelManager; 416 G4bool applyCuts = false; << 264 G4VEmModel* selectedModel; 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 265 428 // ======== particle change ========= << 266 // tables and vectors 429 std::vector<G4DynamicParticle*> secParticles << 267 G4PhysicsTable* theLambdaTable; 430 G4ParticleChangeForGamma fParticleChange; << 268 G4double* theEnergyOfCrossSectionMax; 431 << 269 G4double* theCrossSectionMax; 432 private: << 270 433 << 271 const G4ParticleDefinition* particle; 434 // ======== local vectors ========= << 272 const G4ParticleDefinition* secondaryParticle; 435 std::vector<G4VEmModel*> emModels; << 273 const G4ParticleDefinition* theGamma; >> 274 const G4ParticleDefinition* theElectron; >> 275 const G4ParticleDefinition* thePositron; >> 276 >> 277 const std::vector<G4double>* theCutsGamma; >> 278 const std::vector<G4double>* theCutsElectron; >> 279 const std::vector<G4double>* theCutsPositron; >> 280 >> 281 G4int nLambdaBins; >> 282 >> 283 G4double minKinEnergy; >> 284 G4double maxKinEnergy; >> 285 G4double lambdaFactor; >> 286 >> 287 // cash >> 288 const G4Material* currentMaterial; >> 289 const G4MaterialCutsCouple* currentCouple; >> 290 size_t currentMaterialIndex; >> 291 >> 292 G4double mfpKinEnergy; >> 293 G4double preStepKinEnergy; >> 294 G4double preStepLambda; >> 295 G4double preStepMFP; >> 296 >> 297 G4bool integral; >> 298 G4bool meanFreePath; >> 299 G4bool aboveCSmax; >> 300 G4bool buildLambdaTable; >> 301 G4bool applyCuts; >> 302 G4bool startFromNull; >> 303 >> 304 G4int nRegions; >> 305 std::vector<G4Region*> regions; >> 306 std::vector<G4bool> flagsDeexcitation; 436 307 437 }; 308 }; 438 309 439 // ======== Run time inline methods ========== << 440 << 441 //....oooOO0OOooo........oooOO0OOooo........oo 310 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 442 << 443 inline std::size_t G4VEmProcess::CurrentMateri << 444 { << 445 return currentCoupleIndex; << 446 } << 447 << 448 //....oooOO0OOooo........oooOO0OOooo........oo << 449 << 450 inline const G4MaterialCutsCouple* G4VEmProces << 451 { << 452 return currentCouple; << 453 } << 454 << 455 //....oooOO0OOooo........oooOO0OOooo........oo << 456 << 457 inline G4double G4VEmProcess::GetGammaEnergyCu << 458 { << 459 return (*theCutsGamma)[currentCoupleIndex]; << 460 } << 461 << 462 //....oooOO0OOooo........oooOO0OOooo........oo << 463 << 464 inline G4double G4VEmProcess::GetElectronEnerg << 465 { << 466 return (*theCutsElectron)[currentCoupleIndex << 467 } << 468 << 469 //....oooOO0OOooo........oooOO0OOooo........oo 311 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 470 312 471 inline void G4VEmProcess::DefineMaterial(const 313 inline void G4VEmProcess::DefineMaterial(const G4MaterialCutsCouple* couple) 472 { 314 { 473 if (couple != currentCouple) { << 315 if(couple != currentCouple) { 474 currentCouple = couple; << 316 currentCouple = couple; 475 baseMaterial = currentMaterial = couple->G << 317 currentMaterial = couple->GetMaterial(); 476 basedCoupleIndex = currentCoupleIndex = co << 318 currentMaterialIndex = couple->GetIndex(); 477 fFactor = biasFactor; << 319 if(!meanFreePath) ResetNumberOfInteractionLengthLeft(); 478 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 } << 486 } << 487 << 488 //....oooOO0OOooo........oooOO0OOooo........oo << 489 << 490 inline << 491 G4VEmModel* G4VEmProcess::SelectModel(G4double << 492 { << 493 if(1 < numberOfModels) { << 494 currentModel = modelManager->SelectModel(k << 495 } 320 } 496 currentModel->SetCurrentCouple(currentCouple << 497 return currentModel; << 498 } << 499 << 500 //....oooOO0OOooo........oooOO0OOooo........oo << 501 << 502 inline << 503 G4VEmModel* G4VEmProcess::SelectModelForMateri << 504 << 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 { << 520 return track.GetDynamicParticle()->GetLogKin << 521 } << 522 << 523 //....oooOO0OOooo........oooOO0OOooo........oo << 524 << 525 inline G4double G4VEmProcess::GetLambdaFromTab << 526 { << 527 return ((*theLambdaTable)[basedCoupleIndex]) << 528 } 321 } 529 322 530 //....oooOO0OOooo........oooOO0OOooo........oo 323 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 531 324 532 inline G4double G4VEmProcess::GetLambdaFromTab << 325 inline G4double G4VEmProcess::GetLambda(G4double& kineticEnergy, >> 326 const G4MaterialCutsCouple* couple) 533 { 327 { 534 return ((*theLambdaTablePrim)[basedCoupleInd << 328 DefineMaterial(couple); 535 } << 329 return GetCurrentLambda(kineticEnergy); 536 << 537 //....oooOO0OOooo........oooOO0OOooo........oo << 538 << 539 inline G4double G4VEmProcess::GetLambdaFromTab << 540 { << 541 return ((*theLambdaTablePrim)[basedCoupleInd << 542 } << 543 << 544 //....oooOO0OOooo........oooOO0OOooo........oo << 545 << 546 inline G4double G4VEmProcess::ComputeCurrentLa << 547 { << 548 return currentModel->CrossSectionPerVolume(b << 549 } 330 } 550 331 551 //....oooOO0OOooo........oooOO0OOooo........oo 332 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 552 333 553 inline G4double G4VEmProcess::GetCurrentLambda 334 inline G4double G4VEmProcess::GetCurrentLambda(G4double e) 554 { 335 { 555 if(currentCoupleIndex != coupleIdxLambda || << 336 G4double x = 0.0; 556 coupleIdxLambda = currentCoupleIndex; << 337 if(theLambdaTable) x = GetLambdaFromTable(e); 557 fLambdaEnergy = e; << 338 else x = ComputeCurrentLambda(e); 558 if(e >= minKinEnergyPrim) { fLambda = GetL << 339 return x; 559 else if(nullptr != theLambdaTable) { fLamb << 560 else { fLambda = ComputeCurrentLambda(e); << 561 fLambda *= fFactor; << 562 } << 563 return fLambda; << 564 } 340 } 565 341 566 //....oooOO0OOooo........oooOO0OOooo........oo 342 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 567 343 568 inline G4double G4VEmProcess::GetCurrentLambda << 344 inline G4double G4VEmProcess::RecalculateLambda(G4double e, const G4MaterialCutsCouple* couple) 569 { << 570 if(currentCoupleIndex != coupleIdxLambda || << 571 coupleIdxLambda = currentCoupleIndex; << 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 } << 580 << 581 //....oooOO0OOooo........oooOO0OOooo........oo << 582 << 583 inline void << 584 G4VEmProcess::CurrentSetup(const G4MaterialCut << 585 { 345 { 586 DefineMaterial(couple); 346 DefineMaterial(couple); 587 SelectModel(energy*massRatio, currentCoupleI << 347 return ComputeCurrentLambda(e); 588 } << 589 << 590 //....oooOO0OOooo........oooOO0OOooo........oo << 591 << 592 inline G4double << 593 G4VEmProcess::GetLambda(G4double kinEnergy, co << 594 G4double logKinEnergy) << 595 { << 596 CurrentSetup(couple, kinEnergy); << 597 return GetCurrentLambda(kinEnergy, logKinEne << 598 } << 599 << 600 //....oooOO0OOooo........oooOO0OOooo........oo << 601 << 602 G4double G4VEmProcess::MeanFreePath(const G4Tr << 603 { << 604 const G4double kinEnergy = track.GetKineticE << 605 CurrentSetup(track.GetMaterialCutsCouple(), << 606 const G4double xs = GetCurrentLambda(kinEner << 607 track.GetDynamicP << 608 return (0.0 < xs) ? 1.0/xs : DBL_MAX; << 609 } << 610 << 611 // ======== Get/Set inline methods used at ini << 612 << 613 inline G4bool G4VEmProcess::ApplyCuts() const << 614 { << 615 return applyCuts; << 616 } << 617 << 618 //....oooOO0OOooo........oooOO0OOooo........oo << 619 << 620 inline G4int G4VEmProcess::LambdaBinning() con << 621 { << 622 return nLambdaBins; << 623 } << 624 << 625 //....oooOO0OOooo........oooOO0OOooo........oo << 626 << 627 inline G4double G4VEmProcess::MinKinEnergy() c << 628 { << 629 return minKinEnergy; << 630 } << 631 << 632 //....oooOO0OOooo........oooOO0OOooo........oo << 633 << 634 inline G4double G4VEmProcess::MaxKinEnergy() c << 635 { << 636 return maxKinEnergy; << 637 } 348 } 638 349 639 //....oooOO0OOooo........oooOO0OOooo........oo 350 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 640 351 641 inline G4double G4VEmProcess::CrossSectionBias << 352 inline G4double G4VEmProcess::ComputeCurrentLambda(G4double e) 642 { 353 { 643 return biasFactor; << 354 G4VEmModel* currentModel = SelectModel(e); >> 355 G4double x = 0.0; >> 356 if(currentModel) x = currentModel->CrossSectionPerVolume(currentMaterial,particle,e); >> 357 return x; 644 } 358 } 645 359 646 //....oooOO0OOooo........oooOO0OOooo........oo 360 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 647 361 648 inline G4PhysicsTable* G4VEmProcess::LambdaTab << 362 inline G4double G4VEmProcess::GetLambdaFromTable(G4double e) 649 { 363 { 650 return theLambdaTable; << 364 G4bool b; >> 365 return (((*theLambdaTable)[currentMaterialIndex])->GetValue(e, b)); 651 } 366 } 652 367 653 //....oooOO0OOooo........oooOO0OOooo........oo 368 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 654 369 655 inline G4PhysicsTable* G4VEmProcess::LambdaTab << 370 inline void G4VEmProcess::ComputeIntegralLambda(G4double e) 656 { 371 { 657 return theLambdaTablePrim; << 372 meanFreePath = false; >> 373 aboveCSmax = false; >> 374 mfpKinEnergy = theEnergyOfCrossSectionMax[currentMaterialIndex]; >> 375 if (e <= mfpKinEnergy) { >> 376 preStepLambda = GetLambdaFromTable(e); >> 377 } else { >> 378 aboveCSmax = true; >> 379 G4double e1 = e*lambdaFactor; >> 380 if(e1 > mfpKinEnergy) { >> 381 preStepLambda = GetLambdaFromTable(e); >> 382 G4double preStepLambda1 = GetLambdaFromTable(e1); >> 383 if(preStepLambda1 > preStepLambda) { >> 384 mfpKinEnergy = e1; >> 385 preStepLambda = preStepLambda1; >> 386 } >> 387 } else { >> 388 preStepLambda = theCrossSectionMax[currentMaterialIndex]; >> 389 } >> 390 } 658 } 391 } 659 392 660 //....oooOO0OOooo........oooOO0OOooo........oo 393 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 661 394 662 inline void G4VEmProcess::SetLambdaTable(G4Phy << 395 inline G4double G4VEmProcess::GetMeanFreePath(const G4Track& track, 663 { << 396 G4double, 664 theLambdaTable = ptr; << 397 G4ForceCondition* condition) >> 398 { >> 399 *condition = NotForced; >> 400 preStepKinEnergy = track.GetKineticEnergy(); >> 401 DefineMaterial(track.GetMaterialCutsCouple()); >> 402 if( aboveCSmax && preStepKinEnergy < mfpKinEnergy ) ResetNumberOfInteractionLengthLeft(); >> 403 if (meanFreePath) { >> 404 if(integral) ComputeIntegralLambda(preStepKinEnergy); >> 405 else preStepLambda = GetCurrentLambda(preStepKinEnergy); >> 406 if(0.0 < preStepLambda) preStepMFP = 1.0/preStepLambda; >> 407 else preStepMFP = DBL_MAX; >> 408 } >> 409 // G4cout<<GetProcessName()<<": e= "<<preStepKinEnergy<< " eCSmax= " >> 410 // <<mfpKinEnergy<< " mfp= "<<preStepMFP<<G4endl; >> 411 return preStepMFP; 665 } 412 } 666 413 667 //....oooOO0OOooo........oooOO0OOooo........oo 414 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 668 415 669 inline void G4VEmProcess::SetLambdaTablePrim(G << 416 inline G4VEmModel* G4VEmProcess::SelectModel(G4double& kinEnergy) 670 { 417 { 671 theLambdaTablePrim = ptr; << 418 return modelManager->SelectModel(kinEnergy, currentMaterialIndex); 672 } 419 } 673 420 674 //....oooOO0OOooo........oooOO0OOooo........oo 421 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 675 422 676 inline std::vector<G4double>* G4VEmProcess::En << 423 inline G4VEmModel* G4VEmProcess::SelectModelForMaterial( >> 424 G4double kinEnergy, size_t& idxRegion) const 677 { 425 { 678 return theEnergyOfCrossSectionMax; << 426 return modelManager->SelectModel(kinEnergy, idxRegion); 679 } 427 } 680 428 681 //....oooOO0OOooo........oooOO0OOooo........oo 429 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 682 430 683 inline void << 431 inline void G4VEmProcess::ResetNumberOfInteractionLengthLeft() 684 G4VEmProcess::SetEnergyOfCrossSectionMax(std:: << 685 { 432 { 686 theEnergyOfCrossSectionMax = ptr; << 433 meanFreePath = true; >> 434 aboveCSmax = false; >> 435 G4VProcess::ResetNumberOfInteractionLengthLeft(); 687 } 436 } 688 437 689 //....oooOO0OOooo........oooOO0OOooo........oo 438 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 690 439 691 inline const G4ParticleDefinition* G4VEmProces 440 inline const G4ParticleDefinition* G4VEmProcess::Particle() const 692 { 441 { 693 return particle; 442 return particle; 694 } 443 } 695 444 696 //....oooOO0OOooo........oooOO0OOooo........oo 445 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 697 446 698 inline const G4ParticleDefinition* G4VEmProces 447 inline const G4ParticleDefinition* G4VEmProcess::SecondaryParticle() const 699 { 448 { 700 return secondaryParticle; 449 return secondaryParticle; 701 } 450 } 702 451 703 //....oooOO0OOooo........oooOO0OOooo........oo 452 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 704 453 705 inline void G4VEmProcess::SetCrossSectionType( << 454 inline G4double G4VEmProcess::GetGammaEnergyCut() 706 { << 707 fXSType = val; << 708 } << 709 << 710 //....oooOO0OOooo........oooOO0OOooo........oo << 711 << 712 inline G4CrossSectionType G4VEmProcess::CrossS << 713 { << 714 return fXSType; << 715 } << 716 << 717 //....oooOO0OOooo........oooOO0OOooo........oo << 718 << 719 inline void G4VEmProcess::SetBuildTableFlag(G4 << 720 { << 721 buildLambdaTable = val; << 722 } << 723 << 724 //....oooOO0OOooo........oooOO0OOooo........oo << 725 << 726 inline G4ParticleChangeForGamma* G4VEmProcess: << 727 { << 728 return &fParticleChange; << 729 } << 730 << 731 //....oooOO0OOooo........oooOO0OOooo........oo << 732 << 733 inline void G4VEmProcess::SetParticle(const G4 << 734 { << 735 particle = p; << 736 currentParticle = p; << 737 } << 738 << 739 //....oooOO0OOooo........oooOO0OOooo........oo << 740 << 741 inline void G4VEmProcess::SetSecondaryParticle << 742 { << 743 secondaryParticle = p; << 744 } << 745 << 746 //....oooOO0OOooo........oooOO0OOooo........oo << 747 << 748 inline void G4VEmProcess::SetStartFromNullFlag << 749 { << 750 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 { 455 { 785 return currentModel; << 456 return (*theCutsGamma)[currentMaterialIndex]; 786 } << 787 << 788 //....oooOO0OOooo........oooOO0OOooo........oo << 789 << 790 inline void G4VEmProcess::SetEmMasterProcess(c << 791 { << 792 masterProc = ptr; << 793 } 457 } 794 458 795 //....oooOO0OOooo........oooOO0OOooo........oo 459 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 796 460 797 inline G4int G4VEmProcess::NumberOfModels() co << 461 inline G4double G4VEmProcess::GetElectronEnergyCut() 798 { 462 { 799 return numberOfModels; << 463 return (*theCutsElectron)[currentMaterialIndex]; 800 } 464 } 801 465 802 //....oooOO0OOooo........oooOO0OOooo........oo 466 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 803 467 804 inline G4VEmModel* G4VEmProcess::EmModel(std:: << 468 inline void G4VEmProcess::SetLambdaFactor(G4double val) 805 { 469 { 806 return (index < emModels.size()) ? emModels[ << 470 if(val > 0.0 && val <= 1.0) lambdaFactor = val; 807 } 471 } 808 472 809 //....oooOO0OOooo........oooOO0OOooo........oo 473 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 810 474 811 inline G4VEmModel* G4VEmProcess::GetModelByInd << 475 inline G4VEmModel* G4VEmProcess::GetModelByIndex(G4int idx) 812 { 476 { 813 return modelManager->GetModel(idx, ver); << 477 return modelManager->GetModel(idx); 814 } 478 } 815 479 816 //....oooOO0OOooo........oooOO0OOooo........oo 480 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 817 481 818 #endif 482 #endif 819 483