// // ******************************************************************** // * DISCLAIMER * // * * // * The following disclaimer summarizes all the specific disclaimers * // * of contributors to this software. The specific disclaimers,which * // * govern, are listed with their locations in: * // * http://cern.ch/geant4/license * // * * // * Neither the authors of this software system, nor their employing * // * institutes,nor the agencies providing financial support for this * // * work make any representation or warranty, express or implied, * // * regarding this software system or assume any liability for its * // * use. * // * * // * This code implementation is the intellectual property of the * // * GEANT4 collaboration. * // * By copying, distributing or modifying the Program (or any work * // * based on the Program) you indicate your acceptance of this * // * statement, and all its terms. * // ******************************************************************** // // $Id: G4VEmProcess.hh,v 1.4 2004/05/17 09:46:56 vnivanch Exp $ // GEANT4 tag $Name: geant4-06-02 $ // // ------------------------------------------------------------------- // // GEANT4 Class header file // // // File name: G4VEmProcess // // Author: Vladimir Ivanchenko // // Creation date: 01.10.2003 // // Modifications: // // // Class Description: // // It is the unified Rest and/or Discrete process // ------------------------------------------------------------------- // #ifndef G4VEmProcess_h #define G4VEmProcess_h 1 #include "G4VRestDiscreteProcess.hh" #include "globals.hh" #include "G4Material.hh" #include "G4MaterialCutsCouple.hh" #include "G4Track.hh" #include "G4EmModelManager.hh" #include "G4UnitsTable.hh" #include "G4ParticleDefinition.hh" class G4Step; class G4VEmModel; class G4VEmFluctuationModel; class G4DataVector; class G4VParticleChange; class G4PhysicsTable; class G4PhysicsVector; //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... class G4VEmProcess : public G4VRestDiscreteProcess { public: G4VEmProcess(const G4String& name, G4ProcessType type = fElectromagnetic); ~G4VEmProcess(); G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&); G4double GetMeanLifeTime(const G4Track& aTrack, G4ForceCondition* condition); // It is invoked by the ProcessManager of the Positron if this // e+ has a kinetic energy null. Then it return 0 to force the // call of AtRestDoIt. // This function overloads a virtual function of the base class. virtual G4VParticleChange* AtRestDoIt(const G4Track& aTrack, const G4Step& aStep); // It computes the final state of the process: // e+ (at rest) e- (at rest) ---> gamma gamma, // returned as a ParticleChange object. // This function overloads a virtual function of the base class. // It is invoked by the ProcessManager of the Particle. virtual void SecondariesPostStep(G4VEmModel*, const G4MaterialCutsCouple*, const G4DynamicParticle*, G4double& tcut, G4double& kinEnergy) = 0; virtual G4bool IsApplicable(const G4ParticleDefinition& p) = 0; // True for all charged particles virtual void BuildPhysicsTable(const G4ParticleDefinition&); // Build physics table during initialisation virtual void PrintInfoDefinition(); // Print out of the class parameters G4PhysicsTable* BuildLambdaTable(); void SetLambdaBinning(G4int nbins); // Binning for lambda table void SetMinKinEnergy(G4double e); G4double MinKinEnergy() const; // Min kinetic energy for tables void SetMaxKinEnergy(G4double e); G4double MaxKinEnergy() const; // Max kinetic energy for tables G4bool StorePhysicsTable(G4ParticleDefinition*, const G4String& directory, G4bool ascii = false); // Store PhysicsTable in a file. // Return false in case of failure at I/O G4bool RetrievePhysicsTable(G4ParticleDefinition*, const G4String& directory, G4bool ascii); // Retrieve Physics from a file. // (return true if the Physics Table can be build by using file) // (return false if the process has no functionality or in case of failure) // File name should is constructed as processName+particleName and the // should be placed under the directory specifed by the argument. void AddEmModel(G4int, G4VEmModel*, G4VEmFluctuationModel* fluc = 0, const G4Region* region = 0); // Add EM model coupled with fluctuation model for the region void UpdateEmModel(const G4String&, G4double, G4double); // Define new energy range for the model identified by the name G4double GetLambda(G4double& kinEnergy, const G4MaterialCutsCouple* couple); // It returns the Lambda of the process G4double MicroscopicCrossSection(G4double kineticEnergy, const G4MaterialCutsCouple* couple); // It returns the cross section of the process for energy/ material void SetIntegral(G4bool val) {integral = val;}; G4bool IsIntegral() const {return integral;} G4double MeanFreePath(const G4Track& track, G4double previousStepSize, G4ForceCondition* condition); const G4ParticleDefinition* Particle() const; const G4ParticleDefinition* SecondaryParticle() const; void ActivateFluorescence(G4bool, const G4Region* r = 0); void ActivateAugerElectronProduction(G4bool, const G4Region* r = 0); void SetLambdaFactor(G4double val); protected: void SetParticle(const G4ParticleDefinition* p); void SetSecondaryParticle(const G4ParticleDefinition* p); virtual G4double GetMeanFreePath(const G4Track& track, G4double previousStepSize, G4ForceCondition* condition); virtual G4PhysicsVector* LambdaPhysicsVector(const G4MaterialCutsCouple*); virtual G4double MinPrimaryEnergy(const G4ParticleDefinition*, const G4Material*, G4double cut) = 0; G4VEmModel* SelectModel(G4double& kinEnergy); size_t CurrentMaterialCutsCoupleIndex() const {return currentMaterialIndex;}; void ResetNumberOfInteractionLengthLeft(); // reset (determine the value of)NumberOfInteractionLengthLeft private: void Initialise(); void DefineMaterial(const G4MaterialCutsCouple* couple); G4double GetLambda(G4double kinEnergy); void ComputeLambda(G4double kinEnergy); // hide assignment operator G4VEmProcess(G4VEmProcess &); G4VEmProcess & operator=(const G4VEmProcess &right); // ===================================================================== private: G4EmModelManager* modelManager; // tables and vectors G4PhysicsTable* theLambdaTable; G4double* theEnergyOfCrossSectionMax; G4double* theCrossSectionMax; const G4ParticleDefinition* particle; const G4ParticleDefinition* baseParticle; const G4ParticleDefinition* secondaryParticle; const G4DataVector* theCuts; // cash const G4Material* currentMaterial; const G4MaterialCutsCouple* currentCouple; size_t currentMaterialIndex; G4int nLambdaBins; G4double minKinEnergy; G4double maxKinEnergy; G4double lambdaFactor; G4double preStepLambda; G4double preStepMFP; G4double preStepKinEnergy; G4double mfpKinEnergy; G4bool integral; G4bool meanFreePath; }; //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... inline void G4VEmProcess::DefineMaterial(const G4MaterialCutsCouple* couple) { if(couple != currentCouple) { currentCouple = couple; currentMaterial = couple->GetMaterial(); currentMaterialIndex = couple->GetIndex(); if(integral && (!meanFreePath || preStepKinEnergy < mfpKinEnergy)) ResetNumberOfInteractionLengthLeft(); } } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... inline G4double G4VEmProcess::GetLambda(G4double& kineticEnergy, const G4MaterialCutsCouple* couple) { DefineMaterial(couple); G4double x = 0.0; if(theLambdaTable) x = GetLambda(kineticEnergy); return x; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... inline G4double G4VEmProcess::GetLambda(G4double e) { G4bool b; return (((*theLambdaTable)[currentMaterialIndex])->GetValue(e, b)); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... inline void G4VEmProcess::ComputeLambda(G4double e) { meanFreePath = false; mfpKinEnergy = 0.0; G4double emax = theEnergyOfCrossSectionMax[currentMaterialIndex]; if (e <= emax) preStepLambda = GetLambda(e); else { e *= lambdaFactor; if(e > emax) { mfpKinEnergy = e; preStepLambda = GetLambda(e); } else preStepLambda = theCrossSectionMax[currentMaterialIndex]; } } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... inline G4double G4VEmProcess::GetMeanFreePath(const G4Track& track, G4double, G4ForceCondition*) { preStepKinEnergy = track.GetKineticEnergy(); DefineMaterial(track.GetMaterialCutsCouple()); if (meanFreePath) { if (integral) ComputeLambda(preStepKinEnergy); else preStepLambda = GetLambda(preStepKinEnergy); if(0.0 < preStepLambda) preStepMFP = 1.0/preStepLambda; else preStepMFP = DBL_MAX; } // G4cout<