CMS 3D CMS Logo

ContainerSingle1D.cc
Go to the documentation of this file.
2 
3 namespace hcaldqm
4 {
5  using namespace quantity;
6  using namespace constants;
8  {
9  _qx = nullptr;
10  _qy = nullptr;
11  }
12 
14  Container(c._folder, c._qname)
15  {
16  _qx = c._qx->makeCopy();
17  _qy = c._qy->makeCopy();
18  }
19 
21  Quantity *qx, Quantity *qy):
22  Container(folder, qy->name()+"vs"+qx->name()), _qx(qx), _qy(qy)
23  {
26  }
27 
29  std::string const& qname,
30  Quantity *qx, Quantity *qy):
31  Container(folder, qname), _qx(qx), _qy(qy)
32  {
35  }
36 
38  {
39  if (_qx!=nullptr)
40  delete _qx;
41  if (_qy!=nullptr)
42  delete _qy;
43  _qx = nullptr;
44  _qy = nullptr;
45  }
46 
48  Quantity *qx, Quantity *qy, int debug/*=0*/)
49  {
50  Container::initialize(folder, qy->name()+"vs"+qx->name(), debug);
51  _qx = qx;
52  _qy = qy;
55  }
56 
58  std::string const& qname,
59  Quantity *qx, Quantity *qy, int debug/*=0*/)
60  {
61  Container::initialize(folder, qname, debug);
62  _qx = qx;
63  _qy = qy;
66  }
67 
69  std::string subsystem, std::string aux)
70  {
71  ib.setCurrentFolder(subsystem+"/"+_folder+"/"+_qname);
72  _me = ib.book1D(_qname+(aux.empty()?aux:"_"+aux),
73  _qname+(aux.empty()?aux:" "+aux),
74  _qx->nbins(), _qx->min(), _qx->max());
75  customize();
76  }
77 
78  /* virtual */ void ContainerSingle1D::customize()
79  {
80  _me->setAxisTitle(_qx->name(), 1);
81  _me->setAxisTitle(_qy->name(), 2);
82 
83  TH1 *h = _me->getTH1();
84  _qx->setBits(h);
85  _qy->setBits(h);
86 
87  std::vector<std::string> xlabels = _qx->getLabels();
88  for (unsigned int i=0; i<xlabels.size(); i++)
89  _me->setBinLabel(i+1, xlabels[i], 1);
90  }
91 
92  /* virtual */ void ContainerSingle1D::fill(int x)
93  {
94  _me->Fill(_qx->getValue(x));
95  }
96 
97  /* virtual */ void ContainerSingle1D::fill(double x)
98  {
99  _me->Fill(_qx->getValue(x));
100  }
101 
102  /* virtual */ void ContainerSingle1D::fill(int x, int y)
103  {
104  _me->Fill(_qx->getValue(x), _qy->getValue(y));
105  }
106 
107  /* virtual */ void ContainerSingle1D::fill(int x, double y)
108  {
109  _me->Fill(_qx->getValue(x), _qy->getValue(y));
110  }
111 
112  /* virtual */ void ContainerSingle1D::fill(double x, int y)
113  {
114  _me->Fill(_qx->getValue(x), _qy->getValue(y));
115  }
116 
117  /* virtual */ void ContainerSingle1D::fill(double x, double y)
118  {
119  _me->Fill(_qx->getValue(x), _qy->getValue(y));
120  }
121 
122  /* virtual */ double ContainerSingle1D::getBinContent(int x)
123  {
124  return _me->getBinContent(_qx->getBin(x));
125  }
126  /* virtual */ double ContainerSingle1D::getBinContent(double x)
127  {
128  return _me->getBinContent(_qx->getBin(x));
129  }
130  /* virtual */ double ContainerSingle1D::getBinEntries(int x)
131  {
132  return _me->getBinEntries(_qx->getBin(x));
133  }
134  /* virtual */ double ContainerSingle1D::getBinEntries(double x)
135  {
136  return _me->getBinEntries(_qx->getBin(x));
137  }
138  /* virtual */ void ContainerSingle1D::setBinContent(int x, int y)
139  {
140  _me->setBinContent(_qx->getBin(x), y);
141  }
142  /* virtual */ void ContainerSingle1D::setBinContent(int x, double y)
143  {
144  _me->setBinContent(_qx->getBin(x), y);
145  }
146  /* virtual */ void ContainerSingle1D::setBinContent(double x, int y)
147  {
148  _me->setBinContent(_qx->getBin(x), y);
149  }
150  /* virtual */ void ContainerSingle1D::setBinContent(double x, double y)
151  {
152  _me->setBinContent(_qx->getBin(x), y);
153  }
154 
155  /* virtual */ void ContainerSingle1D::fill(HcalDetId const& id)
156  {
157  _me->Fill(_qx->getValue(id));
158  }
159 
160  /* virtual */ void ContainerSingle1D::fill(HcalDetId const& id, double x)
161  {
162  if (_qx->isCoordinate())
163  _me->Fill(_qx->getValue(id), _qy->getValue(x));
164  else
165  _me->Fill(_qx->getValue(x));
166  }
167 
168  /* virtual */ void ContainerSingle1D::fill(HcalDetId const& id, double x,
169  double y)
170  {
171  if (_qx->isCoordinate())
172  _me->Fill(_qx->getValue(id), _qy->getValue(x), y);
173  else
174  _me->Fill(_qy->getValue(x), _qy->getValue(y));
175  }
176 
177  /* virtual */ double ContainerSingle1D::getBinContent(HcalDetId const& id)
178  {
179  return _me->getBinContent(_qx->getBin(id));
180  }
181  /* virtual */ double ContainerSingle1D::getBinEntries(HcalDetId const& id)
182  {
183  return _me->getBinEntries(_qx->getBin(id));
184  }
185 
186  /* virtual */ void ContainerSingle1D::setBinContent(HcalDetId const& id,
187  int x)
188  {
189  _me->setBinContent(_qx->getBin(id), x);
190  }
191  /* virtual */ void ContainerSingle1D::setBinContent(HcalDetId const& id,
192  double x)
193  {
194  _me->setBinContent(_qx->getBin(id), x);
195  }
196 
197  /* virtual */ void ContainerSingle1D::fill(HcalElectronicsId const& id)
198  {
199  _me->Fill(_qx->getValue(id));
200  }
201 
202  /* virtual */ void ContainerSingle1D::fill(HcalElectronicsId const& id,
203  double x)
204  {
205  if (_qx->isCoordinate())
206  _me->Fill(_qx->getValue(id), _qy->getValue(x));
207  else
208  _me->Fill(_qx->getValue(x));
209  }
210 
211  /* virtual */ void ContainerSingle1D::fill(HcalElectronicsId const& id,
212  double x, double y)
213  {
214  if (_qx->isCoordinate())
215  _me->Fill(_qx->getValue(id), _qy->getValue(x), y);
216  else
217  _me->Fill(_qy->getValue(x), _qy->getValue(y));
218  }
219 
220  /* virtual */ double ContainerSingle1D::getBinContent(HcalElectronicsId const& id)
221  {
222  return _me->getBinContent(_qx->getBin(id));
223  }
224  /* virtual */ double ContainerSingle1D::getBinEntries(HcalElectronicsId const& id)
225  {
226  return _me->getBinEntries(_qx->getBin(id));
227  }
228 
230  int x)
231  {
232  _me->setBinContent(_qx->getBin(id), x);
233  }
235  double x)
236  {
237  _me->setBinContent(_qx->getBin(id), x);
238  }
239 
240  /* virtual */ void ContainerSingle1D::fill(HcalTrigTowerDetId const& id)
241  {
242  _me->Fill(_qx->getValue(id));
243  }
244 
245  /* virtual */ void ContainerSingle1D::fill(HcalTrigTowerDetId const& id,
246  double x)
247  {
248  if (_qx->isCoordinate())
249  _me->Fill(_qx->getValue(id), _qy->getValue(x));
250  else
251  _me->Fill(_qx->getValue(x));
252  }
253 
254  /* virtual */ void ContainerSingle1D::fill(HcalTrigTowerDetId const& id,
255  double x,
256  double y)
257  {
258  if (_qx->isCoordinate())
259  _me->Fill(_qx->getValue(id), _qy->getValue(x), y);
260  else
261  _me->Fill(_qy->getValue(x), _qy->getValue(y));
262  }
263 
264  /* virtual */ double ContainerSingle1D::getBinContent(HcalTrigTowerDetId const& id)
265  {
266  return _me->getBinContent(_qx->getBin(id));
267  }
268  /* virtual */ double ContainerSingle1D::getBinEntries(HcalTrigTowerDetId const& id)
269  {
270  return _me->getBinEntries(_qx->getBin(id));
271  }
272 
274  int x)
275  {
276  _me->setBinContent(_qx->getBin(id), x);
277  }
279  double x)
280  {
281  _me->setBinContent(_qx->getBin(id), x);
282  }
283 
284  /* virtual */ void ContainerSingle1D::extendAxisRange(int l)
285  {
286  if (l<_qx->nbins())
287  return;
288 
289  int x=_qx->nbins();
290  while(l>=x)
291  {
292  _me->getTH1()->LabelsInflate();
293  x*=2;
294  _qx->setMax(x);
295  }
296  }
297 
298  void ContainerSingle1D::showOverflowX(bool showOverflow) {
299  _qx->showOverflow(showOverflow);
300  }
301 
302  void ContainerSingle1D::showOverflowY(bool showOverflow) {
303  _qy->showOverflow(showOverflow);
304  }
305 
306 }
virtual void setBits(TH1 *o)
Definition: Quantity.h:65
void setBinContent(int binx, double content)
set content of bin (1-D)
virtual void initialize(std::string const &folder, std::string const &qname, int debug=0)
Definition: Container.h:33
virtual std::string name()
Definition: Quantity.h:47
virtual void setAxisType(AxisType at)
Definition: Quantity.h:49
quantity::Quantity * _qx
virtual void book(DQMStore::IBooker &, std::string subsystem="Hcal", std::string aux="")
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
virtual std::vector< std::string > getLabels()
Definition: Quantity.h:78
virtual double max()
Definition: Quantity.h:76
virtual void setBinContent(int, int)
quantity::Quantity * _qy
TH1 * getTH1() const
virtual void setMax(double)
Definition: Quantity.h:81
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)
virtual void extendAxisRange(int)
void Fill(long long x)
virtual int getValue(HcalDetId const &)
Definition: Quantity.h:59
virtual void initialize(std::string const &folder, quantity::Quantity *, quantity::Quantity *qy=new quantity::ValueQuantity(quantity::fN), int debug=0)
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
virtual Quantity * makeCopy()
Definition: Quantity.h:50
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
virtual uint32_t getBin(HcalDetId const &)
Definition: Quantity.h:53
virtual void showOverflowX(bool showOverflow)
virtual double getBinContent(int)
virtual void showOverflow(bool showOverflow)
Definition: Quantity.h:85
std::string _folder
Definition: Container.h:42
#define debug
Definition: HDRShower.cc:19
virtual void showOverflowY(bool showOverflow)
virtual double getBinEntries(int)
virtual double min()
Definition: Quantity.h:75
virtual bool isCoordinate()
Definition: Quantity.h:77
double getBinContent(int binx) const
get content of bin (1-D)
std::string _qname
Definition: Container.h:43
double getBinEntries(int bin) const
get # of bin entries (for profiles)
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.
ib
Definition: cuy.py:662