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 {
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(0), labels(0), title("") {}
80  AxisSpecs(AxisSpecs const& _specs) :
81  nbins(_specs.nbins), low(_specs.low), high(_specs.high), edges(0), labels(0), title(_specs.title)
82  {
83  if(_specs.edges){
84  edges = new float[nbins + 1];
85  for(int i(0); i <= nbins; i++) edges[i] = _specs.edges[i];
86  }
87  if(_specs.labels){
88  labels = new std::string[nbins];
89  for(int i(0); i < nbins; i++) labels[i] = _specs.labels[i];
90  }
91  }
93  {
94  if(edges){ delete [] edges; edges = 0; }
95  if(labels){ delete [] labels; labels = 0; }
96  nbins = _rhs.nbins; low = _rhs.low; high = _rhs.high; title = _rhs.title;
97  if(_rhs.edges){
98  edges = new float[nbins + 1];
99  for(int i(0); i <= nbins; i++) edges[i] = _rhs.edges[i];
100  }
101  if(_rhs.labels){
102  labels = new std::string[nbins];
103  for(int i(0); i < nbins; i++) labels[i] = _rhs.labels[i];
104  }
105  return *this;
106  }
108  {
109  delete [] edges;
110  delete [] labels;
111  }
112  };
113 
114  AxisSpecs getBinning(ObjectType, BinningType, bool, int, unsigned);
115 
116  int findBin1D(ObjectType, BinningType, DetId const&);
118  int findBin1D(ObjectType, BinningType, int);
119 
120  int findBin2D(ObjectType, BinningType, DetId const&);
122  int findBin2D(ObjectType, BinningType, int);
123 
124  unsigned findPlotIndex(ObjectType, DetId const&);
125  unsigned findPlotIndex(ObjectType, EcalElectronicsId const&);
126  unsigned findPlotIndex(ObjectType, int, BinningType _btype = kDCC);
127 
128  ObjectType getObject(ObjectType, unsigned);
129 
130  unsigned getNObjects(ObjectType);
131 
132  bool isValidIdBin(ObjectType, BinningType, unsigned, int);
133 
134  std::string channelName(uint32_t, BinningType _btype = kDCC);
135 
136  uint32_t idFromName(std::string const&);
137  uint32_t idFromBin(ObjectType, BinningType, unsigned, int);
138 
139  AxisSpecs formAxis(edm::ParameterSet const&);
141 
145 
146  /* Functions used only internally within binning namespace */
147 
148  // used for SM binnings
149  int xlow_(int);
150  int ylow_(int);
151 
152  AxisSpecs getBinningEB_(BinningType, bool, int);
153  AxisSpecs getBinningEE_(BinningType, bool, int, int);
154  AxisSpecs getBinningSM_(BinningType, bool, unsigned, int);
155  AxisSpecs getBinningSMMEM_(BinningType, bool, unsigned, int);
156  AxisSpecs getBinningEcal_(BinningType, bool, int);
157  AxisSpecs getBinningMEM_(BinningType, bool, int, int);
158 
159  int findBinCrystal_(ObjectType, DetId const&, int = -1);
162  int findBinSuperCrystal_(ObjectType, DetId const&, int = -1);
164  }
165 }
166 
167 #endif
int findBinCrystal_(ObjectType, DetId const &, int=-1)
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 &)
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)