|
|
|||
File indexing completed on 2026-04-10 07:53:14
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 /// \file Par03EMShowerModel.hh 0027 /// \brief Definition of the Par03EMShowerModel class 0028 0029 #ifndef PAR03EMSHOWERMODEL_HH 0030 #define PAR03EMSHOWERMODEL_HH 0031 0032 #include "G4VFastSimulationModel.hh" 0033 0034 class Par03EMShowerMessenger; 0035 class G4FastSimHitMaker; 0036 0037 /** 0038 * @brief Example fast simulation model for EM showers. 0039 * 0040 * Parametrisation of electrons, positrons, and gammas. It is triggered if those 0041 * particles enter the detector so that there is sufficient length for the 0042 * shower development (max depth, controlled by the UI command). 0043 * 0044 * Parametrisation is based on the PDG chapter on the electromagnetic cascades 0045 * (chapter 33.5). Longitudinal profile of the shower is described with Gamma 0046 * distribution, with beta parameter on average equal to 0.5 (default value, 0047 * Fig. 33.21), and alpha parameter calcluated from the incident particle energy 0048 * and material of the detector (critical energy) following Eq.(33.36). 0049 * 0050 * Transverse profile is in this model approximated by the Gaussian 0051 * distribution, with the mean along the shower axis (incident particle momentum 0052 * direction) and the standard deviation calculated from the detector material 0053 * (Moliere radius). This assumes that EM shower is in 90% contained within a 0054 * cylinder of radius equal to Moliere radius, and that area below Gaussian 0055 * distribution from `mean-1.645 sigma` to `mean+1.645 sigma` is also equal to 0056 * 90% of total distribution. 0057 * 0058 * Parameters of both distributions (alpha, beta for Gamma, sigma for Gaussian) 0059 * can be overwritten by UI commands. 0060 * 0061 * Parametrisation creates N hits of same energy (N can be set by UI command), 0062 * using rejection sampling to generate position along shower axis from Gamma 0063 * distribution, and then sampling from uniform and Gaussian distributions to 0064 * sample phi and radius, respectively. Created hits are deposited in the 0065 * detector using its readout geometry, using the helper class G4FastSimHitMaker 0066 * that locates the volume, and calls appropriate sensitive detector class. 0067 * 0068 * PDG Chapter 33: 0069 * https://pdg.lbl.gov/2019/reviews/rpp2018-rev-passage-particles-matter.pdf 0070 * 0071 */ 0072 0073 class Par03EMShowerModel : public G4VFastSimulationModel 0074 { 0075 public: 0076 Par03EMShowerModel(G4String, G4Region*); 0077 Par03EMShowerModel(G4String); 0078 ~Par03EMShowerModel(); 0079 0080 /// There are no kinematics constraints. True is returned. 0081 virtual G4bool ModelTrigger(const G4FastTrack&) final; 0082 /// Model is applicable to electrons, positrons, and photons. 0083 virtual G4bool IsApplicable(const G4ParticleDefinition&) final; 0084 /// Take particle out of the full simulation (kill it at the entrance 0085 /// depositing all the energy). Calculate energy deposited in the detector 0086 /// according to Gamma distribution (along the particle direction) and 0087 /// Gaussian distribution in the transverse direction. Mean of the Gaussian is 0088 /// centred on the shower axis. Create energy deposits on a cylindrical mesh. 0089 /// Parameters of the mesh (size, number of cells) and of the distributions 0090 /// (alpha, beta for Gamma, sigma for Gaussian) can be set with UI commands. 0091 virtual void DoIt(const G4FastTrack&, G4FastStep&) final; 0092 0093 /// Print current settings. 0094 void Print() const; 0095 /// Set standard deviation of a Gaussian distribution that describes the 0096 /// transverse shower profile. 0097 inline void SetSigma(const G4double aSigma) { fSigma = aSigma; }; 0098 /// Get standard deviation of a Gaussian distribution that describes the 0099 /// transverse shower profile. 0100 inline G4double GetSigma() const { return fSigma; }; 0101 /// Set alpha parameter of a Gamma distribution that describes the 0102 /// longitudinal shower profile. 0103 inline void SetAlpha(const G4double aAlpha) { fAlpha = aAlpha; }; 0104 /// Get alpha parameter of a Gamma distribution that describes the 0105 /// longitudinal shower profile. 0106 inline G4double GetAlpha() const { return fAlpha; }; 0107 /// Set beta parameter of a Gamma distribution that describes the longitudinal 0108 /// shower profile. 0109 inline void SetBeta(const G4double aBeta) { fBeta = aBeta; }; 0110 /// Get beta parameter of a Gamma distribution that describes the longitudinal 0111 /// shower profile. 0112 inline G4double GetBeta() const { return fBeta; }; 0113 /// Set number of (same energy) hits created in the parametrisation. 0114 inline void SetNbOfHits(const G4int aNumber) { fNbOfHits = aNumber; }; 0115 /// Get number of (same energy) hits created in the parametrisation.s 0116 inline G4int GetNbOfHits() const { return fNbOfHits; }; 0117 /// Set maximum depth of shower created in fast simulation. It is expressed in 0118 /// units of radiaton length. 0119 inline void SetLongMaxDepth(const G4double aDepth) { fLongMaxDepth = aDepth; }; 0120 /// Get maximum depth of shower created in fast simulation. It is expressed in 0121 /// units of radiaton length. 0122 inline G4double GetLongMaxDepth() const { return fLongMaxDepth; }; 0123 0124 private: 0125 /// Gamma distribution 0126 inline G4double Gamma(G4double x, G4double alpha, G4double beta) 0127 { 0128 return (std::pow(beta, alpha) / std::tgamma(alpha) * std::pow(x, alpha - 1) 0129 * std::exp(-beta * x)); 0130 } 0131 /// Gaussian distribution 0132 inline G4double Gaussian(G4double x, G4double sigma = 1, G4double x0 = 0) 0133 { 0134 G4double tmp = (x - x0) / sigma; 0135 return (1.0 / (std::sqrt(2 * CLHEP::pi) * sigma)) * std::exp(-tmp * tmp / 2); 0136 } 0137 0138 private: 0139 /// Messenger for configuration 0140 Par03EMShowerMessenger* fMessenger; 0141 /// Helper class for creation of hits within the sensitive detector 0142 std::unique_ptr<G4FastSimHitMaker> fHitMaker; 0143 /// Standard deviation of the Gaussian distribution 0144 /// Can be changed with UI command `/Par03/fastSim/transverseProfile/sigma 0145 /// <sigma>` 0146 /// If sigma is smaller than 0, it will be estimated from the detector 0147 /// material (Moliere radius). 0148 G4double fSigma = -1; 0149 /// Alpha parameter of the Gamma distribution 0150 /// Can be changed with UI command `/Par03/fastSim/longitudunalProfile/alpha 0151 /// <alpha>` 0152 /// If alpha is smaller than 0, it will be estimated from particle energy and 0153 /// the detector material. 0154 G4double fAlpha = -1; 0155 /// Beta parameter of the Gamma distribution 0156 /// Can be changed with UI command `/Par03/fastSim/longitudinalProfile/beta 0157 /// <beta>` 0158 G4double fBeta = 0.5; 0159 /// Number of (same energy) hits created by the parametrisation. Can be 0160 /// changed with UI command `/Par03/fastSim/numberOfHits <number>` 0161 G4int fNbOfHits = 100; 0162 /// Maximum depth of a shower created in fast simulation. 0163 /// It is expressed in units of radiation length. Can be changed with UI 0164 /// command `/Par03/fastSim/longitudinalProfile/maxDepth <depth>` 0165 G4double fLongMaxDepth = 30; 0166 }; 0167 #endif /* PAR03EMSHOWERMODEL_HH */
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|