CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/FastSimulation/Calorimetry/interface/HCALResponse.h

Go to the documentation of this file.
00001 #ifndef HCALResponse_h
00002 #define HCALResponse_h
00003 
00010 #include "FastSimulation/Utilities/interface/DoubleCrystalBallGenerator.h"
00011 #include <vector>
00012 #include <string>
00013 
00014 //define multidimensional vector types
00015 typedef std::vector<double> vec1;
00016 typedef std::vector<vec1>   vec2;
00017 typedef std::vector<vec2>   vec3;
00018 typedef std::vector<vec3>   vec4;
00019 typedef std::vector<vec4>   vec5;
00020 enum part{hcbarrel=0, hcendcap=1, hcforward=2};
00021 enum type{ECAL=0, HCAL=1, VFCAL=2};
00022 
00023 class RandomEngine;
00024 
00025 namespace edm { 
00026   class ParameterSet;
00027 }
00028 
00029 class HCALResponse
00030 {
00031 public:
00032   HCALResponse(const edm::ParameterSet& pset, const RandomEngine* engine);
00033   ~HCALResponse(){ } 
00034 
00035   // Get the response smearing factor
00036   // for  e/gamma = 0, hadron = 1, mu = 2, mip: 0/1/2
00037   // mip = 2 means "mean" response regardless actual mip
00038   double responseHCAL(int _mip, double energy, double eta, int partype);
00039 
00040   // legacy methods using simple formulae
00041   double getHCALEnergyResponse(double e, int hit);
00042   
00043 private:
00044 
00045   // calculates interpolated-extrapolated response smearing factors
00046   // for hadrons, muons, and e/gamma (the last in HF specifically)
00047   double interHD(int mip, double e, int ie, int ieta, int det);
00048   double interEM(double e, int ie, int ieta); 
00049   double interMU(double e, int ie, int ieta);
00050   
00051   //random shooting functions w/ protection from negative energies
00052   double gaussShootNoNegative(double e, double sigma);
00053   double cballShootNoNegative(double mu, double sigma, double aL, double nL, double aR, double nR);
00054 
00055   //find subdet
00056   int getDet(int ieta);
00057   
00058   //debugging and mip toggles
00059   bool debug, usemip;
00060   
00061   //Default values for resolution parametrisation:
00062   //stochastic, constant and noise.
00063   //in the barrel and in the endcap
00064   //in the ECAL, HCAL, VFCAL
00065   double RespPar[3][2][3];
00066 
00067   //HCAL response parameters
00068   double eResponseScale[3];
00069   double eResponsePlateau[3];
00070   double eResponseExponent;
00071   double eResponseCoefficient;
00072 
00073   //max values
00074   int maxMUe, maxMUeta, maxMUbin, maxEMe, maxEMeta;
00075   int maxHDe[3];
00076   // eta step for eta index calc
00077   double etaStep;
00078   // eta index for different regions
00079   int HDeta[4], maxHDetas[3], barrelMUeta, endcapMUeta;
00080   // energy step of the tabulated muon data
00081   double muStep;
00082   // correction factor for HF EM
00083   double respFactorEM;
00084 
00085   // Tabulated energy, et/pt and eta points
00086   vec1 eGridHD[3];
00087   vec1 eGridEM;
00088   vec1 eGridMU;
00089   vec1 etaGridMU;
00090 
00091   // Tabulated response and mean for hadrons normalized to the energy
00092   // indices: parameters[par][mip][det][energy][eta]
00093   int nPar;
00094   std::vector<std::string> parNames;
00095   vec5 parameters;
00096   
00097   // Tabulated response and mean for e/gamma in HF specifically (normalized)
00098   // indices: meanEM[energy][eta]
00099   vec2 meanEM, sigmaEM;
00100 
00101   // muon histos
00102   // indices: responseMU[energy][eta][bin]
00103   vec3 responseMU; 
00104 
00105   // Famos random engine
00106   const RandomEngine* random;
00107   
00108   // crystal ball generator
00109   DoubleCrystalBallGenerator cball;
00110 
00111 };
00112 #endif
00113