OMSim
Geant4 for IceCube optical module studies
OMSimG4Scintillation.hh
Go to the documentation of this file.
1 
7 //
8 // ********************************************************************
9 // * License and Disclaimer *
10 // * *
11 // * The Geant4 software is copyright of the Copyright Holders of *
12 // * the Geant4 Collaboration. It is provided under the terms and *
13 // * conditions of the Geant4 Software License, included in the file *
14 // * LICENSE and available at http://cern.ch/geant4/license . These *
15 // * include a list of copyright holders. *
16 // * *
17 // * Neither the authors of this software system, nor their employing *
18 // * institutes,nor the agencies providing financial support for this *
19 // * work make any representation or warranty, express or implied, *
20 // * regarding this software system or assume any liability for its *
21 // * use. Please see the license in the file LICENSE and URL above *
22 // * for the full disclaimer and the limitation of liability. *
23 // * *
24 // * This code implementation is the result of the scientific and *
25 // * technical work of the GEANT4 collaboration. *
26 // * By using, copying, modifying or distributing the software (or *
27 // * any work based on the software) you agree to acknowledge its *
28 // * use in resulting scientific publications, and indicate your *
29 // * acceptance of all terms of the Geant4 Software license. *
30 // ********************************************************************
31 //
33 // Scintillation Light Class Definition
35 //
36 // File: G4Scintillation.hh
37 // Description: Discrete Process - Generation of Scintillation Photons
38 // Version: 1.0
39 // Created: 1998-11-07
40 // Author: Peter Gumplinger
41 // Updated: 2010-10-20 Allow the scintillation yield to be a function
42 // of energy deposited by particle type
43 // Thanks to Zach Hartwig (Department of Nuclear
44 // Science and Engineeering - MIT)
45 // 2005-07-28 add G4ProcessType to constructor
46 // 2002-11-21 change to user G4Poisson for small MeanNumPotons
47 // 2002-11-07 allow for fast and slow scintillation
48 // 2002-11-05 make use of constant material properties
49 // 2002-05-16 changed to inherit from VRestDiscreteProcess
50 // 2002-05-09 changed IsApplicable method
51 // 1999-10-29 add method and class descriptors
52 //
53 //
55 
56 #ifndef G4Scintillation_h
57 #define G4Scintillation_h 1
58 
59 #include "globals.hh"
60 #include "G4EmSaturation.hh"
61 #include "G4OpticalPhoton.hh"
62 #include "G4VRestDiscreteProcess.hh"
63 
64 class G4PhysicsTable;
65 class G4Step;
66 class G4Track;
67 
68 // Class Description:
69 // RestDiscrete Process - Generation of Scintillation Photons.
70 // Class inherits publicly from G4VRestDiscreteProcess.
71 // Class Description - End:
72 
73 class OMSimG4Scintillation : public G4VRestDiscreteProcess
74 {
75  public:
76  explicit OMSimG4Scintillation(const G4String& processName = "Scintillation",
77  G4ProcessType type = fElectromagnetic);
79 
80  OMSimG4Scintillation(const OMSimG4Scintillation& right) = delete;
81  OMSimG4Scintillation& operator=(const OMSimG4Scintillation& right) = delete;
82 
83  // G4Scintillation Process has both PostStepDoIt (for energy
84  // deposition of particles in flight) and AtRestDoIt (for energy
85  // given to the medium by particles at rest)
86 
87  G4bool IsApplicable(const G4ParticleDefinition& aParticleType) override;
88  // Returns true -> 'is applicable', for any particle type except
89  // for an 'opticalphoton' and for short-lived particles
90 
91  void ProcessDescription(std::ostream&) const override;
92  void DumpInfo() const override {ProcessDescription(G4cout);};
93 
94  void BuildPhysicsTable(const G4ParticleDefinition& aParticleType) override;
95  // Build table at the right time
96 
97  void PreparePhysicsTable(const G4ParticleDefinition& part) override;
98  void Initialise();
99 
100  G4double GetMeanFreePath(const G4Track& aTrack, G4double,
101  G4ForceCondition*) override;
102  // Returns infinity; i. e. the process does not limit the step,
103  // but sets the 'StronglyForced' condition for the DoIt to be
104  // invoked at every step.
105 
106  G4double GetMeanLifeTime(const G4Track& aTrack, G4ForceCondition*) override;
107  // Returns infinity; i. e. the process does not limit the time,
108  // but sets the 'StronglyForced' condition for the DoIt to be
109  // invoked at every step.
110 
111  G4VParticleChange* PostStepDoIt(const G4Track& aTrack,
112  const G4Step& aStep) override;
113  G4VParticleChange* AtRestDoIt(const G4Track& aTrack,
114  const G4Step& aStep) override;
115 
116  G4double GetScintillationYieldByParticleType(const G4Track& aTrack,
117  const G4Step& aStep,
118  G4double& yield1,
119  G4double& yield2,
120  G4double& yield3);
121  // allow multiple time constants with scint by particle type
122  // Returns the number of scintillation photons calculated when
123  // scintillation depends on the particle type and energy
124  // deposited (includes nonlinear dependendency) and updates the
125  // yields for each channel
126 
127  void SetTrackSecondariesFirst(const G4bool state);
128  // If set, the primary particle tracking is interrupted and any
129  // produced scintillation photons are tracked next. When all
130  // have been tracked, the tracking of the primary resumes.
131 
132  G4bool GetTrackSecondariesFirst() const;
133  // Returns the boolean flag for tracking secondaries first.
134 
135  void SetFiniteRiseTime(const G4bool state);
136  // If set, the G4Scintillation process expects the user to have
137  // set the constant material property SCINTILLATIONRISETIME{1,2,3}.
138 
139  G4bool GetFiniteRiseTime() const;
140  // Returns the boolean flag for a finite scintillation rise time.
141 
142  G4PhysicsTable* GetIntegralTable1() const;
143  // Returns the address of scintillation integral table #1.
144 
145  G4PhysicsTable* GetIntegralTable2() const;
146  // Returns the address of scintillation integral table #2.
147 
148  G4PhysicsTable* GetIntegralTable3() const;
149  // Returns the address of scintillation integral table #3.
150 
151  void AddSaturation(G4EmSaturation* sat);
152  // Adds Birks Saturation to the process.
153 
154  void RemoveSaturation();
155  // Removes the Birks Saturation from the process.
156 
157  G4EmSaturation* GetSaturation() const;
158  // Returns the Birks Saturation.
159 
160  void SetScintillationByParticleType(const G4bool);
161  // Called by the user to set the scintillation yield as a function
162  // of energy deposited by particle type
163 
164  G4bool GetScintillationByParticleType() const;
165  // Return the boolean that determines the method of scintillation
166  // production
167 
168  void SetScintillationTrackInfo(const G4bool trackType);
169  // Call by the user to set the G4ScintillationTrackInformation
170  // to scintillation photon track
171 
172  G4bool GetScintillationTrackInfo() const;
173  // Return the boolean for whether or not the
174  // G4ScintillationTrackInformation is set to the scint. photon track
175 
176  void SetStackPhotons(const G4bool);
177  // Call by the user to set the flag for stacking the scint. photons
178 
179  G4bool GetStackPhotons() const;
180  // Return the boolean for whether or not the scint. photons are stacked
181 
182  G4int GetNumPhotons() const;
183  // Returns the current number of scint. photons (after PostStepDoIt)
184 
185  void DumpPhysicsTable() const;
186  // Prints the fast and slow scintillation integral tables.
187 
188  void SetVerboseLevel(G4int);
189  // sets verbosity
190 
191  private:
192 
193  G4PhysicsTable* fIntegralTable1;
194  G4PhysicsTable* fIntegralTable2;
195  G4PhysicsTable* fIntegralTable3;
196 
197  G4EmSaturation* fEmSaturation;
198  const G4ParticleDefinition* opticalphoton =
199  G4OpticalPhoton::OpticalPhotonDefinition();
200 
201  G4int fNumPhotons;
202 
203  G4bool fScintillationByParticleType;
204  G4bool fScintillationTrackInfo;
205  G4bool fStackingFlag;
206  G4bool fTrackSecondariesFirst;
207  G4bool fFiniteRiseTime;
208 
209 #ifdef G4DEBUG_SCINTILLATION
210  G4double ScintTrackEDep, ScintTrackYield;
211 #endif
212 
213  G4double single_exp(G4double t, G4double tau2);
214  G4double bi_exp(G4double t, G4double tau1, G4double tau2);
215 
216  // emission time distribution when there is a finite rise time
217  G4double sample_time(G4double tau1, G4double tau2);
218 
219  G4int secID = -1; // creator modelID
220 
221 };
222 
224 // Inline methods
226 
227 inline G4bool OMSimG4Scintillation::GetTrackSecondariesFirst() const
228 {
229  return fTrackSecondariesFirst;
230 }
231 
232 inline G4bool OMSimG4Scintillation::GetFiniteRiseTime() const
233 {
234  return fFiniteRiseTime;
235 }
236 
237 inline G4PhysicsTable* OMSimG4Scintillation::GetIntegralTable1() const
238 {
239  return fIntegralTable1;
240 }
241 
242 inline G4PhysicsTable* OMSimG4Scintillation::GetIntegralTable2() const
243 {
244  return fIntegralTable2;
245 }
246 
247 inline G4PhysicsTable* OMSimG4Scintillation::GetIntegralTable3() const
248 {
249  return fIntegralTable3;
250 }
251 
252 inline void OMSimG4Scintillation::AddSaturation(G4EmSaturation* sat)
253 {
254  fEmSaturation = sat;
255 }
256 
257 inline void OMSimG4Scintillation::RemoveSaturation() { fEmSaturation = nullptr; }
258 
259 inline G4EmSaturation* OMSimG4Scintillation::GetSaturation() const
260 {
261  return fEmSaturation;
262 }
263 
264 inline G4bool OMSimG4Scintillation::GetScintillationByParticleType() const
265 {
266  return fScintillationByParticleType;
267 }
268 
269 inline G4bool OMSimG4Scintillation::GetScintillationTrackInfo() const
270 {
271  return fScintillationTrackInfo;
272 }
273 
274 inline G4bool OMSimG4Scintillation::GetStackPhotons() const { return fStackingFlag; }
275 
276 inline G4int OMSimG4Scintillation::GetNumPhotons() const { return fNumPhotons; }
277 
278 inline G4double OMSimG4Scintillation::single_exp(G4double t, G4double tau2)
279 {
280  return std::exp(-1.0 * t / tau2) / tau2;
281 }
282 
283 inline G4double OMSimG4Scintillation::bi_exp(G4double t, G4double tau1,
284  G4double tau2)
285 {
286  return std::exp(-1.0 * t / tau2) * (1 - std::exp(-1.0 * t / tau1)) / tau2 /
287  tau2 * (tau1 + tau2);
288 }
289 
290 #endif /* G4Scintillation_h */
Definition: OMSimG4Scintillation.hh:74