Import Geant4 10.7.0.beta source tree
This commit is contained in:
@@ -16,6 +16,20 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
28 May 20: D. Sawkey (xrays-V10-06-03)
|
||||
- G4Cerenkov - set verbosity levels correctly
|
||||
|
||||
24 May 20: D. Sawkey (xrays-V10-06-02)
|
||||
- G4Scintillation, G4ScintillationTrackInformation - new material property
|
||||
names allowing 3 time constants, either with/without scintillation
|
||||
by particle type
|
||||
|
||||
19 May 20: D. Sawkey (xrays-V10-06-01)
|
||||
- G4Cerenkov, G4Scintillation - update format and style
|
||||
|
||||
14 February 20: V. Ivanchenko (xrays-V10-06-00)
|
||||
- G4VXTRenergyLoss - fixed destructor
|
||||
|
||||
08 November 19: V. Ivanchenko (xrays-V10-05-02)
|
||||
- G4SynchrotronRadiation, G4VTransitionRadiation - fixed deregistration
|
||||
|
||||
|
||||
@@ -47,10 +47,6 @@
|
||||
#ifndef G4Cerenkov_h
|
||||
#define G4Cerenkov_h 1
|
||||
|
||||
/////////////
|
||||
// Includes
|
||||
/////////////
|
||||
|
||||
#include <CLHEP/Units/SystemOfUnits.h>
|
||||
|
||||
#include "globals.hh"
|
||||
@@ -68,24 +64,11 @@
|
||||
#include "G4MaterialPropertiesTable.hh"
|
||||
#include "G4PhysicsOrderedFreeVector.hh"
|
||||
|
||||
// Class Description:
|
||||
// Discrete Process -- Generation of Cerenkov Photons.
|
||||
// Class inherits publicly from G4VDiscreteProcess.
|
||||
// Class Description - End:
|
||||
|
||||
/////////////////////
|
||||
// Class Definition
|
||||
/////////////////////
|
||||
|
||||
class G4Cerenkov : public G4VProcess
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
////////////////////////////////
|
||||
// Constructors and Destructor
|
||||
////////////////////////////////
|
||||
|
||||
explicit G4Cerenkov(const G4String& processName = "Cerenkov",
|
||||
G4ProcessType type = fElectromagnetic);
|
||||
~G4Cerenkov();
|
||||
@@ -94,18 +77,10 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
//////////////
|
||||
// Operators
|
||||
//////////////
|
||||
|
||||
G4Cerenkov& operator=(const G4Cerenkov &right) = delete;
|
||||
|
||||
public:
|
||||
|
||||
////////////
|
||||
// Methods
|
||||
////////////
|
||||
|
||||
G4bool IsApplicable(const G4ParticleDefinition& aParticleType) override;
|
||||
// Returns true -> 'is applicable', for all charged particles
|
||||
// except short-lived particles.
|
||||
@@ -156,25 +131,23 @@ public:
|
||||
// Returns the boolean flag for tracking secondaries first.
|
||||
|
||||
void SetMaxBetaChangePerStep(const G4double d);
|
||||
// Set the maximum allowed change in beta = v/c in % (perCent)
|
||||
// per step.
|
||||
// Set the maximum allowed change in beta = v/c in % (perCent) per step.
|
||||
|
||||
G4double GetMaxBetaChangePerStep() const;
|
||||
// Returns the maximum allowed change in beta = v/c in % (perCent)
|
||||
|
||||
void SetMaxNumPhotonsPerStep(const G4int NumPhotons);
|
||||
// Set the maximum number of Cerenkov photons allowed to be
|
||||
// generated during a tracking step. This is an average ONLY;
|
||||
// the actual number will vary around this average. If invoked,
|
||||
// the maximum photon stack will roughly be of the size set.
|
||||
// If not called, the step is not limited by the number of
|
||||
// Set the maximum number of Cerenkov photons allowed to be generated during
|
||||
// a tracking step. This is an average ONLY; the actual number will vary
|
||||
// around this average. If invoked, the maximum photon stack will roughly be
|
||||
// of the size set. If not called, the step is not limited by the number of
|
||||
// photons generated.
|
||||
|
||||
G4int GetMaxNumPhotonsPerStep() const;
|
||||
// Returns the maximum number of Cerenkov photons allowed to be
|
||||
// generated during a tracking step.
|
||||
|
||||
void SetStackPhotons(const G4bool );
|
||||
void SetStackPhotons(const G4bool);
|
||||
// Call by the user to set the flag for stacking the scint. photons
|
||||
|
||||
G4bool GetStackPhotons() const;
|
||||
@@ -193,25 +166,14 @@ private:
|
||||
|
||||
void BuildThePhysicsTable();
|
||||
|
||||
/////////////////////
|
||||
// Helper Functions
|
||||
/////////////////////
|
||||
|
||||
G4double GetAverageNumberOfPhotons(const G4double charge,
|
||||
const G4double beta,
|
||||
const G4Material *aMaterial,
|
||||
G4MaterialPropertyVector* Rindex) const;
|
||||
|
||||
///////////////////////
|
||||
// Class Data Members
|
||||
///////////////////////
|
||||
|
||||
protected:
|
||||
|
||||
G4PhysicsTable* thePhysicsTable;
|
||||
// A Physics Table can be either a cross-sections table or
|
||||
// an energy table (or can be used for other specific
|
||||
// purposes).
|
||||
|
||||
private:
|
||||
|
||||
@@ -224,10 +186,6 @@ private:
|
||||
G4int fNumPhotons;
|
||||
};
|
||||
|
||||
////////////////////
|
||||
// Inline methods
|
||||
////////////////////
|
||||
|
||||
inline
|
||||
G4bool G4Cerenkov::GetTrackSecondariesFirst() const
|
||||
{
|
||||
@@ -249,19 +207,19 @@ G4int G4Cerenkov::GetMaxNumPhotonsPerStep() const
|
||||
inline
|
||||
void G4Cerenkov::SetStackPhotons(const G4bool stackingFlag)
|
||||
{
|
||||
fStackingFlag = stackingFlag;
|
||||
fStackingFlag = stackingFlag;
|
||||
}
|
||||
|
||||
inline
|
||||
G4bool G4Cerenkov::GetStackPhotons() const
|
||||
{
|
||||
return fStackingFlag;
|
||||
return fStackingFlag;
|
||||
}
|
||||
|
||||
inline
|
||||
G4int G4Cerenkov::GetNumPhotons() const
|
||||
{
|
||||
return fNumPhotons;
|
||||
return fNumPhotons;
|
||||
}
|
||||
|
||||
inline
|
||||
|
||||
@@ -54,10 +54,6 @@
|
||||
#ifndef G4Scintillation_h
|
||||
#define G4Scintillation_h 1
|
||||
|
||||
/////////////
|
||||
// Includes
|
||||
/////////////
|
||||
|
||||
#include "globals.hh"
|
||||
#include "templates.hh"
|
||||
#include "Randomize.hh"
|
||||
@@ -80,194 +76,199 @@
|
||||
// Class inherits publicly from G4VRestDiscreteProcess.
|
||||
// Class Description - End:
|
||||
|
||||
/////////////////////
|
||||
// Class Definition
|
||||
/////////////////////
|
||||
|
||||
class G4Scintillation : public G4VRestDiscreteProcess
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
////////////////////////////////
|
||||
// Constructors and Destructor
|
||||
////////////////////////////////
|
||||
|
||||
explicit G4Scintillation(const G4String& processName = "Scintillation",
|
||||
G4ProcessType type = fElectromagnetic);
|
||||
~G4Scintillation();
|
||||
|
||||
private:
|
||||
|
||||
G4Scintillation(const G4Scintillation &right) = delete;
|
||||
|
||||
//////////////
|
||||
// Operators
|
||||
//////////////
|
||||
|
||||
G4Scintillation& operator=(const G4Scintillation &right) = delete;
|
||||
G4Scintillation(const G4Scintillation &right) = delete;
|
||||
G4Scintillation& operator=(const G4Scintillation &right) = delete;
|
||||
|
||||
public:
|
||||
|
||||
////////////
|
||||
// Methods
|
||||
////////////
|
||||
// G4Scintillation Process has both PostStepDoIt (for energy
|
||||
// deposition of particles in flight) and AtRestDoIt (for energy
|
||||
// given to the medium by particles at rest)
|
||||
|
||||
// G4Scintillation Process has both PostStepDoIt (for energy
|
||||
// deposition of particles in flight) and AtRestDoIt (for energy
|
||||
// given to the medium by particles at rest)
|
||||
G4bool IsApplicable(const G4ParticleDefinition& aParticleType) override;
|
||||
// Returns true -> 'is applicable', for any particle type except
|
||||
// for an 'opticalphoton' and for short-lived particles
|
||||
|
||||
G4bool IsApplicable(
|
||||
const G4ParticleDefinition& aParticleType) override;
|
||||
// Returns true -> 'is applicable', for any particle type except
|
||||
// for an 'opticalphoton' and for short-lived particles
|
||||
void BuildPhysicsTable(const G4ParticleDefinition& aParticleType) override;
|
||||
// Build table at the right time
|
||||
|
||||
void BuildPhysicsTable(
|
||||
const G4ParticleDefinition& aParticleType) override;
|
||||
// Build table at the right time
|
||||
|
||||
G4double GetMeanFreePath(const G4Track& aTrack,
|
||||
G4double ,
|
||||
G4ForceCondition* ) override;
|
||||
// Returns infinity; i. e. the process does not limit the step,
|
||||
// but sets the 'StronglyForced' condition for the DoIt to be
|
||||
// invoked at every step.
|
||||
|
||||
G4double GetMeanLifeTime(const G4Track& aTrack,
|
||||
G4double GetMeanFreePath(const G4Track& aTrack,
|
||||
G4double ,
|
||||
G4ForceCondition* ) override;
|
||||
// Returns infinity; i. e. the process does not limit the time,
|
||||
// but sets the 'StronglyForced' condition for the DoIt to be
|
||||
// invoked at every step.
|
||||
// Returns infinity; i. e. the process does not limit the step,
|
||||
// but sets the 'StronglyForced' condition for the DoIt to be
|
||||
// invoked at every step.
|
||||
|
||||
G4VParticleChange* PostStepDoIt(const G4Track& aTrack,
|
||||
const G4Step& aStep) override;
|
||||
G4VParticleChange* AtRestDoIt (const G4Track& aTrack,
|
||||
const G4Step& aStep) override;
|
||||
G4double GetMeanLifeTime(const G4Track& aTrack,
|
||||
G4ForceCondition* ) override;
|
||||
// Returns infinity; i. e. the process does not limit the time,
|
||||
// but sets the 'StronglyForced' condition for the DoIt to be
|
||||
// invoked at every step.
|
||||
|
||||
G4double GetScintillationYieldByParticleType(const G4Track &aTrack,
|
||||
const G4Step &aStep);
|
||||
// Returns the number of scintillation photons calculated when
|
||||
// scintillation depends on the particle type and energy
|
||||
// deposited (includes nonlinear dependendency)
|
||||
G4VParticleChange* PostStepDoIt(const G4Track& aTrack,
|
||||
const G4Step& aStep) override;
|
||||
G4VParticleChange* AtRestDoIt (const G4Track& aTrack,
|
||||
const G4Step& aStep) override;
|
||||
|
||||
// These are the methods implementing the scintillation process.
|
||||
G4double GetScintillationYieldByParticleType(const G4Track &aTrack,
|
||||
const G4Step &aStep);
|
||||
// Returns the number of scintillation photons calculated when
|
||||
// scintillation depends on the particle type and energy
|
||||
// deposited (includes nonlinear dependendency)
|
||||
// DEPRECATED: to be removed in the next major release. Use the
|
||||
// following instead.
|
||||
|
||||
void SetTrackSecondariesFirst(const G4bool state);
|
||||
// If set, the primary particle tracking is interrupted and any
|
||||
// produced scintillation photons are tracked next. When all
|
||||
// have been tracked, the tracking of the primary resumes.
|
||||
G4double GetScintillationYieldByParticleType(
|
||||
const G4Track &aTrack,
|
||||
const G4Step &aStep,
|
||||
G4double &yield1,
|
||||
G4double &yield2,
|
||||
G4double &yield3);
|
||||
// allow multiple time constants with scint by particle type
|
||||
|
||||
G4bool GetTrackSecondariesFirst() const;
|
||||
// Returns the boolean flag for tracking secondaries first.
|
||||
void SetTrackSecondariesFirst(const G4bool state);
|
||||
// If set, the primary particle tracking is interrupted and any
|
||||
// produced scintillation photons are tracked next. When all
|
||||
// have been tracked, the tracking of the primary resumes.
|
||||
|
||||
void SetFiniteRiseTime(const G4bool state);
|
||||
// If set, the G4Scintillation process expects the user to have
|
||||
// set the constant material property FAST/SLOWSCINTILLATIONRISETIME.
|
||||
G4bool GetTrackSecondariesFirst() const;
|
||||
// Returns the boolean flag for tracking secondaries first.
|
||||
|
||||
G4bool GetFiniteRiseTime() const;
|
||||
// Returns the boolean flag for a finite scintillation rise time.
|
||||
|
||||
void SetScintillationYieldFactor(const G4double yieldfactor);
|
||||
// Called to set the scintillation photon yield factor, needed when
|
||||
// the yield is different for different types of particles. This
|
||||
// scales the yield obtained from the G4MaterialPropertiesTable.
|
||||
void SetFiniteRiseTime(const G4bool state);
|
||||
// If set, the G4Scintillation process expects the user to have
|
||||
// set the constant material property FAST/SLOWSCINTILLATIONRISETIME.
|
||||
|
||||
G4double GetScintillationYieldFactor() const;
|
||||
// Returns the photon yield factor.
|
||||
G4bool GetFiniteRiseTime() const;
|
||||
// Returns the boolean flag for a finite scintillation rise time.
|
||||
|
||||
void SetScintillationExcitationRatio(const G4double ratio);
|
||||
// Called to set the scintillation exciation ratio, needed when
|
||||
// the scintillation level excitation is different for different
|
||||
// types of particles. This overwrites the YieldRatio obtained
|
||||
// from the G4MaterialPropertiesTable.
|
||||
void SetScintillationYieldFactor(const G4double yieldfactor);
|
||||
// Called to set the scintillation photon yield factor, needed when
|
||||
// the yield is different for different types of particles. This
|
||||
// scales the yield obtained from the G4MaterialPropertiesTable.
|
||||
|
||||
G4double GetScintillationExcitationRatio() const;
|
||||
// Returns the scintillation level excitation ratio.
|
||||
G4double GetScintillationYieldFactor() const;
|
||||
// Returns the photon yield factor.
|
||||
|
||||
G4PhysicsTable* GetFastIntegralTable() const;
|
||||
// Returns the address of the fast scintillation integral table.
|
||||
void SetScintillationExcitationRatio(const G4double ratio);
|
||||
// Called to set the scintillation excitation ratio, needed when
|
||||
// the scintillation level excitation is different for different
|
||||
// types of particles. This overwrites the YieldRatio obtained
|
||||
// from the G4MaterialPropertiesTable.
|
||||
// DEPRECATED and will be removed in the next major release. Set
|
||||
// the yields for different particles in material property table instead.
|
||||
|
||||
G4PhysicsTable* GetSlowIntegralTable() const;
|
||||
// Returns the address of the slow scintillation integral table.
|
||||
G4double GetScintillationExcitationRatio() const;
|
||||
// Returns the scintillation level excitation ratio.
|
||||
// DEPRECATED and will be removed in the next major release. Set
|
||||
// the yields for different particles in material property table instead.
|
||||
|
||||
void AddSaturation(G4EmSaturation* sat);
|
||||
// Adds Birks Saturation to the process.
|
||||
G4PhysicsTable* GetFastIntegralTable() const;
|
||||
// Returns the address of the fast scintillation integral table.
|
||||
// DEPRECATED and will be removed in the next major release. Use
|
||||
// GetIntegralTable1() instead.
|
||||
|
||||
void RemoveSaturation();
|
||||
// Removes the Birks Saturation from the process.
|
||||
G4PhysicsTable* GetSlowIntegralTable() const;
|
||||
// Returns the address of the slow scintillation integral table.
|
||||
// DEPRECATED and will be removed in the next major release. Use
|
||||
// GetIntegralTable3() instead.
|
||||
|
||||
G4EmSaturation* GetSaturation() const;
|
||||
// Returns the Birks Saturation.
|
||||
G4PhysicsTable* GetIntegralTable1() const;
|
||||
// Returns the address of scintillation integral table #1.
|
||||
|
||||
void SetScintillationByParticleType(const G4bool );
|
||||
// Called by the user to set the scintillation yield as a function
|
||||
// of energy deposited by particle type
|
||||
G4PhysicsTable* GetIntegralTable2() const;
|
||||
// Returns the address of scintillation integral table #2.
|
||||
|
||||
G4bool GetScintillationByParticleType() const;
|
||||
// Return the boolean that determines the method of scintillation
|
||||
// production
|
||||
G4PhysicsTable* GetIntegralTable3() const;
|
||||
// Returns the address of scintillation integral table #3.
|
||||
|
||||
void SetScintillationTrackInfo(const G4bool trackType);
|
||||
// Call by the user to set the G4ScintillationTrackInformation
|
||||
// to scintillation photon track
|
||||
void AddSaturation(G4EmSaturation* sat);
|
||||
// Adds Birks Saturation to the process.
|
||||
|
||||
G4bool GetScintillationTrackInfo() const;
|
||||
// Return the boolean for whether or not the
|
||||
// G4ScintillationTrackInformation is set to the scint. photon track
|
||||
void RemoveSaturation();
|
||||
// Removes the Birks Saturation from the process.
|
||||
|
||||
void SetStackPhotons(const G4bool );
|
||||
// Call by the user to set the flag for stacking the scint. photons
|
||||
G4EmSaturation* GetSaturation() const;
|
||||
// Returns the Birks Saturation.
|
||||
|
||||
G4bool GetStackPhotons() const;
|
||||
// Return the boolean for whether or not the scint. photons are stacked
|
||||
void SetScintillationByParticleType(const G4bool );
|
||||
// Called by the user to set the scintillation yield as a function
|
||||
// of energy deposited by particle type
|
||||
|
||||
G4int GetNumPhotons() const;
|
||||
// Returns the current number of scint. photons (after PostStepDoIt)
|
||||
G4bool GetScintillationByParticleType() const;
|
||||
// Return the boolean that determines the method of scintillation
|
||||
// production
|
||||
|
||||
void DumpPhysicsTable() const;
|
||||
// Prints the fast and slow scintillation integral tables.
|
||||
void SetEnhancedTimeConstants(G4bool);
|
||||
G4bool GetEnhancedTimeConstants() const;
|
||||
// Starting with 10.7.beta, enable 3 time constants, either for
|
||||
// all particles or by particle type. The names of the material
|
||||
// properties have been generalized from FAST and SLOW to 1, 2, 3.
|
||||
|
||||
void SetScintillationTrackInfo(const G4bool trackType);
|
||||
// Call by the user to set the G4ScintillationTrackInformation
|
||||
// to scintillation photon track
|
||||
|
||||
G4bool GetScintillationTrackInfo() const;
|
||||
// Return the boolean for whether or not the
|
||||
// G4ScintillationTrackInformation is set to the scint. photon track
|
||||
|
||||
void SetStackPhotons(const G4bool );
|
||||
// Call by the user to set the flag for stacking the scint. photons
|
||||
|
||||
G4bool GetStackPhotons() const;
|
||||
// Return the boolean for whether or not the scint. photons are stacked
|
||||
|
||||
G4int GetNumPhotons() const;
|
||||
// Returns the current number of scint. photons (after PostStepDoIt)
|
||||
|
||||
void DumpPhysicsTable() const;
|
||||
// Prints the fast and slow scintillation integral tables.
|
||||
|
||||
protected:
|
||||
|
||||
void BuildThePhysicsTable();
|
||||
// It builds either the fast or slow scintillation integral table;
|
||||
// or both.
|
||||
void BuildThePhysicsTable();
|
||||
// It builds either the fast or slow scintillation integral table;
|
||||
// or both.
|
||||
|
||||
///////////////////////
|
||||
// Class Data Members
|
||||
///////////////////////
|
||||
|
||||
G4PhysicsTable* fFastIntegralTable;
|
||||
G4PhysicsTable* fSlowIntegralTable;
|
||||
G4PhysicsTable* fIntegralTable1;
|
||||
G4PhysicsTable* fIntegralTable2;
|
||||
G4PhysicsTable* fIntegralTable3;
|
||||
|
||||
private:
|
||||
|
||||
G4bool fTrackSecondariesFirst;
|
||||
G4bool fFiniteRiseTime;
|
||||
|
||||
G4double fYieldFactor;
|
||||
|
||||
G4double fExcitationRatio;
|
||||
|
||||
G4bool fScintillationByParticleType;
|
||||
|
||||
G4bool fScintillationTrackInfo;
|
||||
|
||||
G4bool fStackingFlag;
|
||||
|
||||
G4int fNumPhotons;
|
||||
G4bool fTrackSecondariesFirst;
|
||||
G4bool fFiniteRiseTime;
|
||||
G4double fYieldFactor;
|
||||
G4double fExcitationRatio;
|
||||
G4bool fScintillationByParticleType;
|
||||
G4bool fScintillationTrackInfo;
|
||||
G4bool fStackingFlag;
|
||||
G4int fNumPhotons;
|
||||
G4bool fEnhancedTimeConstants;
|
||||
|
||||
#ifdef G4DEBUG_SCINTILLATION
|
||||
G4double ScintTrackEDep, ScintTrackYield;
|
||||
G4double ScintTrackEDep, ScintTrackYield;
|
||||
#endif
|
||||
|
||||
G4double single_exp(G4double t, G4double tau2);
|
||||
G4double bi_exp(G4double t, G4double tau1, G4double tau2);
|
||||
G4double single_exp(G4double t, G4double tau2);
|
||||
G4double bi_exp(G4double t, G4double tau1, G4double tau2);
|
||||
|
||||
// emission time distribution when there is a finite rise time
|
||||
G4double sample_time(G4double tau1, G4double tau2);
|
||||
// emission time distribution when there is a finite rise time
|
||||
G4double sample_time(G4double tau1, G4double tau2);
|
||||
|
||||
G4EmSaturation* fEmSaturation;
|
||||
G4EmSaturation* fEmSaturation;
|
||||
G4ParticleDefinition* opticalphoton = G4OpticalPhoton::OpticalPhotonDefinition();
|
||||
|
||||
};
|
||||
|
||||
@@ -278,128 +279,158 @@ private:
|
||||
inline
|
||||
void G4Scintillation::SetTrackSecondariesFirst(const G4bool state)
|
||||
{
|
||||
fTrackSecondariesFirst = state;
|
||||
fTrackSecondariesFirst = state;
|
||||
}
|
||||
|
||||
inline
|
||||
G4bool G4Scintillation::GetTrackSecondariesFirst() const
|
||||
{
|
||||
return fTrackSecondariesFirst;
|
||||
return fTrackSecondariesFirst;
|
||||
}
|
||||
|
||||
inline
|
||||
void G4Scintillation::SetFiniteRiseTime(const G4bool state)
|
||||
{
|
||||
fFiniteRiseTime = state;
|
||||
fFiniteRiseTime = state;
|
||||
}
|
||||
|
||||
inline
|
||||
G4bool G4Scintillation::GetFiniteRiseTime() const
|
||||
{
|
||||
return fFiniteRiseTime;
|
||||
return fFiniteRiseTime;
|
||||
}
|
||||
|
||||
inline
|
||||
void G4Scintillation::SetScintillationYieldFactor(const G4double yieldfactor)
|
||||
{
|
||||
fYieldFactor = yieldfactor;
|
||||
fYieldFactor = yieldfactor;
|
||||
}
|
||||
|
||||
inline
|
||||
G4double G4Scintillation::GetScintillationYieldFactor() const
|
||||
{
|
||||
return fYieldFactor;
|
||||
return fYieldFactor;
|
||||
}
|
||||
|
||||
inline
|
||||
void G4Scintillation::SetScintillationExcitationRatio(const G4double ratio)
|
||||
{
|
||||
fExcitationRatio = ratio;
|
||||
fExcitationRatio = ratio;
|
||||
}
|
||||
|
||||
inline
|
||||
G4double G4Scintillation::GetScintillationExcitationRatio() const
|
||||
{
|
||||
return fExcitationRatio;
|
||||
return fExcitationRatio;
|
||||
}
|
||||
|
||||
inline
|
||||
G4PhysicsTable* G4Scintillation::GetSlowIntegralTable() const
|
||||
{
|
||||
return fSlowIntegralTable;
|
||||
return fIntegralTable3;
|
||||
}
|
||||
|
||||
inline
|
||||
G4PhysicsTable* G4Scintillation::GetFastIntegralTable() const
|
||||
{
|
||||
return fFastIntegralTable;
|
||||
return fIntegralTable1;
|
||||
}
|
||||
|
||||
inline
|
||||
G4PhysicsTable* G4Scintillation::GetIntegralTable1() const
|
||||
{
|
||||
return fIntegralTable1;
|
||||
}
|
||||
|
||||
inline
|
||||
G4PhysicsTable* G4Scintillation::GetIntegralTable2() const
|
||||
{
|
||||
return fIntegralTable2;
|
||||
}
|
||||
|
||||
inline
|
||||
G4PhysicsTable* G4Scintillation::GetIntegralTable3() const
|
||||
{
|
||||
return fIntegralTable3;
|
||||
}
|
||||
|
||||
inline
|
||||
void G4Scintillation::AddSaturation(G4EmSaturation* sat)
|
||||
{
|
||||
fEmSaturation = sat;
|
||||
fEmSaturation = sat;
|
||||
}
|
||||
|
||||
inline
|
||||
void G4Scintillation::RemoveSaturation()
|
||||
{
|
||||
fEmSaturation = nullptr;
|
||||
fEmSaturation = nullptr;
|
||||
}
|
||||
|
||||
inline
|
||||
G4EmSaturation* G4Scintillation::GetSaturation() const
|
||||
{
|
||||
return fEmSaturation;
|
||||
return fEmSaturation;
|
||||
}
|
||||
|
||||
inline
|
||||
G4bool G4Scintillation::GetScintillationByParticleType() const
|
||||
{
|
||||
return fScintillationByParticleType;
|
||||
return fScintillationByParticleType;
|
||||
}
|
||||
|
||||
inline
|
||||
void G4Scintillation::SetEnhancedTimeConstants(G4bool val)
|
||||
{
|
||||
fEnhancedTimeConstants = val;
|
||||
}
|
||||
|
||||
inline
|
||||
G4bool G4Scintillation::GetEnhancedTimeConstants() const
|
||||
{
|
||||
return fEnhancedTimeConstants;
|
||||
}
|
||||
|
||||
inline
|
||||
void G4Scintillation::SetScintillationTrackInfo(const G4bool trackType)
|
||||
{
|
||||
fScintillationTrackInfo = trackType;
|
||||
fScintillationTrackInfo = trackType;
|
||||
}
|
||||
|
||||
inline
|
||||
G4bool G4Scintillation::GetScintillationTrackInfo() const
|
||||
{
|
||||
return fScintillationTrackInfo;
|
||||
return fScintillationTrackInfo;
|
||||
}
|
||||
|
||||
inline
|
||||
void G4Scintillation::SetStackPhotons(const G4bool stackingFlag)
|
||||
{
|
||||
fStackingFlag = stackingFlag;
|
||||
fStackingFlag = stackingFlag;
|
||||
}
|
||||
|
||||
inline
|
||||
G4bool G4Scintillation::GetStackPhotons() const
|
||||
{
|
||||
return fStackingFlag;
|
||||
return fStackingFlag;
|
||||
}
|
||||
|
||||
inline
|
||||
G4int G4Scintillation::GetNumPhotons() const
|
||||
{
|
||||
return fNumPhotons;
|
||||
return fNumPhotons;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
G4double G4Scintillation::single_exp(G4double t, G4double tau2)
|
||||
{
|
||||
return std::exp(-1.0*t/tau2)/tau2;
|
||||
return std::exp(-1.0*t/tau2)/tau2;
|
||||
}
|
||||
|
||||
inline
|
||||
G4double G4Scintillation::bi_exp(G4double t, G4double tau1, G4double tau2)
|
||||
{
|
||||
return std::exp(-1.0*t/tau2)*(1-std::exp(-1.0*t/tau1))/tau2/tau2*(tau1+tau2);
|
||||
return std::exp(-1.0*t/tau2)*(1-std::exp(-1.0*t/tau1))/tau2/tau2*(tau1+tau2);
|
||||
}
|
||||
|
||||
#endif /* G4Scintillation_h */
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
#include "G4VUserTrackInformation.hh"
|
||||
|
||||
// Represents the scintillation type used to create the track (opticalphoton).
|
||||
enum G4ScintillationType {Fast, Slow};
|
||||
enum G4ScintillationType {Fast, Medium, Slow};
|
||||
|
||||
class G4ScintillationTrackInformation : public G4VUserTrackInformation
|
||||
{
|
||||
|
||||
@@ -72,6 +72,7 @@
|
||||
|
||||
#include "G4Cerenkov.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
G4Cerenkov::G4Cerenkov(const G4String& processName, G4ProcessType type)
|
||||
: G4VProcess(processName, type),
|
||||
fTrackSecondariesFirst(false),
|
||||
@@ -85,52 +86,55 @@ G4Cerenkov::G4Cerenkov(const G4String& processName, G4ProcessType type)
|
||||
thePhysicsTable = nullptr;
|
||||
|
||||
if (verboseLevel>0) {
|
||||
G4cout << GetProcessName() << " is created " << G4endl;
|
||||
G4cout << GetProcessName() << " is created." << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
G4Cerenkov::~G4Cerenkov()
|
||||
{
|
||||
if (thePhysicsTable != nullptr) {
|
||||
thePhysicsTable->clearAndDestroy();
|
||||
delete thePhysicsTable;
|
||||
thePhysicsTable->clearAndDestroy();
|
||||
delete thePhysicsTable;
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
G4bool G4Cerenkov::IsApplicable(const G4ParticleDefinition& aParticleType)
|
||||
{
|
||||
return (aParticleType.GetPDGCharge() != 0.0 &&
|
||||
aParticleType.GetPDGMass() != 0.0 &&
|
||||
aParticleType.GetParticleName() != "chargedgeantino" &&
|
||||
!aParticleType.IsShortLived() ) ? true : false;
|
||||
aParticleType.GetPDGMass() != 0.0 &&
|
||||
aParticleType.GetParticleName() != "chargedgeantino" &&
|
||||
!aParticleType.IsShortLived() ) ? true : false;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void G4Cerenkov::SetTrackSecondariesFirst(const G4bool state)
|
||||
{
|
||||
fTrackSecondariesFirst = state;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void G4Cerenkov::SetMaxBetaChangePerStep(const G4double value)
|
||||
{
|
||||
fMaxBetaChange = value*CLHEP::perCent;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void G4Cerenkov::SetMaxNumPhotonsPerStep(const G4int NumPhotons)
|
||||
{
|
||||
fMaxPhotons = NumPhotons;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void G4Cerenkov::BuildPhysicsTable(const G4ParticleDefinition&)
|
||||
{
|
||||
if (!thePhysicsTable) BuildThePhysicsTable();
|
||||
}
|
||||
|
||||
// PostStepDoIt
|
||||
// -------------
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
G4VParticleChange*
|
||||
G4Cerenkov::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
|
||||
|
||||
// This routine is called for each tracking Step of a charged particle
|
||||
// in a radiator. A Poisson-distributed number of photons is generated
|
||||
// according to the Cerenkov formula, distributed evenly along the track
|
||||
@@ -153,7 +157,7 @@ G4Cerenkov::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
|
||||
|
||||
G4ThreeVector x0 = pPreStepPoint->GetPosition();
|
||||
G4ThreeVector p0 = aStep.GetDeltaPosition().unit();
|
||||
G4double t0 = pPreStepPoint->GetGlobalTime();
|
||||
G4double t0 = pPreStepPoint->GetGlobalTime();
|
||||
|
||||
G4MaterialPropertiesTable* aMaterialPropertiesTable =
|
||||
aMaterial->GetMaterialPropertiesTable();
|
||||
@@ -163,10 +167,7 @@ G4Cerenkov::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
|
||||
aMaterialPropertiesTable->GetProperty(kRINDEX);
|
||||
if (!Rindex) return pParticleChange;
|
||||
|
||||
// particle charge
|
||||
G4double charge = aParticle->GetDefinition()->GetPDGCharge();
|
||||
|
||||
// particle beta
|
||||
G4double beta = (pPreStepPoint->GetBeta() + pPostStepPoint->GetBeta())*0.5;
|
||||
|
||||
//fNumPhotons = 0; // in PostStepGetPhysicalInteractionLength()
|
||||
@@ -175,48 +176,35 @@ G4Cerenkov::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
|
||||
GetAverageNumberOfPhotons(charge,beta,aMaterial,Rindex);
|
||||
|
||||
if (MeanNumberOfPhotons <= 0.0) {
|
||||
|
||||
// return unchanged particle and no secondaries
|
||||
|
||||
aParticleChange.SetNumberOfSecondaries(0);
|
||||
|
||||
return pParticleChange;
|
||||
|
||||
// return unchanged particle and no secondaries
|
||||
aParticleChange.SetNumberOfSecondaries(0);
|
||||
return pParticleChange;
|
||||
}
|
||||
|
||||
G4double step_length = aStep.GetStepLength();
|
||||
|
||||
MeanNumberOfPhotons = MeanNumberOfPhotons * step_length;
|
||||
fNumPhotons = (G4int)G4Poisson(MeanNumberOfPhotons);
|
||||
|
||||
fNumPhotons = (G4int) G4Poisson(MeanNumberOfPhotons);
|
||||
|
||||
if ( fNumPhotons <= 0 || !fStackingFlag ) {
|
||||
|
||||
// return unchanged particle and no secondaries
|
||||
|
||||
aParticleChange.SetNumberOfSecondaries(0);
|
||||
|
||||
return pParticleChange;
|
||||
|
||||
if (fNumPhotons <= 0 || !fStackingFlag) {
|
||||
// return unchanged particle and no secondaries
|
||||
aParticleChange.SetNumberOfSecondaries(0);
|
||||
return pParticleChange;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
aParticleChange.SetNumberOfSecondaries(fNumPhotons);
|
||||
|
||||
if (fTrackSecondariesFirst) {
|
||||
if (aTrack.GetTrackStatus() == fAlive )
|
||||
if (aTrack.GetTrackStatus() == fAlive)
|
||||
aParticleChange.ProposeTrackStatus(fSuspend);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
G4double Pmin = Rindex->GetMinLowEdgeEnergy();
|
||||
G4double Pmax = Rindex->GetMaxLowEdgeEnergy();
|
||||
G4double dp = Pmax - Pmin;
|
||||
|
||||
G4double nMax = Rindex->GetMaxValue();
|
||||
|
||||
G4double BetaInverse = 1./beta;
|
||||
|
||||
G4double maxCos = BetaInverse / nMax;
|
||||
@@ -230,127 +218,89 @@ G4Cerenkov::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
|
||||
G4double MeanNumberOfPhotons2 =
|
||||
GetAverageNumberOfPhotons(charge,beta2,aMaterial,Rindex);
|
||||
|
||||
for (G4int i = 0; i < fNumPhotons; i++) {
|
||||
for (G4int i=0; i<fNumPhotons; ++i) {
|
||||
// Determine photon energy
|
||||
G4double rand;
|
||||
G4double sampledEnergy, sampledRI;
|
||||
G4double cosTheta, sin2Theta;
|
||||
|
||||
// Determine photon energy
|
||||
// sample an energy
|
||||
do {
|
||||
rand = G4UniformRand();
|
||||
sampledEnergy = Pmin + rand * dp;
|
||||
sampledRI = Rindex->Value(sampledEnergy);
|
||||
cosTheta = BetaInverse / sampledRI;
|
||||
|
||||
G4double rand;
|
||||
G4double sampledEnergy, sampledRI;
|
||||
G4double cosTheta, sin2Theta;
|
||||
sin2Theta = (1.0 - cosTheta)*(1.0 + cosTheta);
|
||||
rand = G4UniformRand();
|
||||
|
||||
// sample an energy
|
||||
// Loop checking, 07-Aug-2015, Vladimir Ivanchenko
|
||||
} while (rand*maxSin2 > sin2Theta);
|
||||
|
||||
do {
|
||||
rand = G4UniformRand();
|
||||
sampledEnergy = Pmin + rand * dp;
|
||||
sampledRI = Rindex->Value(sampledEnergy);
|
||||
cosTheta = BetaInverse / sampledRI;
|
||||
// Create photon momentum direction vector. The momentum direction is still
|
||||
// with respect to the coordinate system where the primary particle
|
||||
// direction is aligned with the z axis
|
||||
rand = G4UniformRand();
|
||||
G4double phi = twopi*rand;
|
||||
G4double sinPhi = std::sin(phi);
|
||||
G4double cosPhi = std::cos(phi);
|
||||
G4double sinTheta = std::sqrt(sin2Theta);
|
||||
G4ParticleMomentum photonMomentum(sinTheta*cosPhi, sinTheta*sinPhi, cosTheta);
|
||||
|
||||
sin2Theta = (1.0 - cosTheta)*(1.0 + cosTheta);
|
||||
rand = G4UniformRand();
|
||||
// Rotate momentum direction back to global reference system
|
||||
photonMomentum.rotateUz(p0);
|
||||
|
||||
// Loop checking, 07-Aug-2015, Vladimir Ivanchenko
|
||||
} while (rand*maxSin2 > sin2Theta);
|
||||
// Determine polarization of new photon
|
||||
G4ThreeVector photonPolarization(cosTheta*cosPhi, cosTheta*sinPhi, -sinTheta);
|
||||
|
||||
// Generate random position of photon on cone surface
|
||||
// defined by Theta
|
||||
// Rotate back to original coord system
|
||||
photonPolarization.rotateUz(p0);
|
||||
|
||||
// Generate a new photon:
|
||||
G4DynamicParticle* aCerenkovPhoton =
|
||||
new G4DynamicParticle(G4OpticalPhoton::OpticalPhoton(), photonMomentum);
|
||||
|
||||
aCerenkovPhoton->SetPolarization(photonPolarization);
|
||||
aCerenkovPhoton->SetKineticEnergy(sampledEnergy);
|
||||
|
||||
G4double NumberOfPhotons, N;
|
||||
|
||||
do {
|
||||
rand = G4UniformRand();
|
||||
NumberOfPhotons = MeanNumberOfPhotons1 - rand *
|
||||
(MeanNumberOfPhotons1-MeanNumberOfPhotons2);
|
||||
N = G4UniformRand() *
|
||||
std::max(MeanNumberOfPhotons1,MeanNumberOfPhotons2);
|
||||
// Loop checking, 07-Aug-2015, Vladimir Ivanchenko
|
||||
} while (N > NumberOfPhotons);
|
||||
|
||||
G4double phi = twopi*rand;
|
||||
G4double sinPhi = std::sin(phi);
|
||||
G4double cosPhi = std::cos(phi);
|
||||
G4double delta = rand * aStep.GetStepLength();
|
||||
G4double deltaTime = delta / (pPreStepPoint->GetVelocity() +
|
||||
rand*(pPostStepPoint->GetVelocity() -
|
||||
pPreStepPoint->GetVelocity())*0.5);
|
||||
|
||||
// calculate x,y, and z components of photon energy
|
||||
// (in coord system with primary particle direction
|
||||
// aligned with the z axis)
|
||||
G4double aSecondaryTime = t0 + deltaTime;
|
||||
G4ThreeVector aSecondaryPosition = x0 + rand * aStep.GetDeltaPosition();
|
||||
|
||||
G4double sinTheta = std::sqrt(sin2Theta);
|
||||
G4double px = sinTheta*cosPhi;
|
||||
G4double py = sinTheta*sinPhi;
|
||||
G4double pz = cosTheta;
|
||||
// Generate new G4Track object:
|
||||
G4Track* aSecondaryTrack =
|
||||
new G4Track(aCerenkovPhoton,aSecondaryTime,aSecondaryPosition);
|
||||
|
||||
// Create photon momentum direction vector
|
||||
// The momentum direction is still with respect
|
||||
// to the coordinate system where the primary
|
||||
// particle direction is aligned with the z axis
|
||||
|
||||
G4ParticleMomentum photonMomentum(px, py, pz);
|
||||
|
||||
// Rotate momentum direction back to global reference
|
||||
// system
|
||||
|
||||
photonMomentum.rotateUz(p0);
|
||||
|
||||
// Determine polarization of new photon
|
||||
|
||||
G4double sx = cosTheta*cosPhi;
|
||||
G4double sy = cosTheta*sinPhi;
|
||||
G4double sz = -sinTheta;
|
||||
|
||||
G4ThreeVector photonPolarization(sx, sy, sz);
|
||||
|
||||
// Rotate back to original coord system
|
||||
|
||||
photonPolarization.rotateUz(p0);
|
||||
|
||||
// Generate a new photon:
|
||||
|
||||
G4DynamicParticle* aCerenkovPhoton =
|
||||
new G4DynamicParticle(G4OpticalPhoton::OpticalPhoton(),photonMomentum);
|
||||
|
||||
aCerenkovPhoton->SetPolarization(photonPolarization.x(),
|
||||
photonPolarization.y(),
|
||||
photonPolarization.z());
|
||||
|
||||
aCerenkovPhoton->SetKineticEnergy(sampledEnergy);
|
||||
|
||||
// Generate new G4Track object:
|
||||
|
||||
G4double NumberOfPhotons, N;
|
||||
|
||||
do {
|
||||
rand = G4UniformRand();
|
||||
NumberOfPhotons = MeanNumberOfPhotons1 - rand *
|
||||
(MeanNumberOfPhotons1-MeanNumberOfPhotons2);
|
||||
N = G4UniformRand() *
|
||||
std::max(MeanNumberOfPhotons1,MeanNumberOfPhotons2);
|
||||
// Loop checking, 07-Aug-2015, Vladimir Ivanchenko
|
||||
} while (N > NumberOfPhotons);
|
||||
|
||||
G4double delta = rand * aStep.GetStepLength();
|
||||
|
||||
G4double deltaTime = delta / (pPreStepPoint->GetVelocity()+
|
||||
rand*(pPostStepPoint->GetVelocity()-
|
||||
pPreStepPoint->GetVelocity())*0.5);
|
||||
|
||||
G4double aSecondaryTime = t0 + deltaTime;
|
||||
|
||||
G4ThreeVector aSecondaryPosition = x0 + rand * aStep.GetDeltaPosition();
|
||||
|
||||
G4Track* aSecondaryTrack =
|
||||
new G4Track(aCerenkovPhoton,aSecondaryTime,aSecondaryPosition);
|
||||
|
||||
aSecondaryTrack->SetTouchableHandle(
|
||||
aStep.GetPreStepPoint()->GetTouchableHandle());
|
||||
|
||||
aSecondaryTrack->SetParentID(aTrack.GetTrackID());
|
||||
|
||||
aParticleChange.AddSecondary(aSecondaryTrack);
|
||||
aSecondaryTrack->SetTouchableHandle(
|
||||
aStep.GetPreStepPoint()->GetTouchableHandle());
|
||||
aSecondaryTrack->SetParentID(aTrack.GetTrackID());
|
||||
aParticleChange.AddSecondary(aSecondaryTrack);
|
||||
}
|
||||
|
||||
if (verboseLevel>0) {
|
||||
G4cout <<"\n Exiting from G4Cerenkov::DoIt -- NumberOfSecondaries = "
|
||||
<< aParticleChange.GetNumberOfSecondaries() << G4endl;
|
||||
if (verboseLevel>1) {
|
||||
G4cout << "\n Exiting from G4Cerenkov::DoIt -- NumberOfSecondaries = "
|
||||
<< aParticleChange.GetNumberOfSecondaries() << G4endl;
|
||||
}
|
||||
|
||||
return pParticleChange;
|
||||
}
|
||||
|
||||
// BuildThePhysicsTable for the Cerenkov process
|
||||
// ---------------------------------------------
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void G4Cerenkov::BuildThePhysicsTable()
|
||||
{
|
||||
if (thePhysicsTable) return;
|
||||
@@ -359,92 +309,68 @@ void G4Cerenkov::BuildThePhysicsTable()
|
||||
G4Material::GetMaterialTable();
|
||||
G4int numOfMaterials = G4Material::GetNumberOfMaterials();
|
||||
|
||||
// create new physics table
|
||||
|
||||
thePhysicsTable = new G4PhysicsTable(numOfMaterials);
|
||||
|
||||
// loop for materials
|
||||
// loop over materials
|
||||
for (G4int i=0; i<numOfMaterials; ++i) {
|
||||
G4PhysicsOrderedFreeVector* aPhysicsOrderedFreeVector = 0;
|
||||
|
||||
for (G4int i=0 ; i < numOfMaterials; i++) {
|
||||
// Retrieve vector of refraction indices for the material
|
||||
// from the material's optical properties table
|
||||
G4Material* aMaterial = (*theMaterialTable)[i];
|
||||
G4MaterialPropertiesTable* aMaterialPropertiesTable =
|
||||
aMaterial->GetMaterialPropertiesTable();
|
||||
|
||||
G4PhysicsOrderedFreeVector* aPhysicsOrderedFreeVector = 0;
|
||||
if (aMaterialPropertiesTable) {
|
||||
aPhysicsOrderedFreeVector = new G4PhysicsOrderedFreeVector();
|
||||
G4MaterialPropertyVector* theRefractionIndexVector =
|
||||
aMaterialPropertiesTable->GetProperty(kRINDEX);
|
||||
|
||||
// Retrieve vector of refraction indices for the material
|
||||
// from the material's optical properties table
|
||||
if (theRefractionIndexVector) {
|
||||
// Retrieve the first refraction index in vector
|
||||
// of (photon energy, refraction index) pairs
|
||||
G4double currentRI = (*theRefractionIndexVector)[0];
|
||||
|
||||
G4Material* aMaterial = (*theMaterialTable)[i];
|
||||
if (currentRI > 1.0) {
|
||||
// Create first (photon energy, Cerenkov Integral) pair
|
||||
G4double currentPM = theRefractionIndexVector->Energy(0);
|
||||
G4double currentCAI = 0.0;
|
||||
|
||||
G4MaterialPropertiesTable* aMaterialPropertiesTable =
|
||||
aMaterial->GetMaterialPropertiesTable();
|
||||
aPhysicsOrderedFreeVector->InsertValues(currentPM , currentCAI);
|
||||
|
||||
if (aMaterialPropertiesTable) {
|
||||
aPhysicsOrderedFreeVector = new G4PhysicsOrderedFreeVector();
|
||||
G4MaterialPropertyVector* theRefractionIndexVector =
|
||||
aMaterialPropertiesTable->GetProperty(kRINDEX);
|
||||
// Set previous values to current ones prior to loop
|
||||
G4double prevPM = currentPM;
|
||||
G4double prevCAI = currentCAI;
|
||||
G4double prevRI = currentRI;
|
||||
|
||||
if (theRefractionIndexVector) {
|
||||
// loop over all (photon energy, refraction index)
|
||||
// pairs stored for this material
|
||||
for (size_t ii = 1;
|
||||
ii < theRefractionIndexVector->GetVectorLength();
|
||||
++ii) {
|
||||
currentRI = (*theRefractionIndexVector)[ii];
|
||||
currentPM = theRefractionIndexVector->Energy(ii);
|
||||
currentCAI = prevCAI + (currentPM - prevPM) *
|
||||
0.5*(1.0/(prevRI*prevRI) + 1.0/(currentRI*currentRI));
|
||||
|
||||
// Retrieve the first refraction index in vector
|
||||
// of (photon energy, refraction index) pairs
|
||||
aPhysicsOrderedFreeVector->InsertValues(currentPM, currentCAI);
|
||||
|
||||
G4double currentRI = (*theRefractionIndexVector)[0];
|
||||
|
||||
if (currentRI > 1.0) {
|
||||
|
||||
// Create first (photon energy, Cerenkov Integral)
|
||||
// pair
|
||||
|
||||
G4double currentPM = theRefractionIndexVector->Energy(0);
|
||||
G4double currentCAI = 0.0;
|
||||
|
||||
aPhysicsOrderedFreeVector->InsertValues(currentPM , currentCAI);
|
||||
|
||||
// Set previous values to current ones prior to loop
|
||||
|
||||
G4double prevPM = currentPM;
|
||||
G4double prevCAI = currentCAI;
|
||||
G4double prevRI = currentRI;
|
||||
|
||||
// loop over all (photon energy, refraction index)
|
||||
// pairs stored for this material
|
||||
|
||||
for (size_t ii = 1;
|
||||
ii < theRefractionIndexVector->GetVectorLength();
|
||||
++ii) {
|
||||
currentRI = (*theRefractionIndexVector)[ii];
|
||||
currentPM = theRefractionIndexVector->Energy(ii);
|
||||
|
||||
currentCAI = 0.5*(1.0/(prevRI*prevRI) +
|
||||
1.0/(currentRI*currentRI));
|
||||
|
||||
currentCAI = prevCAI + (currentPM - prevPM) * currentCAI;
|
||||
|
||||
aPhysicsOrderedFreeVector->
|
||||
InsertValues(currentPM, currentCAI);
|
||||
|
||||
prevPM = currentPM;
|
||||
prevCAI = currentCAI;
|
||||
prevRI = currentRI;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
prevPM = currentPM;
|
||||
prevCAI = currentCAI;
|
||||
prevRI = currentRI;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The Cerenkov integral for a given material
|
||||
// will be inserted in thePhysicsTable
|
||||
// according to the position of the material in
|
||||
// the material table.
|
||||
|
||||
thePhysicsTable->insertAt(i,aPhysicsOrderedFreeVector);
|
||||
|
||||
// The Cerenkov integral for a given material will be inserted in
|
||||
// thePhysicsTable according to the position of the material in
|
||||
// the material table.
|
||||
thePhysicsTable->insertAt(i,aPhysicsOrderedFreeVector);
|
||||
}
|
||||
}
|
||||
|
||||
// GetMeanFreePath
|
||||
// ---------------
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
G4double G4Cerenkov::GetMeanFreePath(const G4Track&,
|
||||
G4double,
|
||||
G4ForceCondition*)
|
||||
@@ -452,6 +378,7 @@ G4double G4Cerenkov::GetMeanFreePath(const G4Track&,
|
||||
return 1.;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
G4double G4Cerenkov::PostStepGetPhysicalInteractionLength(
|
||||
const G4Track& aTrack,
|
||||
G4double,
|
||||
@@ -465,9 +392,7 @@ G4double G4Cerenkov::PostStepGetPhysicalInteractionLength(
|
||||
G4int materialIndex = aMaterial->GetIndex();
|
||||
|
||||
// If Physics Vector is not defined no Cerenkov photons
|
||||
// this check avoid string comparison below
|
||||
|
||||
if(!(*thePhysicsTable)[materialIndex]) { return StepLimit; }
|
||||
if (!(*thePhysicsTable)[materialIndex]) { return StepLimit; }
|
||||
|
||||
const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
|
||||
const G4MaterialCutsCouple* couple = aTrack.GetMaterialCutsCouple();
|
||||
@@ -476,120 +401,95 @@ G4double G4Cerenkov::PostStepGetPhysicalInteractionLength(
|
||||
const G4ParticleDefinition* particleType = aParticle->GetDefinition();
|
||||
G4double mass = particleType->GetPDGMass();
|
||||
|
||||
// particle beta
|
||||
G4double beta = aParticle->GetTotalMomentum() /
|
||||
aParticle->GetTotalEnergy();
|
||||
// particle gamma
|
||||
G4double beta = aParticle->GetTotalMomentum() / aParticle->GetTotalEnergy();
|
||||
G4double gamma = aParticle->GetTotalEnergy()/mass;
|
||||
|
||||
G4MaterialPropertiesTable* aMaterialPropertiesTable =
|
||||
aMaterial->GetMaterialPropertiesTable();
|
||||
|
||||
G4MaterialPropertyVector* Rindex = NULL;
|
||||
G4MaterialPropertyVector* Rindex = nullptr;
|
||||
|
||||
if (aMaterialPropertiesTable)
|
||||
Rindex = aMaterialPropertiesTable->GetProperty(kRINDEX);
|
||||
|
||||
G4double nMax;
|
||||
if (Rindex) {
|
||||
nMax = Rindex->GetMaxValue();
|
||||
nMax = Rindex->GetMaxValue();
|
||||
} else {
|
||||
return StepLimit;
|
||||
return StepLimit;
|
||||
}
|
||||
|
||||
G4double BetaMin = 1./nMax;
|
||||
if ( BetaMin >= 1. ) return StepLimit;
|
||||
if (BetaMin >= 1.) return StepLimit;
|
||||
|
||||
G4double GammaMin = 1./std::sqrt(1.-BetaMin*BetaMin);
|
||||
|
||||
if (gamma < GammaMin ) return StepLimit;
|
||||
if (gamma < GammaMin) return StepLimit;
|
||||
|
||||
G4double kinEmin = mass*(GammaMin-1.);
|
||||
|
||||
G4double RangeMin = G4LossTableManager::Instance()->GetRange(particleType,
|
||||
kinEmin,
|
||||
couple);
|
||||
G4double Range = G4LossTableManager::Instance()->GetRange(particleType,
|
||||
kineticEnergy,
|
||||
couple);
|
||||
|
||||
G4double RangeMin =
|
||||
G4LossTableManager::Instance()->GetRange(particleType, kinEmin, couple);
|
||||
G4double Range =
|
||||
G4LossTableManager::Instance()->GetRange(particleType, kineticEnergy, couple);
|
||||
G4double Step = Range - RangeMin;
|
||||
|
||||
// If the step is smaller than 1e-16 mm, it may happen that the particle
|
||||
// does not move. See bug 1992.
|
||||
// 2019-03-11: change to 1e-15
|
||||
if (Step < 1.e-15*mm) return StepLimit;
|
||||
|
||||
|
||||
if (Step < StepLimit) StepLimit = Step;
|
||||
// If user has defined an average maximum number of photons to
|
||||
// be generated in a Step, then calculate the Step length for
|
||||
// that number of photons.
|
||||
|
||||
|
||||
// If user has defined an average maximum number of photons to be generated in
|
||||
// a Step, then calculate the Step length for that number of photons.
|
||||
if (fMaxPhotons > 0) {
|
||||
|
||||
// particle charge
|
||||
const G4double charge = aParticle->GetDefinition()->GetPDGCharge();
|
||||
|
||||
G4double MeanNumberOfPhotons =
|
||||
GetAverageNumberOfPhotons(charge,beta,aMaterial,Rindex);
|
||||
|
||||
Step = 0.;
|
||||
if (MeanNumberOfPhotons > 0.0) Step = fMaxPhotons / MeanNumberOfPhotons;
|
||||
|
||||
if (Step > 0. && Step < StepLimit) StepLimit = Step;
|
||||
const G4double charge = aParticle->GetDefinition()->GetPDGCharge();
|
||||
G4double MeanNumberOfPhotons =
|
||||
GetAverageNumberOfPhotons(charge,beta,aMaterial,Rindex);
|
||||
Step = 0.;
|
||||
if (MeanNumberOfPhotons > 0.0) Step = fMaxPhotons / MeanNumberOfPhotons;
|
||||
if (Step > 0. && Step < StepLimit) StepLimit = Step;
|
||||
}
|
||||
|
||||
// If user has defined an maximum allowed change in beta per step
|
||||
if (fMaxBetaChange > 0.) {
|
||||
G4double dedx =
|
||||
G4LossTableManager::Instance()->GetDEDX(particleType, kineticEnergy, couple);
|
||||
G4double deltaGamma =
|
||||
gamma - 1./std::sqrt(1.-beta*beta* (1.-fMaxBetaChange)* (1.-fMaxBetaChange));
|
||||
|
||||
G4double dedx = G4LossTableManager::Instance()->GetDEDX(particleType,
|
||||
kineticEnergy,
|
||||
couple);
|
||||
|
||||
G4double deltaGamma = gamma - 1./std::sqrt(1.-beta*beta*
|
||||
(1.-fMaxBetaChange)*
|
||||
(1.-fMaxBetaChange));
|
||||
|
||||
Step = mass * deltaGamma / dedx;
|
||||
|
||||
if (Step > 0. && Step < StepLimit) StepLimit = Step;
|
||||
|
||||
Step = mass * deltaGamma / dedx;
|
||||
if (Step > 0. && Step < StepLimit) StepLimit = Step;
|
||||
}
|
||||
|
||||
*condition = StronglyForced;
|
||||
return StepLimit;
|
||||
}
|
||||
|
||||
// GetAverageNumberOfPhotons
|
||||
// -------------------------
|
||||
// This routine computes the number of Cerenkov photons produced per
|
||||
// GEANT-unit (millimeter) in the current medium.
|
||||
// ^^^^^^^^^^
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
G4double
|
||||
G4Cerenkov::GetAverageNumberOfPhotons(const G4double charge,
|
||||
const G4double beta,
|
||||
const G4Material* aMaterial,
|
||||
G4MaterialPropertyVector* Rindex) const
|
||||
G4Cerenkov::GetAverageNumberOfPhotons(const G4double charge,
|
||||
const G4double beta,
|
||||
const G4Material* aMaterial,
|
||||
G4MaterialPropertyVector* Rindex) const
|
||||
// This routine computes the number of Cerenkov photons produced per
|
||||
// GEANT4-unit (millimeter) in the current medium.
|
||||
// ^^^^^^^^^^
|
||||
{
|
||||
const G4double Rfact = 369.81/(eV * cm);
|
||||
|
||||
if(beta <= 0.0)return 0.0;
|
||||
|
||||
if (beta <= 0.0) return 0.0;
|
||||
G4double BetaInverse = 1./beta;
|
||||
|
||||
// Vectors used in computation of Cerenkov Angle Integral:
|
||||
// - Refraction Indices for the current material
|
||||
// - new G4PhysicsOrderedFreeVector allocated to hold CAI's
|
||||
|
||||
G4int materialIndex = aMaterial->GetIndex();
|
||||
|
||||
// Retrieve the Cerenkov Angle Integrals for this material
|
||||
|
||||
G4PhysicsOrderedFreeVector* CerenkovAngleIntegrals =
|
||||
(G4PhysicsOrderedFreeVector*)((*thePhysicsTable)(materialIndex));
|
||||
|
||||
if(!(CerenkovAngleIntegrals->IsFilledVectorExist()))return 0.0;
|
||||
if (!(CerenkovAngleIntegrals->IsFilledVectorExist())) return 0.0;
|
||||
|
||||
// Min and Max photon energies
|
||||
G4double Pmin = Rindex->GetMinLowEdgeEnergy();
|
||||
@@ -603,41 +503,31 @@ G4double
|
||||
G4double CAImax = CerenkovAngleIntegrals->GetMaxValue();
|
||||
|
||||
G4double dp, ge;
|
||||
|
||||
// If n(Pmax) < 1/Beta -- no photons generated
|
||||
|
||||
if (nMax < BetaInverse) {
|
||||
dp = 0.0;
|
||||
ge = 0.0;
|
||||
dp = 0.0;
|
||||
ge = 0.0;
|
||||
}
|
||||
|
||||
// otherwise if n(Pmin) >= 1/Beta -- photons generated
|
||||
|
||||
else if (nMin > BetaInverse) {
|
||||
dp = Pmax - Pmin;
|
||||
ge = CAImax;
|
||||
dp = Pmax - Pmin;
|
||||
ge = CAImax;
|
||||
}
|
||||
|
||||
// If n(Pmin) < 1/Beta, and n(Pmax) >= 1/Beta, then
|
||||
// we need to find a P such that the value of n(P) == 1/Beta.
|
||||
// Interpolation is performed by the GetEnergy() and
|
||||
// Value() methods of the G4MaterialPropertiesTable and
|
||||
// the GetValue() method of G4PhysicsVector.
|
||||
|
||||
// If n(Pmin) < 1/Beta, and n(Pmax) >= 1/Beta, then we need to find a P such
|
||||
// that the value of n(P) == 1/Beta. Interpolation is performed by the
|
||||
// GetEnergy() and Value() methods of the G4MaterialPropertiesTable and
|
||||
// the Value() method of G4PhysicsVector.
|
||||
else {
|
||||
Pmin = Rindex->GetEnergy(BetaInverse);
|
||||
dp = Pmax - Pmin;
|
||||
Pmin = Rindex->GetEnergy(BetaInverse);
|
||||
dp = Pmax - Pmin;
|
||||
|
||||
// need boolean for current implementation of G4PhysicsVector
|
||||
// ==> being phased out
|
||||
G4bool isOutRange;
|
||||
G4double CAImin = CerenkovAngleIntegrals->GetValue(Pmin, isOutRange);
|
||||
ge = CAImax - CAImin;
|
||||
G4double CAImin = CerenkovAngleIntegrals->Value(Pmin);
|
||||
ge = CAImax - CAImin;
|
||||
|
||||
if (verboseLevel>0) {
|
||||
G4cout << "CAImin = " << CAImin << G4endl;
|
||||
G4cout << "ge = " << ge << G4endl;
|
||||
}
|
||||
if (verboseLevel>1) {
|
||||
G4cout << "CAImin = " << CAImin << G4endl
|
||||
<< "ge = " << ge << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate number of photons
|
||||
@@ -647,12 +537,11 @@ G4double
|
||||
return NumPhotons;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void G4Cerenkov::DumpPhysicsTable() const
|
||||
{
|
||||
G4int PhysicsTableSize = thePhysicsTable->entries();
|
||||
G4PhysicsOrderedFreeVector *v;
|
||||
|
||||
for (G4int i = 0 ; i < PhysicsTableSize ; i++ ) {
|
||||
for (size_t i=0 ; i<thePhysicsTable->entries(); ++i) {
|
||||
v = (G4PhysicsOrderedFreeVector*)(*thePhysicsTable)[i];
|
||||
v->DumpValues();
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -169,7 +169,6 @@ G4VXTRenergyLoss::G4VXTRenergyLoss(G4LogicalVolume *anEnvelope,
|
||||
|
||||
G4VXTRenergyLoss::~G4VXTRenergyLoss()
|
||||
{
|
||||
if(fEnvelope) delete fEnvelope;
|
||||
delete fProtonEnergyVector;
|
||||
delete fXTREnergyVector;
|
||||
if(fEnergyDistrTable) {
|
||||
|
||||
Reference in New Issue
Block a user