CMS 3D CMS Logo

MonitorElement.cc
Go to the documentation of this file.
1 #define __STDC_FORMAT_MACROS 1
5 #include "TClass.h"
6 #include "TMath.h"
7 #include "TList.h"
8 #include "THashList.h"
9 #include <iostream>
10 #include <cassert>
11 #include <cfloat>
12 #include <cinttypes>
13 
14 #if !WITHOUT_CMS_FRAMEWORK
16 #endif
17 
18 namespace dqm::impl {
19 
20  static TH1 *checkRootObject(const std::string &name, TObject *tobj, const char *func, int reqdim) {
21  if (!tobj)
22  raiseDQMError("MonitorElement",
23  "Method '%s' cannot be invoked on monitor"
24  " element '%s' because it is not a ROOT object.",
25  func,
26  name.c_str());
27 
28  auto *h = static_cast<TH1 *>(tobj);
29  int ndim = h->GetDimension();
30  if (reqdim < 0 || reqdim > ndim)
31  raiseDQMError("MonitorElement",
32  "Method '%s' cannot be invoked on monitor"
33  " element '%s' because it requires %d dimensions; this"
34  " object of type '%s' has %d dimensions",
35  func,
36  name.c_str(),
37  reqdim,
38  typeid(*h).name(),
39  ndim);
40 
41  return h;
42  }
43 
45  switch (kind) {
46  case Kind::INT:
47  case Kind::REAL:
48  case Kind::STRING:
49  case Kind::TH1F:
50  case Kind::TH1S:
51  case Kind::TH1D:
52  case Kind::TH2F:
53  case Kind::TH2S:
54  case Kind::TH2D:
55  case Kind::TH3F:
56  case Kind::TPROFILE:
57  case Kind::TPROFILE2D:
58  data_.flags &= ~DQMNet::DQM_PROP_TYPE_MASK;
59  data_.flags |= ((int)kind);
60  break;
61 
62  default:
63  raiseDQMError("MonitorElement",
64  "cannot initialise monitor element"
65  " to invalid type %d",
66  (int)kind);
67  }
68 
69  return this;
70  }
71 
73  initialise(kind);
74  auto access = this->accessMut();
75  switch (kind) {
76  case Kind::TH1F:
77  assert(dynamic_cast<TH1F *>(rootobj));
78  assert(!reference_ || dynamic_cast<TH1F *>(reference_));
79  access.value.object_ = std::unique_ptr<TH1>(rootobj);
80  break;
81 
82  case Kind::TH1S:
83  assert(dynamic_cast<TH1S *>(rootobj));
84  assert(!reference_ || dynamic_cast<TH1S *>(reference_));
85  access.value.object_ = std::unique_ptr<TH1>(rootobj);
86  break;
87 
88  case Kind::TH1D:
89  assert(dynamic_cast<TH1D *>(rootobj));
90  assert(!reference_ || dynamic_cast<TH1D *>(reference_));
91  access.value.object_ = std::unique_ptr<TH1>(rootobj);
92  break;
93 
94  case Kind::TH2F:
95  assert(dynamic_cast<TH2F *>(rootobj));
96  assert(!reference_ || dynamic_cast<TH2F *>(reference_));
97  access.value.object_ = std::unique_ptr<TH1>(rootobj);
98  break;
99 
100  case Kind::TH2S:
101  assert(dynamic_cast<TH2S *>(rootobj));
102  assert(!reference_ || dynamic_cast<TH2S *>(reference_));
103  access.value.object_ = std::unique_ptr<TH1>(rootobj);
104  break;
105 
106  case Kind::TH2D:
107  assert(dynamic_cast<TH2D *>(rootobj));
108  assert(!reference_ || dynamic_cast<TH1D *>(reference_));
109  access.value.object_ = std::unique_ptr<TH1>(rootobj);
110  break;
111 
112  case Kind::TH3F:
113  assert(dynamic_cast<TH3F *>(rootobj));
114  assert(!reference_ || dynamic_cast<TH3F *>(reference_));
115  access.value.object_ = std::unique_ptr<TH1>(rootobj);
116  break;
117 
118  case Kind::TPROFILE:
119  assert(dynamic_cast<TProfile *>(rootobj));
120  assert(!reference_ || dynamic_cast<TProfile *>(reference_));
121  access.value.object_ = std::unique_ptr<TH1>(rootobj);
122  break;
123 
124  case Kind::TPROFILE2D:
125  assert(dynamic_cast<TProfile2D *>(rootobj));
126  assert(!reference_ || dynamic_cast<TProfile2D *>(reference_));
127  access.value.object_ = std::unique_ptr<TH1>(rootobj);
128  break;
129 
130  default:
131  raiseDQMError("MonitorElement",
132  "cannot initialise monitor element"
133  " as a root object with type %d",
134  (int)kind);
135  }
136 
137  if (reference_)
139 
140  return this;
141  }
142 
144  initialise(kind);
145  auto access = this->accessMut();
146  if (kind == Kind::STRING)
148  else
149  raiseDQMError("MonitorElement",
150  "cannot initialise monitor element"
151  " as a string with type %d",
152  (int)kind);
153 
154  return this;
155  }
156 
159  data_.version = 0;
160  data_.dirname = nullptr;
161  data_.run = 0;
162  data_.lumi = 0;
163  data_.streamId = 0;
164  data_.moduleId = 0;
165  data_.tag = 0;
167  }
168 
171  data_.version = 0;
172  data_.run = 0;
173  data_.lumi = 0;
174  data_.streamId = 0;
175  data_.moduleId = 0;
176  data_.dirname = path;
177  data_.objname = name;
178  data_.tag = 0;
180  }
181 
184  data_.version = 0;
185  data_.run = run;
186  data_.lumi = 0;
187  data_.streamId = 0;
189  data_.dirname = path;
190  data_.objname = name;
191  data_.tag = 0;
193  }
194 
196  : data_(x.data_),
197  frozen_(nullptr),
201  qreports_(x.qreports_) {}
202 
205  auto access = this->accessMut();
206  auto xaccess = x.access();
207  if (xaccess.value.object_)
208  access.value.object_ = std::unique_ptr<TH1>(static_cast<TH1 *>(xaccess.value.object_->Clone()));
209  access.value.scalar_ = xaccess.value.scalar_;
210 
211  if (x.refvalue_)
212  refvalue_ = static_cast<TH1 *>(x.refvalue_->Clone());
213  }
214 
216  // TODO: this is only as long as we use the edm::Service DQMStore.
217  delete mutable_;
218  delete refvalue_;
219  }
220 
221  //utility function to check the consistency of the axis labels
222  //taken from TH1::CheckBinLabels which is not public
223  bool MonitorElement::CheckBinLabels(const TAxis *a1, const TAxis *a2) {
224  // check that axis have same labels
225  THashList *l1 = (const_cast<TAxis *>(a1))->GetLabels();
226  THashList *l2 = (const_cast<TAxis *>(a2))->GetLabels();
227 
228  if (!l1 && !l2)
229  return true;
230  if (!l1 || !l2) {
231  return false;
232  }
233  // check now labels sizes are the same
234  if (l1->GetSize() != l2->GetSize()) {
235  return false;
236  }
237  for (int i = 1; i <= a1->GetNbins(); ++i) {
238  TString label1 = a1->GetBinLabel(i);
239  TString label2 = a2->GetBinLabel(i);
240  if (label1 != label2) {
241  return false;
242  }
243  }
244  return true;
245  }
246 
249  auto access = this->accessMut();
250  update();
251  if (kind() == Kind::STRING) {
253  } else {
254  incompatible(__PRETTY_FUNCTION__);
255  }
256  }
257 
259  void MonitorElement::Fill(double x) {
260  auto access = this->accessMut();
261  update();
262  if (kind() == Kind::INT)
263  access.value.scalar_.num = static_cast<int64_t>(x);
264  else if (kind() == Kind::REAL)
265  access.value.scalar_.real = x;
266  else if (kind() == Kind::TH1F)
267  accessRootObject(access, __PRETTY_FUNCTION__, 1)->Fill(x, 1);
268  else if (kind() == Kind::TH1S)
269  accessRootObject(access, __PRETTY_FUNCTION__, 1)->Fill(x, 1);
270  else if (kind() == Kind::TH1D)
271  accessRootObject(access, __PRETTY_FUNCTION__, 1)->Fill(x, 1);
272  else
273  incompatible(__PRETTY_FUNCTION__);
274  }
275 
277  void MonitorElement::doFill(int64_t x) {
278  auto access = this->accessMut();
279  update();
280  if (kind() == Kind::INT)
281  access.value.scalar_.num = static_cast<int64_t>(x);
282  else if (kind() == Kind::REAL)
283  access.value.scalar_.real = static_cast<double>(x);
284  else if (kind() == Kind::TH1F)
285  accessRootObject(access, __PRETTY_FUNCTION__, 1)->Fill(static_cast<double>(x), 1);
286  else if (kind() == Kind::TH1S)
287  accessRootObject(access, __PRETTY_FUNCTION__, 1)->Fill(static_cast<double>(x), 1);
288  else if (kind() == Kind::TH1D)
289  accessRootObject(access, __PRETTY_FUNCTION__, 1)->Fill(static_cast<double>(x), 1);
290  else
291  incompatible(__PRETTY_FUNCTION__);
292  }
293 
295  void MonitorElement::Fill(double x, double yw) {
296  auto access = this->accessMut();
297  update();
298  if (kind() == Kind::TH1F)
299  accessRootObject(access, __PRETTY_FUNCTION__, 1)->Fill(x, yw);
300  else if (kind() == Kind::TH1S)
301  accessRootObject(access, __PRETTY_FUNCTION__, 1)->Fill(x, yw);
302  else if (kind() == Kind::TH1D)
303  accessRootObject(access, __PRETTY_FUNCTION__, 1)->Fill(x, yw);
304  else if (kind() == Kind::TH2F)
305  static_cast<TH2F *>(accessRootObject(access, __PRETTY_FUNCTION__, 2))->Fill(x, yw, 1);
306  else if (kind() == Kind::TH2S)
307  static_cast<TH2S *>(accessRootObject(access, __PRETTY_FUNCTION__, 2))->Fill(x, yw, 1);
308  else if (kind() == Kind::TH2D)
309  static_cast<TH2D *>(accessRootObject(access, __PRETTY_FUNCTION__, 2))->Fill(x, yw, 1);
310  else if (kind() == Kind::TPROFILE)
311  static_cast<TProfile *>(accessRootObject(access, __PRETTY_FUNCTION__, 1))->Fill(x, yw, 1);
312  else
313  incompatible(__PRETTY_FUNCTION__);
314  }
315 
319  void MonitorElement::ShiftFillLast(double y, double ye, int xscale) {
320  // TODO: this should take the lock only once to be actually safe.
321  // But since it is not const, we don't even claim it is thread-safe.
322  update();
323  if (kind() == Kind::TH1F || kind() == Kind::TH1S || kind() == Kind::TH1D) {
324  int nbins = getNbinsX();
325  auto entries = (int)getEntries();
326  // first fill bins from left to right
327  int index = entries + 1;
328  int xlow = 2;
329  int xup = nbins;
330  // if more entries than bins then start shifting
331  if (entries >= nbins) {
332  index = nbins;
333  xlow = entries - nbins + 3;
334  xup = entries + 1;
335  // average first bin
336  double y1 = getBinContent(1);
337  double y2 = getBinContent(2);
338  double y1err = getBinError(1);
339  double y2err = getBinError(2);
340  double N = entries - nbins + 1.;
341  if (ye == 0. || y1err == 0. || y2err == 0.) {
342  // for errors zero calculate unweighted mean and its error
343  double sum = N * y1 + y2;
344  y1 = sum / (N + 1.);
345  // FIXME check if correct
346  double s = (N + 1.) * (N * y1 * y1 + y2 * y2) - sum * sum;
347  if (s >= 0.)
348  y1err = sqrt(s) / (N + 1.);
349  else
350  y1err = 0.;
351  } else {
352  // for errors non-zero calculate weighted mean and its error
353  double denom = (1. / y1err + 1. / y2err);
354  double mean = (y1 / y1err + y2 / y2err) / denom;
355  // FIXME check if correct
356  y1err = sqrt(((y1 - mean) * (y1 - mean) / y1err + (y2 - mean) * (y2 - mean) / y2err) / denom / 2.);
357  y1 = mean; // set y1 to mean for filling below
358  }
359  setBinContent(1, y1);
360  setBinError(1, y1err);
361  // shift remaining bins to the left
362  for (int i = 3; i <= nbins; i++) {
364  setBinError(i - 1, getBinError(i));
365  }
366  }
367  // fill last bin with new values
368  setBinContent(index, y);
369  setBinError(index, ye);
370  // set entries
371  setEntries(entries + 1);
372  // set axis labels and reset drawing option
373  char buffer[10];
374  sprintf(buffer, "%d", xlow * xscale);
375  std::string a(buffer);
376  setBinLabel(2, a);
377  sprintf(buffer, "%d", xup * xscale);
378  std::string b(buffer);
379  setBinLabel(nbins, b);
380  setBinLabel(1, "av.");
381  } else
382  incompatible(__PRETTY_FUNCTION__);
383  }
385  void MonitorElement::Fill(double x, double y, double zw) {
386  auto access = this->accessMut();
387  update();
388  if (kind() == Kind::TH2F)
389  static_cast<TH2F *>(accessRootObject(access, __PRETTY_FUNCTION__, 2))->Fill(x, y, zw);
390  else if (kind() == Kind::TH2S)
391  static_cast<TH2S *>(accessRootObject(access, __PRETTY_FUNCTION__, 2))->Fill(x, y, zw);
392  else if (kind() == Kind::TH2D)
393  static_cast<TH2D *>(accessRootObject(access, __PRETTY_FUNCTION__, 2))->Fill(x, y, zw);
394  else if (kind() == Kind::TH3F)
395  static_cast<TH3F *>(accessRootObject(access, __PRETTY_FUNCTION__, 2))->Fill(x, y, zw, 1);
396  else if (kind() == Kind::TPROFILE)
397  static_cast<TProfile *>(accessRootObject(access, __PRETTY_FUNCTION__, 2))->Fill(x, y, zw);
398  else if (kind() == Kind::TPROFILE2D)
399  static_cast<TProfile2D *>(accessRootObject(access, __PRETTY_FUNCTION__, 2))->Fill(x, y, zw, 1);
400  else
401  incompatible(__PRETTY_FUNCTION__);
402  }
403 
405  void MonitorElement::Fill(double x, double y, double z, double w) {
406  auto access = this->accessMut();
407  update();
408  if (kind() == Kind::TH3F)
409  static_cast<TH3F *>(accessRootObject(access, __PRETTY_FUNCTION__, 2))->Fill(x, y, z, w);
410  else if (kind() == Kind::TPROFILE2D)
411  static_cast<TProfile2D *>(accessRootObject(access, __PRETTY_FUNCTION__, 2))->Fill(x, y, z, w);
412  else
413  incompatible(__PRETTY_FUNCTION__);
414  }
415 
418  auto access = this->accessMut();
419  update();
420  if (kind() == Kind::INT)
421  access.value.scalar_.num = 0;
422  else if (kind() == Kind::REAL)
423  access.value.scalar_.real = 0;
424  else if (kind() == Kind::STRING)
425  access.value.scalar_.str.clear();
426  else
427  return accessRootObject(access, __PRETTY_FUNCTION__, 1)->Reset();
428  }
429 
431  void MonitorElement::packScalarData(std::string &into, const char *prefix) const {
432  auto access = this->access();
433  char buf[64];
434  if (kind() == Kind::INT) {
435  snprintf(buf, sizeof(buf), "%s%" PRId64, prefix, access.value.scalar_.num);
436  into = buf;
437  } else if (kind() == Kind::REAL) {
438  snprintf(buf, sizeof(buf), "%s%.*g", prefix, DBL_DIG + 2, access.value.scalar_.real);
439  into = buf;
440  } else if (kind() == Kind::STRING) {
441  into.reserve(strlen(prefix) + access.value.scalar_.str.size());
442  into += prefix;
443  into += access.value.scalar_.str;
444  } else
445  incompatible(__PRETTY_FUNCTION__);
446  }
447 
450 
455  if (kind() == Kind::INT)
456  packScalarData(result, "i=");
457  else if (kind() == Kind::REAL)
458  packScalarData(result, "f=");
459  else if (kind() == Kind::STRING)
460  packScalarData(result, "s=");
461  else
462  incompatible(__PRETTY_FUNCTION__);
463 
464  return result;
465  }
466 
473  result.reserve(6 + 2 * data_.objname.size() + val.size());
474  result += '<';
475  result += data_.objname;
476  result += '>';
477  result += val;
478  result += '<';
479  result += '/';
480  result += data_.objname;
481  result += '>';
482  return result;
483  }
484 
487  char buf[32];
489  size_t len = sprintf(buf, "t=%" PRIu32, data_.tag);
490 
491  result.reserve(6 + 2 * data_.objname.size() + len);
492  result += '<';
493  result += data_.objname;
494  result += '>';
495  result += buf;
496  result += '<';
497  result += '/';
498  result += data_.objname;
499  result += '>';
500  return result;
501  }
502 
506 
507  result.reserve(6 + 2 * data_.objname.size() + 3);
508  result += '<';
509  result += data_.objname;
510  result += '>';
511  result += "e=1";
512  result += '<';
513  result += '/';
514  result += data_.objname;
515  result += '>';
516  return result;
517  }
518 
520  char buf[64];
522  size_t titlelen = data_.objname.size() + qv.qtname.size() + 1;
523  size_t buflen = sprintf(buf, "qr=st:%d:%.*g:", qv.code, DBL_DIG + 2, qv.qtresult);
524 
525  result.reserve(7 + 2 * titlelen + buflen + qv.algorithm.size() + qv.message.size());
526  result += '<';
527  result += data_.objname;
528  result += '.';
529  result += qv.qtname;
530  result += '>';
531  result += buf;
532  result += qv.algorithm;
533  result += ':';
534  result += qv.message;
535  result += '<';
536  result += '/';
537  result += data_.objname;
538  result += '.';
539  result += qv.qtname;
540  result += '>';
541  return result;
542  }
543 
544  const QReport *MonitorElement::getQReport(const std::string &qtname) const {
545  QReport *qr;
546  DQMNet::QValue *qv;
547  const_cast<MonitorElement *>(this)->getQReport(false, qtname, qr, qv);
548  return qr;
549  }
550 
551  std::vector<QReport *> MonitorElement::getQReports() const {
552  std::vector<QReport *> result;
553  result.reserve(qreports_.size());
554  for (size_t i = 0, e = qreports_.size(); i != e; ++i) {
555  const_cast<MonitorElement *>(this)->qreports_[i].qvalue_ = const_cast<DQMNet::QValue *>(&data_.qreports[i]);
556  result.push_back(const_cast<QReport *>(&qreports_[i]));
557  }
558  return result;
559  }
560 
561  std::vector<QReport *> MonitorElement::getQWarnings() const {
562  std::vector<QReport *> result;
563  result.reserve(qreports_.size());
564  for (size_t i = 0, e = qreports_.size(); i != e; ++i)
565  if (data_.qreports[i].code == dqm::qstatus::WARNING) {
566  const_cast<MonitorElement *>(this)->qreports_[i].qvalue_ = const_cast<DQMNet::QValue *>(&data_.qreports[i]);
567  result.push_back(const_cast<QReport *>(&qreports_[i]));
568  }
569  return result;
570  }
571 
572  std::vector<QReport *> MonitorElement::getQErrors() const {
573  std::vector<QReport *> result;
574  result.reserve(qreports_.size());
575  for (size_t i = 0, e = qreports_.size(); i != e; ++i)
576  if (data_.qreports[i].code == dqm::qstatus::ERROR) {
577  const_cast<MonitorElement *>(this)->qreports_[i].qvalue_ = const_cast<DQMNet::QValue *>(&data_.qreports[i]);
578  result.push_back(const_cast<QReport *>(&qreports_[i]));
579  }
580  return result;
581  }
582 
583  std::vector<QReport *> MonitorElement::getQOthers() const {
584  std::vector<QReport *> result;
585  result.reserve(qreports_.size());
586  for (size_t i = 0, e = qreports_.size(); i != e; ++i)
588  data_.qreports[i].code != dqm::qstatus::ERROR) {
589  const_cast<MonitorElement *>(this)->qreports_[i].qvalue_ = const_cast<DQMNet::QValue *>(&data_.qreports[i]);
590  result.push_back(const_cast<QReport *>(&qreports_[i]));
591  }
592  return result;
593  }
594 
595  void MonitorElement::incompatible(const char *func) const {
596  raiseDQMError("MonitorElement",
597  "Method '%s' cannot be invoked on monitor"
598  " element '%s'",
599  func,
600  data_.objname.c_str());
601  }
602 
603  TH1 const *MonitorElement::accessRootObject(Access const &access, const char *func, int reqdim) const {
604  if (kind() < Kind::TH1F)
605  raiseDQMError("MonitorElement",
606  "Method '%s' cannot be invoked on monitor"
607  " element '%s' because it is not a root object",
608  func,
609  data_.objname.c_str());
610  return access.value.object_.get();
611  }
612  TH1 *MonitorElement::accessRootObject(AccessMut const &access, const char *func, int reqdim) const {
613  if (kind() < Kind::TH1F)
614  raiseDQMError("MonitorElement",
615  "Method '%s' cannot be invoked on monitor"
616  " element '%s' because it is not a root object",
617  func,
618  data_.objname.c_str());
619  return checkRootObject(data_.objname, access.value.object_.get(), func, reqdim);
620  }
621 
622  /*** getter methods (wrapper around ROOT methods) ****/
623  //
625  double MonitorElement::getMean(int axis /* = 1 */) const {
626  auto access = this->access();
627  return accessRootObject(access, __PRETTY_FUNCTION__, axis - 1)->GetMean(axis);
628  }
629 
632  double MonitorElement::getMeanError(int axis /* = 1 */) const {
633  auto access = this->access();
634  return accessRootObject(access, __PRETTY_FUNCTION__, axis - 1)->GetMeanError(axis);
635  }
636 
638  double MonitorElement::getRMS(int axis /* = 1 */) const {
639  auto access = this->access();
640  return accessRootObject(access, __PRETTY_FUNCTION__, axis - 1)->GetRMS(axis);
641  }
642 
644  double MonitorElement::getRMSError(int axis /* = 1 */) const {
645  auto access = this->access();
646  return accessRootObject(access, __PRETTY_FUNCTION__, axis - 1)->GetRMSError(axis);
647  }
648 
651  auto access = this->access();
652  return accessRootObject(access, __PRETTY_FUNCTION__, 1)->GetNbinsX();
653  }
654 
657  auto access = this->access();
658  return accessRootObject(access, __PRETTY_FUNCTION__, 2)->GetNbinsY();
659  }
660 
663  auto access = this->access();
664  return accessRootObject(access, __PRETTY_FUNCTION__, 3)->GetNbinsZ();
665  }
666 
668  double MonitorElement::getBinContent(int binx) const {
669  auto access = this->access();
670  return accessRootObject(access, __PRETTY_FUNCTION__, 1)->GetBinContent(binx);
671  }
672 
674  double MonitorElement::getBinContent(int binx, int biny) const {
675  auto access = this->access();
676  return accessRootObject(access, __PRETTY_FUNCTION__, 2)->GetBinContent(binx, biny);
677  }
678 
680  double MonitorElement::getBinContent(int binx, int biny, int binz) const {
681  auto access = this->access();
682  return accessRootObject(access, __PRETTY_FUNCTION__, 3)->GetBinContent(binx, biny, binz);
683  }
684 
686  double MonitorElement::getBinError(int binx) const {
687  auto access = this->access();
688  return accessRootObject(access, __PRETTY_FUNCTION__, 1)->GetBinError(binx);
689  }
690 
692  double MonitorElement::getBinError(int binx, int biny) const {
693  auto access = this->access();
694  return accessRootObject(access, __PRETTY_FUNCTION__, 2)->GetBinError(binx, biny);
695  }
696 
698  double MonitorElement::getBinError(int binx, int biny, int binz) const {
699  auto access = this->access();
700  return accessRootObject(access, __PRETTY_FUNCTION__, 3)->GetBinError(binx, biny, binz);
701  }
702 
704  double MonitorElement::getEntries() const {
705  auto access = this->access();
706  return accessRootObject(access, __PRETTY_FUNCTION__, 1)->GetEntries();
707  }
708 
710  double MonitorElement::getBinEntries(int bin) const {
711  auto access = this->access();
712  if (kind() == Kind::TPROFILE)
713  return static_cast<TProfile const *>(accessRootObject(access, __PRETTY_FUNCTION__, 1))->GetBinEntries(bin);
714  else if (kind() == Kind::TPROFILE2D)
715  return static_cast<TProfile2D const *>(accessRootObject(access, __PRETTY_FUNCTION__, 1))->GetBinEntries(bin);
716  else {
717  incompatible(__PRETTY_FUNCTION__);
718  return 0;
719  }
720  }
721 
723  std::string MonitorElement::getAxisTitle(int axis /* = 1 */) const {
724  auto access = this->access();
725  return getAxis(access, __PRETTY_FUNCTION__, axis)->GetTitle();
726  }
727 
730  auto access = this->access();
731  return accessRootObject(access, __PRETTY_FUNCTION__, 1)->GetTitle();
732  }
733 
734  /*** setter methods (wrapper around ROOT methods) ****/
735  //
737  void MonitorElement::setBinContent(int binx, double content) {
738  auto access = this->accessMut();
739  accessRootObject(access, __PRETTY_FUNCTION__, 1)->SetBinContent(binx, content);
740  }
741 
743  void MonitorElement::setBinContent(int binx, int biny, double content) {
744  auto access = this->accessMut();
745  accessRootObject(access, __PRETTY_FUNCTION__, 2)->SetBinContent(binx, biny, content);
746  }
747 
749  void MonitorElement::setBinContent(int binx, int biny, int binz, double content) {
750  auto access = this->accessMut();
751  accessRootObject(access, __PRETTY_FUNCTION__, 3)->SetBinContent(binx, biny, binz, content);
752  }
753 
755  void MonitorElement::setBinError(int binx, double error) {
756  auto access = this->accessMut();
757  accessRootObject(access, __PRETTY_FUNCTION__, 1)->SetBinError(binx, error);
758  }
759 
761  void MonitorElement::setBinError(int binx, int biny, double error) {
762  auto access = this->accessMut();
763  accessRootObject(access, __PRETTY_FUNCTION__, 2)->SetBinError(binx, biny, error);
764  }
765 
767  void MonitorElement::setBinError(int binx, int biny, int binz, double error) {
768  auto access = this->accessMut();
769  accessRootObject(access, __PRETTY_FUNCTION__, 3)->SetBinError(binx, biny, binz, error);
770  }
771 
773  void MonitorElement::setBinEntries(int bin, double nentries) {
774  auto access = this->accessMut();
775  if (kind() == Kind::TPROFILE)
776  static_cast<TProfile *>(accessRootObject(access, __PRETTY_FUNCTION__, 1))->SetBinEntries(bin, nentries);
777  else if (kind() == Kind::TPROFILE2D)
778  static_cast<TProfile2D *>(accessRootObject(access, __PRETTY_FUNCTION__, 1))->SetBinEntries(bin, nentries);
779  else
780  incompatible(__PRETTY_FUNCTION__);
781  }
782 
784  void MonitorElement::setEntries(double nentries) {
785  auto access = this->accessMut();
786  accessRootObject(access, __PRETTY_FUNCTION__, 1)->SetEntries(nentries);
787  }
788 
790  void MonitorElement::setBinLabel(int bin, const std::string &label, int axis /* = 1 */) {
791  auto access = this->accessMut();
792  update();
793  if (getAxis(access, __PRETTY_FUNCTION__, axis)->GetNbins() >= bin) {
794  getAxis(access, __PRETTY_FUNCTION__, axis)->SetBinLabel(bin, label.c_str());
795  } else {
796 #if WITHOUT_CMS_FRAMEWORK
797  std::cout
798 #else
799  edm::LogWarning("MonitorElement")
800 #endif
801  << "*** MonitorElement: WARNING:"
802  << "setBinLabel: attempting to set label of non-existent bin number for ME: " << getFullname() << " \n";
803  }
804  }
805 
807  void MonitorElement::setAxisRange(double xmin, double xmax, int axis /* = 1 */) {
808  auto access = this->accessMut();
809  getAxis(access, __PRETTY_FUNCTION__, axis)->SetRangeUser(xmin, xmax);
810  }
811 
813  void MonitorElement::setAxisTitle(const std::string &title, int axis /* = 1 */) {
814  auto access = this->accessMut();
815  getAxis(access, __PRETTY_FUNCTION__, axis)->SetTitle(title.c_str());
816  }
817 
819  void MonitorElement::setAxisTimeDisplay(int value, int axis /* = 1 */) {
820  auto access = this->accessMut();
821  getAxis(access, __PRETTY_FUNCTION__, axis)->SetTimeDisplay(value);
822  }
823 
825  void MonitorElement::setAxisTimeFormat(const char *format /* = "" */, int axis /* = 1 */) {
826  auto access = this->accessMut();
827  getAxis(access, __PRETTY_FUNCTION__, axis)->SetTimeFormat(format);
828  }
829 
831  void MonitorElement::setAxisTimeOffset(double toffset, const char *option /* ="local" */, int axis /* = 1 */) {
832  auto access = this->accessMut();
833  getAxis(access, __PRETTY_FUNCTION__, axis)->SetTimeOffset(toffset, option);
834  }
835 
838  auto access = this->accessMut();
839  accessRootObject(access, __PRETTY_FUNCTION__, 1)->SetTitle(title.c_str());
840  }
841 
842  TAxis *MonitorElement::getAxis(AccessMut const &access, const char *func, int axis) const {
843  TH1 *h = accessRootObject(access, func, axis - 1);
844  TAxis *a = nullptr;
845  if (axis == 1)
846  a = h->GetXaxis();
847  else if (axis == 2)
848  a = h->GetYaxis();
849  else if (axis == 3)
850  a = h->GetZaxis();
851 
852  if (!a)
853  raiseDQMError("MonitorElement",
854  "No such axis %d in monitor element"
855  " '%s' of type '%s'",
856  axis,
857  data_.objname.c_str(),
858  typeid(*h).name());
859 
860  return a;
861  }
862 
863  TAxis const *MonitorElement::getAxis(Access const &access, const char *func, int axis) const {
864  TH1 const *h = accessRootObject(access, func, axis - 1);
865  TAxis const *a = nullptr;
866  if (axis == 1)
867  a = h->GetXaxis();
868  else if (axis == 2)
869  a = h->GetYaxis();
870  else if (axis == 3)
871  a = h->GetZaxis();
872 
873  if (!a)
874  raiseDQMError("MonitorElement",
875  "No such axis %d in monitor element"
876  " '%s' of type '%s'",
877  axis,
878  data_.objname.c_str(),
879  typeid(*h).name());
880 
881  return a;
882  }
883 
885  auto access = this->accessMut();
886  update();
887  access.value.object_->SetXTitle(title.c_str());
888  }
890  auto access = this->accessMut();
891  update();
892  access.value.object_->SetYTitle(title.c_str());
893  }
894 
896  auto access = this->accessMut();
897  update();
898  access.value.object_->Sumw2();
899  }
900 
902  auto access = this->accessMut();
903  update();
904  access.value.object_->GetXaxis()->SetNoAlphanumeric(false);
905  access.value.object_->GetYaxis()->SetNoAlphanumeric(false);
906  }
907 
908  void MonitorElement::setOption(const char *option) {
909  auto access = this->accessMut();
910  update();
911  access.value.object_->SetOption(option);
912  }
913  double MonitorElement::getAxisMin(int axis) const {
914  auto access = this->access();
915  return getAxis(access, __PRETTY_FUNCTION__, axis)->GetXmin();
916  }
917 
918  double MonitorElement::getAxisMax(int axis) const {
919  auto access = this->access();
920  return getAxis(access, __PRETTY_FUNCTION__, axis)->GetXmax();
921  }
922 
923  void MonitorElement::setCanExtend(unsigned int value) {
924  auto access = this->accessMut();
925  access.value.object_->SetCanExtend(value);
926  }
927 
929  auto access = this->accessMut();
930  access.value.object_->StatOverflows(value);
931  }
932 
933  int64_t MonitorElement::getIntValue() const {
934  assert(kind() == Kind::INT);
935  auto access = this->access();
936  return access.value.scalar_.num;
937  }
939  assert(kind() == Kind::REAL);
940  auto access = this->access();
941  return access.value.scalar_.real;
942  }
944  assert(kind() == Kind::STRING);
945  auto access = this->access();
946  return access.value.scalar_.str;
947  }
948 
949  // implementation: Giuseppe.Della-Ricca@ts.infn.it
950  // Can be called with sum = h1 or sum = h2
951  void MonitorElement::addProfiles(TProfile *h1, TProfile *h2, TProfile *sum, float c1, float c2) {
952  assert(h1);
953  assert(h2);
954  assert(sum);
955 
956  static const Int_t NUM_STAT = 6;
957  Double_t stats1[NUM_STAT];
958  Double_t stats2[NUM_STAT];
959  Double_t stats3[NUM_STAT];
960 
961  bool isRebinOn = sum->CanExtendAllAxes();
962  sum->SetCanExtend(TH1::kNoAxis);
963 
964  for (Int_t i = 0; i < NUM_STAT; ++i)
965  stats1[i] = stats2[i] = stats3[i] = 0;
966 
967  h1->GetStats(stats1);
968  h2->GetStats(stats2);
969 
970  for (Int_t i = 0; i < NUM_STAT; ++i)
971  stats3[i] = c1 * stats1[i] + c2 * stats2[i];
972 
973  stats3[1] = c1 * TMath::Abs(c1) * stats1[1] + c2 * TMath::Abs(c2) * stats2[1];
974 
975  Double_t entries = c1 * h1->GetEntries() + c2 * h2->GetEntries();
976  TArrayD *h1sumw2 = h1->GetSumw2();
977  TArrayD *h2sumw2 = h2->GetSumw2();
978  for (Int_t bin = 0, nbin = sum->GetNbinsX() + 1; bin <= nbin; ++bin) {
979  Double_t entries = c1 * h1->GetBinEntries(bin) + c2 * h2->GetBinEntries(bin);
980  Double_t content =
981  c1 * h1->GetBinEntries(bin) * h1->GetBinContent(bin) + c2 * h2->GetBinEntries(bin) * h2->GetBinContent(bin);
982  Double_t error =
983  TMath::Sqrt(c1 * TMath::Abs(c1) * h1sumw2->fArray[bin] + c2 * TMath::Abs(c2) * h2sumw2->fArray[bin]);
984  sum->SetBinContent(bin, content);
985  sum->SetBinError(bin, error);
986  sum->SetBinEntries(bin, entries);
987  }
988 
989  sum->SetEntries(entries);
990  sum->PutStats(stats3);
991  if (isRebinOn)
992  sum->SetCanExtend(TH1::kAllAxes);
993  }
994 
995  // implementation: Giuseppe.Della-Ricca@ts.infn.it
996  // Can be called with sum = h1 or sum = h2
997  void MonitorElement::addProfiles(TProfile2D *h1, TProfile2D *h2, TProfile2D *sum, float c1, float c2) {
998  assert(h1);
999  assert(h2);
1000  assert(sum);
1001 
1002  static const Int_t NUM_STAT = 9;
1003  Double_t stats1[NUM_STAT];
1004  Double_t stats2[NUM_STAT];
1005  Double_t stats3[NUM_STAT];
1006 
1007  bool isRebinOn = sum->CanExtendAllAxes();
1008  sum->SetCanExtend(TH1::kNoAxis);
1009 
1010  for (Int_t i = 0; i < NUM_STAT; ++i)
1011  stats1[i] = stats2[i] = stats3[i] = 0;
1012 
1013  h1->GetStats(stats1);
1014  h2->GetStats(stats2);
1015 
1016  for (Int_t i = 0; i < NUM_STAT; i++)
1017  stats3[i] = c1 * stats1[i] + c2 * stats2[i];
1018 
1019  stats3[1] = c1 * TMath::Abs(c1) * stats1[1] + c2 * TMath::Abs(c2) * stats2[1];
1020 
1021  Double_t entries = c1 * h1->GetEntries() + c2 * h2->GetEntries();
1022  TArrayD *h1sumw2 = h1->GetSumw2();
1023  TArrayD *h2sumw2 = h2->GetSumw2();
1024  for (Int_t xbin = 0, nxbin = sum->GetNbinsX() + 1; xbin <= nxbin; ++xbin)
1025  for (Int_t ybin = 0, nybin = sum->GetNbinsY() + 1; ybin <= nybin; ++ybin) {
1026  Int_t bin = sum->GetBin(xbin, ybin);
1027  Double_t entries = c1 * h1->GetBinEntries(bin) + c2 * h2->GetBinEntries(bin);
1028  Double_t content =
1029  c1 * h1->GetBinEntries(bin) * h1->GetBinContent(bin) + c2 * h2->GetBinEntries(bin) * h2->GetBinContent(bin);
1030  Double_t error =
1031  TMath::Sqrt(c1 * TMath::Abs(c1) * h1sumw2->fArray[bin] + c2 * TMath::Abs(c2) * h2sumw2->fArray[bin]);
1032 
1033  sum->SetBinContent(bin, content);
1034  sum->SetBinError(bin, error);
1035  sum->SetBinEntries(bin, entries);
1036  }
1037  sum->SetEntries(entries);
1038  sum->PutStats(stats3);
1039  if (isRebinOn)
1040  sum->SetCanExtend(TH1::kAllAxes);
1041  }
1042 
1043  void MonitorElement::copyFunctions(TH1 *from, TH1 *to) {
1044  update();
1045  TList *fromf = from->GetListOfFunctions();
1046  TList *tof = to->GetListOfFunctions();
1047  for (int i = 0, nfuncs = fromf ? fromf->GetSize() : 0; i < nfuncs; ++i) {
1048  TObject *obj = fromf->At(i);
1049  // not interested in statistics
1050  if (!strcmp(obj->IsA()->GetName(), "TPaveStats"))
1051  continue;
1052 
1053  if (auto *fn = dynamic_cast<TF1 *>(obj))
1054  tof->Add(new TF1(*fn));
1055  //else if (dynamic_cast<TPaveStats *>(obj))
1056  // ; // FIXME? tof->Add(new TPaveStats(*stats));
1057  else
1058  raiseDQMError("MonitorElement",
1059  "Cannot extract function '%s' of type"
1060  " '%s' from monitor element '%s' for a copy",
1061  obj->GetName(),
1062  obj->IsA()->GetName(),
1063  data_.objname.c_str());
1064  }
1065  }
1066 
1067  void MonitorElement::copyFrom(TH1 *from) {
1068  TH1 *orig = getTH1();
1069  if (orig->GetTitle() != from->GetTitle())
1070  orig->SetTitle(from->GetTitle());
1071 
1072  orig->Add(from);
1073 
1074  copyFunctions(from, orig);
1075  }
1076 
1077  // --- Operations on MEs that are normally reset at end of monitoring cycle ---
1078  void MonitorElement::getQReport(bool create, const std::string &qtname, QReport *&qr, DQMNet::QValue *&qv) {
1079  assert(qreports_.size() == data_.qreports.size());
1080 
1081  qr = nullptr;
1082  qv = nullptr;
1083 
1084  size_t pos = 0, end = qreports_.size();
1085  while (pos < end && data_.qreports[pos].qtname != qtname)
1086  ++pos;
1087 
1088  if (pos == end && !create)
1089  return;
1090  else if (pos == end) {
1091  data_.qreports.emplace_back();
1092  qreports_.push_back(QReport(nullptr, nullptr));
1093 
1094  DQMNet::QValue &q = data_.qreports.back();
1096  q.qtresult = 0;
1097  q.qtname = qtname;
1098  q.message = "NO_MESSAGE_ASSIGNED";
1099  q.algorithm = "UNKNOWN_ALGORITHM";
1100  }
1101 
1102  qr = &qreports_[pos];
1103  qv = &data_.qreports[pos];
1104  }
1105 
1108  QReport *qr;
1109  DQMNet::QValue *qv;
1110  getQReport(true, desc.qtname, qr, qv);
1111  qr->qcriterion_ = qc;
1112  *qv = desc;
1113  update();
1114  }
1115 
1117  QReport *qr;
1118  DQMNet::QValue *qv;
1119  getQReport(true, qc->getName(), qr, qv);
1121  qv->message = "NO_MESSAGE_ASSIGNED";
1122  qr->qcriterion_ = qc;
1123  update();
1124  }
1125 
1128  data_.flags &= ~DQMNet::DQM_PROP_REPORT_ALARM;
1129  for (auto &qreport : data_.qreports)
1130  switch (qreport.code) {
1132  break;
1133  case dqm::qstatus::WARNING:
1135  break;
1136  case dqm::qstatus::ERROR:
1138  break;
1139  default:
1141  break;
1142  }
1143  }
1144 
1145  // -------------------------------------------------------------------
1146  // TODO: all of these are UNSAFE and have to be NON-const.
1147  TObject const *MonitorElement::getRootObject() const {
1148  auto access = this->access();
1149  return access.value.object_.get();
1150  }
1151 
1153  auto access = this->accessMut();
1154  return accessRootObject(access, __PRETTY_FUNCTION__, 0);
1155  }
1156 
1158  auto access = this->accessMut();
1159  assert(kind() == Kind::TH1F);
1160  return static_cast<TH1F *>(accessRootObject(access, __PRETTY_FUNCTION__, 1));
1161  }
1162 
1164  auto access = this->accessMut();
1165  assert(kind() == Kind::TH1S);
1166  return static_cast<TH1S *>(accessRootObject(access, __PRETTY_FUNCTION__, 1));
1167  }
1168 
1170  auto access = this->accessMut();
1171  assert(kind() == Kind::TH1D);
1172  return static_cast<TH1D *>(accessRootObject(access, __PRETTY_FUNCTION__, 1));
1173  }
1174 
1176  auto access = this->accessMut();
1177  assert(kind() == Kind::TH2F);
1178  return static_cast<TH2F *>(accessRootObject(access, __PRETTY_FUNCTION__, 2));
1179  }
1180 
1182  auto access = this->accessMut();
1183  assert(kind() == Kind::TH2S);
1184  return static_cast<TH2S *>(accessRootObject(access, __PRETTY_FUNCTION__, 2));
1185  }
1186 
1188  auto access = this->accessMut();
1189  assert(kind() == Kind::TH2D);
1190  return static_cast<TH2D *>(accessRootObject(access, __PRETTY_FUNCTION__, 2));
1191  }
1192 
1194  auto access = this->accessMut();
1195  assert(kind() == Kind::TH3F);
1196  return static_cast<TH3F *>(accessRootObject(access, __PRETTY_FUNCTION__, 3));
1197  }
1198 
1200  auto access = this->accessMut();
1201  assert(kind() == Kind::TPROFILE);
1202  return static_cast<TProfile *>(accessRootObject(access, __PRETTY_FUNCTION__, 1));
1203  }
1204 
1206  auto access = this->accessMut();
1207  assert(kind() == Kind::TPROFILE2D);
1208  return static_cast<TProfile2D *>(accessRootObject(access, __PRETTY_FUNCTION__, 2));
1209  }
1210 
1211 } // namespace dqm::impl
1212 
1213 namespace dqm::legacy {
1216  assert(qreports_.size() == data_.qreports.size());
1217 
1218  // Rerun quality tests where the ME or the quality algorithm was modified.
1219  bool dirty = wasUpdated();
1220  for (size_t i = 0, e = data_.qreports.size(); i < e; ++i) {
1221  DQMNet::QValue &qv = data_.qreports[i];
1222  QReport &qr = qreports_[i];
1223  QCriterion *qc = qr.qcriterion_;
1224  qr.qvalue_ = &qv;
1225 
1226  // if (qc && (dirty || qc->wasModified())) // removed for new QTest (abm-090503)
1227  if (qc && dirty) {
1228  assert(qc->getName() == qv.qtname);
1229  std::string oldMessage = qv.message;
1230  int oldStatus = qv.code;
1231 
1232  qc->runTest(this, qr, qv);
1233 
1234  if (oldStatus != qv.code || oldMessage != qv.message)
1235  update();
1236  }
1237  }
1238 
1239  // Update QReport statistics.
1241  }
1242 } // namespace dqm::legacy
virtual std::string getTitle() const
get MonitorElement title
QCriterion * qcriterion_
Definition: QReport.h:51
static const uint32_t DQM_PROP_REPORT_WARN
Definition: DQMNet.h:47
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
virtual void setTitle(const std::string &title)
set (ie. change) histogram/profile title
std::vector< QReport > qreports_
uint32_t moduleId
Definition: DQMNet.h:100
QReports qreports
Definition: DQMNet.h:103
virtual DQM_DEPRECATED void setCanExtend(unsigned int value)
std::atomic< MonitorElementData const * > frozen_
std::vector< QReport * > getQWarnings() const
get warnings from last set of quality tests
virtual void disableAlphanumeric()
std::string algorithm
Definition: DQMNet.h:90
const double w
Definition: UKUtility.cc:23
uint64_t version
Definition: DQMNet.h:96
def create(alignables, pedeDump, additionalData, outputFile, config)
TAxis const * getAxis(Access const &access, const char *func, int axis) const
virtual int getNbinsY() const
get # of bins in Y-axis
DQMNet::CoreObject data_
virtual double getAxisMin(int axis=1) const
virtual void setEntries(double nentries)
set # of entries
virtual void setAxisTimeDisplay(int value, int axis=1)
set x-, y-, or z-axis to display time values
Definition: DQMNet.h:23
virtual void setOption(const char *option)
std::atomic< MutableMonitorElementData * > mutable_
virtual void setAxisTimeFormat(const char *format="", int axis=1)
set the format of the time values that are displayed on an axis
uint32_t flags
Definition: DQMNet.h:94
edm::propagate_const< std::unique_ptr< TH1 > > object_
#define nullptr
static bool CheckBinLabels(const TAxis *a1, const TAxis *a2)
Check the consistency of the axis labels.
virtual double getBinError(int binx) const
get uncertainty on content of bin (1-D) - See TH1::GetBinError for details
virtual int64_t getIntValue() const
virtual int getNbinsZ() const
get # of bins in Z-axis
virtual std::string getAxisTitle(int axis=1) const
get x-, y- or z-axis title (axis=1, 2, 3 respectively)
static const int WARNING
Kind kind() const
Get the type of the monitor element.
void updateQReportStats()
Refresh QReport stats, usually after MEs were read in from a file.
uint32_t tag
Definition: DQMNet.h:95
const std::string * dirname
Definition: DQMNet.h:101
const QReport * getQReport(const std::string &qtname) const
get QReport corresponding to <qtname> (null pointer if QReport does not exist)
void packQualityData(std::string &into) const
serialise quality report information into a string.
void incompatible(const char *func) const
uint32_t run
Definition: DQMNet.h:97
const std::string getFullname() const
get full name of ME including Pathname
void Fill(long long x)
virtual void Reset()
reset ME (ie. contents, errors, etc)
DQM_DEPRECATED void ShiftFillLast(double y, double ye=0., int32_t xscale=1)
std::vector< QReport * > getQErrors() const
get errors from last set of quality tests
char const * label
virtual void setXTitle(std::string const &title)
virtual TProfile2D * getTProfile2D()
static const uint32_t DQM_PROP_HAS_REFERENCE
Definition: DQMNet.h:51
virtual int getNbinsX() const
get # of bins in X-axis
const uint32_t run() const
virtual void setAxisRange(double xmin, double xmax, int axis=1)
set x-, y- or z-axis range (axis=1, 2, 3 respectively)
virtual double getEntries() const
get # of entries
std::string tagString() const
T sqrt(T t)
Definition: SSEVec.h:19
uint32_t lumi
Definition: DQMNet.h:98
void addQReport(const DQMNet::QValue &desc, QCriterion *qc)
Add quality report, from DQMStore.
T Abs(T a)
Definition: MathUtil.h:49
void doFill(int64_t x)
"Fill" ME method for int64_t
static const int DID_NOT_RUN
static const uint32_t DQM_PROP_REPORT_ERROR
Definition: DQMNet.h:46
const uint32_t moduleId() const
void copyFunctions(TH1 *from, TH1 *to)
#define end
Definition: vmac.h:39
Definition: value.py:1
static const uint32_t DQM_PROP_REPORT_OTHER
Definition: DQMNet.h:48
void addProfiles(TProfile *h1, TProfile *h2, TProfile *sum, float c1, float c2)
virtual 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 double getBinContent(int binx) const
get content of bin (1-D)
std::vector< QReport * > getQReports() const
get map of QReports
virtual TProfile * getTProfile()
std::string objname
Definition: DQMNet.h:102
element_type const * get() const
MonitorElementData::Value & value
std::string qtname
Definition: DQMNet.h:89
void packScalarData(std::string &into, const char *prefix) const
convert scalar data into a string.
MonitorElementData::Value const & value
void update()
Mark the object updated.
virtual double getMean(int axis=1) const
get mean value of histogram along x, y or z axis (axis=1, 2, 3 respectively)
virtual void setYTitle(std::string const &title)
virtual void setBinEntries(int bin, double nentries)
set # of bin entries (to be used for profiles)
#define N
Definition: blowfish.cc:9
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
std::vector< QReport * > getQOthers() const
from last set of quality tests
virtual DQM_DEPRECATED void setStatOverflows(unsigned int value)
virtual double getMeanError(int axis=1) const
virtual float runTest(const MonitorElement *me)
Definition: QTest.cc:25
virtual double getRMS(int axis=1) const
get RMS of histogram along x, y or z axis (axis=1, 2, 3 respectively)
double b
Definition: hdecay.h:118
static void packQualityData(std::string &into, const QReports &qr)
Definition: DQMNet.cc:149
std::string valueString() const
virtual double getBinEntries(int bin) const
get # of bin entries (for profiles)
bool wasUpdated() const
true if ME was updated in last monitoring cycle
virtual double getFloatValue() const
double a
Definition: hdecay.h:119
DQMNet::QValue * qvalue_
Definition: QReport.h:50
const Access access() const
virtual const std::string & getStringValue() const
std::string tagLabelString() const
return label string for the monitor element tag (eg. <name>t=12345</name>)
void setAxisTimeOffset(double toffset, const char *option="local", int axis=1)
set the time offset, if option = "gmt" then the offset is treated as a GMT time
virtual double getRMSError(int axis=1) const
get RMS uncertainty of histogram along x, y or z axis(axis=1,2,3 respectively)
std::string message
Definition: DQMNet.h:88
std::string getName() const
get name of quality test
Definition: QTest.h:73
static const int STATUS_OK
void runQTests()
run all quality tests
auto zw(V v) -> Vec2< typename std::remove_reference< decltype(v[0])>::type >
Definition: ExtVec.h:75
MonitorElement * initialise(Kind kind)
virtual void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
static TH1 * checkRootObject(const std::string &name, TObject *tobj, const char *func, int reqdim)
static const uint32_t DQM_PROP_NEW
Definition: DQMNet.h:56
TH1 const * accessRootObject(Access const &access, const char *func, int reqdim) const
uint32_t streamId
Definition: DQMNet.h:99
virtual TObject const * getRootObject() const
float qtresult
Definition: DQMNet.h:87
std::string effLabelString() const
return label string for the monitor element tag (eg. <name>t=12345</name>)
virtual double getAxisMax(int axis=1) const
std::string qualityTagString(const DQMNet::QValue &qv) const
static const int ERROR
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void raiseDQMError(const char *context, const char *fmt,...)
Definition: DQMError.cc:10