CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MonitorElement.cc
Go to the documentation of this file.
1 #define __STDC_FORMAT_MACROS 1
2 #define DQM_ROOT_METHODS 1
6 #include "TClass.h"
7 #include "TMath.h"
8 #include "TList.h"
9 #include "THashList.h"
10 #include <iostream>
11 #include <cassert>
12 #include <cfloat>
13 #include <inttypes.h>
14 
15 static TH1 *
16 checkRootObject(const std::string &name, TObject *tobj, const char *func, int reqdim)
17 {
18  if (! tobj)
19  raiseDQMError("MonitorElement", "Method '%s' cannot be invoked on monitor"
20  " element '%s' because it is not a ROOT object.",
21  func, name.c_str());
22 
23  TH1 *h = static_cast<TH1 *>(tobj);
24  int ndim = h->GetDimension();
25  if (reqdim < 0 || reqdim > ndim)
26  raiseDQMError("MonitorElement", "Method '%s' cannot be invoked on monitor"
27  " element '%s' because it requires %d dimensions; this"
28  " object of type '%s' has %d dimensions",
29  func, name.c_str(), reqdim, typeid(*h).name(), ndim);
30 
31  return h;
32 }
33 
36 {
37  switch (kind)
38  {
39  case DQM_KIND_INT:
40  case DQM_KIND_REAL:
41  case DQM_KIND_STRING:
42  case DQM_KIND_TH1F:
43  case DQM_KIND_TH1S:
44  case DQM_KIND_TH1D:
45  case DQM_KIND_TH2F:
46  case DQM_KIND_TH2S:
47  case DQM_KIND_TH2D:
48  case DQM_KIND_TH3F:
49  case DQM_KIND_TPROFILE:
51  data_.flags &= ~DQMNet::DQM_PROP_TYPE_MASK;
52  data_.flags |= kind;
53  break;
54 
55  default:
56  raiseDQMError("MonitorElement", "cannot initialise monitor element"
57  " to invalid type %d", (int) kind);
58  }
59 
60  return this;
61 }
62 
65 {
66  initialise(kind);
67  switch (kind)
68  {
69  case DQM_KIND_TH1F:
70  assert(dynamic_cast<TH1F *>(rootobj));
71  assert(! reference_ || dynamic_cast<TH1F *>(reference_));
72  object_ = rootobj;
73  break;
74 
75  case DQM_KIND_TH1S:
76  assert(dynamic_cast<TH1S *>(rootobj));
77  assert(! reference_ || dynamic_cast<TH1S *>(reference_));
78  object_ = rootobj;
79  break;
80 
81  case DQM_KIND_TH1D:
82  assert(dynamic_cast<TH1D *>(rootobj));
83  assert(! reference_ || dynamic_cast<TH1D *>(reference_));
84  object_ = rootobj;
85  break;
86 
87  case DQM_KIND_TH2F:
88  assert(dynamic_cast<TH2F *>(rootobj));
89  assert(! reference_ || dynamic_cast<TH2F *>(reference_));
90  object_ = rootobj;
91  break;
92 
93  case DQM_KIND_TH2S:
94  assert(dynamic_cast<TH2S *>(rootobj));
95  assert(! reference_ || dynamic_cast<TH2S *>(reference_));
96  object_ = rootobj;
97  break;
98 
99  case DQM_KIND_TH2D:
100  assert(dynamic_cast<TH2D *>(rootobj));
101  assert(! reference_ || dynamic_cast<TH1D *>(reference_));
102  object_ = rootobj;
103  break;
104 
105  case DQM_KIND_TH3F:
106  assert(dynamic_cast<TH3F *>(rootobj));
107  assert(! reference_ || dynamic_cast<TH3F *>(reference_));
108  object_ = rootobj;
109  break;
110 
111  case DQM_KIND_TPROFILE:
112  assert(dynamic_cast<TProfile *>(rootobj));
113  assert(! reference_ || dynamic_cast<TProfile *>(reference_));
114  object_ = rootobj;
115  break;
116 
117  case DQM_KIND_TPROFILE2D:
118  assert(dynamic_cast<TProfile2D *>(rootobj));
119  assert(! reference_ || dynamic_cast<TProfile2D *>(reference_));
120  object_ = rootobj;
121  break;
122 
123  default:
124  raiseDQMError("MonitorElement", "cannot initialise monitor element"
125  " as a root object with type %d", (int) kind);
126  }
127 
128  if (reference_)
130 
131  return this;
132 }
133 
136 {
137  initialise(kind);
138  if (kind == DQM_KIND_STRING)
139  scalar_.str = value;
140  else
141  raiseDQMError("MonitorElement", "cannot initialise monitor element"
142  " as a string with type %d", (int) kind);
143 
144  return this;
145 }
146 
148  : object_(0),
149  reference_(0),
150  refvalue_(0)
151 {
152  data_.version = 0;
153  data_.dirname = 0;
154  data_.run = 0;
155  data_.lumi = 0;
156  data_.streamId = 0;
157  data_.moduleId = 0;
158  data_.tag = 0;
160  scalar_.num = 0;
161  scalar_.real = 0;
162 }
163 
165  const std::string &name,
166  uint32_t run /* = 0 */,
167  uint32_t streamId /* = 0 */,
168  uint32_t moduleId /* = 0 */)
169  : object_(0),
170  reference_(0),
171  refvalue_(0)
172 {
173  data_.version = 0;
174  data_.run = run;
175  data_.lumi = 0;
178  data_.dirname = path;
179  data_.objname = name;
180  data_.tag = 0;
182  scalar_.num = 0;
183  scalar_.real = 0;
184 }
185 
187  : data_(x.data_),
188  scalar_(x.scalar_),
189  object_(nullptr),
190  reference_(x.reference_),
191  refvalue_(nullptr),
192  qreports_(x.qreports_)
193 {
194 }
195 
198 {
199  if (x.object_)
200  object_ = static_cast<TH1 *>(x.object_->Clone());
201 
202  if (x.refvalue_)
203  refvalue_ = static_cast<TH1 *>(x.refvalue_->Clone());
204 }
205 
208 {
209  object_ = o.object_;
210  refvalue_ = o.refvalue_;
211 
212  o.object_ = nullptr;
213  o.refvalue_ = nullptr;
214 }
215 
217 {
218  delete object_;
219  delete refvalue_;
220 }
221 
222 //utility function to check the consistency of the axis labels
223 //taken from TH1::CheckBinLabels which is not public
224 bool
225 MonitorElement::CheckBinLabels(const TAxis* a1, const TAxis * a2)
226 {
227  // check that axis have same labels
228  THashList *l1 = (const_cast<TAxis*>(a1))->GetLabels();
229  THashList *l2 = (const_cast<TAxis*>(a2))->GetLabels();
230 
231  if (!l1 && !l2 )
232  return true;
233  if (!l1 || !l2 ) {
234  return false;
235  }
236  // check now labels sizes are the same
237  if (l1->GetSize() != l2->GetSize() ) {
238  return false;
239  }
240  for (int i = 1; i <= a1->GetNbins(); ++i) {
241  TString label1 = a1->GetBinLabel(i);
242  TString label2 = a2->GetBinLabel(i);
243  if (label1 != label2) {
244  return false;
245  }
246  }
247  return true;
248 }
249 
251 void
253 {
254  update();
255  if (kind() == DQM_KIND_STRING)
256  scalar_.str = value;
257  else
258  incompatible(__PRETTY_FUNCTION__);
259 }
260 
262 void
264 {
265  update();
266  if (kind() == DQM_KIND_INT)
267  scalar_.num = static_cast<int64_t>(x);
268  else if (kind() == DQM_KIND_REAL)
269  scalar_.real = x;
270  else if (kind() == DQM_KIND_TH1F)
271  accessRootObject(__PRETTY_FUNCTION__, 1)
272  ->Fill(x, 1);
273  else if (kind() == DQM_KIND_TH1S)
274  accessRootObject(__PRETTY_FUNCTION__, 1)
275  ->Fill(x, 1);
276  else if (kind() == DQM_KIND_TH1D)
277  accessRootObject(__PRETTY_FUNCTION__, 1)
278  ->Fill(x, 1);
279  else
280  incompatible(__PRETTY_FUNCTION__);
281 }
282 
284 void
286 {
287  update();
288  if (kind() == DQM_KIND_INT)
289  scalar_.num = static_cast<int64_t>(x);
290  else if (kind() == DQM_KIND_REAL)
291  scalar_.real = static_cast<double>(x);
292  else if (kind() == DQM_KIND_TH1F)
293  accessRootObject(__PRETTY_FUNCTION__, 1)
294  ->Fill(static_cast<double>(x), 1);
295  else if (kind() == DQM_KIND_TH1S)
296  accessRootObject(__PRETTY_FUNCTION__, 1)
297  ->Fill(static_cast<double>(x), 1);
298  else if (kind() == DQM_KIND_TH1D)
299  accessRootObject(__PRETTY_FUNCTION__, 1)
300  ->Fill(static_cast<double>(x), 1);
301  else
302  incompatible(__PRETTY_FUNCTION__);
303 }
304 
306 void
307 MonitorElement::Fill(double x, double yw)
308 {
309  update();
310  if (kind() == DQM_KIND_TH1F)
311  accessRootObject(__PRETTY_FUNCTION__, 1)
312  ->Fill(x, yw);
313  else if (kind() == DQM_KIND_TH1S)
314  accessRootObject(__PRETTY_FUNCTION__, 1)
315  ->Fill(x, yw);
316  else if (kind() == DQM_KIND_TH1D)
317  accessRootObject(__PRETTY_FUNCTION__, 1)
318  ->Fill(x, yw);
319  else if (kind() == DQM_KIND_TH2F)
320  static_cast<TH2F *>(accessRootObject(__PRETTY_FUNCTION__, 2))
321  ->Fill(x, yw, 1);
322  else if (kind() == DQM_KIND_TH2S)
323  static_cast<TH2S *>(accessRootObject(__PRETTY_FUNCTION__, 2))
324  ->Fill(x, yw, 1);
325  else if (kind() == DQM_KIND_TH2D)
326  static_cast<TH2D *>(accessRootObject(__PRETTY_FUNCTION__, 2))
327  ->Fill(x, yw, 1);
328  else if (kind() == DQM_KIND_TPROFILE)
329  static_cast<TProfile *>(accessRootObject(__PRETTY_FUNCTION__, 1))
330  ->Fill(x, yw, 1);
331  else
332  incompatible(__PRETTY_FUNCTION__);
333 }
334 
338 void
339 MonitorElement::ShiftFillLast(double y, double ye, int xscale)
340 {
341  update();
342  if (kind() == DQM_KIND_TH1F
343  || kind() == DQM_KIND_TH1S
344  || kind() == DQM_KIND_TH1D)
345  {
346  int nbins = getNbinsX();
347  int entries = (int)getEntries();
348  // first fill bins from left to right
349  int index = entries + 1 ;
350  int xlow = 2 ; int xup = nbins ;
351  // if more entries than bins then start shifting
352  if ( entries >= nbins )
353  {
354  index = nbins;
355  xlow = entries - nbins + 3 ; xup = entries+1 ;
356  // average first bin
357  double y1 = getBinContent(1);
358  double y2 = getBinContent(2);
359  double y1err = getBinError(1);
360  double y2err = getBinError(2);
361  double N = entries - nbins + 1.;
362  if ( ye == 0. || y1err == 0. || y2err == 0.)
363  {
364  // for errors zero calculate unweighted mean and its error
365  double sum = N*y1 + y2;
366  y1 = sum/(N+1.) ;
367  // FIXME check if correct
368  double s=(N+1.)*(N*y1*y1 + y2*y2) - sum*sum;
369  if (s>=0.)
370  y1err = sqrt(s)/(N+1.);
371  else
372  y1err = 0.;
373  }
374  else
375  {
376  // for errors non-zero calculate weighted mean and its error
377  double denom = (1./y1err + 1./y2err);
378  double mean = (y1/y1err + y2/y2err)/denom;
379  // FIXME check if correct
380  y1err = sqrt(((y1-mean)*(y1-mean)/y1err +
381  (y2-mean)*(y2-mean)/y2err)/denom/2.);
382  y1 = mean; // set y1 to mean for filling below
383  }
384  setBinContent(1,y1);
385  setBinError(1,y1err);
386  // shift remaining bins to the left
387  for ( int i = 3; i <= nbins ; i++)
388  {
391  }
392  }
393  // fill last bin with new values
394  setBinContent(index,y);
395  setBinError(index,ye);
396  // set entries
397  setEntries(entries+1);
398  // set axis labels and reset drawing option
399  char buffer [10];
400  sprintf (buffer, "%d", xlow*xscale);
401  std::string a(buffer); setBinLabel(2,a);
402  sprintf (buffer, "%d", xup*xscale);
403  std::string b(buffer); setBinLabel(nbins,b);
404  setBinLabel(1,"av.");
405  }
406  else
407  incompatible(__PRETTY_FUNCTION__);
408 }
410 void
411 MonitorElement::Fill(double x, double y, double zw)
412 {
413  update();
414  if (kind() == DQM_KIND_TH2F)
415  static_cast<TH2F *>(accessRootObject(__PRETTY_FUNCTION__, 2))
416  ->Fill(x, y, zw);
417  else if (kind() == DQM_KIND_TH2S)
418  static_cast<TH2S *>(accessRootObject(__PRETTY_FUNCTION__, 2))
419  ->Fill(x, y, zw);
420  else if (kind() == DQM_KIND_TH2D)
421  static_cast<TH2D *>(accessRootObject(__PRETTY_FUNCTION__, 2))
422  ->Fill(x, y, zw);
423  else if (kind() == DQM_KIND_TH3F)
424  static_cast<TH3F *>(accessRootObject(__PRETTY_FUNCTION__, 2))
425  ->Fill(x, y, zw, 1);
426  else if (kind() == DQM_KIND_TPROFILE)
427  static_cast<TProfile *>(accessRootObject(__PRETTY_FUNCTION__, 2))
428  ->Fill(x, y, zw);
429  else if (kind() == DQM_KIND_TPROFILE2D)
430  static_cast<TProfile2D *>(accessRootObject(__PRETTY_FUNCTION__, 2))
431  ->Fill(x, y, zw, 1);
432  else
433  incompatible(__PRETTY_FUNCTION__);
434 }
435 
437 void
438 MonitorElement::Fill(double x, double y, double z, double w)
439 {
440  update();
441  if (kind() == DQM_KIND_TH3F)
442  static_cast<TH3F *>(accessRootObject(__PRETTY_FUNCTION__, 2))
443  ->Fill(x, y, z, w);
444  else if (kind() == DQM_KIND_TPROFILE2D)
445  static_cast<TProfile2D *>(accessRootObject(__PRETTY_FUNCTION__, 2))
446  ->Fill(x, y, z, w);
447  else
448  incompatible(__PRETTY_FUNCTION__);
449 }
450 
452 void
454 {
455  update();
456  if (kind() == DQM_KIND_INT)
457  scalar_.num = 0;
458  else if (kind() == DQM_KIND_REAL)
459  scalar_.real = 0;
460  else if (kind() == DQM_KIND_STRING)
461  scalar_.str.clear();
462  else
463  return accessRootObject(__PRETTY_FUNCTION__, 1)
464  ->Reset();
465 }
466 
468 void
470 {
471  char buf[64];
472  if (kind() == DQM_KIND_INT)
473  {
474  snprintf(buf, sizeof(buf), "%s%" PRId64, prefix, scalar_.num);
475  into = buf;
476  }
477  else if (kind() == DQM_KIND_REAL)
478  {
479  snprintf(buf, sizeof(buf), "%s%.*g", prefix, DBL_DIG+2, scalar_.real);
480  into = buf;
481  }
482  else if (kind() == DQM_KIND_STRING)
483  {
484  into.reserve(strlen(prefix) + scalar_.str.size());
485  into += prefix;
486  into += scalar_.str;
487  }
488  else
489  incompatible(__PRETTY_FUNCTION__);
490 }
491 
493 void
495 {
497 }
498 
503 {
505  if (kind() == DQM_KIND_INT)
506  packScalarData(result, "i=");
507  else if (kind() == DQM_KIND_REAL)
508  packScalarData(result, "f=");
509  else if (kind() == DQM_KIND_STRING)
510  packScalarData(result, "s=");
511  else
512  incompatible(__PRETTY_FUNCTION__);
513 
514  return result;
515 }
516 
522 {
524  std::string val(valueString());
525  result.reserve(6 + 2*data_.objname.size() + val.size());
526  result += '<'; result += data_.objname; result += '>';
527  result += val;
528  result += '<'; result += '/'; result += data_.objname; result += '>';
529  return result;
530 }
531 
535 {
536  char buf[32];
538  size_t len = sprintf(buf, "t=%" PRIu32, data_.tag);
539 
540  result.reserve(6 + 2*data_.objname.size() + len);
541  result += '<'; result += data_.objname; result += '>';
542  result += buf;
543  result += '<'; result += '/'; result += data_.objname; result += '>';
544  return result;
545 }
546 
550 {
552 
553  result.reserve(6 + 2*data_.objname.size() + 3);
554  result += '<'; result += data_.objname; result += '>';
555  result += "e=1";
556  result += '<'; result += '/'; result += data_.objname; result += '>';
557  return result;
558 }
559 
562 {
563  char buf[64];
565  size_t titlelen = data_.objname.size() + qv.qtname.size() + 1;
566  size_t buflen = sprintf(buf, "qr=st:%d:%.*g:", qv.code, DBL_DIG+2, qv.qtresult);
567 
568  result.reserve(7 + 2*titlelen + buflen + qv.algorithm.size() + qv.message.size());
569  result += '<'; result += data_.objname; result += '.'; result += qv.qtname; result += '>';
570  result += buf; result += qv.algorithm; result += ':'; result += qv.message;
571  result += '<'; result += '/'; result += data_.objname; result += '.'; result += qv.qtname; result += '>';
572  return result;
573 }
574 
575 const QReport *
577 {
578  QReport *qr;
579  DQMNet::QValue *qv;
580  const_cast<MonitorElement *>(this)->getQReport(false, qtname, qr, qv);
581  return qr;
582 }
583 
584 std::vector<QReport *>
586 {
587  std::vector<QReport *> result;
588  result.reserve(qreports_.size());
589  for (size_t i = 0, e = qreports_.size(); i != e; ++i)
590  {
591  const_cast<MonitorElement *>(this)->qreports_[i].qvalue_
592  = const_cast<DQMNet::QValue *>(&data_.qreports[i]);
593  result.push_back(const_cast<QReport *>(&qreports_[i]));
594  }
595  return result;
596 }
597 
598 std::vector<QReport *>
600 {
601  std::vector<QReport *> result;
602  result.reserve(qreports_.size());
603  for (size_t i = 0, e = qreports_.size(); i != e; ++i)
604  if (data_.qreports[i].code == dqm::qstatus::WARNING)
605  {
606  const_cast<MonitorElement *>(this)->qreports_[i].qvalue_
607  = const_cast<DQMNet::QValue *>(&data_.qreports[i]);
608  result.push_back(const_cast<QReport *>(&qreports_[i]));
609  }
610  return result;
611 }
612 
613 std::vector<QReport *>
615 {
616  std::vector<QReport *> result;
617  result.reserve(qreports_.size());
618  for (size_t i = 0, e = qreports_.size(); i != e; ++i)
619  if (data_.qreports[i].code == dqm::qstatus::ERROR)
620  {
621  const_cast<MonitorElement *>(this)->qreports_[i].qvalue_
622  = const_cast<DQMNet::QValue *>(&data_.qreports[i]);
623  result.push_back(const_cast<QReport *>(&qreports_[i]));
624  }
625  return result;
626 }
627 
628 std::vector<QReport *>
630 {
631  std::vector<QReport *> result;
632  result.reserve(qreports_.size());
633  for (size_t i = 0, e = qreports_.size(); i != e; ++i)
636  && data_.qreports[i].code != dqm::qstatus::ERROR)
637  {
638  const_cast<MonitorElement *>(this)->qreports_[i].qvalue_
639  = const_cast<DQMNet::QValue *>(&data_.qreports[i]);
640  result.push_back(const_cast<QReport *>(&qreports_[i]));
641  }
642  return result;
643 }
644 
646 void
648 {
649  assert(qreports_.size() == data_.qreports.size());
650 
651  // Rerun quality tests where the ME or the quality algorithm was modified.
652  bool dirty = wasUpdated();
653  for (size_t i = 0, e = data_.qreports.size(); i < e; ++i)
654  {
656  QReport &qr = qreports_[i];
657  QCriterion *qc = qr.qcriterion_;
658  qr.qvalue_ = &qv;
659 
660  // if (qc && (dirty || qc->wasModified())) // removed for new QTest (abm-090503)
661  if (qc && dirty)
662  {
663  assert(qc->getName() == qv.qtname);
664  std::string oldMessage = qv.message;
665  int oldStatus = qv.code;
666 
667  qc->runTest(this, qr, qv);
668 
669  if (oldStatus != qv.code || oldMessage != qv.message)
670  update();
671  }
672  }
673 
674  // Update QReport statistics.
676 }
677 
678 void
679 MonitorElement::incompatible(const char *func) const
680 {
681  raiseDQMError("MonitorElement", "Method '%s' cannot be invoked on monitor"
682  " element '%s'", func, data_.objname.c_str());
683 }
684 
685 TH1 *
686 MonitorElement::accessRootObject(const char *func, int reqdim) const
687 {
688  if (kind() < DQM_KIND_TH1F)
689  raiseDQMError("MonitorElement", "Method '%s' cannot be invoked on monitor"
690  " element '%s' because it is not a root object",
691  func, data_.objname.c_str());
692 
693  return checkRootObject(data_.objname, object_, func, reqdim);
694 }
695 
696 /*** getter methods (wrapper around ROOT methods) ****/
697 //
699 double
700 MonitorElement::getMean(int axis /* = 1 */) const
701 { return accessRootObject(__PRETTY_FUNCTION__, axis-1)
702  ->GetMean(axis); }
703 
706 double
707 MonitorElement::getMeanError(int axis /* = 1 */) const
708 { return accessRootObject(__PRETTY_FUNCTION__, axis-1)
709  ->GetMeanError(axis); }
710 
712 double
713 MonitorElement::getRMS(int axis /* = 1 */) const
714 { return accessRootObject(__PRETTY_FUNCTION__, axis-1)
715  ->GetRMS(axis); }
716 
718 double
719 MonitorElement::getRMSError(int axis /* = 1 */) const
720 { return accessRootObject(__PRETTY_FUNCTION__, axis-1)
721  ->GetRMSError(axis); }
722 
724 int
726 { return accessRootObject(__PRETTY_FUNCTION__, 1)
727  ->GetNbinsX(); }
728 
730 int
732 { return accessRootObject(__PRETTY_FUNCTION__, 2)
733  ->GetNbinsY(); }
734 
736 int
738 { return accessRootObject(__PRETTY_FUNCTION__, 3)
739  ->GetNbinsZ(); }
740 
742 double
744 { return accessRootObject(__PRETTY_FUNCTION__, 1)
745  ->GetBinContent(binx); }
746 
748 double
749 MonitorElement::getBinContent(int binx, int biny) const
750 { return accessRootObject(__PRETTY_FUNCTION__, 2)
751  ->GetBinContent(binx, biny); }
752 
754 double
755 MonitorElement::getBinContent(int binx, int biny, int binz) const
756 { return accessRootObject(__PRETTY_FUNCTION__, 3)
757  ->GetBinContent(binx, biny, binz); }
758 
760 double
762 { return accessRootObject(__PRETTY_FUNCTION__, 1)
763  ->GetBinError(binx); }
764 
766 double
767 MonitorElement::getBinError(int binx, int biny) const
768 { return accessRootObject(__PRETTY_FUNCTION__, 2)
769  ->GetBinError(binx, biny); }
770 
772 double
773 MonitorElement::getBinError(int binx, int biny, int binz) const
774 { return accessRootObject(__PRETTY_FUNCTION__, 3)
775  ->GetBinError(binx, biny, binz); }
776 
778 double
780 { return accessRootObject(__PRETTY_FUNCTION__, 1)
781  ->GetEntries(); }
782 
784 double
786 {
787  if (kind() == DQM_KIND_TPROFILE)
788  return static_cast<TProfile *>(accessRootObject(__PRETTY_FUNCTION__, 1))
789  ->GetBinEntries(bin);
790  else if (kind() == DQM_KIND_TPROFILE2D)
791  return static_cast<TProfile2D *>(accessRootObject(__PRETTY_FUNCTION__, 1))
792  ->GetBinEntries(bin);
793  else
794  {
795  incompatible(__PRETTY_FUNCTION__);
796  return 0;
797  }
798 }
799 
801 double
803 {
804  if (kind() == DQM_KIND_TPROFILE)
805  return static_cast<TProfile *>(accessRootObject(__PRETTY_FUNCTION__, 1))
806  ->GetYmin();
807  else
808  {
809  incompatible(__PRETTY_FUNCTION__);
810  return 0;
811  }
812 }
813 
815 double
817 {
818  if (kind() == DQM_KIND_TPROFILE)
819  return static_cast<TProfile *>(accessRootObject(__PRETTY_FUNCTION__, 1))
820  ->GetYmax();
821  else
822  {
823  incompatible(__PRETTY_FUNCTION__);
824  return 0;
825  }
826 }
827 
830 MonitorElement::getAxisTitle(int axis /* = 1 */) const
831 { return getAxis(__PRETTY_FUNCTION__, axis)
832  ->GetTitle(); }
833 
837 { return accessRootObject(__PRETTY_FUNCTION__, 1)
838  ->GetTitle(); }
839 
840 /*** setter methods (wrapper around ROOT methods) ****/
841 //
843 void
845 {
846  update();
847  accessRootObject(__PRETTY_FUNCTION__, 1)
848  ->SetBinContent(binx, content);
849 }
850 
852 void
853 MonitorElement::setBinContent(int binx, int biny, double content)
854 {
855  update();
856  accessRootObject(__PRETTY_FUNCTION__, 2)
857  ->SetBinContent(binx, biny, content); }
858 
860 void
861 MonitorElement::setBinContent(int binx, int biny, int binz, double content)
862 {
863  update();
864  accessRootObject(__PRETTY_FUNCTION__, 3)
865  ->SetBinContent(binx, biny, binz, content); }
866 
868 void
870 {
871  update();
872  accessRootObject(__PRETTY_FUNCTION__, 1)
873  ->SetBinError(binx, error);
874 }
875 
877 void
878 MonitorElement::setBinError(int binx, int biny, double error)
879 {
880  update();
881  accessRootObject(__PRETTY_FUNCTION__, 2)
882  ->SetBinError(binx, biny, error);
883 }
884 
886 void
887 MonitorElement::setBinError(int binx, int biny, int binz, double error)
888 {
889  update();
890  accessRootObject(__PRETTY_FUNCTION__, 3)
891  ->SetBinError(binx, biny, binz, error);
892 }
893 
895 void
896 MonitorElement::setBinEntries(int bin, double nentries)
897 {
898  update();
899  if (kind() == DQM_KIND_TPROFILE)
900  static_cast<TProfile *>(accessRootObject(__PRETTY_FUNCTION__, 1))
901  ->SetBinEntries(bin, nentries);
902  else if (kind() == DQM_KIND_TPROFILE2D)
903  static_cast<TProfile2D *>(accessRootObject(__PRETTY_FUNCTION__, 1))
904  ->SetBinEntries(bin, nentries);
905  else
906  incompatible(__PRETTY_FUNCTION__);
907 }
908 
910 void
912 {
913  update();
914  accessRootObject(__PRETTY_FUNCTION__, 1)
915  ->SetEntries(nentries);
916 }
917 
919 void
920 MonitorElement::setBinLabel(int bin, const std::string &label, int axis /* = 1 */)
921 {
922  update();
923  if ( getAxis(__PRETTY_FUNCTION__, axis)->GetNbins() >= bin )
924  {
925  getAxis(__PRETTY_FUNCTION__, axis)
926  ->SetBinLabel(bin, label.c_str());
927  }
928  else
929  {
930  // edm::LogWarning ("MonitorElement")
931  std::cout << "*** MonitorElement: WARNING:"
932  <<"setBinLabel: attempting to set label of non-existent bin number for ME: "<< getFullname() << " \n";
933  }
934 }
935 
937 void
938 MonitorElement::setAxisRange(double xmin, double xmax, int axis /* = 1 */)
939 {
940  update();
941  getAxis(__PRETTY_FUNCTION__, axis)
942  ->SetRangeUser(xmin, xmax);
943 }
944 
946 void
947 MonitorElement::setAxisTitle(const std::string &title, int axis /* = 1 */)
948 {
949  update();
950  getAxis(__PRETTY_FUNCTION__, axis)
951  ->SetTitle(title.c_str());
952 }
953 
955 void
957 {
958  update();
959  getAxis(__PRETTY_FUNCTION__, axis)
960  ->SetTimeDisplay(value);
961 }
962 
964 void
965 MonitorElement::setAxisTimeFormat(const char *format /* = "" */, int axis /* = 1 */)
966 {
967  update();
968  getAxis(__PRETTY_FUNCTION__, axis)
969  ->SetTimeFormat(format);
970 }
971 
973 void
974 MonitorElement::setAxisTimeOffset(double toffset, const char *option /* ="local" */, int axis /* = 1 */)
975 {
976  update();
977  getAxis(__PRETTY_FUNCTION__, axis)
978  ->SetTimeOffset(toffset, option);
979 }
980 
982 void
984 {
985  update();
986  accessRootObject(__PRETTY_FUNCTION__, 1)
987  ->SetTitle(title.c_str());
988 }
989 
990 TAxis *
991 MonitorElement::getAxis(const char *func, int axis) const
992 {
993  TH1 *h = accessRootObject(func, axis-1);
994  TAxis *a = 0;
995  if (axis == 1)
996  a = h->GetXaxis();
997  else if (axis == 2)
998  a = h->GetYaxis();
999  else if (axis == 3)
1000  a = h->GetZaxis();
1001 
1002  if (! a)
1003  raiseDQMError("MonitorElement", "No such axis %d in monitor element"
1004  " '%s' of type '%s'", axis, data_.objname.c_str(),
1005  typeid(*h).name());
1006 
1007  return a;
1008 }
1009 
1010 // ------------ Operations for MEs that are normally never reset ---------
1011 
1014 void
1016 {
1017  update();
1018 
1019  // Create the reference object the first time this is called.
1020  // On subsequent calls accumulate the current value to the
1021  // reference, and then reset the current value. This way the
1022  // future contents will have the reference "subtracted".
1023  if (kind() == DQM_KIND_TH1F)
1024  {
1025  TH1F *orig = static_cast<TH1F *>(object_);
1026  TH1F *r = static_cast<TH1F *>(refvalue_);
1027  if (! r)
1028  {
1029  refvalue_ = r = (TH1F*)orig->Clone((std::string(orig->GetName()) + "_ref").c_str());
1030  r->SetDirectory(0);
1031  r->Reset();
1032  }
1033 
1034  r->Add(orig);
1035  orig->Reset();
1036  }
1037  else if (kind() == DQM_KIND_TH1S)
1038  {
1039  TH1S *orig = static_cast<TH1S *>(object_);
1040  TH1S *r = static_cast<TH1S *>(refvalue_);
1041  if (! r)
1042  {
1043  refvalue_ = r = (TH1S*)orig->Clone((std::string(orig->GetName()) + "_ref").c_str());
1044  r->SetDirectory(0);
1045  r->Reset();
1046  }
1047 
1048  r->Add(orig);
1049  orig->Reset();
1050  }
1051  else if (kind() == DQM_KIND_TH1D)
1052  {
1053  TH1D *orig = static_cast<TH1D *>(object_);
1054  TH1D *r = static_cast<TH1D *>(refvalue_);
1055  if (! r)
1056  {
1057  refvalue_ = r = (TH1D*)orig->Clone((std::string(orig->GetName()) + "_ref").c_str());
1058  r->SetDirectory(0);
1059  r->Reset();
1060  }
1061 
1062  r->Add(orig);
1063  orig->Reset();
1064  }
1065  else if (kind() == DQM_KIND_TH2F)
1066  {
1067  TH2F *orig = static_cast<TH2F *>(object_);
1068  TH2F *r = static_cast<TH2F *>(refvalue_);
1069  if (! r)
1070  {
1071  refvalue_ = r = (TH2F*)orig->Clone((std::string(orig->GetName()) + "_ref").c_str());
1072  r->SetDirectory(0);
1073  r->Reset();
1074  }
1075 
1076  r->Add(orig);
1077  orig->Reset();
1078  }
1079  else if (kind() == DQM_KIND_TH2S)
1080  {
1081  TH2S *orig = static_cast<TH2S *>(object_);
1082  TH2S *r = static_cast<TH2S *>(refvalue_);
1083  if (! r)
1084  {
1085  refvalue_ = r = (TH2S*)orig->Clone((std::string(orig->GetName()) + "_ref").c_str());
1086  r->SetDirectory(0);
1087  r->Reset();
1088  }
1089 
1090  r->Add(orig);
1091  orig->Reset();
1092  }
1093  else if (kind() == DQM_KIND_TH2D)
1094  {
1095  TH2D *orig = static_cast<TH2D *>(object_);
1096  TH2D *r = static_cast<TH2D *>(refvalue_);
1097  if (! r)
1098  {
1099  refvalue_ = r = (TH2D*)orig->Clone((std::string(orig->GetName()) + "_ref").c_str());
1100  r->SetDirectory(0);
1101  r->Reset();
1102  }
1103 
1104  r->Add(orig);
1105  orig->Reset();
1106  }
1107  else if (kind() == DQM_KIND_TH3F)
1108  {
1109  TH3F *orig = static_cast<TH3F *>(object_);
1110  TH3F *r = static_cast<TH3F *>(refvalue_);
1111  if (! r)
1112  {
1113  refvalue_ = r = (TH3F*)orig->Clone((std::string(orig->GetName()) + "_ref").c_str());
1114  r->SetDirectory(0);
1115  r->Reset();
1116  }
1117 
1118  r->Add(orig);
1119  orig->Reset();
1120  }
1121  else if (kind() == DQM_KIND_TPROFILE)
1122  {
1123  TProfile *orig = static_cast<TProfile *>(object_);
1124  TProfile *r = static_cast<TProfile *>(refvalue_);
1125  if (! r)
1126  {
1127  refvalue_ = r = (TProfile*)orig->Clone((std::string(orig->GetName()) + "_ref").c_str());
1128  r->SetDirectory(0);
1129  r->Reset();
1130  }
1131 
1132  addProfiles(r, orig, r, 1, 1);
1133  orig->Reset();
1134  }
1135  else if (kind() == DQM_KIND_TPROFILE2D)
1136  {
1137  TProfile2D *orig = static_cast<TProfile2D *>(object_);
1138  TProfile2D *r = static_cast<TProfile2D *>(refvalue_);
1139  if (! r)
1140  {
1141  refvalue_ = r = (TProfile2D*)orig->Clone((std::string(orig->GetName()) + "_ref").c_str());
1142  r->SetDirectory(0);
1143  r->Reset();
1144  }
1145 
1146  addProfiles(r, orig, r, 1, 1);
1147  orig->Reset();
1148  }
1149  else
1150  incompatible(__PRETTY_FUNCTION__);
1151 }
1152 
1154 void
1156 {
1157  if (refvalue_)
1158  {
1159  if (kind() == DQM_KIND_TH1F
1160  || kind() == DQM_KIND_TH1S
1161  || kind() == DQM_KIND_TH1D
1162  || kind() == DQM_KIND_TH2F
1163  || kind() == DQM_KIND_TH2S
1164  || kind() == DQM_KIND_TH2D
1165  || kind() == DQM_KIND_TH3F)
1166  {
1167  TH1 *orig = static_cast<TH1 *>(object_);
1168  orig->Add(refvalue_);
1169  }
1170  else if (kind() == DQM_KIND_TPROFILE)
1171  {
1172  TProfile *orig = static_cast<TProfile *>(object_);
1173  TProfile *r = static_cast<TProfile *>(refvalue_);
1174  addProfiles(orig, r, orig, 1, 1);
1175  }
1176  else if (kind() == DQM_KIND_TPROFILE2D)
1177  {
1178  TProfile2D *orig = static_cast<TProfile2D *>(object_);
1179  TProfile2D *r = static_cast<TProfile2D *>(refvalue_);
1180  addProfiles(orig, r, orig, 1, 1);
1181  }
1182  else
1183  incompatible(__PRETTY_FUNCTION__);
1184 
1185  delete refvalue_;
1186  refvalue_ = 0;
1187  }
1188 }
1189 
1190 // implementation: Giuseppe.Della-Ricca@ts.infn.it
1191 // Can be called with sum = h1 or sum = h2
1192 void
1193 MonitorElement::addProfiles(TProfile *h1, TProfile *h2, TProfile *sum, float c1, float c2)
1194 {
1195  assert(h1);
1196  assert(h2);
1197  assert(sum);
1198 
1199  static const Int_t NUM_STAT = 6;
1200  Double_t stats1[NUM_STAT];
1201  Double_t stats2[NUM_STAT];
1202  Double_t stats3[NUM_STAT];
1203 
1204  bool isRebinOn = sum->CanExtendAllAxes();
1205  sum->SetCanExtend(TH1::kNoAxis);
1206 
1207  for (Int_t i = 0; i < NUM_STAT; ++i)
1208  stats1[i] = stats2[i] = stats3[i] = 0;
1209 
1210  h1->GetStats(stats1);
1211  h2->GetStats(stats2);
1212 
1213  for (Int_t i = 0; i < NUM_STAT; ++i)
1214  stats3[i] = c1*stats1[i] + c2*stats2[i];
1215 
1216  stats3[1] = c1*TMath::Abs(c1)*stats1[1]
1217  + c2*TMath::Abs(c2)*stats2[1];
1218 
1219  Double_t entries = c1*h1->GetEntries() + c2* h2->GetEntries();
1220  TArrayD* h1sumw2 = h1->GetSumw2();
1221  TArrayD* h2sumw2 = h2->GetSumw2();
1222  for (Int_t bin = 0, nbin = sum->GetNbinsX()+1; bin <= nbin; ++bin)
1223  {
1224  Double_t entries = c1*h1->GetBinEntries(bin)
1225  + c2*h2->GetBinEntries(bin);
1226  Double_t content = c1*h1->GetBinEntries(bin)*h1->GetBinContent(bin)
1227  + c2*h2->GetBinEntries(bin)*h2->GetBinContent(bin);
1228  Double_t error = TMath::Sqrt(c1*TMath::Abs(c1)*h1sumw2->fArray[bin]
1229  + c2*TMath::Abs(c2)*h2sumw2->fArray[bin]);
1230  sum->SetBinContent(bin, content);
1231  sum->SetBinError(bin, error);
1232  sum->SetBinEntries(bin, entries);
1233  }
1234 
1235  sum->SetEntries(entries);
1236  sum->PutStats(stats3);
1237  if (isRebinOn) sum->SetCanExtend(TH1::kAllAxes);
1238 }
1239 
1240 // implementation: Giuseppe.Della-Ricca@ts.infn.it
1241 // Can be called with sum = h1 or sum = h2
1242 void
1243 MonitorElement::addProfiles(TProfile2D *h1, TProfile2D *h2, TProfile2D *sum, float c1, float c2)
1244 {
1245  assert(h1);
1246  assert(h2);
1247  assert(sum);
1248 
1249  static const Int_t NUM_STAT = 9;
1250  Double_t stats1[NUM_STAT];
1251  Double_t stats2[NUM_STAT];
1252  Double_t stats3[NUM_STAT];
1253 
1254  bool isRebinOn = sum->CanExtendAllAxes();
1255  sum->SetCanExtend(TH1::kNoAxis);
1256 
1257  for (Int_t i = 0; i < NUM_STAT; ++i)
1258  stats1[i] = stats2[i] = stats3[i] = 0;
1259 
1260  h1->GetStats(stats1);
1261  h2->GetStats(stats2);
1262 
1263  for (Int_t i = 0; i < NUM_STAT; i++)
1264  stats3[i] = c1*stats1[i] + c2*stats2[i];
1265 
1266  stats3[1] = c1*TMath::Abs(c1)*stats1[1]
1267  + c2*TMath::Abs(c2)*stats2[1];
1268 
1269  Double_t entries = c1*h1->GetEntries() + c2*h2->GetEntries();
1270  TArrayD *h1sumw2 = h1->GetSumw2();
1271  TArrayD *h2sumw2 = h2->GetSumw2();
1272  for (Int_t xbin = 0, nxbin = sum->GetNbinsX()+1; xbin <= nxbin; ++xbin)
1273  for (Int_t ybin = 0, nybin = sum->GetNbinsY()+1; ybin <= nybin; ++ybin)
1274  {
1275  Int_t bin = sum->GetBin(xbin, ybin);
1276  Double_t entries = c1*h1->GetBinEntries(bin)
1277  + c2*h2->GetBinEntries(bin);
1278  Double_t content = c1*h1->GetBinEntries(bin)*h1->GetBinContent(bin)
1279  + c2*h2->GetBinEntries(bin)*h2->GetBinContent(bin);
1280  Double_t error = TMath::Sqrt(c1*TMath::Abs(c1)*h1sumw2->fArray[bin]
1281  + c2*TMath::Abs(c2)*h2sumw2->fArray[bin]);
1282 
1283  sum->SetBinContent(bin, content);
1284  sum->SetBinError(bin, error);
1285  sum->SetBinEntries(bin, entries);
1286  }
1287  sum->SetEntries(entries);
1288  sum->PutStats(stats3);
1289  if (isRebinOn) sum->SetCanExtend(TH1::kAllAxes);
1290 }
1291 
1292 void
1294 {
1295  // will copy functions only if local-copy and original-object are equal
1296  // (ie. no soft-resetting or accumulating is enabled)
1298  return;
1299 
1300  update();
1301  TList *fromf = from->GetListOfFunctions();
1302  TList *tof = to->GetListOfFunctions();
1303  for (int i = 0, nfuncs = fromf ? fromf->GetSize() : 0; i < nfuncs; ++i)
1304  {
1305  TObject *obj = fromf->At(i);
1306  // not interested in statistics
1307  if (!strcmp(obj->IsA()->GetName(), "TPaveStats"))
1308  continue;
1309 
1310  if (TF1 *fn = dynamic_cast<TF1 *>(obj))
1311  tof->Add(new TF1(*fn));
1312  //else if (dynamic_cast<TPaveStats *>(obj))
1313  // ; // FIXME? tof->Add(new TPaveStats(*stats));
1314  else
1315  raiseDQMError("MonitorElement", "Cannot extract function '%s' of type"
1316  " '%s' from monitor element '%s' for a copy",
1317  obj->GetName(), obj->IsA()->GetName(), data_.objname.c_str());
1318  }
1319 }
1320 
1321 void
1323 {
1324  TH1 *orig = accessRootObject(__PRETTY_FUNCTION__, 1);
1325  if (orig->GetTitle() != from->GetTitle())
1326  orig->SetTitle(from->GetTitle());
1327 
1328  if (!isAccumulateEnabled())
1329  orig->Reset();
1330 
1331  if (isSoftResetEnabled())
1332  {
1333  if (kind() == DQM_KIND_TH1F
1334  || kind() == DQM_KIND_TH1S
1335  || kind() == DQM_KIND_TH1D
1336  || kind() == DQM_KIND_TH2F
1337  || kind() == DQM_KIND_TH2S
1338  || kind() == DQM_KIND_TH2D
1339  || kind() == DQM_KIND_TH3F)
1340  // subtract "reference"
1341  orig->Add(from, refvalue_, 1, -1);
1342  else if (kind() == DQM_KIND_TPROFILE)
1343  // subtract "reference"
1344  addProfiles(static_cast<TProfile *>(from),
1345  static_cast<TProfile *>(refvalue_),
1346  static_cast<TProfile *>(orig),
1347  1, -1);
1348  else if (kind() == DQM_KIND_TPROFILE2D)
1349  // subtract "reference"
1350  addProfiles(static_cast<TProfile2D *>(from),
1351  static_cast<TProfile2D *>(refvalue_),
1352  static_cast<TProfile2D *>(orig),
1353  1, -1);
1354  else
1355  incompatible(__PRETTY_FUNCTION__);
1356  }
1357  else
1358  orig->Add(from);
1359 
1360  copyFunctions(from, orig);
1361 }
1362 
1363 // --- Operations on MEs that are normally reset at end of monitoring cycle ---
1364 void
1366 {
1367  assert(qreports_.size() == data_.qreports.size());
1368 
1369  qr = 0;
1370  qv = 0;
1371 
1372  size_t pos = 0, end = qreports_.size();
1373  while (pos < end && data_.qreports[pos].qtname != qtname)
1374  ++pos;
1375 
1376  if (pos == end && ! create)
1377  return;
1378  else if (pos == end)
1379  {
1380  data_.qreports.push_back(DQMNet::QValue());
1381  qreports_.push_back(QReport(0, 0));
1382 
1383  DQMNet::QValue &q = data_.qreports.back();
1385  q.qtresult = 0;
1386  q.qtname = qtname;
1387  q.message = "NO_MESSAGE_ASSIGNED";
1388  q.algorithm = "UNKNOWN_ALGORITHM";
1389  }
1390 
1391  qr = &qreports_[pos];
1392  qv = &data_.qreports[pos];
1393 }
1394 
1396 void
1398 {
1399  QReport *qr;
1400  DQMNet::QValue *qv;
1401  getQReport(true, desc.qtname, qr, qv);
1402  qr->qcriterion_ = qc;
1403  *qv = desc;
1404  update();
1405 }
1406 
1407 void
1409 {
1410  QReport *qr;
1411  DQMNet::QValue *qv;
1412  getQReport(true, qc->getName(), qr, qv);
1414  qv->message = "NO_MESSAGE_ASSIGNED";
1415  qr->qcriterion_ = qc;
1416  update();
1417 }
1418 
1420 void
1422 {
1423  data_.flags &= ~DQMNet::DQM_PROP_REPORT_ALARM;
1424  for (size_t i = 0, e = data_.qreports.size(); i < e; ++i)
1425  switch (data_.qreports[i].code)
1426  {
1428  break;
1429  case dqm::qstatus::WARNING:
1431  break;
1432  case dqm::qstatus::ERROR:
1434  break;
1435  default:
1437  break;
1438  }
1439 }
1440 
1441 // -------------------------------------------------------------------
1442 TObject *
1444 {
1445  const_cast<MonitorElement *>(this)->update();
1446  return object_;
1447 }
1448 
1449 TH1 *
1451 {
1452  const_cast<MonitorElement *>(this)->update();
1453  return accessRootObject(__PRETTY_FUNCTION__, 0);
1454 }
1455 
1456 TH1F *
1458 {
1459  assert(kind() == DQM_KIND_TH1F);
1460  const_cast<MonitorElement *>(this)->update();
1461  return static_cast<TH1F *>(accessRootObject(__PRETTY_FUNCTION__, 1));
1462 }
1463 
1464 TH1S *
1466 {
1467  assert(kind() == DQM_KIND_TH1S);
1468  const_cast<MonitorElement *>(this)->update();
1469  return static_cast<TH1S *>(accessRootObject(__PRETTY_FUNCTION__, 1));
1470 }
1471 
1472 TH1D *
1474 {
1475  assert(kind() == DQM_KIND_TH1D);
1476  const_cast<MonitorElement *>(this)->update();
1477  return static_cast<TH1D *>(accessRootObject(__PRETTY_FUNCTION__, 1));
1478 }
1479 
1480 TH2F *
1482 {
1483  assert(kind() == DQM_KIND_TH2F);
1484  const_cast<MonitorElement *>(this)->update();
1485  return static_cast<TH2F *>(accessRootObject(__PRETTY_FUNCTION__, 2));
1486 }
1487 
1488 TH2S *
1490 {
1491  assert(kind() == DQM_KIND_TH2S);
1492  const_cast<MonitorElement *>(this)->update();
1493  return static_cast<TH2S *>(accessRootObject(__PRETTY_FUNCTION__, 2));
1494 }
1495 
1496 TH2D *
1498 {
1499  assert(kind() == DQM_KIND_TH2D);
1500  const_cast<MonitorElement *>(this)->update();
1501  return static_cast<TH2D *>(accessRootObject(__PRETTY_FUNCTION__, 2));
1502 }
1503 
1504 TH3F *
1506 {
1507  assert(kind() == DQM_KIND_TH3F);
1508  const_cast<MonitorElement *>(this)->update();
1509  return static_cast<TH3F *>(accessRootObject(__PRETTY_FUNCTION__, 3));
1510 }
1511 
1512 TProfile *
1514 {
1516  const_cast<MonitorElement *>(this)->update();
1517  return static_cast<TProfile *>(accessRootObject(__PRETTY_FUNCTION__, 1));
1518 }
1519 
1520 TProfile2D *
1522 {
1524  const_cast<MonitorElement *>(this)->update();
1525  return static_cast<TProfile2D *>(accessRootObject(__PRETTY_FUNCTION__, 2));
1526 }
1527 
1528 // -------------------------------------------------------------------
1529 TObject *
1531 {
1532  const_cast<MonitorElement *>(this)->update();
1533  return reference_;
1534 }
1535 
1536 TH1 *
1538 {
1539  const_cast<MonitorElement *>(this)->update();
1540  return checkRootObject(data_.objname, reference_, __PRETTY_FUNCTION__, 0);
1541 }
1542 
1543 TH1F *
1545 {
1546  assert(kind() == DQM_KIND_TH1F);
1547  const_cast<MonitorElement *>(this)->update();
1548  return static_cast<TH1F *>
1549  (checkRootObject(data_.objname, reference_, __PRETTY_FUNCTION__, 1));
1550 }
1551 
1552 TH1S *
1554 {
1555  assert(kind() == DQM_KIND_TH1S);
1556  const_cast<MonitorElement *>(this)->update();
1557  return static_cast<TH1S *>
1558  (checkRootObject(data_.objname, reference_, __PRETTY_FUNCTION__, 1));
1559 }
1560 
1561 TH1D *
1563 {
1564  assert(kind() == DQM_KIND_TH1D);
1565  const_cast<MonitorElement *>(this)->update();
1566  return static_cast<TH1D *>
1567  (checkRootObject(data_.objname, reference_, __PRETTY_FUNCTION__, 1));
1568 }
1569 
1570 TH2F *
1572 {
1573  assert(kind() == DQM_KIND_TH2F);
1574  const_cast<MonitorElement *>(this)->update();
1575  return static_cast<TH2F *>
1576  (checkRootObject(data_.objname, reference_, __PRETTY_FUNCTION__, 2));
1577 }
1578 
1579 TH2S *
1581 {
1582  assert(kind() == DQM_KIND_TH2S);
1583  const_cast<MonitorElement *>(this)->update();
1584  return static_cast<TH2S *>
1585  (checkRootObject(data_.objname, reference_, __PRETTY_FUNCTION__, 2));
1586 }
1587 
1588 TH2D *
1590 {
1591  assert(kind() == DQM_KIND_TH2D);
1592  const_cast<MonitorElement *>(this)->update();
1593  return static_cast<TH2D *>
1594  (checkRootObject(data_.objname, reference_, __PRETTY_FUNCTION__, 2));
1595 }
1596 
1597 TH3F *
1599 {
1600  assert(kind() == DQM_KIND_TH3F);
1601  const_cast<MonitorElement *>(this)->update();
1602  return static_cast<TH3F *>
1603  (checkRootObject(data_.objname, reference_, __PRETTY_FUNCTION__, 3));
1604 }
1605 
1606 TProfile *
1608 {
1610  const_cast<MonitorElement *>(this)->update();
1611  return static_cast<TProfile *>
1612  (checkRootObject(data_.objname, reference_, __PRETTY_FUNCTION__, 1));
1613 }
1614 
1615 TProfile2D *
1617 {
1619  const_cast<MonitorElement *>(this)->update();
1620  return static_cast<TProfile2D *>
1621  (checkRootObject(data_.objname, reference_, __PRETTY_FUNCTION__, 2));
1622 }
TH1F * getRefTH1F(void) const
TH2S * getTH2S(void) const
TH1S * getTH1S(void) const
QCriterion * qcriterion_
Definition: QReport.h:51
static const uint32_t DQM_PROP_REPORT_WARN
Definition: DQMNet.h:47
int i
Definition: DBlmapReader.cc:9
void incompatible(const char *func) const
uint32_t moduleId
Definition: DQMNet.h:104
const QReport * getQReport(const std::string &qtname) const
get QReport corresponding to &lt;qtname&gt; (null pointer if QReport does not exist)
void setBinContent(int binx, double content)
set content of bin (1-D)
QReports qreports
Definition: DQMNet.h:107
TH1 * accessRootObject(const char *func, int reqdim) const
std::string getName(void) const
get name of quality test
Definition: QTest.h:57
void copyFrom(TH1 *from)
MonitorElement * initialise(Kind kind)
std::string algorithm
Definition: DQMNet.h:93
const double w
Definition: UKUtility.cc:23
TProfile2D * getTProfile2D(void) const
TH1 * getRefTH1(void) const
uint64_t version
Definition: DQMNet.h:100
void setAxisRange(double xmin, double xmax, int axis=1)
set x-, y- or z-axis range (axis=1, 2, 3 respectively)
void setAxisTimeFormat(const char *format="", int axis=1)
set the format of the time values that are displayed on an axis
void updateQReportStats(void)
Refresh QReport stats, usually after MEs were read in from a file.
std::vector< QReport > qreports_
std::string tagLabelString(void) const
return label string for the monitor element tag (eg. &lt;name&gt;t=12345&lt;/name&gt;)
Definition: DQMNet.h:22
std::string qualityTagString(const DQMNet::QValue &qv) const
std::string getAxisTitle(int axis=1) const
get x-, y- or z-axis title (axis=1, 2, 3 respectively)
TProfile2D * getRefTProfile2D(void) const
auto zw(V v) -> Vec2< typenamestd::remove_reference< decltype(v[0])>::type >
Definition: ExtVec.h:87
uint32_t flags
Definition: DQMNet.h:98
assert(m_qm.get())
void disableSoftReset(void)
reverts action of softReset
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)
static const int WARNING
TH3F * getTH3F(void) const
TH1D * getTH1D(void) const
void runQTests(void)
run all quality tests
void softReset(void)
TH2D * getTH2D(void) const
uint32_t tag
Definition: DQMNet.h:99
const std::string * dirname
Definition: DQMNet.h:105
void update(void)
Mark the object updated.
#define nullptr
double getEntries(void) const
get # of entries
double getMean(int axis=1) const
get mean value of histogram along x, y or z axis (axis=1, 2, 3 respectively)
uint32_t run
Definition: DQMNet.h:101
float float float z
double getMeanError(int axis=1) const
void packScalarData(std::string &into, const char *prefix) const
convert scalar data into a string.
int getNbinsY(void) const
get # of bins in Y-axis
void Fill(long long x)
std::vector< QReport * > getQErrors(void) const
get errors from last set of quality tests
bool wasUpdated(void) const
true if ME was updated in last monitoring cycle
TH3F * getRefTH3F(void) const
T x() const
Cartesian x coordinate.
tuple c2
Definition: counter.py:145
void ShiftFillLast(double y, double ye=0., int32_t xscale=1)
static TH1 * checkRootObject(const std::string &name, TObject *tobj, const char *func, int reqdim)
void packQualityData(std::string &into) const
serialise quality report information into a string.
static const uint32_t DQM_PROP_HAS_REFERENCE
Definition: DQMNet.h:53
TH2F * getRefTH2F(void) const
void setAxisTimeDisplay(int value, int axis=1)
set x-, y-, or z-axis to display time values
void doFill(int64_t x)
&quot;Fill&quot; ME method for int64_t
int getNbinsZ(void) const
get # of bins in Z-axis
T sqrt(T t)
Definition: SSEVec.h:48
uint32_t lumi
Definition: DQMNet.h:102
tuple result
Definition: query.py:137
void addProfiles(TProfile *h1, TProfile *h2, TProfile *sum, float c1, float c2)
std::string getTitle(void) const
get MonitorElement title
T Abs(T a)
Definition: MathUtil.h:49
static const int DID_NOT_RUN
TH1 * getTH1(void) const
static const uint32_t DQM_PROP_REPORT_ERROR
Definition: DQMNet.h:46
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
#define end
Definition: vmac.h:37
static const uint32_t DQM_PROP_REPORT_OTHER
Definition: DQMNet.h:48
Kind kind(void) const
Get the type of the monitor element.
void setEntries(double nentries)
set # of entries
const std::string getFullname(void) const
get full name of ME including Pathname
std::string effLabelString(void) const
return label string for the monitor element tag (eg. &lt;name&gt;t=12345&lt;/name&gt;)
bool isAccumulateEnabled(void) const
whether ME contents should be accumulated over multiple monitoring periods; default: false ...
const uint32_t streamId(void) const
std::string objname
Definition: DQMNet.h:106
std::string valueString(void) const
TH2D * getRefTH2D(void) const
std::string qtname
Definition: DQMNet.h:92
DQMNet::CoreObject data_
TAxis * getAxis(const char *func, int axis) const
void setTitle(const std::string &title)
set (ie. change) histogram/profile title
double getRMSError(int axis=1) const
get RMS uncertainty of histogram along x, y or z axis(axis=1,2,3 respectively)
TObject * getRootObject(void) const
#define N
Definition: blowfish.cc:9
std::vector< QReport * > getQReports(void) const
get map of QReports
void setAxisTimeOffset(double toffset, const char *option="local", int axis=1)
set the time offset, if option = &quot;gmt&quot; then the offset is treated as a GMT time
std::vector< QReport * > getQOthers(void) const
double getBinError(int binx) const
get uncertainty on content of bin (1-D) - See TH1::GetBinError for details
virtual float runTest(const MonitorElement *me)
Definition: QTest.cc:27
TH1F * getTH1F(void) const
std::string tagString(void) const
double b
Definition: hdecay.h:120
static void packQualityData(std::string &into, const QReports &qr)
Definition: DQMNet.cc:177
TProfile * getRefTProfile(void) const
void copyFunctions(TH1 *from, TH1 *to)
const uint32_t moduleId(void) const
double getBinContent(int binx) const
get content of bin (1-D)
double getRMS(int axis=1) const
get RMS of histogram along x, y or z axis (axis=1, 2, 3 respectively)
double getYmax(void) const
get max Y value (for profiles)
double a
Definition: hdecay.h:121
DQMNet::QValue * qvalue_
Definition: QReport.h:50
TProfile * getTProfile(void) const
TH2S * getRefTH2S(void) const
bool isSoftResetEnabled(void) const
whether soft-reset is enabled; default is false
double getBinEntries(int bin) const
get # of bin entries (for profiles)
std::vector< QReport * > getQWarnings(void) const
get warnings from last set of quality tests
int getNbinsX(void) const
get # of bins in X-axis
std::string message
Definition: DQMNet.h:91
static const int STATUS_OK
const uint32_t run(void) const
tuple cout
Definition: gather_cfg.py:121
static const uint32_t DQM_PROP_NEW
Definition: DQMNet.h:58
TH2F * getTH2F(void) const
if(conf.exists("allCellsPositionCalc"))
uint32_t streamId
Definition: DQMNet.h:103
float qtresult
Definition: DQMNet.h:90
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void Reset(void)
reset ME (ie. contents, errors, etc)
TObject * getRefRootObject(void) const
void setBinEntries(int bin, double nentries)
set # of bin entries (to be used for profiles)
TH1S * getRefTH1S(void) const
SurfaceDeformation * create(int type, const std::vector< double > &params)
void addQReport(const DQMNet::QValue &desc, QCriterion *qc)
Add quality report, from DQMStore.
static const int ERROR
double getYmin(void) const
get min Y value (for profiles)
TH1D * getRefTH1D(void) const
static bool CheckBinLabels(const TAxis *a1, const TAxis *a2)
Check the consistency of the axis labels.
void raiseDQMError(const char *context, const char *fmt,...)
Definition: DQMError.cc:11