CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Enumerations | Functions
EcalFloatCondObjectContainerUtils.h File Reference
#include "CondCore/Utilities/interface/PayloadInspector.h"
#include "DataFormats/EcalDetId/interface/EBDetId.h"
#include "DataFormats/EcalDetId/interface/EEDetId.h"
#include "CondFormats/EcalObjects/interface/EcalCondObjectContainer.h"
#include "TH2F.h"
#include <string>

Go to the source code of this file.

Enumerations

enum  { kEBChannels = 61200, kEEChannels = 14648 }
 
enum  {
  MIN_IETA = 1, MIN_IPHI = 1, MAX_IETA = 85, MAX_IPHI = 360,
  EBhistEtaMax = 171
}
 
enum  {
  IX_MIN = 1, IY_MIN = 1, IX_MAX = 100, IY_MAX = 100,
  EEhistXMax = 220
}
 

Functions

template<class floatCondObj >
void fillEBMap_SingleIOV (std::shared_ptr< floatCondObj > payload, TH2F *&barrel)
 
template<class floatCondObj >
void fillEBMap_TwoIOVs (std::shared_ptr< floatCondObj > payload, TH2F *&barrel, int irun, float pEB[], float &pEBmin, float &pEBmax, int method)
 
template<class floatCondObj >
void fillEEMap_SingleIOV (std::shared_ptr< floatCondObj > payload, TH2F *&endc_m, TH2F *&endc_p)
 
template<class floatCondObj >
void fillEEMap_TwoIOVs (std::shared_ptr< floatCondObj > payload, TH2F *&endc_m, TH2F *&endc_p, int irun, float pEE[], float &pEEmin, float &pEEmax, int method)
 
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)
 

Enumeration Type Documentation

anonymous enum
Enumerator
kEBChannels 
kEEChannels 

Definition at line 9 of file EcalFloatCondObjectContainerUtils.h.

anonymous enum
Enumerator
MIN_IETA 
MIN_IPHI 
MAX_IETA 
MAX_IPHI 
EBhistEtaMax 

Definition at line 10 of file EcalFloatCondObjectContainerUtils.h.

10  {
11  MIN_IETA = 1,
12  MIN_IPHI = 1,
13  MAX_IETA = 85,
14  MAX_IPHI = 360,
15  EBhistEtaMax = 171
16 }; // barrel lower and upper bounds on eta and phi
anonymous enum
Enumerator
IX_MIN 
IY_MIN 
IX_MAX 
IY_MAX 
EEhistXMax 

Definition at line 17 of file EcalFloatCondObjectContainerUtils.h.

17  {
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

Function Documentation

template<class floatCondObj >
void fillEBMap_SingleIOV ( std::shared_ptr< floatCondObj >  payload,
TH2F *&  barrel 
)

Definition at line 26 of file EcalFloatCondObjectContainerUtils.h.

References EcalCondObjectContainer< T >::end(), PVValHelper::eta, EBDetId::kSizeForDenseIndexing, EBDetId::MIN_HASH, PVValHelper::phi, EBDetId::unhashIndex(), and histoStyle::weight.

26  {
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 }
static const int MIN_HASH
Definition: EBDetId.h:149
std::vector< Item >::const_iterator const_iterator
static EBDetId unhashIndex(int hi)
get a DetId from a compact index for arrays
Definition: EBDetId.h:110
int weight
Definition: histoStyle.py:51
template<class floatCondObj >
void fillEBMap_TwoIOVs ( std::shared_ptr< floatCondObj >  payload,
TH2F *&  barrel,
int  irun,
float  pEB[],
float &  pEBmin,
float &  pEBmax,
int  method 
)

Definition at line 69 of file EcalFloatCondObjectContainerUtils.h.

References runTauDisplay::dr, EcalCondObjectContainer< T >::end(), PVValHelper::eta, EBDetId::kSizeForDenseIndexing, EBDetId::MIN_HASH, PVValHelper::phi, EBDetId::unhashIndex(), and histoStyle::weight.

75  {
76  for (int cellid = EBDetId::MIN_HASH; cellid < EBDetId::kSizeForDenseIndexing; ++cellid) {
77  uint32_t rawid = EBDetId::unhashIndex(cellid);
79  if (value_ptr == payload->end())
80  continue; // cell absent from payload
81 
82  float weight = (float)(*value_ptr);
83  if (irun == 0)
84  pEB[cellid] = weight;
85  else {
86  Double_t phi = (Double_t)(EBDetId(rawid)).iphi() - 0.5;
87  Double_t eta = (Double_t)(EBDetId(rawid)).ieta();
88 
89  if (eta > 0.)
90  eta = eta - 0.5; // 0.5 to 84.5
91  else
92  eta = eta + 0.5; // -84.5 to -0.5
93  double dr;
94  if (method == 0) {
95  dr = weight - pEB[cellid];
96  } // diff
97  else {
98  if (pEB[cellid] != 0.)
99  dr = weight / pEB[cellid];
100  else {
101  if (weight == 0.)
102  dr = 1.;
103  else
104  dr = 9999.; // use a large value
105  }
106  } // ratio
107  if (dr < pEBmin)
108  pEBmin = dr;
109  if (dr > pEBmax)
110  pEBmax = dr;
111  barrel->Fill(phi, eta, dr);
112  }
113  } // loop over cellid
114 }
static const int MIN_HASH
Definition: EBDetId.h:149
std::vector< Item >::const_iterator const_iterator
static EBDetId unhashIndex(int hi)
get a DetId from a compact index for arrays
Definition: EBDetId.h:110
int weight
Definition: histoStyle.py:51
template<class floatCondObj >
void fillEEMap_SingleIOV ( std::shared_ptr< floatCondObj >  payload,
TH2F *&  endc_m,
TH2F *&  endc_p 
)

Definition at line 47 of file EcalFloatCondObjectContainerUtils.h.

References EcalCondObjectContainer< T >::end(), IX_MAX, IX_MIN, IY_MAX, IY_MIN, DetId::rawId(), EEDetId::validDetId(), histoStyle::weight, and EEDetId::XYMODE.

47  {
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 }
static const int XYMODE
Definition: EEDetId.h:335
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
std::vector< Item >::const_iterator const_iterator
int weight
Definition: histoStyle.py:51
template<class floatCondObj >
void fillEEMap_TwoIOVs ( std::shared_ptr< floatCondObj >  payload,
TH2F *&  endc_m,
TH2F *&  endc_p,
int  irun,
float  pEE[],
float &  pEEmin,
float &  pEEmax,
int  method 
)

Definition at line 117 of file EcalFloatCondObjectContainerUtils.h.

References runTauDisplay::dr, EcalCondObjectContainer< T >::end(), EEDetId::hashedIndex(), IX_MAX, IX_MIN, IY_MAX, IY_MIN, DetId::rawId(), EEDetId::validDetId(), histoStyle::weight, and EEDetId::XYMODE.

124  {
125  // looping over the EE channels
126  for (int iz = -1; iz < 2; iz = iz + 2) // -1 or +1
127  for (int iy = IY_MIN; iy < IY_MAX + IY_MIN; iy++)
128  for (int ix = IX_MIN; ix < IX_MAX + IX_MIN; ix++)
129  if (EEDetId::validDetId(ix, iy, iz)) {
130  EEDetId myEEId = EEDetId(ix, iy, iz, EEDetId::XYMODE);
131  uint32_t cellid = myEEId.hashedIndex();
132  uint32_t rawid = myEEId.rawId();
134 
135  if (value_ptr == payload->end())
136  continue; // cell absent from payload
137  float weight = (float)(*value_ptr);
138 
139  if (irun == 0)
140  pEE[cellid] = weight;
141  else {
142  double dr;
143  if (method == 0) {
144  dr = weight - pEE[cellid];
145  } // diff
146  else {
147  if (pEE[cellid] != 0.)
148  dr = weight / pEE[cellid];
149  else {
150  if (weight == 0.)
151  dr = 1.;
152  else
153  dr = 9999.; // use a large value
154  }
155  } // ratio
156  if (dr < pEEmin)
157  pEEmin = dr;
158  if (dr > pEEmax)
159  pEEmax = dr;
160  if (iz == 1)
161  endc_p->Fill(ix, iy, dr);
162  else
163  endc_m->Fill(ix, iy, dr);
164  }
165 
166  } // validDetId
167 }
static const int XYMODE
Definition: EEDetId.h:335
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
int hashedIndex() const
Definition: EEDetId.h:183
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
std::vector< Item >::const_iterator const_iterator
int weight
Definition: histoStyle.py:51
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 
)
inline

Definition at line 169 of file EcalFloatCondObjectContainerUtils.h.

176  {
177  int NbRows = 2;
178  align = new TH2F(title.c_str(), "EB/EE mean_x rms num_x", 4, 0, 4, NbRows, 0, NbRows);
179 
180  double row = NbRows - 0.5;
181 
182  align->Fill(0.5, row, 1);
183  align->Fill(1.5, row, mean_x_EB);
184  align->Fill(2.5, row, rms_EB);
185  align->Fill(3.5, row, num_x_EB);
186 
187  row--;
188 
189  align->Fill(0.5, row, 2);
190  align->Fill(1.5, row, mean_x_EE);
191  align->Fill(2.5, row, rms_EE);
192  align->Fill(3.5, row, num_x_EE);
193 
194  align->GetXaxis()->SetTickLength(0.);
195  align->GetXaxis()->SetLabelSize(0.);
196  align->GetYaxis()->SetTickLength(0.);
197  align->GetYaxis()->SetLabelSize(0.);
198 }