CMS 3D CMS Logo

HBHEDarkening.h
Go to the documentation of this file.
1 #ifndef CondFormats_HcalObjects_HBHEDarkening_h
2 #define CondFormats_HcalObjects_HBHEDarkening_h
3 
4 #include <vector>
5 #include <string>
6 #include <map>
7 
8 // Scintillator darkening model for HB and HE
9 // ingredients:
10 // 1) dose map (Mrad/fb-1), from Fluka
11 // 2) decay constant D as function of dose rate d (Mrad vs krad/hr): D(d) = A*d^B
12 // 3) inst lumi per year (fb-1/hr)
13 // 4) int lumi per year (fb-1)
14 // layer number for HB: (0,16) = (1,17) in HcalTestNumbering
15 // layer number for HE: (-1,17) = (1,19) in HcalTestNumbering
16 
18  public:
19  //helper classes
20  struct LumiYear {
21  //constructors
22  LumiYear() :
23  year_(""), intlumi_(0.), lumirate_(0.), energy_(0), sumlumi_(0.) {}
24  LumiYear(std::string year, float intlumi, float lumirate, int energy) :
25  year_(year), intlumi_(intlumi), lumirate_(lumirate), energy_(energy), sumlumi_(0.) {}
26 
27  //sorting
28  bool operator<(const LumiYear& yr) const {
29  return year_ < yr.year_;
30  }
31 
32  //member variables
34  float intlumi_;
35  float lumirate_;
36  int energy_;
37  float sumlumi_;
38  };
39  struct LumiYearComp {
40  bool operator()(const LumiYear& yr, const float& lum) const {
41  return yr.sumlumi_ < lum;
42  }
43  };
44 
45  HBHEDarkening(int ieta_shift, float drdA, float drdB, const std::map<int,std::vector<std::vector<float>>>& dosemaps, const std::vector<LumiYear>& years);
47 
48  //public accessors
49  float degradation(float intlumi, int ieta, int lay) const;
50  int get_ieta_shift() const { return ieta_shift_; }
51 
52  //helper function
53  static std::vector<std::vector<float>> readDoseMap(const std::string& fullpath);
54 
55  private:
56  //helper functions
57  float dose(int ieta, int lay, int energy) const;
58  std::string getYearForLumi(float intlumi) const;
59  float degradationYear(const LumiYear& year, float intlumi, int ieta, int lay) const;
60 
61  //member variables
63  float drdA_, drdB_;
64  std::map<int,std::vector<std::vector<float>>> dosemaps_; //one map for each center of mass energy
65  std::vector<LumiYear> years_;
66 };
67 
68 #endif // HBHEDarkening_h
HBHEDarkening(int ieta_shift, float drdA, float drdB, const std::map< int, std::vector< std::vector< float >>> &dosemaps, const std::vector< LumiYear > &years)
std::string getYearForLumi(float intlumi) const
std::map< int, std::vector< std::vector< float > > > dosemaps_
Definition: HBHEDarkening.h:64
static std::vector< std::vector< float > > readDoseMap(const std::string &fullpath)
bool operator<(const LumiYear &yr) const
Definition: HBHEDarkening.h:28
LumiYear(std::string year, float intlumi, float lumirate, int energy)
Definition: HBHEDarkening.h:24
float degradationYear(const LumiYear &year, float intlumi, int ieta, int lay) const
std::vector< LumiYear > years_
Definition: HBHEDarkening.h:65
int get_ieta_shift() const
Definition: HBHEDarkening.h:50
bool operator()(const LumiYear &yr, const float &lum) const
Definition: HBHEDarkening.h:40
float dose(int ieta, int lay, int energy) const
float degradation(float intlumi, int ieta, int lay) const