CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Container1D.cc
Go to the documentation of this file.
1 
3 
4 namespace hcaldqm
5 {
6  using namespace mapper;
7  using namespace axis;
8  using namespace constants;
9 
11  {
12  _xaxis = NULL;
13  _yaxis = NULL;
14  }
15 
16  /* virtual */ Container1D::~Container1D()
17  {
18  delete _xaxis; _xaxis=NULL;
19  delete _yaxis; _yaxis=NULL;
20  }
21 
23  std::string const& nametitle, mapper::MapperType mt, axis::Axis *xaxis,
24  axis::Axis *yaxis):
25  Container(folder, nametitle), _mapper(mt), _xaxis(xaxis), _yaxis(yaxis)
26  {}
27 
28  /* virtuial */ void Container1D::initialize(std::string const& folder,
29  std::string const& nametitle, mapper::MapperType mt, axis::Axis *xaxis,
30  axis::Axis *yaxis, int debug /* =0 */)
31  {
32  Container::initialize(folder, nametitle, debug);
33  _mapper.initialize(mt, debug);
34  _xaxis = xaxis;
35  _yaxis = yaxis;
36  }
37 
38  /* virtual */ void Container1D::fill(int id, int x)
39  {
40  _mes[_mapper.index(id)]->Fill(_xaxis->get(x));
41  }
42  /* virtual */ void Container1D::fill(int id, double x)
43  {
44  _mes[_mapper.index(id)]->Fill(_xaxis->get(x));
45  }
46  /* virtual */ void Container1D::fill(int id, int x, double y)
47  {
48  _mes[_mapper.index(id)]->Fill(_xaxis->get(x), _yaxis->get(y));
49  }
50  /* virtual */ void Container1D::fill(int id, double x, double y)
51  {
52  _mes[_mapper.index(id)]->Fill(_xaxis->get(x), _yaxis->get(y));
53  }
54 
55  /* virtual */ void Container1D::fill(int id, int x, int y, double z)
56  {
57  _mes[_mapper.index(id)]->Fill(_xaxis->get(x), _yaxis->get(y), z);
58  }
59 
60  /* virtual */ void Container1D::fill(int id, int x, double y, double z)
61  {
62  _mes[_mapper.index(id)]->Fill(_xaxis->get(x), _yaxis->get(y), z);
63  }
64 
65  /* virtual */ void Container1D::fill(int id, double x, double y, double z)
66  {
67  _mes[_mapper.index(id)]->Fill(_xaxis->get(x), _yaxis->get(y), z);
68  }
69 
70  /* virtual */ void Container1D::fill(HcalDetId const& did)
71  {
72  _mes[_mapper.index(did)]->Fill(_xaxis->get(did));
73  }
74  /* virtual */ void Container1D::fill(HcalDetId const& did, int x)
75  {
76  AxisQType act = _xaxis->getType();
77  if (act==fValue || act==fFlag)
78  _mes[_mapper.index(did)]->Fill(_xaxis->get(x));
79  else if (act==fCoordinate)
80  _mes[_mapper.index(did)]->Fill(_xaxis->get(did), _yaxis->get(x));
81  }
82  /* virtual */ void Container1D::fill(HcalDetId const& did, double x)
83  {
84  AxisQType act = _xaxis->getType();
85  if (act==fValue || act==fFlag)
86  _mes[_mapper.index(did)]->Fill(_xaxis->get(x));
87  else if (act==fCoordinate)
88  _mes[_mapper.index(did)]->Fill(_xaxis->get(did), _yaxis->get(x));
89  }
90  /* virtual */ void Container1D::fill(HcalDetId const& did, int x, double y)
91  {
92  AxisQType act = _xaxis->getType();
93  if (act==fValue || act==fFlag)
94  _mes[_mapper.index(did)]->Fill(_xaxis->get(x), _yaxis->get(y));
95  else if (act==fCoordinate)
96  _mes[_mapper.index(did)]->Fill(_xaxis->get(did), _yaxis->get(x), y);
97  }
98  /* virtual */ void Container1D::fill(HcalDetId const& did, int x, int y)
99  {
100  AxisQType act = _xaxis->getType();
101  if (act==fValue || act==fFlag)
102  _mes[_mapper.index(did)]->Fill(_xaxis->get(x), _yaxis->get(y));
103  else if (act==fCoordinate)
104  _mes[_mapper.index(did)]->Fill(_xaxis->get(did), _yaxis->get(x), y);
105  }
106  /* virtual */ void Container1D::fill(HcalDetId const& did, double x ,
107  double y)
108  {
109  AxisQType act = _xaxis->getType();
110  if (act==fValue || act==fFlag)
111  _mes[_mapper.index(did)]->Fill(_xaxis->get(x), _yaxis->get(y));
112  else if (act==fCoordinate)
113  _mes[_mapper.index(did)]->Fill(_xaxis->get(did), _yaxis->get(x), y);
114  }
115 
116  /* virtual */ void Container1D::fill(HcalElectronicsId const& eid)
117  {
118  _mes[_mapper.index(eid)]->Fill(_xaxis->get(eid));
119  }
120  /* virtual */ void Container1D::fill(HcalElectronicsId const& eid, int x)
121  {
122  AxisQType act = _xaxis->getType();
123  if (act==fValue || act==fFlag)
124  _mes[_mapper.index(eid)]->Fill(_xaxis->get(x));
125  else if (act==fCoordinate)
126  _mes[_mapper.index(eid)]->Fill(_xaxis->get(eid), _yaxis->get(x));
127  }
128  /* virtual */ void Container1D::fill(HcalElectronicsId const& eid, double x)
129  {
130  AxisQType act = _xaxis->getType();
131  if (act==fValue || act==fFlag)
132  _mes[_mapper.index(eid)]->Fill(_xaxis->get(x));
133  else if (act==fCoordinate)
134  _mes[_mapper.index(eid)]->Fill(_xaxis->get(eid), _yaxis->get(x));
135  }
136  /* virtual */ void Container1D::fill(HcalElectronicsId const& eid,
137  int x, double y)
138  {
139  AxisQType act = _xaxis->getType();
140  if (act==fValue || act==fFlag)
141  _mes[_mapper.index(eid)]->Fill(_xaxis->get(x), _yaxis->get(y));
142  else if (act==fCoordinate)
143  _mes[_mapper.index(eid)]->Fill(_xaxis->get(eid), _yaxis->get(x), y);
144  }
145  /* virtual */ void Container1D::fill(HcalElectronicsId const& eid,
146  double x, double y)
147  {
148  AxisQType act = _xaxis->getType();
149  if (act==fValue || act==fFlag)
150  _mes[_mapper.index(eid)]->Fill(_xaxis->get(x), _yaxis->get(y));
151  else if (act==fCoordinate)
152  _mes[_mapper.index(eid)]->Fill(_xaxis->get(eid), _yaxis->get(x), y);
153  }
154 
155  /* virtual */ void Container1D::fill(HcalTrigTowerDetId const& tid)
156  {
157  _mes[_mapper.index(tid)]->Fill(_xaxis->get(tid));
158  }
159 
160  /* virtual */ void Container1D::fill(HcalTrigTowerDetId const& tid, int x)
161  {
162  AxisQType act = _xaxis->getType();
163  if (act==fCoordinate)
164  _mes[_mapper.index(tid)]->Fill(_xaxis->get(tid), _yaxis->get(x));
165  else
166  _mes[_mapper.index(tid)]->Fill(_xaxis->get(x));
167  }
168 
169  /* virtual */ void Container1D::fill(HcalTrigTowerDetId const& tid, double x)
170  {
171  AxisQType act = _xaxis->getType();
172  if (act==fCoordinate)
173  _mes[_mapper.index(tid)]->Fill(_xaxis->get(tid), _yaxis->get(x));
174  else
175  _mes[_mapper.index(tid)]->Fill(_xaxis->get(x));
176  }
177 
178  /* virtual */ void Container1D::fill(HcalTrigTowerDetId const& tid, int x,
179  int y)
180  {
181  AxisQType act = _xaxis->getType();
182  if (act==fCoordinate)
183  _mes[_mapper.index(tid)]->Fill(_xaxis->get(tid), _yaxis->get(x), y);
184  else
185  _mes[_mapper.index(tid)]->Fill(_xaxis->get(x), _yaxis->get(y));
186  }
187 
188  /* virtual */ void Container1D::fill(HcalTrigTowerDetId const& tid, int x,
189  double y)
190  {
191  AxisQType act = _xaxis->getType();
192  if (act==fCoordinate)
193  _mes[_mapper.index(tid)]->Fill(_xaxis->get(tid), _yaxis->get(x), y);
194  else
195  _mes[_mapper.index(tid)]->Fill(_xaxis->get(x), _yaxis->get(y));
196  }
197 
198  /* virtual */ void Container1D::book(DQMStore::IBooker& ib,
200  {
201 
202  unsigned int size = _mapper.getSize();
203  ib.setCurrentFolder(subsystem+"/"+_folder+aux);
204  for (unsigned int i=0; i<size; i++)
205  {
206 // utilities::log(_name);
207  std::string hname = _mapper.buildName(i);
208  MonitorElement *me = ib.book1D(_name+"_"+hname, _name +" "+hname,
210  TObject *o = me->getRootObject();
211  _xaxis->setLog(o);
212  _yaxis->setLog(o);
213  _xaxis->setBitAxisLS(o);
214  _yaxis->setBitAxisLS(o);
217  me->setAxisTitle(_xaxis->_title, 1);
218  me->setAxisTitle(_yaxis->_title, 2);
219  for (unsigned int i=0; i<_xaxis->_labels.size(); i++)
220  me->setBinLabel(i+1, _xaxis->_labels[i]);
221  _mes.push_back(me);
222  }
223  }
224 
225  /* virtual */ double Container1D::getBinContent(unsigned int id, int x)
226  {
227  return _mes[id]->getBinContent(_xaxis->getBin(x));
228  }
229 
230  /* virtual */ void Container1D::reset()
231  {
232  for (MEVector::const_iterator it=_mes.begin(); it!=_mes.end(); ++it)
233  (*it)->Reset();
234  }
235 
236  /* virtual */ MonitorElement* Container1D::at(unsigned int i)
237  {
238  return _mes[i];
239  }
240 
241  /* virtual */ MonitorElement* Container1D::at(HcalDetId const& did)
242  {
243  return _mes[_mapper.index(did)];
244  }
245 
247  {
248  return _mes[_mapper.index(eid)];
249  }
250 
252  {
253  return _mes[_mapper.index(tid)];
254  }
255 }
256 
257 
258 
259 
260 
261 
262 
int i
Definition: DBlmapReader.cc:9
int ib
Definition: cuy.py:660
virtual void setBitAxisFlag(TObject *o)
Definition: Axis.h:98
virtual void book(DQMStore::IBooker &, std::string subsystem="Hcal", std::string aux="")
Definition: Container1D.cc:198
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:79
virtual int get(HcalDetId const &)
Definition: Axis.h:72
mapper::Mapper _mapper
Definition: Container1D.h:109
virtual void reset()
Definition: Container1D.cc:230
std::string _title
Definition: Axis.h:108
virtual void fill(double)
Definition: Container1D.h:53
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
virtual void initialize(std::string const &folder, std::string const &name, int debug=0)
Definition: Container.h:33
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:109
AxisQType getType()
Definition: Axis.h:88
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
virtual MonitorElement * at(unsigned int i)
Definition: Container1D.cc:236
axis::Axis * _xaxis
Definition: Container1D.h:110
axis::Axis * _yaxis
Definition: Container1D.h:111
void setLog(TObject *o)
Definition: Axis.h:89
virtual void setBitAxisLS(TObject *o)
Definition: Axis.h:94
unsigned int getSize()
Definition: Mapper.h:517
virtual double getBinContent(unsigned int, int)
Definition: Container1D.cc:225
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
virtual ~Container1D()
Definition: Container1D.cc:16
virtual void initialize(MapperType type, int debug=0)
Definition: Mapper.h:122