CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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(0), labels(0), title("") {}
82  AxisSpecs(AxisSpecs const& _specs) :
83  nbins(_specs.nbins), low(_specs.low), high(_specs.high), edges(0), labels(0), 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 = 0; }
97  if(labels){ delete [] labels; labels = 0; }
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 
141  AxisSpecs formAxis(edm::ParameterSet const&);
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);
158  AxisSpecs getBinningEcal_(BinningType, bool, 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
int findBinCrystal_(ObjectType, DetId const &, int=-1)
int findBinRCT_(ObjectType, DetId const &)
int i
Definition: DBlmapReader.cc:9
int findBinTriggerTower_(ObjectType, DetId const &)
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)
ObjectType getObject(ObjectType, unsigned)
ObjectType translateObjectType(std::string const &)
AxisSpecs getBinning(ObjectType, BinningType, bool, int, unsigned)
int findBinSuperCrystal_(ObjectType, DetId const &, int=-1)
AxisSpecs getBinningSMMEM_(BinningType, bool, unsigned, int)
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)
int findBin1D(ObjectType, BinningType, DetId const &)
std::string channelName(uint32_t, BinningType _btype=kDCC)
Definition: DetId.h:18
int findBin2D(ObjectType, BinningType, DetId const &)
unsigned findPlotIndex(ObjectType, DetId const &)
AxisSpecs getBinningEE_(BinningType, bool, int, int)
void fillAxisDescriptions(edm::ParameterSetDescription &)
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)