CMS 3D CMS Logo

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