CMS 3D CMS Logo

EcalFloatCondObjectContainerUtils.h
Go to the documentation of this file.
5 
6 #include "TH2F.h"
7 #include <string>
8 
9 enum { kEBChannels = 61200, kEEChannels = 14648 };
10 enum {
11  MIN_IETA = 1,
12  MIN_IPHI = 1,
13  MAX_IETA = 85,
14  MAX_IPHI = 360,
16 }; // barrel lower and upper bounds on eta and phi
17 enum {
18  IX_MIN = 1,
19  IY_MIN = 1,
20  IX_MAX = 100,
21  IY_MAX = 100,
22  EEhistXMax = 220
23 }; // endcaps lower and upper bounds on x and y
24 
25 template <class floatCondObj>
26 void fillEBMap_SingleIOV(std::shared_ptr<floatCondObj> payload, TH2F*& barrel) {
27  for (int cellid = EBDetId::MIN_HASH; cellid < EBDetId::kSizeForDenseIndexing; ++cellid) {
28  uint32_t rawid = EBDetId::unhashIndex(cellid);
30  if (value_ptr == payload->end())
31  continue; // cell absent from payload
32 
33  float weight = (float)(*value_ptr);
34  Double_t phi = (Double_t)(EBDetId(rawid)).iphi() - 0.5;
35  Double_t eta = (Double_t)(EBDetId(rawid)).ieta();
36 
37  if (eta > 0.)
38  eta = eta - 0.5; // 0.5 to 84.5
39  else
40  eta = eta + 0.5; // -84.5 to -0.5
41 
42  barrel->Fill(phi, eta, weight);
43  } // loop over cellid
44 }
45 
46 template <class floatCondObj>
47 void fillEEMap_SingleIOV(std::shared_ptr<floatCondObj> payload, TH2F*& endc_m, TH2F*& endc_p) {
48  // looping over the EE channels
49  for (int iz = -1; iz < 2; iz = iz + 2) // -1 or +1
50  for (int iy = IY_MIN; iy < IY_MAX + IY_MIN; iy++)
51  for (int ix = IX_MIN; ix < IX_MAX + IX_MIN; ix++)
52  if (EEDetId::validDetId(ix, iy, iz)) {
53  EEDetId myEEId = EEDetId(ix, iy, iz, EEDetId::XYMODE);
54  uint32_t rawid = myEEId.rawId();
56  if (value_ptr == payload->end())
57  continue; // cell absent from payload
58 
59  float weight = (float)(*value_ptr);
60  if (iz == 1)
61  endc_p->Fill(ix, iy, weight);
62  else
63  endc_m->Fill(ix, iy, weight);
64 
65  } // validDetId
66 }
67 
68 template <class floatCondObj>
70  std::shared_ptr<floatCondObj> payload, TH2F*& barrel, int irun, float pEB[], float& pEBmin, float& pEBmax) {
71  for (int cellid = EBDetId::MIN_HASH; cellid < EBDetId::kSizeForDenseIndexing; ++cellid) {
72  uint32_t rawid = EBDetId::unhashIndex(cellid);
74  if (value_ptr == payload->end())
75  continue; // cell absent from payload
76 
77  float weight = (float)(*value_ptr);
78  if (irun == 0)
79  pEB[cellid] = weight;
80  else {
81  Double_t phi = (Double_t)(EBDetId(rawid)).iphi() - 0.5;
82  Double_t eta = (Double_t)(EBDetId(rawid)).ieta();
83 
84  if (eta > 0.)
85  eta = eta - 0.5; // 0.5 to 84.5
86  else
87  eta = eta + 0.5; // -84.5 to -0.5
88 
89  double diff = weight - pEB[cellid];
90 
91  if (diff < pEBmin)
92  pEBmin = diff;
93  if (diff > pEBmax)
94  pEBmax = diff;
95 
96  barrel->Fill(phi, eta, diff);
97  }
98 
99  } // loop over cellid
100 }
101 
102 template <class floatCondObj>
103 void fillEEMap_DiffIOV(std::shared_ptr<floatCondObj> payload,
104  TH2F*& endc_m,
105  TH2F*& endc_p,
106  int irun,
107  float pEE[],
108  float& pEEmin,
109  float& pEEmax) {
110  // looping over the EE channels
111  for (int iz = -1; iz < 2; iz = iz + 2) // -1 or +1
112  for (int iy = IY_MIN; iy < IY_MAX + IY_MIN; iy++)
113  for (int ix = IX_MIN; ix < IX_MAX + IX_MIN; ix++)
114  if (EEDetId::validDetId(ix, iy, iz)) {
115  EEDetId myEEId = EEDetId(ix, iy, iz, EEDetId::XYMODE);
116  uint32_t cellid = myEEId.hashedIndex();
117  uint32_t rawid = myEEId.rawId();
119 
120  if (value_ptr == payload->end())
121  continue; // cell absent from payload
122  float weight = (float)(*value_ptr);
123 
124  if (irun == 0)
125  pEE[cellid] = weight;
126  else {
127  double diff = weight - pEE[cellid];
128  if (diff < pEEmin)
129  pEEmin = diff;
130 
131  if (diff > pEEmax)
132  pEEmax = diff;
133  if (iz == 1)
134  endc_p->Fill(ix, iy, diff);
135  else
136  endc_m->Fill(ix, iy, diff);
137  }
138 
139  } // validDetId
140 }
141 
144  const float& mean_x_EB,
145  const float& rms_EB,
146  const int& num_x_EB,
147  const float& mean_x_EE,
148  const float& rms_EE,
149  const int& num_x_EE) {
150  int NbRows = 2;
151  align = new TH2F(title.c_str(), "EB/EE mean_x rms num_x", 4, 0, 4, NbRows, 0, NbRows);
152 
153  double row = NbRows - 0.5;
154 
155  align->Fill(0.5, row, 1);
156  align->Fill(1.5, row, mean_x_EB);
157  align->Fill(2.5, row, rms_EB);
158  align->Fill(3.5, row, num_x_EB);
159 
160  row--;
161 
162  align->Fill(0.5, row, 2);
163  align->Fill(1.5, row, mean_x_EE);
164  align->Fill(2.5, row, rms_EE);
165  align->Fill(3.5, row, num_x_EE);
166 
167  align->GetXaxis()->SetTickLength(0.);
168  align->GetXaxis()->SetLabelSize(0.);
169  align->GetYaxis()->SetTickLength(0.);
170  align->GetYaxis()->SetLabelSize(0.);
171 }
change_name.diff
diff
Definition: change_name.py:13
runGCPTkAlMap.title
string title
Definition: runGCPTkAlMap.py:94
Reference_intrackfit_cff.barrel
list barrel
Definition: Reference_intrackfit_cff.py:37
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
align
Definition: AlignableIndexer.h:30
fillEEMap_SingleIOV
void fillEEMap_SingleIOV(std::shared_ptr< floatCondObj > payload, TH2F *&endc_m, TH2F *&endc_p)
Definition: EcalFloatCondObjectContainerUtils.h:47
kEEChannels
Definition: EcalFloatCondObjectContainerUtils.h:9
MAX_IPHI
Definition: EcalFloatCondObjectContainerUtils.h:14
IX_MAX
Definition: EcalFloatCondObjectContainerUtils.h:20
IY_MAX
Definition: EcalFloatCondObjectContainerUtils.h:21
EBDetId
Definition: EBDetId.h:17
mps_merge.weight
weight
Definition: mps_merge.py:88
PayloadInspector.h
EBDetId.h
EEDetId.h
EBDetId::unhashIndex
static EBDetId unhashIndex(int hi)
get a DetId from a compact index for arrays
Definition: EBDetId.h:110
fillTableWithSummary
void fillTableWithSummary(TH2F *&align, std::string title, const float &mean_x_EB, const float &rms_EB, const int &num_x_EB, const float &mean_x_EE, const float &rms_EE, const int &num_x_EE)
Definition: EcalFloatCondObjectContainerUtils.h:142
EcalCondObjectContainer.h
LEDCalibrationChannels.iphi
iphi
Definition: LEDCalibrationChannels.py:64
PVValHelper::eta
Definition: PVValidationHelpers.h:69
MIN_IETA
Definition: EcalFloatCondObjectContainerUtils.h:11
jets_cff.payload
payload
Definition: jets_cff.py:32
fillEBMap_DiffIOV
void fillEBMap_DiffIOV(std::shared_ptr< floatCondObj > payload, TH2F *&barrel, int irun, float pEB[], float &pEBmin, float &pEBmax)
Definition: EcalFloatCondObjectContainerUtils.h:69
EEDetId
Definition: EEDetId.h:14
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
IY_MIN
Definition: EcalFloatCondObjectContainerUtils.h:19
PVValHelper::phi
Definition: PVValidationHelpers.h:68
EEDetId::hashedIndex
int hashedIndex() const
Definition: EEDetId.h:183
MIN_IPHI
Definition: EcalFloatCondObjectContainerUtils.h:12
EEhistXMax
Definition: EcalFloatCondObjectContainerUtils.h:22
EBhistEtaMax
Definition: EcalFloatCondObjectContainerUtils.h:15
fillEEMap_DiffIOV
void fillEEMap_DiffIOV(std::shared_ptr< floatCondObj > payload, TH2F *&endc_m, TH2F *&endc_p, int irun, float pEE[], float &pEEmin, float &pEEmax)
Definition: EcalFloatCondObjectContainerUtils.h:103
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
EEDetId::XYMODE
static const int XYMODE
Definition: EEDetId.h:335
EBDetId::kSizeForDenseIndexing
Definition: EBDetId.h:155
EEDetId::validDetId
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
EcalCondObjectContainer::const_iterator
std::vector< Item >::const_iterator const_iterator
Definition: EcalCondObjectContainer.h:19
EBDetId::MIN_HASH
static const int MIN_HASH
Definition: EBDetId.h:149
kEBChannels
Definition: EcalFloatCondObjectContainerUtils.h:9
IX_MIN
Definition: EcalFloatCondObjectContainerUtils.h:18
weight
Definition: weight.py:1
fillEBMap_SingleIOV
void fillEBMap_SingleIOV(std::shared_ptr< floatCondObj > payload, TH2F *&barrel)
Definition: EcalFloatCondObjectContainerUtils.h:26
MAX_IETA
Definition: EcalFloatCondObjectContainerUtils.h:13