Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:11:13

0001 #ifndef HCALResponse_h
0002 #define HCALResponse_h
0003 
0004 /** \file FastSimulation/Calorimetry/interface/HCALResponse.h. 
0005  *
0006  *  Helper class to contain the HCAL response to hadrons and e/gamma
0007  * 
0008  */
0009 
0010 #include "FastSimulation/Utilities/interface/DoubleCrystalBallGenerator.h"
0011 #include <vector>
0012 #include <string>
0013 
0014 //define multidimensional vector types
0015 typedef std::vector<double> vec1;
0016 typedef std::vector<vec1> vec2;
0017 typedef std::vector<vec2> vec3;
0018 typedef std::vector<vec3> vec4;
0019 typedef std::vector<vec4> vec5;
0020 enum part { hcbarrel = 0, hcendcap = 1, hcforward = 2 };
0021 enum type { ECAL = 0, HCAL = 1, VFCAL = 2 };
0022 
0023 class RandomEngineAndDistribution;
0024 
0025 namespace edm {
0026   class ParameterSet;
0027 }
0028 
0029 class HCALResponse {
0030 public:
0031   HCALResponse(const edm::ParameterSet& pset);
0032   ~HCALResponse() {}
0033 
0034   // Get the response smearing factor
0035   // for  e/gamma = 0, hadron = 1, mu = 2, mip: 0/1/2
0036   // mip = 2 means "mean" response regardless actual mip
0037   double responseHCAL(int _mip, double energy, double eta, int partype, RandomEngineAndDistribution const*);
0038 
0039   //Get the energy and eta dependent mip fraction
0040   double getMIPfraction(double energy, double eta);
0041 
0042   // legacy methods using simple formulae
0043   double getHCALEnergyResponse(double e, int hit, RandomEngineAndDistribution const*);
0044 
0045   // correct HF response for SL
0046   void correctHF(double e, int type);
0047   vec1& getCorrHFem() { return corrHFem; }
0048   vec1& getCorrHFhad() { return corrHFhad; }
0049 
0050 private:
0051   // calculates interpolated-extrapolated response smearing factors
0052   // for hadrons, muons, and e/gamma (the last in HF specifically)
0053   double interHD(int mip, double e, int ie, int ieta, int det, RandomEngineAndDistribution const*);
0054   double interEM(double e, int ie, int ieta, RandomEngineAndDistribution const*);
0055   double interMU(double e, int ie, int ieta, RandomEngineAndDistribution const*);
0056 
0057   //random shooting functions w/ protection from negative energies
0058   double gaussShootNoNegative(double e, double sigma, RandomEngineAndDistribution const*);
0059   double cballShootNoNegative(
0060       double mu, double sigma, double aL, double nL, double aR, double nR, RandomEngineAndDistribution const*);
0061   double PoissonShootNoNegative(double e, double sigma, RandomEngineAndDistribution const*);
0062 
0063   //find subdet
0064   int getDet(int ieta);
0065 
0066   //debugging and mip toggles
0067   bool debug, usemip;
0068 
0069   //Default values for resolution parametrisation:
0070   //stochastic, constant and noise.
0071   //in the barrel and in the endcap
0072   //in the ECAL, HCAL, VFCAL
0073   double RespPar[3][2][3];
0074 
0075   //HCAL response parameters
0076   double eResponseScale[3];
0077   double eResponsePlateau[3];
0078   double eResponseExponent;
0079   double eResponseCoefficient;
0080 
0081   //max values
0082   int maxMUe, maxMUeta, maxMUbin, maxEMe, maxEMeta;
0083   int maxHDe[4];
0084   // eta step for eta index calc
0085   double etaStep;
0086   // eta index for different regions
0087   int HDeta[4], maxHDetas[3], barrelMUeta, endcapMUeta;
0088   // energy step of the tabulated muon data
0089   double muStep;
0090   // correction factor for HF EM
0091   double respFactorEM;
0092 
0093   // Tabulated energy, et/pt and eta points
0094   vec1 eGridHD[4];
0095   vec1 eGridEM;
0096   vec1 eGridMU;
0097   vec1 etaGridMU;
0098 
0099   // Tabulated response and mean for hadrons normalized to the energy
0100   // indices: parameters[par][mip][det][energy][eta]
0101   int nPar;
0102   std::vector<std::string> parNames;
0103   vec5 parameters;
0104 
0105   // Tabulated response and mean for e/gamma in HF specifically (normalized)
0106   // indices: meanEM[energy][eta]
0107   vec2 meanEM, sigmaEM;
0108 
0109   // muon histos
0110   // indices: responseMU[energy][eta][bin]
0111   vec3 responseMU;
0112   vec3 mipfraction;
0113   vec3 PoissonParameters;
0114 
0115   // crystal ball generator
0116   DoubleCrystalBallGenerator cball;
0117 
0118   // HF correction for SL
0119   int maxEta, maxEne;
0120   vec1 energyHF;
0121   vec2 corrHFgEm, corrHFgHad;
0122   vec2 corrHFhEm, corrHFhHad;
0123   vec1 corrHFem, corrHFhad;
0124 };
0125 #endif