G4Scintillation.hh

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id$
00028 //
00029 // 
00031 // Scintillation Light Class Definition 
00033 //
00034 // File:        G4Scintillation.hh  
00035 // Description: Discrete Process - Generation of Scintillation Photons
00036 // Version:     1.0
00037 // Created:     1998-11-07
00038 // Author:      Peter Gumplinger
00039 // Updated:     2010-10-20 Allow the scintillation yield to be a function
00040 //                         of energy deposited by particle type
00041 //                         Thanks to Zach Hartwig (Department of Nuclear
00042 //                         Science and Engineeering - MIT)
00043 //              2005-07-28 add G4ProcessType to constructor
00044 //              2002-11-21 change to user G4Poisson for small MeanNumPotons
00045 //              2002-11-07 allow for fast and slow scintillation
00046 //              2002-11-05 make use of constant material properties
00047 //              2002-05-16 changed to inherit from VRestDiscreteProcess
00048 //              2002-05-09 changed IsApplicable method
00049 //              1999-10-29 add method and class descriptors
00050 //
00051 // mail:        gum@triumf.ca
00052 //
00054 
00055 #ifndef G4Scintillation_h
00056 #define G4Scintillation_h 1
00057 
00059 // Includes
00061 
00062 #include "globals.hh"
00063 #include "templates.hh"
00064 #include "Randomize.hh"
00065 #include "G4Poisson.hh"
00066 #include "G4ThreeVector.hh"
00067 #include "G4ParticleMomentum.hh"
00068 #include "G4Step.hh"
00069 #include "G4VRestDiscreteProcess.hh"
00070 #include "G4OpticalPhoton.hh"
00071 #include "G4DynamicParticle.hh"
00072 #include "G4Material.hh" 
00073 #include "G4PhysicsTable.hh"
00074 #include "G4MaterialPropertiesTable.hh"
00075 #include "G4PhysicsOrderedFreeVector.hh"
00076 
00077 #include "G4EmSaturation.hh"
00078 
00079 // Class Description:
00080 // RestDiscrete Process - Generation of Scintillation Photons.
00081 // Class inherits publicly from G4VRestDiscreteProcess.
00082 // Class Description - End:
00083 
00085 // Class Definition
00087 
00088 class G4Scintillation : public G4VRestDiscreteProcess
00089 {
00090 
00091 public:
00092 
00094         // Constructors and Destructor
00096 
00097         G4Scintillation(const G4String& processName = "Scintillation",
00098                                  G4ProcessType type = fElectromagnetic);
00099         ~G4Scintillation();     
00100 
00101 private:
00102 
00103         G4Scintillation(const G4Scintillation &right);
00104 
00106         // Operators
00108 
00109         G4Scintillation& operator=(const G4Scintillation &right);
00110 
00111 public:
00112 
00114         // Methods
00116 
00117         // G4Scintillation Process has both PostStepDoIt (for energy 
00118         // deposition of particles in flight) and AtRestDoIt (for energy
00119         // given to the medium by particles at rest)
00120 
00121         G4bool IsApplicable(const G4ParticleDefinition& aParticleType);
00122         // Returns true -> 'is applicable', for any particle type except
00123         // for an 'opticalphoton' and for short-lived particles
00124 
00125         G4double GetMeanFreePath(const G4Track& aTrack,
00126                                        G4double ,
00127                                        G4ForceCondition* );
00128         // Returns infinity; i. e. the process does not limit the step,
00129         // but sets the 'StronglyForced' condition for the DoIt to be 
00130         // invoked at every step.
00131 
00132         G4double GetMeanLifeTime(const G4Track& aTrack,
00133                                  G4ForceCondition* );
00134         // Returns infinity; i. e. the process does not limit the time,
00135         // but sets the 'StronglyForced' condition for the DoIt to be
00136         // invoked at every step.
00137 
00138         G4VParticleChange* PostStepDoIt(const G4Track& aTrack, 
00139                                         const G4Step&  aStep);
00140         G4VParticleChange* AtRestDoIt (const G4Track& aTrack,
00141                                        const G4Step& aStep);
00142 
00143         // These are the methods implementing the scintillation process.
00144 
00145         void SetTrackSecondariesFirst(const G4bool state);
00146         // If set, the primary particle tracking is interrupted and any
00147         // produced scintillation photons are tracked next. When all 
00148         // have been tracked, the tracking of the primary resumes.
00149 
00150         void SetFiniteRiseTime(const G4bool state);
00151         // If set, the G4Scintillation process expects the user to have
00152         // set the constant material property FAST/SLOWSCINTILLATIONRISETIME.
00153 
00154         G4bool GetTrackSecondariesFirst() const;
00155         // Returns the boolean flag for tracking secondaries first.
00156 
00157         G4bool GetFiniteRiseTime() const;
00158         // Returns the boolean flag for a finite scintillation rise time.
00159         
00160         void SetScintillationYieldFactor(const G4double yieldfactor);
00161         // Called to set the scintillation photon yield factor, needed when
00162         // the yield is different for different types of particles. This
00163         // scales the yield obtained from the G4MaterialPropertiesTable.
00164 
00165         G4double GetScintillationYieldFactor() const;
00166         // Returns the photon yield factor.
00167 
00168         void SetScintillationExcitationRatio(const G4double excitationratio);
00169         // Called to set the scintillation exciation ratio, needed when
00170         // the scintillation level excitation is different for different
00171         // types of particles. This overwrites the YieldRatio obtained
00172         // from the G4MaterialPropertiesTable.
00173 
00174         G4double GetScintillationExcitationRatio() const;
00175         // Returns the scintillation level excitation ratio.
00176 
00177         G4PhysicsTable* GetFastIntegralTable() const;
00178         // Returns the address of the fast scintillation integral table.
00179 
00180         G4PhysicsTable* GetSlowIntegralTable() const;
00181         // Returns the address of the slow scintillation integral table.
00182 
00183         void AddSaturation(G4EmSaturation* sat) { emSaturation = sat; }
00184         // Adds Birks Saturation to the process.
00185 
00186         void RemoveSaturation() { emSaturation = NULL; }
00187         // Removes the Birks Saturation from the process.
00188 
00189         G4EmSaturation* GetSaturation() const { return emSaturation; }
00190         // Returns the Birks Saturation.
00191 
00192         void SetScintillationByParticleType(const G4bool );
00193         // Called by the user to set the scintillation yield as a function
00194         // of energy deposited by particle type
00195 
00196         G4bool GetScintillationByParticleType() const
00197         { return scintillationByParticleType; }
00198         // Return the boolean that determines the method of scintillation
00199         // production
00200 
00201         void DumpPhysicsTable() const;
00202         // Prints the fast and slow scintillation integral tables.
00203 
00204 protected:
00205 
00206         void BuildThePhysicsTable();
00207         // It builds either the fast or slow scintillation integral table; 
00208         // or both. 
00209 
00211         // Class Data Members
00213 
00214         G4PhysicsTable* theSlowIntegralTable;
00215         G4PhysicsTable* theFastIntegralTable;
00216 
00217         G4bool fTrackSecondariesFirst;
00218         G4bool fFiniteRiseTime;
00219 
00220         G4double YieldFactor;
00221 
00222         G4double ExcitationRatio;
00223 
00224         G4bool scintillationByParticleType;
00225 
00226 private:
00227 
00228         G4double single_exp(G4double t, G4double tau2);
00229         G4double bi_exp(G4double t, G4double tau1, G4double tau2);
00230 
00231         // emission time distribution when there is a finite rise time
00232         G4double sample_time(G4double tau1, G4double tau2);
00233 
00234         G4EmSaturation* emSaturation;
00235 
00236 };
00237 
00239 // Inline methods
00241 
00242 inline 
00243 G4bool G4Scintillation::IsApplicable(const G4ParticleDefinition& aParticleType)
00244 {
00245        if (aParticleType.GetParticleName() == "opticalphoton") return false;
00246        if (aParticleType.IsShortLived()) return false;
00247 
00248        return true;
00249 }
00250 
00251 inline 
00252 void G4Scintillation::SetTrackSecondariesFirst(const G4bool state) 
00253 {
00254         fTrackSecondariesFirst = state;
00255 }
00256 
00257 inline
00258 void G4Scintillation::SetFiniteRiseTime(const G4bool state)
00259 {
00260         fFiniteRiseTime = state;
00261 }
00262 
00263 inline
00264 G4bool G4Scintillation::GetTrackSecondariesFirst() const
00265 {
00266         return fTrackSecondariesFirst;
00267 }
00268 
00269 inline 
00270 G4bool G4Scintillation::GetFiniteRiseTime() const
00271 {
00272         return fFiniteRiseTime;
00273 }
00274 
00275 inline
00276 void G4Scintillation::SetScintillationYieldFactor(const G4double yieldfactor)
00277 {
00278         YieldFactor = yieldfactor;
00279 }
00280 
00281 inline
00282 G4double G4Scintillation::GetScintillationYieldFactor() const
00283 {
00284         return YieldFactor;
00285 }
00286 
00287 inline
00288 void G4Scintillation::SetScintillationExcitationRatio(const G4double excitationratio)
00289 {
00290         ExcitationRatio = excitationratio;
00291 }
00292 
00293 inline
00294 G4double G4Scintillation::GetScintillationExcitationRatio() const
00295 {
00296         return ExcitationRatio;
00297 }
00298 
00299 inline
00300 G4PhysicsTable* G4Scintillation::GetSlowIntegralTable() const
00301 {
00302         return theSlowIntegralTable;
00303 }
00304 
00305 inline
00306 G4PhysicsTable* G4Scintillation::GetFastIntegralTable() const
00307 {
00308         return theFastIntegralTable;
00309 }
00310 
00311 inline
00312 void G4Scintillation::DumpPhysicsTable() const
00313 {
00314         if (theFastIntegralTable) {
00315            G4int PhysicsTableSize = theFastIntegralTable->entries();
00316            G4PhysicsOrderedFreeVector *v;
00317 
00318            for (G4int i = 0 ; i < PhysicsTableSize ; i++ )
00319            {
00320                 v = (G4PhysicsOrderedFreeVector*)(*theFastIntegralTable)[i];
00321                 v->DumpValues();
00322            }
00323          }
00324 
00325         if (theSlowIntegralTable) {
00326            G4int PhysicsTableSize = theSlowIntegralTable->entries();
00327            G4PhysicsOrderedFreeVector *v;
00328 
00329            for (G4int i = 0 ; i < PhysicsTableSize ; i++ )
00330            {
00331                 v = (G4PhysicsOrderedFreeVector*)(*theSlowIntegralTable)[i];
00332                 v->DumpValues();
00333            }
00334          }
00335 }
00336 
00337 inline
00338 G4double G4Scintillation::single_exp(G4double t, G4double tau2)
00339 {
00340          return std::exp(-1.0*t/tau2)/tau2;
00341 }
00342 
00343 inline
00344 G4double G4Scintillation::bi_exp(G4double t, G4double tau1, G4double tau2)
00345 {
00346          return std::exp(-1.0*t/tau2)*(1-std::exp(-1.0*t/tau1))/tau2/tau2*(tau1+tau2);
00347 }
00348 
00349 #endif /* G4Scintillation_h */

Generated on Mon May 27 17:49:48 2013 for Geant4 by  doxygen 1.4.7