Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-05-23 23:48:32

0001 #ifndef HDShower_H
0002 #define HDShower_H
0003 
0004 //FastSimulation Headers
0005 #include "FastSimulation/ShowerDevelopment/interface/HDShowerParametrization.h"
0006 
0007 #include "DataFormats/Math/interface/Vector3D.h"
0008 
0009 #include <vector>
0010 
0011 /** 
0012  * \author Salavat Abdullin
0013  * \date: 21-Oct-2004
0014  * \parameterized hadronic shower simulation 
0015  * \based on paper G.Gridhammer, M.Rudowicz, S.Peters, SLAC-PUB-5072
0016  */
0017 
0018 class EcalHitMaker;
0019 class HcalHitMaker;
0020 class RandomEngineAndDistribution;
0021 
0022 class HDShower {
0023 public:
0024   typedef math::XYZVector XYZPoint;
0025 
0026   typedef std::pair<XYZPoint, double> Spot;
0027   typedef std::pair<unsigned int, double> Step;
0028   typedef std::vector<Step> Steps;
0029   typedef Steps::const_iterator step_iterator;
0030 
0031   HDShower(const RandomEngineAndDistribution* engine,
0032            HDShowerParametrization* myParam,
0033            EcalHitMaker* myGrid,
0034            HcalHitMaker* myHcalHitMaker,
0035            int onECAL,
0036            double epart,
0037            double pmip);
0038 
0039   int getmip() { return mip; }
0040 
0041   virtual ~HDShower() { ; }
0042 
0043   /// Compute the shower longitudinal and lateral development
0044   bool compute();
0045 
0046 private:
0047   //Initialization function to avoid large constructor which
0048   //takes hours to compile for UBSAN IBs
0049   void init(const RandomEngineAndDistribution* engine,
0050             HDShowerParametrization* myParam,
0051             EcalHitMaker* myGrid,
0052             HcalHitMaker* myHcalHitMaker,
0053             int onECAL,
0054             double epart,
0055             double pmip);
0056   // The longitudinal development ersatzt.
0057   double gam(double x, double a) const { return pow(x, a - 1.) * exp(-x); }
0058 
0059   // Transverse integrated probability function (for 4R max size)
0060   // integral of the transverse ansatz f(r) =  2rR/(r**2 + R**2)**2 ->
0061   // 1/R - R/(R**2+r**2) | at limits 4R - 0
0062   double transProb(double factor, double R, double r) {
0063     double fsq = factor * factor;
0064     return ((fsq + 1.) / fsq) * r * r / (r * r + R * R);
0065   }
0066   // Compute longE[i] and transR[i] for all nsteps
0067   void makeSteps(int nsteps);
0068 
0069   int indexFinder(double x, const std::vector<double>& Fhist);
0070 
0071   // The parametrization
0072   HDShowerParametrization* theParam;
0073 
0074   // The Calorimeter properties
0075   const ECALProperties* theECALproperties;
0076   const HCALProperties* theHCALproperties;
0077 
0078   // Basic parameters of the simulation
0079   double theR1, theR2, theR3;
0080   double alpEM, betEM, alpHD, betHD, part, tgamEM, tgamHD;
0081 
0082   // The basic quantities for the shower development.
0083   double lambdaEM, lambdaHD, x0EM, x0HD;
0084   double depthStart;
0085   double aloge;
0086 
0087   std::vector<int> detector, nspots;
0088   std::vector<double> eStep, rlamStep;
0089   std::vector<double> x0curr, x0depth;
0090   std::vector<double> lamstep, lamcurr, lamdepth, lamtotal;
0091 
0092   int infinity;  // big number of cycles if exit is on a special condition
0093 
0094   // The crystal grid
0095   EcalHitMaker* theGrid;
0096 
0097   // The HCAL
0098   HcalHitMaker* theHcalHitMaker;
0099 
0100   // OnECAL flag as an input parameter ...
0101   int onEcal;
0102 
0103   // MIP in ECAL map flag
0104   int mip;
0105 
0106   // Input energy to distribute
0107   double e;
0108 
0109   // HCAL losses option (0-off, 1-on)
0110   int lossesOpt;
0111   // Number of longitudinal steps in HCAL
0112   int nDepthSteps;
0113   // Number of bins in the transverse probability histogram
0114   int nTRsteps;
0115   // Transverse size tuning factor
0116   double transParam;
0117   // Transverse normalization : 1 for HB/HE, 0.5 for HF (narrow showers)
0118   double transFactor;
0119   // HCAL energy spot size
0120   double eSpotSize;
0121   // Longitudinal step size (lambda units)
0122   double depthStep;
0123   // Energy threshold (one depth step -> nDepthSteps);
0124   double criticalEnergy;
0125   // Transverse size cut (in character transverse size units)
0126   double maxTRfactor;
0127   // Balance between ECAL and HCAL "visible" energy (default = 1.)
0128   double balanceEH;
0129   // Regulator of HCAL depth of the shower (to adjust/shrink it to CMS depth)
0130   double hcalDepthFactor;
0131 
0132   // Famos Random Engine
0133   const RandomEngineAndDistribution* random;
0134 
0135   //calorimeter depths
0136   double depthECAL, depthGAP, depthGAPx0, depthHCAL, depthToHCAL;
0137 };
0138 
0139 #endif