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() : year_(""), intlumi_(0.), lumirate_(0.), energy_(0), sumlumi_(0.) {}
23  LumiYear(std::string year, float intlumi, float lumirate, int energy)
24  : year_(year), intlumi_(intlumi), lumirate_(lumirate), energy_(energy), sumlumi_(0.) {}
25 
26  //sorting
27  bool operator<(const LumiYear& yr) const { return year_ < yr.year_; }
28 
29  //member variables
31  float intlumi_;
32  float lumirate_;
33  int energy_;
34  float sumlumi_;
35  };
36  struct LumiYearComp {
37  bool operator()(const LumiYear& yr, const float& lum) const { return yr.sumlumi_ < lum; }
38  };
39 
40  HBHEDarkening(int ieta_shift,
41  float drdA,
42  float drdB,
43  std::map<int, std::vector<std::vector<float>>> dosemaps,
44  std::vector<LumiYear> years);
46 
47  //public accessors
48  float degradation(float intlumi, int ieta, int lay) const;
49  int get_ieta_shift() const { return ieta_shift_; }
50 
51  //helper function
52  static std::vector<std::vector<float>> readDoseMap(const std::string& fullpath);
53 
54 private:
55  //helper functions
56  float dose(int ieta, int lay, int energy) const;
57  std::string getYearForLumi(float intlumi) const;
58  float degradationYear(const LumiYear& year, float intlumi, int ieta, int lay) const;
59 
60  //member variables
62  float drdA_, drdB_;
63  std::map<int, std::vector<std::vector<float>>> dosemaps_; //one map for each center of mass energy
64  std::vector<LumiYear> years_;
65 };
66 
67 #endif // HBHEDarkening_h
float degradation(float intlumi, int ieta, int lay) const
std::string getYearForLumi(float intlumi) const
float degradationYear(const LumiYear &year, float intlumi, int ieta, int lay) const
std::map< int, std::vector< std::vector< float > > > dosemaps_
Definition: HBHEDarkening.h:63
static std::vector< std::vector< float > > readDoseMap(const std::string &fullpath)
HBHEDarkening(int ieta_shift, float drdA, float drdB, std::map< int, std::vector< std::vector< float >>> dosemaps, std::vector< LumiYear > years)
LumiYear(std::string year, float intlumi, float lumirate, int energy)
Definition: HBHEDarkening.h:23
int get_ieta_shift() const
Definition: HBHEDarkening.h:49
std::vector< LumiYear > years_
Definition: HBHEDarkening.h:64
bool operator<(const LumiYear &yr) const
Definition: HBHEDarkening.h:27
bool operator()(const LumiYear &yr, const float &lum) const
Definition: HBHEDarkening.h:37
float dose(int ieta, int lay, int energy) const