Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:59:04

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 ////////////////////////////////////////////////////////////////////////
0027 // Scintillation Light Class Definition
0028 ////////////////////////////////////////////////////////////////////////
0029 //
0030 // File:        G4Scintillation.hh
0031 // Description: Discrete Process - Generation of Scintillation Photons
0032 // Version:     1.0
0033 // Created:     1998-11-07
0034 // Author:      Peter Gumplinger
0035 // Updated:     2010-10-20 Allow the scintillation yield to be a function
0036 //                         of energy deposited by particle type
0037 //                         Thanks to Zach Hartwig (Department of Nuclear
0038 //                         Science and Engineeering - MIT)
0039 //              2005-07-28 add G4ProcessType to constructor
0040 //              2002-11-21 change to user G4Poisson for small MeanNumPotons
0041 //              2002-11-07 allow for fast and slow scintillation
0042 //              2002-11-05 make use of constant material properties
0043 //              2002-05-16 changed to inherit from VRestDiscreteProcess
0044 //              2002-05-09 changed IsApplicable method
0045 //              1999-10-29 add method and class descriptors
0046 //
0047 //
0048 ////////////////////////////////////////////////////////////////////////
0049 
0050 #ifndef G4Scintillation_h
0051 #define G4Scintillation_h 1
0052 
0053 #include "globals.hh"
0054 #include "G4EmSaturation.hh"
0055 #include "G4OpticalPhoton.hh"
0056 #include "G4VRestDiscreteProcess.hh"
0057 
0058 class G4PhysicsTable;
0059 class G4Step;
0060 class G4Track;
0061 
0062 // Class Description:
0063 // RestDiscrete Process - Generation of Scintillation Photons.
0064 // Class inherits publicly from G4VRestDiscreteProcess.
0065 // Class Description - End:
0066 
0067 class G4Scintillation : public G4VRestDiscreteProcess
0068 {
0069  public:
0070   explicit G4Scintillation(const G4String& processName = "Scintillation",
0071                            G4ProcessType type          = fElectromagnetic);
0072   ~G4Scintillation();
0073 
0074   G4Scintillation(const G4Scintillation& right) = delete;
0075   G4Scintillation& operator=(const G4Scintillation& right) = delete;
0076 
0077   // G4Scintillation Process has both PostStepDoIt (for energy
0078   // deposition of particles in flight) and AtRestDoIt (for energy
0079   // given to the medium by particles at rest)
0080 
0081   G4bool IsApplicable(const G4ParticleDefinition& aParticleType) override;
0082   // Returns true -> 'is applicable', for any particle type except
0083   // for an 'opticalphoton' and for short-lived particles
0084 
0085   void ProcessDescription(std::ostream&) const override;
0086   void DumpInfo() const override {ProcessDescription(G4cout);};
0087 
0088   void BuildPhysicsTable(const G4ParticleDefinition& aParticleType) override;
0089   // Build table at the right time
0090 
0091   void PreparePhysicsTable(const G4ParticleDefinition& part) override;
0092   void Initialise();
0093 
0094   G4double GetMeanFreePath(const G4Track& aTrack, G4double,
0095                            G4ForceCondition*) override;
0096   // Returns infinity; i. e. the process does not limit the step,
0097   // but sets the 'StronglyForced' condition for the DoIt to be
0098   // invoked at every step.
0099 
0100   G4double GetMeanLifeTime(const G4Track& aTrack, G4ForceCondition*) override;
0101   // Returns infinity; i. e. the process does not limit the time,
0102   // but sets the 'StronglyForced' condition for the DoIt to be
0103   // invoked at every step.
0104 
0105   G4VParticleChange* PostStepDoIt(const G4Track& aTrack,
0106                                   const G4Step& aStep) override;
0107   G4VParticleChange* AtRestDoIt(const G4Track& aTrack,
0108                                 const G4Step& aStep) override;
0109 
0110   G4double GetScintillationYieldByParticleType(const G4Track& aTrack,
0111                                                const G4Step& aStep,
0112                                                G4double& yield1,
0113                                                G4double& yield2,
0114                                                G4double& yield3,
0115                                                G4double& timeconstant1,
0116                                                G4double& timeconstant2,
0117                                                G4double& timeconstant3);
0118   // allow multiple time constants with scint by particle type
0119   // Returns the number of scintillation photons calculated when
0120   // scintillation depends on the particle type and energy
0121   // deposited (includes nonlinear dependendency) and updates the
0122   // yields for each channel
0123 
0124   void SetTrackSecondariesFirst(const G4bool state);
0125   // If set, the primary particle tracking is interrupted and any
0126   // produced scintillation photons are tracked next. When all
0127   // have been tracked, the tracking of the primary resumes.
0128 
0129   G4bool GetTrackSecondariesFirst() const;
0130   // Returns the boolean flag for tracking secondaries first.
0131 
0132   void SetFiniteRiseTime(const G4bool state);
0133   // If set, the G4Scintillation process expects the user to have
0134   // set the constant material property SCINTILLATIONRISETIME{1,2,3}.
0135 
0136   G4bool GetFiniteRiseTime() const;
0137   // Returns the boolean flag for a finite scintillation rise time.
0138 
0139   G4PhysicsTable* GetIntegralTable1() const;
0140   // Returns the address of scintillation integral table #1.
0141 
0142   G4PhysicsTable* GetIntegralTable2() const;
0143   // Returns the address of scintillation integral table #2.
0144 
0145   G4PhysicsTable* GetIntegralTable3() const;
0146   // Returns the address of scintillation integral table #3.
0147 
0148   void AddSaturation(G4EmSaturation* sat);
0149   // Adds Birks Saturation to the process.
0150 
0151   void RemoveSaturation();
0152   // Removes the Birks Saturation from the process.
0153 
0154   G4EmSaturation* GetSaturation() const;
0155   // Returns the Birks Saturation.
0156 
0157   void SetScintillationByParticleType(const G4bool);
0158   // Called by the user to set the scintillation yield as a function
0159   // of energy deposited by particle type
0160 
0161   G4bool GetScintillationByParticleType() const;
0162   // Return the boolean that determines the method of scintillation
0163   // production
0164 
0165   void SetScintillationTrackInfo(const G4bool trackType);
0166   // Call by the user to set the G4ScintillationTrackInformation
0167   // to scintillation photon track
0168 
0169   G4bool GetScintillationTrackInfo() const;
0170   // Return the boolean for whether or not the
0171   // G4ScintillationTrackInformation is set to the scint. photon track
0172 
0173   void SetStackPhotons(const G4bool);
0174   // Call by the user to set the flag for stacking the scint. photons
0175 
0176   G4bool GetStackPhotons() const;
0177   // Return the boolean for whether or not the scint. photons are stacked
0178 
0179   G4int GetNumPhotons() const;
0180   // Returns the current number of scint. photons (after PostStepDoIt)
0181 
0182   void DumpPhysicsTable() const;
0183   // Prints the fast and slow scintillation integral tables.
0184 
0185   void SetVerboseLevel(G4int);
0186   // sets verbosity
0187 
0188  private:
0189 
0190   G4PhysicsTable* fIntegralTable1;
0191   G4PhysicsTable* fIntegralTable2;
0192   G4PhysicsTable* fIntegralTable3;
0193 
0194   G4EmSaturation* fEmSaturation;
0195   const G4ParticleDefinition* opticalphoton =
0196     G4OpticalPhoton::OpticalPhotonDefinition();
0197 
0198   G4int fNumPhotons;
0199   
0200   G4bool fScintillationByParticleType;
0201   G4bool fScintillationTrackInfo;
0202   G4bool fStackingFlag;
0203   G4bool fTrackSecondariesFirst;
0204   G4bool fFiniteRiseTime;
0205 
0206 #ifdef G4DEBUG_SCINTILLATION
0207   G4double ScintTrackEDep, ScintTrackYield;
0208 #endif
0209 
0210   G4double single_exp(G4double t, G4double tau2);
0211   G4double bi_exp(G4double t, G4double tau1, G4double tau2);
0212 
0213   // emission time distribution when there is a finite rise time
0214   G4double sample_time(G4double tau1, G4double tau2);
0215 
0216   G4int secID = -1;  // creator modelID
0217   G4int fNumEnergyWarnings = 0;
0218 
0219 };
0220 
0221 ////////////////////
0222 // Inline methods
0223 ////////////////////
0224 
0225 inline G4bool G4Scintillation::GetTrackSecondariesFirst() const
0226 {
0227   return fTrackSecondariesFirst;
0228 }
0229 
0230 inline G4bool G4Scintillation::GetFiniteRiseTime() const
0231 {
0232   return fFiniteRiseTime;
0233 }
0234 
0235 inline G4PhysicsTable* G4Scintillation::GetIntegralTable1() const
0236 {
0237   return fIntegralTable1;
0238 }
0239 
0240 inline G4PhysicsTable* G4Scintillation::GetIntegralTable2() const
0241 {
0242   return fIntegralTable2;
0243 }
0244 
0245 inline G4PhysicsTable* G4Scintillation::GetIntegralTable3() const
0246 {
0247   return fIntegralTable3;
0248 }
0249 
0250 inline void G4Scintillation::AddSaturation(G4EmSaturation* sat)
0251 {
0252   fEmSaturation = sat;
0253 }
0254 
0255 inline void G4Scintillation::RemoveSaturation() { fEmSaturation = nullptr; }
0256 
0257 inline G4EmSaturation* G4Scintillation::GetSaturation() const
0258 {
0259   return fEmSaturation;
0260 }
0261 
0262 inline G4bool G4Scintillation::GetScintillationByParticleType() const
0263 {
0264   return fScintillationByParticleType;
0265 }
0266 
0267 inline G4bool G4Scintillation::GetScintillationTrackInfo() const
0268 {
0269   return fScintillationTrackInfo;
0270 }
0271 
0272 inline G4bool G4Scintillation::GetStackPhotons() const { return fStackingFlag; }
0273 
0274 inline G4int G4Scintillation::GetNumPhotons() const { return fNumPhotons; }
0275 
0276 inline G4double G4Scintillation::single_exp(G4double t, G4double tau2)
0277 {
0278   return std::exp(-1.0 * t / tau2) / tau2;
0279 }
0280 
0281 inline G4double G4Scintillation::bi_exp(G4double t, G4double tau1,
0282                                         G4double tau2)
0283 {
0284   return std::exp(-1.0 * t / tau2) * (1 - std::exp(-1.0 * t / tau1)) / tau2 /
0285          tau2 * (tau1 + tau2);
0286 }
0287 
0288 #endif /* G4Scintillation_h */