CMS 3D CMS Logo

HFValueStruct.cc
Go to the documentation of this file.
1 #include "HFValueStruct.h"
2 
3 //version -1 will take information from DB (NOT DONE YET)
4 //version 0 has energy corrections on, everything else off
5 //version 1 has energy correction, and pile up slope and interceept on
6 // version 2+ will use defaults of 'do nothing'
7 //
8 //
9 //
10 
11 reco::HFValueStruct::HFValueStruct(const int& version, const std::vector<double>& vect) : v_(version), hfvv_(vect) {
12  //if(v_==-1) hfvv_=SetHfvvFromDB_();
13  //v==99 will always give defaults
14 
15  //version control, add in versions as they appear!!
16  if (v_ == 0 || v_ == 1)
17  doEnCor_ = true;
18  else
19  doEnCor_ = false;
20 
21  if (v_ == 1)
22  doPU_ = true;
23  else
24  doPU_ = false;
25 }
26 
27 int reco::HFValueStruct::indexByIeta(int& ieta) const { return (ieta > 0) ? (ieta - 29 + 13) : (41 + ieta); }
28 int reco::HFValueStruct::ietaByIndex(int& indx) const { return (indx > 13) ? (indx + 29 - 13) : (indx - 41); }
29 //version 0
30 // EnCor=energy corrections,default 1.0, 26 slots
31 
32 //version 1
33 //PUSlope= slope for pile up corrections,default 0.0, 26 slots, 0,1,12,13,24,25 are all defaults always
34 
35 //PUIntercept= intercept slope for pile up corrections,default 1.0, 26 slots, 0,1,12,13,24,25 are all defaults always
36 
37 // returns single value by index
38 
39 double reco::HFValueStruct::EnCor(int ieta) const {
40  int indx = indexByIeta(ieta);
41  if (doEnCor_)
42  return hfvv_[indx];
43  else
44  return 1.0;
45 }
47  int indx = indexByIeta(ieta) + 26;
48  if (doPU_)
49  return hfvv_[indx];
50  else
51  return 0.0;
52 }
54  int indx = indexByIeta(ieta) + 52;
55  if (doPU_)
56  return hfvv_[indx];
57  else
58  return 1.0;
59 }
60 
61 // sets single value by index
63  int indx = indexByIeta(ieta);
64  hfvv_[indx] = val;
65 }
67  int indx = indexByIeta(ieta) + 26;
68  hfvv_[indx] = val;
69 }
71  int indx = indexByIeta(ieta) + 52;
72  hfvv_[indx] = val;
73 }
74 
75 // returns whole vector
76 std::vector<double> reco::HFValueStruct::EnCor() const {
77  std::vector<double> vct;
78  if (doEnCor_) {
79  for (int ii = 0; ii < 13; ii++)
80  vct.push_back(hfvv_[ii]);
81  } else {
82  for (int ii = 0; ii < 13; ii++)
83  vct.push_back(1.0);
84  }
85  return vct;
86 }
87 
88 std::vector<double> reco::HFValueStruct::PUSlope() const {
89  std::vector<double> vct;
90  if (doPU_) {
91  for (int ii = 0; ii < 13; ii++)
92  vct.push_back(hfvv_[ii + 26]);
93  } else {
94  for (int ii = 0; ii < 13; ii++)
95  vct.push_back(0.0);
96  }
97  return vct;
98 }
99 
100 std::vector<double> reco::HFValueStruct::PUIntercept() const {
101  std::vector<double> vct;
102  if (doPU_) {
103  for (int ii = 0; ii < 13; ii++)
104  vct.push_back(hfvv_[ii + 52]);
105  } else {
106  for (int ii = 0; ii < 13; ii++)
107  vct.push_back(1.0);
108  }
109  return vct;
110 }
111 
112 // set whole vector
113 void reco::HFValueStruct::setEnCor(const std::vector<double>& val) {
114  for (int ii = 0; ii < 13; ii++)
115  hfvv_[ii] = val[ii];
116 }
117 void reco::HFValueStruct::setPUSlope(const std::vector<double>& val) {
118  for (int ii = 0; ii < 13; ii++)
119  hfvv_[ii + 26] = val[ii];
120 }
121 void reco::HFValueStruct::setPUIntercept(const std::vector<double>& val) {
122  for (int ii = 0; ii < 13; ii++)
123  hfvv_[ii + 52] = val[ii];
124 }
reco::HFValueStruct::setEnCor
void setEnCor(int ieta, double val)
Definition: HFValueStruct.cc:62
reco::HFValueStruct::indexByIeta
int indexByIeta(int &ieta) const
Definition: HFValueStruct.cc:27
reco::HFValueStruct::PUSlope
std::vector< double > PUSlope() const
Definition: HFValueStruct.cc:88
reco::HFValueStruct::v_
int v_
Definition: HFValueStruct.h:34
reco::HFValueStruct::EnCor
std::vector< double > EnCor() const
Definition: HFValueStruct.cc:76
reco::HFValueStruct::setPUIntercept
void setPUIntercept(int ieta, double val)
Definition: HFValueStruct.cc:70
reco::HFValueStruct::PUIntercept
std::vector< double > PUIntercept() const
Definition: HFValueStruct.cc:100
reco::HFValueStruct::HFValueStruct
HFValueStruct()
Definition: HFValueStruct.h:10
reco::HFValueStruct::doPU_
bool doPU_
Definition: HFValueStruct.h:37
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
HFValueStruct.h
reco::HFValueStruct::setPUSlope
void setPUSlope(int ieta, double val)
Definition: HFValueStruct.cc:66
reco::HFValueStruct::doEnCor_
bool doEnCor_
Definition: HFValueStruct.h:37
reco::HFValueStruct::ietaByIndex
int ietaByIndex(int &indx) const
Definition: HFValueStruct.cc:28
heppy_batch.val
val
Definition: heppy_batch.py:351
BeamSplash_cfg.version
version
Definition: BeamSplash_cfg.py:45
cuy.ii
ii
Definition: cuy.py:590