Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:02:12

0001 #ifndef CondFormats_HcalObjects_HBHEDarkening_h
0002 #define CondFormats_HcalObjects_HBHEDarkening_h
0003 
0004 #include <vector>
0005 #include <string>
0006 #include <map>
0007 
0008 // Scintillator darkening model for HB and HE

0009 // ingredients:

0010 // 1) dose map (Mrad/fb-1), from Fluka

0011 // 2) decay constant D as function of dose rate d (Mrad vs krad/hr): D(d) = A*d^B

0012 // 3) inst lumi per year (fb-1/hr)

0013 // 4) int lumi per year (fb-1)

0014 // layer number for HB: (0,16) = (1,17) in HcalTestNumbering

0015 // layer number for HE: (-1,17) = (1,19) in HcalTestNumbering

0016 
0017 class HBHEDarkening {
0018 public:
0019   //helper classes

0020   struct LumiYear {
0021     //constructors

0022     LumiYear() : year_(""), intlumi_(0.), lumirate_(0.), energy_(0), sumlumi_(0.) {}
0023     LumiYear(std::string year, float intlumi, float lumirate, int energy)
0024         : year_(year), intlumi_(intlumi), lumirate_(lumirate), energy_(energy), sumlumi_(0.) {}
0025 
0026     //sorting

0027     bool operator<(const LumiYear& yr) const { return year_ < yr.year_; }
0028 
0029     //member variables

0030     std::string year_;
0031     float intlumi_;
0032     float lumirate_;
0033     int energy_;
0034     float sumlumi_;
0035   };
0036   struct LumiYearComp {
0037     bool operator()(const LumiYear& yr, const float& lum) const { return yr.sumlumi_ < lum; }
0038   };
0039 
0040   HBHEDarkening(int ieta_shift,
0041                 float drdA,
0042                 float drdB,
0043                 std::map<int, std::vector<std::vector<float>>> dosemaps,
0044                 std::vector<LumiYear> years);
0045   ~HBHEDarkening() {}
0046 
0047   //public accessors

0048   float degradation(float intlumi, int ieta, int lay) const;
0049   int get_ieta_shift() const { return ieta_shift_; }
0050 
0051   //helper function

0052   static std::vector<std::vector<float>> readDoseMap(const std::string& fullpath);
0053 
0054 private:
0055   //helper functions

0056   float dose(int ieta, int lay, int energy) const;
0057   std::string getYearForLumi(float intlumi) const;
0058   float degradationYear(const LumiYear& year, float intlumi, int ieta, int lay) const;
0059 
0060   //member variables

0061   int ieta_shift_;
0062   float drdA_, drdB_;
0063   std::map<int, std::vector<std::vector<float>>> dosemaps_;  //one map for each center of mass energy

0064   std::vector<LumiYear> years_;
0065 };
0066 
0067 #endif  // HBHEDarkening_h