CMS 3D CMS Logo

MESetBinningUtils.h
Go to the documentation of this file.
1 #ifndef MESetBinningUtils_H
2 #define MESetBinningUtils_H
3 
6 
7 #include <string>
8 
9 class DetId;
10 class EcalElectronicsId;
11 namespace edm {
12  class ParameterSet;
14 } // namespace edm
15 
16 namespace ecaldqm {
17  namespace binning {
18  enum ObjectType {
19  kEB,
20  kEE,
23  kSM,
39  };
40 
41  enum BinningType {
55  };
56 
57  enum Constants {
59 
60  nEBSMEta = 85,
61  nEBSMPhi = 20,
62  nEESMX = 40,
63  nEESMXRed = 30, // for EE+-01&05&09
64  nEESMXExt = 45, // for EE+-02&08
65  nEESMY = 40,
66  nEESMYRed = 35, // for EE+-03&07
67 
68  nEBEtaBins = 34,
69  nEEEtaBins = 20,
70  nPhiBins = 36
71  };
72 
73  struct AxisSpecs {
74  int nbins;
75  float low, high;
76  float *edges;
79  AxisSpecs() : nbins(0), low(0.), high(0.), edges(nullptr), labels(nullptr), title("") {}
80  AxisSpecs(AxisSpecs const &_specs)
81  : nbins(_specs.nbins),
82  low(_specs.low),
83  high(_specs.high),
84  edges(nullptr),
85  labels(nullptr),
86  title(_specs.title) {
87  if (_specs.edges) {
88  edges = new float[nbins + 1];
89  for (int i(0); i <= nbins; i++)
90  edges[i] = _specs.edges[i];
91  }
92  if (_specs.labels) {
93  labels = new std::string[nbins];
94  for (int i(0); i < nbins; i++)
95  labels[i] = _specs.labels[i];
96  }
97  }
98  AxisSpecs &operator=(AxisSpecs const &_rhs) {
99  if (edges) {
100  delete[] edges;
101  edges = nullptr;
102  }
103  if (labels) {
104  delete[] labels;
105  labels = nullptr;
106  }
107  nbins = _rhs.nbins;
108  low = _rhs.low;
109  high = _rhs.high;
110  title = _rhs.title;
111  if (_rhs.edges) {
112  edges = new float[nbins + 1];
113  for (int i(0); i <= nbins; i++)
114  edges[i] = _rhs.edges[i];
115  }
116  if (_rhs.labels) {
117  labels = new std::string[nbins];
118  for (int i(0); i < nbins; i++)
119  labels[i] = _rhs.labels[i];
120  }
121  return *this;
122  }
124  delete[] edges;
125  delete[] labels;
126  }
127  };
128 
129  AxisSpecs getBinning(EcalElectronicsMapping const *, ObjectType, BinningType, bool, int, unsigned);
130 
134 
138 
139  unsigned findPlotIndex(EcalElectronicsMapping const *, ObjectType, DetId const &);
141  unsigned findPlotIndex(EcalElectronicsMapping const *, ObjectType, int, BinningType _btype = kDCC);
142 
143  ObjectType getObject(ObjectType, unsigned);
144 
145  unsigned getNObjects(ObjectType);
146 
147  bool isValidIdBin(EcalElectronicsMapping const *, ObjectType, BinningType, unsigned, int);
148 
149  std::string channelName(EcalElectronicsMapping const *, uint32_t, BinningType _btype = kDCC);
150 
151  uint32_t idFromName(std::string const &);
152  uint32_t idFromBin(ObjectType, BinningType, unsigned, int);
153 
154  AxisSpecs formAxis(edm::ParameterSet const &);
156 
160 
161  /* Functions used only internally within binning namespace */
162 
163  // used for SM binnings
164  int xlow_(int);
165  int ylow_(int);
166 
167  AxisSpecs getBinningEB_(BinningType, bool, int);
168  AxisSpecs getBinningEE_(BinningType, bool, int, int);
169  AxisSpecs getBinningSM_(BinningType, bool, unsigned, int, EcalElectronicsMapping const *);
170  AxisSpecs getBinningSMMEM_(BinningType, bool, unsigned, int);
171  AxisSpecs getBinningEcal_(BinningType, bool, int);
172  AxisSpecs getBinningMEM_(BinningType, bool, int, int);
173 
174  int findBinCrystal_(EcalElectronicsMapping const *, ObjectType, DetId const &, int = -1);
178  int findBinRCT_(ObjectType, DetId const &);
179  int findBinSuperCrystal_(EcalElectronicsMapping const *, ObjectType, DetId const &, int = -1);
181  } // namespace binning
182 } // namespace ecaldqm
183 
184 #endif
int findBinRCT_(ObjectType, DetId const &)
bool isValidIdBin(EcalElectronicsMapping const *, ObjectType, BinningType, unsigned, int)
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
int findBinPseudoStrip_(EcalElectronicsMapping const *, ObjectType, DetId const &)
unsigned getNObjects(ObjectType)
int findBinCrystal_(EcalElectronicsMapping const *, ObjectType, DetId const &, int=-1)
ObjectType getObject(ObjectType, unsigned)
AxisSpecs getBinningSM_(BinningType, bool, unsigned, int, EcalElectronicsMapping const *)
ObjectType translateObjectType(std::string const &)
dqm::legacy::MonitorElement::Kind translateKind(std::string const &)
AxisSpecs getBinningSMMEM_(BinningType, bool, unsigned, int)
AxisSpecs(AxisSpecs const &_specs)
AxisSpecs getBinningEB_(BinningType, bool, int)
int findBin2D(EcalElectronicsMapping const *, ObjectType, BinningType, DetId const &)
AxisSpecs & operator=(AxisSpecs const &_rhs)
int findBinTriggerTower_(EcalElectronicsMapping const *, ObjectType, DetId const &)
uint32_t idFromName(std::string const &)
Definition: DetId.h:17
int findBinSuperCrystal_(EcalElectronicsMapping const *, ObjectType, DetId const &, int=-1)
unsigned findPlotIndex(EcalElectronicsMapping const *, ObjectType, DetId const &)
AxisSpecs getBinningEE_(BinningType, bool, int, int)
AxisSpecs getBinning(EcalElectronicsMapping const *, ObjectType, BinningType, bool, int, unsigned)
HLT enums.
void fillAxisDescriptions(edm::ParameterSetDescription &)
std::string channelName(EcalElectronicsMapping const *, uint32_t, BinningType _btype=kDCC)
BinningType translateBinningType(std::string const &)
AxisSpecs formAxis(edm::ParameterSet const &)
AxisSpecs getBinningMEM_(BinningType, bool, int, int)
int findBin1D(EcalElectronicsMapping const *, ObjectType, BinningType, DetId const &)
AxisSpecs getBinningEcal_(BinningType, bool, int)
uint32_t idFromBin(ObjectType, BinningType, unsigned, int)