Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // >> 23 // $Id: G4VEmProcess.hh,v 1.15 2004/11/10 08:54:59 vnivanch Exp $ >> 24 // GEANT4 tag $Name: geant4-07-00-patch-01 $ >> 25 // 26 // ------------------------------------------- 26 // ------------------------------------------------------------------- 27 // 27 // 28 // GEANT4 Class header file 28 // GEANT4 Class header file 29 // 29 // 30 // 30 // 31 // File name: G4VEmProcess 31 // File name: G4VEmProcess 32 // 32 // 33 // Author: Vladimir Ivanchenko 33 // Author: Vladimir Ivanchenko 34 // 34 // 35 // Creation date: 01.10.2003 35 // Creation date: 01.10.2003 36 // 36 // 37 // Modifications: Vladimir Ivanchenko << 37 // Modifications: >> 38 // 30-06-04 make destructor virtual (V.Ivanchenko) >> 39 // 09-08-04 optimise integral option (V.Ivanchenko) >> 40 // 11-08-04 add protected methods to access cuts (V.Ivanchenko) >> 41 // 09-09-04 Bug fix for the integral mode with 2 peaks (V.Ivanchneko) >> 42 // 16-09-04 Add flag for LambdaTable and method RecalculateLambda (V.Ivanchneko) >> 43 // 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivantchenko) 38 // 44 // 39 // Class Description: 45 // Class Description: 40 // 46 // 41 // It is the base class - EM discrete and rest << 47 // It is the unified Discrete process 42 48 43 // ------------------------------------------- 49 // ------------------------------------------------------------------- 44 // 50 // 45 51 46 #ifndef G4VEmProcess_h 52 #ifndef G4VEmProcess_h 47 #define G4VEmProcess_h 1 53 #define G4VEmProcess_h 1 48 54 49 #include <CLHEP/Units/SystemOfUnits.h> << 50 << 51 #include "G4VDiscreteProcess.hh" 55 #include "G4VDiscreteProcess.hh" 52 #include "globals.hh" 56 #include "globals.hh" 53 #include "G4Material.hh" 57 #include "G4Material.hh" 54 #include "G4MaterialCutsCouple.hh" 58 #include "G4MaterialCutsCouple.hh" 55 #include "G4Track.hh" 59 #include "G4Track.hh" >> 60 #include "G4EmModelManager.hh" 56 #include "G4UnitsTable.hh" 61 #include "G4UnitsTable.hh" 57 #include "G4ParticleDefinition.hh" 62 #include "G4ParticleDefinition.hh" 58 #include "G4ParticleChangeForGamma.hh" << 63 #include "G4ParticleChangeForLoss.hh" 59 #include "G4EmParameters.hh" << 60 #include "G4EmDataHandler.hh" << 61 #include "G4EmTableType.hh" << 62 #include "G4EmModelManager.hh" << 63 #include "G4EmSecondaryParticleType.hh" << 64 64 65 class G4Step; 65 class G4Step; 66 class G4VEmModel; 66 class G4VEmModel; 67 class G4DataVector; 67 class G4DataVector; 68 class G4VParticleChange; 68 class G4VParticleChange; 69 class G4PhysicsTable; 69 class G4PhysicsTable; 70 class G4PhysicsVector; 70 class G4PhysicsVector; 71 class G4EmBiasingManager; << 72 class G4LossTableManager; << 73 71 74 //....oooOO0OOooo........oooOO0OOooo........oo 72 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 75 73 76 class G4VEmProcess : public G4VDiscreteProcess 74 class G4VEmProcess : public G4VDiscreteProcess 77 { 75 { 78 public: 76 public: 79 77 80 G4VEmProcess(const G4String& name, G4Process << 78 G4VEmProcess(const G4String& name, 81 << 79 G4ProcessType type = fElectromagnetic); 82 ~G4VEmProcess() override; << 83 80 84 //------------------------------------------ << 81 virtual ~G4VEmProcess(); 85 // Virtual methods to be implemented in conc << 86 //------------------------------------------ << 87 82 88 void ProcessDescription(std::ostream& outFil << 83 virtual G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&); 89 84 90 protected: << 85 virtual std::vector<G4DynamicParticle*>* SecondariesPostStep( 91 << 86 G4VEmModel*, 92 virtual void StreamProcessInfo(std::ostream& << 87 const G4MaterialCutsCouple*, 93 << 88 const G4DynamicParticle*) = 0; 94 virtual void InitialiseProcess(const G4Parti << 95 89 96 //------------------------------------------ << 90 virtual G4bool IsApplicable(const G4ParticleDefinition& p) = 0; 97 // Implementation of virtual methods common << 91 // True for all charged particles 98 //------------------------------------------ << 99 << 100 public: << 101 92 >> 93 virtual void PreparePhysicsTable(const G4ParticleDefinition&); 102 // Initialise for build of tables 94 // Initialise for build of tables 103 void PreparePhysicsTable(const G4ParticleDef << 104 95 >> 96 virtual void BuildPhysicsTable(const G4ParticleDefinition&); 105 // Build physics table during initialisation 97 // 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 98 117 // implementation of virtual method, specifi << 99 virtual void PrintInfoDefinition(); 118 G4VParticleChange* PostStepDoIt(const G4Trac << 100 // Print out of the class parameters 119 101 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 << 138 //------------------------------------------ << 139 // Specific methods for Discrete EM post ste << 140 //------------------------------------------ << 141 << 142 // The main method to access cross section p << 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 << 151 // It returns the cross section of the proce << 152 G4double ComputeCrossSectionPerAtom(G4double << 153 G4double << 154 G4double << 155 << 156 inline G4double MeanFreePath(const G4Track& << 157 << 158 //------------------------------------------ << 159 // Specific methods to build and access Phys << 160 //------------------------------------------ << 161 << 162 // Binning for lambda table << 163 void SetLambdaBinning(G4int nbins); 102 void SetLambdaBinning(G4int nbins); >> 103 G4int LambdaBinning() const; >> 104 // Binning for lambda table 164 105 165 // Min kinetic energy for tables << 166 void SetMinKinEnergy(G4double e); 106 void SetMinKinEnergy(G4double e); >> 107 G4double MinKinEnergy() const; >> 108 // Min kinetic energy for tables 167 109 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); 110 void SetMaxKinEnergy(G4double e); >> 111 G4double MaxKinEnergy() const; >> 112 // Max kinetic energy for tables 173 113 174 // Cross section table pointers << 114 G4bool StorePhysicsTable(const G4ParticleDefinition*, 175 inline G4PhysicsTable* LambdaTable() const; << 115 const G4String& directory, 176 inline G4PhysicsTable* LambdaTablePrim() con << 116 G4bool ascii = false); 177 inline void SetLambdaTable(G4PhysicsTable*); << 117 // Store PhysicsTable in a file. 178 inline void SetLambdaTablePrim(G4PhysicsTabl << 118 // Return false in case of failure at I/O 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 << 193 protected: << 194 << 195 //------------------------------------------ << 196 // Specific methods to set, access, modify m << 197 //------------------------------------------ << 198 << 199 // Select model in run time << 200 inline G4VEmModel* SelectModel(G4double kinE << 201 << 202 public: << 203 << 204 // Select model by energy and couple index << 205 inline G4VEmModel* SelectModelForMaterial(G4 << 206 st << 207 << 208 // Add model for region, smaller value of or << 209 // model will be selected for a given energy << 210 void AddEmModel(G4int, G4VEmModel*, const G4 << 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 << 221 // Access to active model << 222 inline const G4VEmModel* GetCurrentModel() c << 223 119 224 // Access to models << 120 G4bool RetrievePhysicsTable(const G4ParticleDefinition*, 225 inline G4VEmModel* GetModelByIndex(G4int idx << 121 const G4String& directory, >> 122 G4bool ascii); >> 123 // Retrieve Physics from a file. >> 124 // (return true if the Physics Table can be build by using file) >> 125 // (return false if the process has no functionality or in case of failure) >> 126 // File name should is constructed as processName+particleName and the >> 127 // should be placed under the directory specifed by the argument. 226 128 227 // Access to the current G4Element << 129 void AddEmModel(G4int, G4VEmModel*, const G4Region* region = 0); 228 const G4Element* GetCurrentElement() const; << 130 // Add EM model coupled for the region 229 131 230 // Biasing parameters << 132 void UpdateEmModel(const G4String&, G4double, G4double); 231 void SetCrossSectionBiasingFactor(G4double f << 133 // Define new energy range for the model identified by the name 232 inline G4double CrossSectionBiasingFactor() << 233 134 234 // Activate forced interaction << 135 virtual G4double RecalculateLambda(G4double kinEnergy, 235 void ActivateForcedInteraction(G4double leng << 136 const G4MaterialCutsCouple* couple); 236 const G4Strin << 137 G4double GetLambda(G4double& kinEnergy, const G4MaterialCutsCouple* couple); 237 G4bool flag = << 138 // It returns the Lambda of the process 238 139 239 void ActivateSecondaryBiasing(const G4String << 140 const G4PhysicsTable* LambdaTable() const; 240 G4double energ << 241 141 242 inline void SetEmMasterProcess(const G4VEmPr << 142 G4double MicroscopicCrossSection(G4double kineticEnergy, >> 143 const G4MaterialCutsCouple* couple); >> 144 // It returns the cross section of the process for energy/ material 243 145 244 inline void SetBuildTableFlag(G4bool val); << 146 G4double MeanFreePath( const G4Track& track, >> 147 G4double previousStepSize, >> 148 G4ForceCondition* condition); 245 149 246 inline void CurrentSetup(const G4MaterialCut << 150 const G4ParticleDefinition* Particle() const; >> 151 const G4ParticleDefinition* SecondaryParticle() const; 247 152 248 inline G4bool UseBaseMaterial() const; << 153 virtual void ActivateFluorescence(G4bool, const G4Region* r = 0); >> 154 virtual void ActivateAugerElectronProduction(G4bool, const G4Region* r = 0); 249 155 250 void BuildLambdaTable(); << 156 G4VEmModel* SelectModelForMaterial(G4double kinEnergy, size_t& idxRegion) const; 251 157 252 void StreamInfo(std::ostream& outFile, const << 158 void SetIntegral(G4bool val); 253 G4bool rst=false) const; << 159 G4bool IsIntegral() const; 254 160 255 // hide copy constructor and assignment oper << 256 G4VEmProcess(G4VEmProcess &) = delete; << 257 G4VEmProcess & operator=(const G4VEmProcess << 258 << 259 //------------------------------------------ << 260 // Other generic methods << 261 //------------------------------------------ << 262 << 263 protected: 161 protected: 264 162 265 G4double GetMeanFreePath(const G4Track& trac << 163 virtual void InitialiseProcess(const G4ParticleDefinition*) = 0; 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 164 286 inline void SetSecondaryParticle(const G4Par << 165 void SetParticle(const G4ParticleDefinition* p); 287 << 166 288 inline std::size_t CurrentMaterialCutsCouple << 167 void SetSecondaryParticle(const G4ParticleDefinition* p); 289 << 290 inline const G4MaterialCutsCouple* MaterialC << 291 << 292 inline G4bool ApplyCuts() const; << 293 << 294 inline G4double GetGammaEnergyCut(); << 295 << 296 inline G4double GetElectronEnergyCut(); << 297 << 298 inline void SetStartFromNullFlag(G4bool val) << 299 << 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: << 312 << 313 void PrintWarning(G4String tit, G4double val << 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 << 327 inline G4double GetCurrentLambda(G4double ki << 328 << 329 inline G4double GetCurrentLambda(G4double ki << 330 << 331 inline G4double ComputeCurrentLambda(G4doubl << 332 168 333 // ======== pointers ========= << 169 virtual G4double GetMeanFreePath(const G4Track& track, >> 170 G4double previousStepSize, >> 171 G4ForceCondition* condition); 334 172 335 G4EmModelManager* modelManager = << 173 virtual G4PhysicsVector* LambdaPhysicsVector(const G4MaterialCutsCouple*) = 0; 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 174 349 // ======== tables and vectors ======== << 175 G4VEmModel* SelectModel(G4double& kinEnergy); 350 G4PhysicsTable* theLambdaTable << 351 G4PhysicsTable* theLambdaTableP << 352 176 353 const std::vector<G4double>* theCuts = nullp << 177 size_t CurrentMaterialCutsCoupleIndex() const {return currentMaterialIndex;}; 354 const std::vector<G4double>* theCutsGamma = << 355 const std::vector<G4double>* theCutsElectron << 356 const std::vector<G4double>* theCutsPositron << 357 178 358 protected: << 179 void ResetNumberOfInteractionLengthLeft(); 359 180 360 // ======== pointers ========= << 181 G4double GetGammaEnergyCut(); >> 182 G4double GetElectronEnergyCut(); 361 183 362 const G4MaterialCutsCouple* currentCouple = << 184 void SetBuildTableFlag(G4bool val); 363 const G4Material* currentMaterial << 364 G4EmBiasingManager* biasManager = n << 365 std::vector<G4double>* theEnergyOfCros << 366 185 367 private: 186 private: 368 187 369 const std::vector<G4double>* theDensityFacto << 188 void Clear(); 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 << 386 G4double mfpKinEnergy = DBL_MAX; << 387 G4double preStepKinEnergy = 0.0; << 388 G4double preStepLambda = 0.0; << 389 189 390 private: << 190 void DefineMaterial(const G4MaterialCutsCouple* couple); 391 191 392 G4CrossSectionType fXSType = fEmNoIntegral; << 192 G4double GetLambda(G4double kinEnergy); 393 193 394 G4int numberOfModels = 0; << 194 void ComputeLambda(G4double kinEnergy); 395 G4int nLambdaBins = 84; << 396 195 397 protected: << 196 void BuildLambdaTable(); 398 197 399 G4int mainSecondaries = 1; << 198 void FindLambdaMax(); 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 199 410 G4bool isTheMaster = false; << 200 // hide assignment operator 411 G4bool baseMat = false; << 412 201 413 private: << 202 G4VEmProcess(G4VEmProcess &); >> 203 G4VEmProcess & operator=(const G4VEmProcess &right); 414 204 415 G4bool buildLambdaTable = true; << 205 // ===================================================================== 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 206 426 protected: 207 protected: 427 208 428 // ======== particle change ========= << 209 G4ParticleChangeForLoss fParticleChange; 429 std::vector<G4DynamicParticle*> secParticles << 430 G4ParticleChangeForGamma fParticleChange; << 431 210 432 private: 211 private: 433 212 434 // ======== local vectors ========= << 213 G4EmModelManager* modelManager; 435 std::vector<G4VEmModel*> emModels; << 436 214 >> 215 // tables and vectors >> 216 G4PhysicsTable* theLambdaTable; >> 217 G4double* theEnergyOfCrossSectionMax; >> 218 G4double* theCrossSectionMax; >> 219 >> 220 const G4ParticleDefinition* particle; >> 221 const G4ParticleDefinition* secondaryParticle; >> 222 >> 223 const std::vector<G4double>* theCutsGamma; >> 224 const std::vector<G4double>* theCutsElectron; >> 225 const std::vector<G4double>* theCutsPositron; >> 226 >> 227 G4int nLambdaBins; >> 228 >> 229 G4double minKinEnergy; >> 230 G4double maxKinEnergy; >> 231 G4double lambdaFactor; >> 232 >> 233 // cash >> 234 const G4Material* currentMaterial; >> 235 const G4MaterialCutsCouple* currentCouple; >> 236 size_t currentMaterialIndex; >> 237 >> 238 G4double mfpKinEnergy; >> 239 G4double preStepKinEnergy; >> 240 G4double preStepLambda; >> 241 G4double preStepMFP; >> 242 >> 243 G4bool integral; >> 244 G4bool meanFreePath; >> 245 G4bool aboveCSmax; >> 246 G4bool buildLambdaTable; 437 }; 247 }; 438 248 439 // ======== Run time inline methods ========== << 440 << 441 //....oooOO0OOooo........oooOO0OOooo........oo << 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 249 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 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 250 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 470 251 471 inline void G4VEmProcess::DefineMaterial(const 252 inline void G4VEmProcess::DefineMaterial(const G4MaterialCutsCouple* couple) 472 { 253 { 473 if (couple != currentCouple) { << 254 if(couple != currentCouple) { 474 currentCouple = couple; << 255 currentCouple = couple; 475 baseMaterial = currentMaterial = couple->G << 256 currentMaterial = couple->GetMaterial(); 476 basedCoupleIndex = currentCoupleIndex = co << 257 currentMaterialIndex = couple->GetIndex(); 477 fFactor = biasFactor; << 258 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 } 259 } 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 } 260 } 522 261 523 //....oooOO0OOooo........oooOO0OOooo........oo 262 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 524 263 525 inline G4double G4VEmProcess::GetLambdaFromTab << 264 inline G4double G4VEmProcess::GetLambda(G4double& kineticEnergy, >> 265 const G4MaterialCutsCouple* couple) 526 { 266 { 527 return ((*theLambdaTable)[basedCoupleIndex]) << 267 DefineMaterial(couple); 528 } << 268 G4double x = 0.0; 529 << 269 if(theLambdaTable) x = GetLambda(kineticEnergy); 530 //....oooOO0OOooo........oooOO0OOooo........oo << 270 else x = RecalculateLambda(kineticEnergy, couple); 531 << 271 return x; 532 inline G4double G4VEmProcess::GetLambdaFromTab << 533 { << 534 return ((*theLambdaTablePrim)[basedCoupleInd << 535 } 272 } 536 273 537 //....oooOO0OOooo........oooOO0OOooo........oo 274 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 538 275 539 inline G4double G4VEmProcess::GetLambdaFromTab << 276 inline G4double G4VEmProcess::RecalculateLambda( >> 277 G4double, const G4MaterialCutsCouple*) 540 { 278 { 541 return ((*theLambdaTablePrim)[basedCoupleInd << 279 return 0.0; 542 } 280 } 543 281 544 //....oooOO0OOooo........oooOO0OOooo........oo 282 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 545 283 546 inline G4double G4VEmProcess::ComputeCurrentLa << 284 inline G4double G4VEmProcess::GetLambda(G4double e) 547 { 285 { 548 return currentModel->CrossSectionPerVolume(b << 286 G4bool b; >> 287 return (((*theLambdaTable)[currentMaterialIndex])->GetValue(e, b)); 549 } 288 } 550 289 551 //....oooOO0OOooo........oooOO0OOooo........oo 290 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 552 291 553 inline G4double G4VEmProcess::GetCurrentLambda << 292 inline void G4VEmProcess::ComputeLambda(G4double e) 554 { 293 { 555 if(currentCoupleIndex != coupleIdxLambda || << 294 meanFreePath = false; 556 coupleIdxLambda = currentCoupleIndex; << 295 aboveCSmax = false; 557 fLambdaEnergy = e; << 296 mfpKinEnergy = theEnergyOfCrossSectionMax[currentMaterialIndex]; 558 if(e >= minKinEnergyPrim) { fLambda = GetL << 297 if (e <= mfpKinEnergy) { 559 else if(nullptr != theLambdaTable) { fLamb << 298 preStepLambda = GetLambda(e); 560 else { fLambda = ComputeCurrentLambda(e); << 299 } else { 561 fLambda *= fFactor; << 300 aboveCSmax = true; >> 301 G4double e1 = e*lambdaFactor; >> 302 if(e1 > mfpKinEnergy) { >> 303 preStepLambda = GetLambda(e); >> 304 G4double preStepLambda1 = GetLambda(e1); >> 305 if(preStepLambda1 > preStepLambda) { >> 306 mfpKinEnergy = e1; >> 307 preStepLambda = preStepLambda1; >> 308 } >> 309 } else { >> 310 preStepLambda = theCrossSectionMax[currentMaterialIndex]; >> 311 } 562 } 312 } 563 return fLambda; << 564 } 313 } 565 314 566 //....oooOO0OOooo........oooOO0OOooo........oo 315 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 567 316 568 inline G4double G4VEmProcess::GetCurrentLambda << 317 inline G4double G4VEmProcess::GetMeanFreePath(const G4Track& track, 569 { << 318 G4double, 570 if(currentCoupleIndex != coupleIdxLambda || << 319 G4ForceCondition* condition) 571 coupleIdxLambda = currentCoupleIndex; << 320 { 572 fLambdaEnergy = e; << 321 *condition = NotForced; 573 if(e >= minKinEnergyPrim) { fLambda = GetL << 322 preStepKinEnergy = track.GetKineticEnergy(); 574 else if(nullptr != theLambdaTable) { fLamb << 323 if(aboveCSmax && preStepKinEnergy < mfpKinEnergy) ResetNumberOfInteractionLengthLeft(); 575 else { fLambda = ComputeCurrentLambda(e); << 324 DefineMaterial(track.GetMaterialCutsCouple()); 576 fLambda *= fFactor; << 325 if (meanFreePath) { >> 326 if (integral) ComputeLambda(preStepKinEnergy); >> 327 else preStepLambda = GetLambda(preStepKinEnergy); >> 328 if(0.0 < preStepLambda) preStepMFP = 1.0/preStepLambda; >> 329 else preStepMFP = DBL_MAX; 577 } 330 } 578 return fLambda; << 331 //G4cout<<GetProcessName()<<": e= "<<preStepKinEnergy<< " eCSmax= " <<mfpKinEnergy<< " mfp= "<<preStepMFP<<G4endl; >> 332 return preStepMFP; 579 } 333 } 580 334 581 //....oooOO0OOooo........oooOO0OOooo........oo 335 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 582 336 583 inline void << 337 inline G4VEmModel* G4VEmProcess::SelectModel(G4double& kinEnergy) 584 G4VEmProcess::CurrentSetup(const G4MaterialCut << 585 { 338 { 586 DefineMaterial(couple); << 339 return modelManager->SelectModel(kinEnergy, currentMaterialIndex); 587 SelectModel(energy*massRatio, currentCoupleI << 588 } 340 } 589 341 590 //....oooOO0OOooo........oooOO0OOooo........oo 342 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 591 343 592 inline G4double << 344 inline G4VEmModel* G4VEmProcess::SelectModelForMaterial( 593 G4VEmProcess::GetLambda(G4double kinEnergy, co << 345 G4double kinEnergy, size_t& idxRegion) const 594 G4double logKinEnergy) << 595 { 346 { 596 CurrentSetup(couple, kinEnergy); << 347 return modelManager->SelectModel(kinEnergy, idxRegion); 597 return GetCurrentLambda(kinEnergy, logKinEne << 598 } 348 } 599 349 600 //....oooOO0OOooo........oooOO0OOooo........oo 350 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 601 351 602 G4double G4VEmProcess::MeanFreePath(const G4Tr << 352 inline void G4VEmProcess::ResetNumberOfInteractionLengthLeft() 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 { 353 { 615 return applyCuts; << 354 meanFreePath = true; 616 } << 355 aboveCSmax = false; 617 << 356 G4VProcess::ResetNumberOfInteractionLengthLeft(); 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 } << 638 << 639 //....oooOO0OOooo........oooOO0OOooo........oo << 640 << 641 inline G4double G4VEmProcess::CrossSectionBias << 642 { << 643 return biasFactor; << 644 } << 645 << 646 //....oooOO0OOooo........oooOO0OOooo........oo << 647 << 648 inline G4PhysicsTable* G4VEmProcess::LambdaTab << 649 { << 650 return theLambdaTable; << 651 } << 652 << 653 //....oooOO0OOooo........oooOO0OOooo........oo << 654 << 655 inline G4PhysicsTable* G4VEmProcess::LambdaTab << 656 { << 657 return theLambdaTablePrim; << 658 } << 659 << 660 //....oooOO0OOooo........oooOO0OOooo........oo << 661 << 662 inline void G4VEmProcess::SetLambdaTable(G4Phy << 663 { << 664 theLambdaTable = ptr; << 665 } << 666 << 667 //....oooOO0OOooo........oooOO0OOooo........oo << 668 << 669 inline void G4VEmProcess::SetLambdaTablePrim(G << 670 { << 671 theLambdaTablePrim = ptr; << 672 } << 673 << 674 //....oooOO0OOooo........oooOO0OOooo........oo << 675 << 676 inline std::vector<G4double>* G4VEmProcess::En << 677 { << 678 return theEnergyOfCrossSectionMax; << 679 } << 680 << 681 //....oooOO0OOooo........oooOO0OOooo........oo << 682 << 683 inline void << 684 G4VEmProcess::SetEnergyOfCrossSectionMax(std:: << 685 { << 686 theEnergyOfCrossSectionMax = ptr; << 687 } 357 } 688 358 689 //....oooOO0OOooo........oooOO0OOooo........oo 359 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 690 360 691 inline const G4ParticleDefinition* G4VEmProces 361 inline const G4ParticleDefinition* G4VEmProcess::Particle() const 692 { 362 { 693 return particle; 363 return particle; 694 } 364 } 695 365 696 //....oooOO0OOooo........oooOO0OOooo........oo 366 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 697 367 698 inline const G4ParticleDefinition* G4VEmProces 368 inline const G4ParticleDefinition* G4VEmProcess::SecondaryParticle() const 699 { 369 { 700 return secondaryParticle; 370 return secondaryParticle; 701 } 371 } 702 372 703 //....oooOO0OOooo........oooOO0OOooo........oo 373 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 704 374 705 inline void G4VEmProcess::SetCrossSectionType( << 375 inline G4double G4VEmProcess::GetGammaEnergyCut() 706 { 376 { 707 fXSType = val; << 377 return (*theCutsGamma)[currentMaterialIndex]; 708 } 378 } 709 379 710 //....oooOO0OOooo........oooOO0OOooo........oo 380 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 711 381 712 inline G4CrossSectionType G4VEmProcess::CrossS << 382 inline G4double G4VEmProcess::GetElectronEnergyCut() 713 { 383 { 714 return fXSType; << 384 return (*theCutsElectron)[currentMaterialIndex]; 715 } 385 } 716 386 717 //....oooOO0OOooo........oooOO0OOooo........oo 387 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 718 388 719 inline void G4VEmProcess::SetBuildTableFlag(G4 389 inline void G4VEmProcess::SetBuildTableFlag(G4bool val) 720 { 390 { 721 buildLambdaTable = val; 391 buildLambdaTable = val; 722 } 392 } 723 393 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 { << 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 } << 815 394 816 //....oooOO0OOooo........oooOO0OOooo........oo 395 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 817 396 818 #endif 397 #endif 819 398