CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Container2D.cc
Go to the documentation of this file.
1 
4 
5 namespace hcaldqm
6 {
7  using namespace hcaldqm::axis;
8  using namespace hcaldqm::mapper;
9  using namespace constants;
10 
12  {
13  _xaxis = NULL;
14  _yaxis = NULL;
15  _zaxis = NULL;
16  }
17 
18  /* virtual */ Container2D::~Container2D()
19  {
20  // Container1D::~Container1D will be called as well
21  delete _zaxis; _zaxis=NULL;
22  }
23 
25  mapper::MapperType mt, axis::Axis *xaxis, axis::Axis* yaxis,
26  axis::Axis *zaxis):
27  Container1D(folder, nametitle, mt, xaxis, yaxis), _zaxis(zaxis)
28  {}
29 
30  /* virtual */ void Container2D::initialize(std::string const& folder,
31  std::string nametitle,
32  mapper::MapperType mt, axis::Axis *xaxis, axis::Axis* yaxis,
33  axis::Axis *zaxis, int debug/*=0*/)
34  {
35  Container1D::initialize(folder, nametitle, mt, xaxis, yaxis, debug);
36  _zaxis = zaxis;
37  }
38 
39  /* virtual */ void Container2D::fill(HcalDetId const& did)
40  {
41  _mes[_mapper.index(did)]->Fill(_xaxis->get(did),
42  _yaxis->get(did));
43  }
44 
45  // HcalDetId based
46  /* virtual */ void Container2D::fill(HcalDetId const& did, int x)
47  {
48  AxisQType xact = _xaxis->getType();
49  AxisQType yact = _yaxis->getType();
50  if (xact==fCoordinate && yact==fCoordinate)
51  _mes[_mapper.index(did)]->Fill(_xaxis->get(did),
52  _yaxis->get(did), x);
53  else if (xact==fCoordinate)
54  _mes[_mapper.index(did)]->Fill(_xaxis->get(did),
55  _yaxis->get(x));
56  else if (yact==fCoordinate)
57  _mes[_mapper.index(did)]->Fill(_xaxis->get(x), _yaxis->get(did));
58  }
59 
60  /* virtual */ void Container2D::fill(HcalDetId const& did, double x)
61  {
62  AxisQType xact = _xaxis->getType();
63  AxisQType yact = _yaxis->getType();
64  if (xact==fCoordinate && yact==fCoordinate)
65  _mes[_mapper.index(did)]->Fill(_xaxis->get(did),
66  _yaxis->get(did), x);
67  else if (xact==fCoordinate)
68  _mes[_mapper.index(did)]->Fill(_xaxis->get(did),
69  _yaxis->get(x));
70  else if (yact==fCoordinate)
71  _mes[_mapper.index(did)]->Fill(_xaxis->get(x), _yaxis->get(did));
72  }
73 
74  /* virtual */ void Container2D::fill(HcalDetId const& did,
75  int x, double y)
76  {
77  AxisQType xact = _xaxis->getType();
78  AxisQType yact = _yaxis->getType();
79  if (xact==fCoordinate && yact!=fCoordinate)
80  _mes[_mapper.index(did)]->Fill(_xaxis->get(did), _yaxis->get(x), y);
81  else if (xact!=fCoordinate && yact==fCoordinate)
82  _mes[_mapper.index(did)]->Fill(_xaxis->get(x), _yaxis->get(did), y);
83  else if (yact!=fCoordinate && xact!=fCoordinate)
84  _mes[_mapper.index(did)]->Fill(_xaxis->get(x), _yaxis->get(y));
85  }
86 
87  /* virtual */ void Container2D::fill(HcalDetId const& did,
88  double x, double y)
89  {
90  AxisQType xact = _xaxis->getType();
91  AxisQType yact = _yaxis->getType();
92  if (xact==fCoordinate && yact!=fCoordinate)
93  _mes[_mapper.index(did)]->Fill(_xaxis->get(did), _yaxis->get(x), y);
94  else if (xact!=fCoordinate && yact==fCoordinate)
95  _mes[_mapper.index(did)]->Fill(_xaxis->get(x), _yaxis->get(did), y);
96  else if (yact!=fCoordinate && xact!=fCoordinate)
97  _mes[_mapper.index(did)]->Fill(_xaxis->get(x), _yaxis->get(y));
98  }
99 
100  // HcalElectronicsId based
101  /* virtual */ void Container2D::fill(HcalElectronicsId const& eid)
102  {
103  _mes[_mapper.index(eid)]->Fill(_xaxis->get(eid),
104  _yaxis->get(eid));
105  }
106 
107  /* virtual */ void Container2D::fill(HcalElectronicsId const& eid, int x)
108  {
109  AxisQType xact = _xaxis->getType();
110  AxisQType yact = _yaxis->getType();
111  if (xact==fCoordinate && yact==fCoordinate)
112  _mes[_mapper.index(eid)]->Fill(_xaxis->get(eid),
113  _yaxis->get(eid), x);
114  else if (xact==fCoordinate)
115  _mes[_mapper.index(eid)]->Fill(_xaxis->get(eid),
116  _yaxis->get(x));
117  else if (yact==fCoordinate)
118  _mes[_mapper.index(eid)]->Fill(_xaxis->get(x), _yaxis->get(eid));
119  }
120 
121  /* virtual */ void Container2D::fill(HcalElectronicsId const& eid, double x)
122  {
123  AxisQType xact = _xaxis->getType();
124  AxisQType yact = _yaxis->getType();
125  if (xact==fCoordinate && yact==fCoordinate)
126  _mes[_mapper.index(eid)]->Fill(_xaxis->get(eid),
127  _yaxis->get(eid), x);
128  else if (xact==fCoordinate)
129  _mes[_mapper.index(eid)]->Fill(_xaxis->get(eid),
130  _yaxis->get(x));
131  else if (yact==fCoordinate)
132  _mes[_mapper.index(eid)]->Fill(_xaxis->get(x), _yaxis->get(eid));
133  }
134 
135  /* virtual */ void Container2D::fill(HcalElectronicsId const& eid,
136  int x, double y)
137  {
138  AxisQType xact = _xaxis->getType();
139  AxisQType yact = _yaxis->getType();
140  if (xact==fCoordinate && yact!=fCoordinate)
141  _mes[_mapper.index(eid)]->Fill(_xaxis->get(eid), _yaxis->get(x), y);
142  else if (xact!=fCoordinate && yact==fCoordinate)
143  _mes[_mapper.index(eid)]->Fill(_xaxis->get(x), _yaxis->get(eid), y);
144  else if (yact!=fCoordinate && xact!=fCoordinate)
145  _mes[_mapper.index(eid)]->Fill(_xaxis->get(x), _yaxis->get(y));
146  }
147 
148  /* virtual */ void Container2D::fill(HcalElectronicsId const& eid,
149  double x, double y)
150  {
151  AxisQType xact = _xaxis->getType();
152  AxisQType yact = _yaxis->getType();
153  if (xact==fCoordinate && yact!=fCoordinate)
154  _mes[_mapper.index(eid)]->Fill(_xaxis->get(eid), _yaxis->get(x), y);
155  else if (xact!=fCoordinate && yact==fCoordinate)
156  _mes[_mapper.index(eid)]->Fill(_xaxis->get(x), _yaxis->get(eid), y);
157  else if (yact!=fCoordinate && xact!=fCoordinate)
158  _mes[_mapper.index(eid)]->Fill(_xaxis->get(x), _yaxis->get(y));
159  }
160 
161  /* virtual */ void Container2D::fill(HcalTrigTowerDetId const& tid)
162  {
163  _mes[_mapper.index(tid)]->Fill(_xaxis->get(tid), _yaxis->get(tid));
164  }
165 
166  /* virtual */ void Container2D::fill(HcalTrigTowerDetId const& tid, int x)
167  {
168  AxisQType xact = _xaxis->getType();
169  AxisQType yact = _yaxis->getType();
170  if (xact==fCoordinate && yact==fCoordinate)
171  _mes[_mapper.index(tid)]->Fill(_xaxis->get(tid),
172  _yaxis->get(tid), x);
173  else if (xact==fCoordinate)
174  _mes[_mapper.index(tid)]->Fill(_xaxis->get(tid),
175  _yaxis->get(x));
176  else if (yact==fCoordinate)
177  _mes[_mapper.index(tid)]->Fill(_xaxis->get(x), _yaxis->get(tid));
178  }
179 
180  /* virtual */ void Container2D::fill(HcalTrigTowerDetId const& tid, double x)
181  {
182  AxisQType xact = _xaxis->getType();
183  AxisQType yact = _yaxis->getType();
184  if (xact==fCoordinate && yact==fCoordinate)
185  _mes[_mapper.index(tid)]->Fill(_xaxis->get(tid),
186  _yaxis->get(tid), x);
187  else if (xact==fCoordinate)
188  _mes[_mapper.index(tid)]->Fill(_xaxis->get(tid),
189  _yaxis->get(x));
190  else if (yact==fCoordinate)
191  _mes[_mapper.index(tid)]->Fill(_xaxis->get(x), _yaxis->get(tid));
192  }
193 
194  /* virtual */ void Container2D::fill(HcalTrigTowerDetId const& tid,
195  int x, int y)
196  {
197  AxisQType xact = _xaxis->getType();
198  AxisQType yact = _yaxis->getType();
199  if (xact==fCoordinate && yact!=fCoordinate)
200  _mes[_mapper.index(tid)]->Fill(_xaxis->get(tid), _yaxis->get(x), y);
201  else if (xact!=fCoordinate && yact==fCoordinate)
202  _mes[_mapper.index(tid)]->Fill(_xaxis->get(x), _yaxis->get(tid), y);
203  else if (yact!=fCoordinate && xact!=fCoordinate)
204  _mes[_mapper.index(tid)]->Fill(_xaxis->get(x), _yaxis->get(y));
205  }
206 
207  /* virtual */ void Container2D::fill(HcalTrigTowerDetId const& tid,
208  int x, double y)
209  {
210  AxisQType xact = _xaxis->getType();
211  AxisQType yact = _yaxis->getType();
212  if (xact==fCoordinate && yact!=fCoordinate)
213  _mes[_mapper.index(tid)]->Fill(_xaxis->get(tid), _yaxis->get(x), y);
214  else if (xact!=fCoordinate && yact==fCoordinate)
215  _mes[_mapper.index(tid)]->Fill(_xaxis->get(x), _yaxis->get(tid), y);
216  else if (yact!=fCoordinate && xact!=fCoordinate)
217  _mes[_mapper.index(tid)]->Fill(_xaxis->get(x), _yaxis->get(y));
218  }
219 
220  /* virtual */ void Container2D::fill(HcalTrigTowerDetId const& tid,
221  double x, double y)
222  {
223  AxisQType xact = _xaxis->getType();
224  AxisQType yact = _yaxis->getType();
225  if (xact==fCoordinate && yact!=fCoordinate)
226  _mes[_mapper.index(tid)]->Fill(_xaxis->get(tid), _yaxis->get(x), y);
227  else if (xact!=fCoordinate && yact==fCoordinate)
228  _mes[_mapper.index(tid)]->Fill(_xaxis->get(x), _yaxis->get(tid), y);
229  else if (yact!=fCoordinate && xact!=fCoordinate)
230  _mes[_mapper.index(tid)]->Fill(_xaxis->get(x), _yaxis->get(y));
231  }
232 
233  /* virtual */ void Container2D::book(DQMStore::IBooker &ib,
235  {
236  unsigned int size = _mapper.getSize();
237  ib.setCurrentFolder(subsystem+"/"+_folder+aux);
238  for (unsigned int i=0; i<size; i++)
239  {
240  std::string hname = _mapper.buildName(i);
241  MonitorElement *me = ib.book2D(_name+"_"+hname,
242  _name+" "+hname, _xaxis->_nbins, _xaxis->_min, _xaxis->_max,
244  TObject *o = me->getRootObject();
245  _xaxis->setLog(o);
246  _yaxis->setLog(o);
247  _zaxis->setLog(o);
248  _xaxis->setBitAxisLS(o);
249  _yaxis->setBitAxisLS(o);
252  me->setAxisTitle(_xaxis->_title, 1);
253  me->setAxisTitle(_yaxis->_title, 2);
254  me->setAxisTitle(_zaxis->_title, 3);
255  for (unsigned int i=0; i<_xaxis->_labels.size(); i++)
256  me->setBinLabel(i+1, _xaxis->_labels[i], 1);
257  for (unsigned int i=0; i<_yaxis->_labels.size(); i++)
258  me->setBinLabel(i+1, _yaxis->_labels[i], 2);
259  _mes.push_back(me);
260  }
261  }
262 
263  /* virtual */ void Container2D::setBinContent(int id, int x, int y, double z)
264  {
265  _mes[id]->setBinContent(_xaxis->getBin(x),
266  _yaxis->getBin(y), z);
267  }
268 
269  /* virtual */ void Container2D::setBinContent(unsigned int id,
270  int x, int y, double z)
271  {
272  _mes[id]->setBinContent(_xaxis->getBin(x),
273  _yaxis->getBin(y), z);
274  }
275 
276  /* virtual */ void Container2D::setBinContent(int id, int x, double y, double z)
277  {
278  _mes[id]->setBinContent(_xaxis->getBin(x),
279  _yaxis->getBin(y), z);
280  }
281 
282  /* virtual */ void Container2D::setBinContent(int id, double x, int y, double z)
283  {
284  _mes[id]->setBinContent(_xaxis->getBin(x),
285  _yaxis->getBin(y), z);
286  }
287 
288  /* virtual */ void Container2D::setBinContent(int id, double x, double y, double z)
289  {
290  _mes[id]->setBinContent(_xaxis->getBin(x),
291  _yaxis->getBin(y), z);
292  }
293 
294  /* virtual */ void Container2D::loadLabels(
295  std::vector<std::string> const& labels)
296  {
297  AxisQType xact = _xaxis->getType();
298  AxisQType yact = _yaxis->getType();
299  if (xact!=fFlag && yact!=fFlag)
300  return;
301  else if (xact!=fFlag)
302  _yaxis->loadLabels(labels);
303  else
304  _xaxis->loadLabels(labels);
305  }
306 }
307 
308 
int i
Definition: DBlmapReader.cc:9
virtual void book(DQMStore::IBooker &, std::string subsystem="Hcal", std::string aux="")
Definition: Container2D.cc:233
virtual void initialize(std::string const &folder, std::string nametitle, mapper::MapperType mt, axis::Axis *xaxis, axis::Axis *yaxis=new axis::CoordinateAxis(axis::fYaxis, axis::fiphi), axis::Axis *zaxis=new axis::ValueAxis(axis::fZaxis, axis::fEntries), int debug=0)
Definition: Container2D.cc:30
int ib
Definition: cuy.py:660
virtual void setBitAxisFlag(TObject *o)
Definition: Axis.h:95
virtual unsigned int index()
Definition: Mapper.h:128
virtual std::string buildName(unsigned id)
Definition: Mapper.h:226
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
#define NULL
Definition: scimark2.h:8
virtual int getBin(HcalDetId const &)
Definition: Axis.h:76
virtual int get(HcalDetId const &)
Definition: Axis.h:69
virtual void fill(HcalDetId const &)
Definition: Container2D.cc:39
mapper::Mapper _mapper
Definition: Container1D.h:109
std::string _title
Definition: Axis.h:105
virtual ~Container2D()
Definition: Container2D.cc:18
virtual void loadLabels(std::vector< std::string > const &)
Definition: Container2D.cc:294
virtual void loadLabels(std::vector< std::string > const &)
Definition: Axis.h:82
virtual void initialize(std::string const &folder, std::string const &nametitle, mapper::MapperType mt, axis::Axis *xaxis, axis::Axis *yaxis=new ValueAxis(fYaxis, fEntries), int debug=0)
Definition: Container1D.cc:28
std::vector< std::string > _labels
Definition: Axis.h:106
AxisQType getType()
Definition: Axis.h:85
std::string _folder
Definition: Container.h:42
virtual unsigned int size()
Definition: Container1D.h:96
TObject * getRootObject(void) const
#define debug
Definition: HDRShower.cc:19
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:273
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
axis::Axis * _xaxis
Definition: Container1D.h:110
axis::Axis * _yaxis
Definition: Container1D.h:111
void setLog(TObject *o)
Definition: Axis.h:86
virtual void setBitAxisLS(TObject *o)
Definition: Axis.h:91
virtual void setBinContent(int, int, int, double)
Definition: Container2D.cc:263
unsigned int getSize()
Definition: Mapper.h:517
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
Readout chain identification for Hcal.
std::string _name
Definition: Container.h:43