Loading...
Searching...
No Matches
Par03EMShowerModel.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26#ifndef PAR03EMSHOWERMODEL_HH
27#define PAR03EMSHOWERMODEL_HH
28
29#include "G4VFastSimulationModel.hh"
30
33
34/**
35 * @brief Example fast simulation model for EM showers.
36 *
37 * Parametrisation of electrons, positrons, and gammas. It is triggered if those
38 * particles enter the detector so that there is sufficient length for the
39 * shower development (max depth, controlled by the UI command).
40 *
41 * Parametrisation is based on the PDG chapter on the electromagnetic cascades
42 * (chapter 33.5). Longitudinal profile of the shower is described with Gamma
43 * distribution, with beta parameter on average equal to 0.5 (default value,
44 * Fig. 33.21), and alpha parameter calcluated from the incident particle energy
45 * and material of the detector (critical energy) following Eq.(33.36).
46 *
47 * Transverse profile is in this model approximated by the Gaussian
48 * distribution, with the mean along the shower axis (incident particle momentum
49 * direction) and the standard deviation calculated from the detector material
50 * (Moliere radius). This assumes that EM shower is in 90% contained within a
51 * cylinder of radius equal to Moliere radius, and that area below Gaussian
52 * distribution from `mean-1.645 sigma` to `mean+1.645 sigma` is also equal to
53 * 90% of total distribution.
54 *
55 * Parameters of both distributions (alpha, beta for Gamma, sigma for Gaussian)
56 * can be overwritten by UI commands.
57 *
58 * Parametrisation creates N hits of same energy (N can be set by UI command),
59 * using rejection sampling to generate position along shower axis from Gamma
60 * distribution, and then sampling from uniform and Gaussian distributions to
61 * sample phi and radius, respectively. Created hits are deposited in the
62 * detector using its readout geometry, using the helper class G4FastSimHitMaker
63 * that locates the volume, and calls appropriate sensitive detector class.
64 *
65 * PDG Chapter 33:
66 * https://pdg.lbl.gov/2019/reviews/rpp2018-rev-passage-particles-matter.pdf
67 *
68 */
69
71{
72 public:
76
77 /// There are no kinematics constraints. True is returned.
78 virtual G4bool ModelTrigger(const G4FastTrack&) final;
79 /// Model is applicable to electrons, positrons, and photons.
80 virtual G4bool IsApplicable(const G4ParticleDefinition&) final;
81 /// Take particle out of the full simulation (kill it at the entrance
82 /// depositing all the energy). Calculate energy deposited in the detector
83 /// according to Gamma distribution (along the particle direction) and
84 /// Gaussian distribution in the transverse direction. Mean of the Gaussian is
85 /// centred on the shower axis. Create energy deposits on a cylindrical mesh.
86 /// Parameters of the mesh (size, number of cells) and of the distributions
87 /// (alpha, beta for Gamma, sigma for Gaussian) can be set with UI commands.
88 virtual void DoIt(const G4FastTrack&, G4FastStep&) final;
89
90 /// Print current settings.
91 void Print() const;
92 /// Set standard deviation of a Gaussian distribution that describes the
93 /// transverse shower profile.
94 inline void SetSigma(const G4double aSigma) { fSigma = aSigma; };
95 /// Get standard deviation of a Gaussian distribution that describes the
96 /// transverse shower profile.
97 inline G4double GetSigma() const { return fSigma; };
98 /// Set alpha parameter of a Gamma distribution that describes the
99 /// longitudinal shower profile.
100 inline void SetAlpha(const G4double aAlpha) { fAlpha = aAlpha; };
101 /// Get alpha parameter of a Gamma distribution that describes the
102 /// longitudinal shower profile.
103 inline G4double GetAlpha() const { return fAlpha; };
104 /// Set beta parameter of a Gamma distribution that describes the longitudinal
105 /// shower profile.
106 inline void SetBeta(const G4double aBeta) { fBeta = aBeta; };
107 /// Get beta parameter of a Gamma distribution that describes the longitudinal
108 /// shower profile.
109 inline G4double GetBeta() const { return fBeta; };
110 /// Set number of (same energy) hits created in the parametrisation.
111 inline void SetNbOfHits(const G4int aNumber) { fNbOfHits = aNumber; };
112 /// Get number of (same energy) hits created in the parametrisation.s
113 inline G4int GetNbOfHits() const { return fNbOfHits; };
114 /// Set maximum depth of shower created in fast simulation. It is expressed in
115 /// units of radiaton length.
116 inline void SetLongMaxDepth(const G4double aDepth)
117 {
118 fLongMaxDepth = aDepth;
119 };
120 /// Get maximum depth of shower created in fast simulation. It is expressed in
121 /// units of radiaton length.
122 inline G4double GetLongMaxDepth() const { return fLongMaxDepth; };
123
124 private:
125 /// Gamma distribution
126 inline G4double Gamma(G4double x, G4double alpha, G4double beta)
127 {
128 return (std::pow(beta, alpha) / std::tgamma(alpha) * std::pow(x, alpha - 1) *
129 std::exp(-beta * x));
130 }
131 /// Gaussian distribution
132 inline G4double Gaussian(G4double x, G4double sigma = 1, G4double x0 = 0)
133 {
134 G4double tmp = (x - x0) / sigma;
135 return (1.0 / (std::sqrt(2 * CLHEP::pi) * sigma)) * std::exp(-tmp * tmp / 2);
136 }
137
138 private:
139 /// Messenger for configuration
141 /// Helper class for creation of hits within the sensitive detector
142 std::unique_ptr<G4FastSimHitMaker> fHitMaker;
143 /// Standard deviation of the Gaussian distribution
144 /// Can be changed with UI command `/Par03/fastSim/transverseProfile/sigma
145 /// <sigma>`
146 /// If sigma is smaller than 0, it will be estimated from the detector
147 /// material (Moliere radius).
148 G4double fSigma = -1;
149 /// Alpha parameter of the Gamma distribution
150 /// Can be changed with UI command `/Par03/fastSim/longitudunalProfile/alpha
151 /// <alpha>`
152 /// If alpha is smaller than 0, it will be estimated from particle energy and
153 /// the detector material.
154 G4double fAlpha = -1;
155 /// Beta parameter of the Gamma distribution
156 /// Can be changed with UI command `/Par03/fastSim/longitudinalProfile/beta
157 /// <beta>`
158 G4double fBeta = 0.5;
159 /// Number of (same energy) hits created by the parametrisation. Can be
160 /// changed with UI command `/Par03/fastSim/numberOfHits <number>`
161 G4int fNbOfHits = 100;
162 /// Maximum depth of a shower created in fast simulation.
163 /// It is expressed in units of radiation length. Can be changed with UI
164 /// command `/Par03/fastSim/longitudinalProfile/maxDepth <depth>`
165 G4double fLongMaxDepth = 30;
166};
167#endif /* PAR03EMSHOWERMODEL_HH */
Messenger for the example fast simulation model.
Example fast simulation model for EM showers.
G4double Gaussian(G4double x, G4double sigma=1, G4double x0=0)
Gaussian distribution.
G4double GetBeta() const
Get beta parameter of a Gamma distribution that describes the longitudinal shower profile.
void SetNbOfHits(const G4int aNumber)
Set number of (same energy) hits created in the parametrisation.
void Print() const
Print current settings.
void SetLongMaxDepth(const G4double aDepth)
Set maximum depth of shower created in fast simulation.
G4double fLongMaxDepth
Maximum depth of a shower created in fast simulation.
G4int fNbOfHits
Number of (same energy) hits created by the parametrisation.
virtual G4bool ModelTrigger(const G4FastTrack &) final
There are no kinematics constraints. True is returned.
G4double fBeta
Beta parameter of the Gamma distribution Can be changed with UI command /Par03/fastSim/longitudinalPr...
G4double fAlpha
Alpha parameter of the Gamma distribution Can be changed with UI command /Par03/fastSim/longitudunalP...
void SetSigma(const G4double aSigma)
Set standard deviation of a Gaussian distribution that describes the transverse shower profile.
Par03EMShowerMessenger * fMessenger
Messenger for configuration.
void SetBeta(const G4double aBeta)
Set beta parameter of a Gamma distribution that describes the longitudinal shower profile.
G4double GetAlpha() const
Get alpha parameter of a Gamma distribution that describes the longitudinal shower profile.
std::unique_ptr< G4FastSimHitMaker > fHitMaker
Helper class for creation of hits within the sensitive detector.
G4double fSigma
Standard deviation of the Gaussian distribution Can be changed with UI command /Par03/fastSim/transve...
G4double Gamma(G4double x, G4double alpha, G4double beta)
Gamma distribution.
G4int GetNbOfHits() const
Get number of (same energy) hits created in the parametrisation.s.
virtual G4bool IsApplicable(const G4ParticleDefinition &) final
Model is applicable to electrons, positrons, and photons.
void SetAlpha(const G4double aAlpha)
Set alpha parameter of a Gamma distribution that describes the longitudinal shower profile.
virtual void DoIt(const G4FastTrack &, G4FastStep &) final
Take particle out of the full simulation (kill it at the entrance depositing all the energy).
G4double GetLongMaxDepth() const
Get maximum depth of shower created in fast simulation.
G4double GetSigma() const
Get standard deviation of a Gaussian distribution that describes the transverse shower profile.

Applications | User Support | Publications | Collaboration