1 #define __STDC_FORMAT_MACROS 1 14 #if !WITHOUT_CMS_FRAMEWORK 23 "Method '%s' cannot be invoked on monitor" 24 " element '%s' because it is not a ROOT object.",
28 auto *
h =
static_cast<TH1 *
>(tobj);
29 int ndim = h->GetDimension();
30 if (reqdim < 0 || reqdim > ndim)
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",
64 "cannot initialise monitor element" 65 " to invalid type %d",
77 assert(dynamic_cast<TH1F *>(rootobj));
83 assert(dynamic_cast<TH1S *>(rootobj));
89 assert(dynamic_cast<TH1D *>(rootobj));
95 assert(dynamic_cast<TH2F *>(rootobj));
101 assert(dynamic_cast<TH2S *>(rootobj));
107 assert(dynamic_cast<TH2D *>(rootobj));
113 assert(dynamic_cast<TH3F *>(rootobj));
119 assert(dynamic_cast<TProfile *>(rootobj));
125 assert(dynamic_cast<TProfile2D *>(rootobj));
132 "cannot initialise monitor element" 133 " as a root object with type %d",
150 "cannot initialise monitor element" 151 " as a string with type %d",
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()));
225 THashList *l1 = (
const_cast<TAxis *
>(a1))->GetLabels();
226 THashList *l2 = (
const_cast<TAxis *
>(
a2))->GetLabels();
234 if (l1->GetSize() != l2->GetSize()) {
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) {
327 int index = entries + 1;
331 if (entries >= nbins) {
333 xlow = entries - nbins + 3;
340 double N = entries - nbins + 1.;
341 if (ye == 0. || y1err == 0. || y2err == 0.) {
343 double sum = N * y1 +
y2;
346 double s = (N + 1.) * (N * y1 * y1 + y2 *
y2) - sum * sum;
348 y1err =
sqrt(s) / (N + 1.);
353 double denom = (1. / y1err + 1. / y2err);
354 double mean = (y1 / y1err + y2 / y2err) / denom;
356 y1err =
sqrt(((y1 - mean) * (y1 - mean) / y1err + (y2 - mean) * (y2 - mean) / y2err) / denom / 2.);
374 sprintf(buffer,
"%d", xlow * xscale);
377 sprintf(buffer,
"%d", xup * xscale);
473 result.reserve(6 + 2 *
data_.
objname.size() + val.size());
489 size_t len = sprintf(buf,
"t=%" PRIu32,
data_.
tag);
523 size_t buflen = sprintf(buf,
"qr=st:%d:%.*g:", qv.
code, DBL_DIG + 2, qv.
qtresult);
525 result.reserve(7 + 2 * titlelen + buflen + qv.
algorithm.size() + qv.
message.size());
552 std::vector<QReport *>
result;
556 result.push_back(const_cast<QReport *>(&
qreports_[
i]));
562 std::vector<QReport *>
result;
567 result.push_back(const_cast<QReport *>(&
qreports_[
i]));
573 std::vector<QReport *>
result;
578 result.push_back(const_cast<QReport *>(&
qreports_[
i]));
584 std::vector<QReport *>
result;
590 result.push_back(const_cast<QReport *>(&
qreports_[
i]));
597 "Method '%s' cannot be invoked on monitor" 606 "Method '%s' cannot be invoked on monitor" 607 " element '%s' because it is not a root object",
615 "Method '%s' cannot be invoked on monitor" 616 " element '%s' because it is not a root object",
713 return static_cast<TProfile
const *
>(
accessRootObject(
access, __PRETTY_FUNCTION__, 1))->GetBinEntries(bin);
715 return static_cast<TProfile2D const *>(
accessRootObject(
access, __PRETTY_FUNCTION__, 1))->GetBinEntries(bin);
725 return getAxis(
access, __PRETTY_FUNCTION__, axis)->GetTitle();
778 static_cast<TProfile2D *>(
accessRootObject(
access, __PRETTY_FUNCTION__, 1))->SetBinEntries(bin, nentries);
793 if (
getAxis(
access, __PRETTY_FUNCTION__, axis)->GetNbins() >= bin) {
794 getAxis(
access, __PRETTY_FUNCTION__, axis)->SetBinLabel(bin, label.c_str());
796 #if WITHOUT_CMS_FRAMEWORK 801 <<
"*** MonitorElement: WARNING:" 802 <<
"setBinLabel: attempting to set label of non-existent bin number for ME: " <<
getFullname() <<
" \n";
809 getAxis(
access, __PRETTY_FUNCTION__, axis)->SetRangeUser(xmin, xmax);
815 getAxis(
access, __PRETTY_FUNCTION__, axis)->SetTitle(title.c_str());
821 getAxis(
access, __PRETTY_FUNCTION__, axis)->SetTimeDisplay(value);
827 getAxis(
access, __PRETTY_FUNCTION__, axis)->SetTimeFormat(format);
833 getAxis(
access, __PRETTY_FUNCTION__, axis)->SetTimeOffset(toffset, option);
854 "No such axis %d in monitor element" 855 " '%s' of type '%s'",
865 TAxis
const *
a =
nullptr;
875 "No such axis %d in monitor element" 876 " '%s' of type '%s'",
915 return getAxis(
access, __PRETTY_FUNCTION__, axis)->GetXmin();
920 return getAxis(
access, __PRETTY_FUNCTION__, axis)->GetXmax();
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];
961 bool isRebinOn = sum->CanExtendAllAxes();
962 sum->SetCanExtend(TH1::kNoAxis);
964 for (Int_t
i = 0;
i < NUM_STAT; ++
i)
965 stats1[
i] = stats2[
i] = stats3[
i] = 0;
967 h1->GetStats(stats1);
968 h2->GetStats(stats2);
970 for (Int_t
i = 0;
i < NUM_STAT; ++
i)
971 stats3[
i] = c1 * stats1[
i] + c2 * stats2[
i];
975 Double_t entries = c1 * h1->GetEntries() + c2 * h2->GetEntries();
976 TArrayD *h1sumw2 = h1->GetSumw2();
977 TArrayD *h2sumw2 = h2->GetSumw2();
979 Double_t entries = c1 * h1->GetBinEntries(
bin) + c2 * h2->GetBinEntries(
bin);
981 c1 * h1->GetBinEntries(
bin) * h1->GetBinContent(
bin) + c2 * h2->GetBinEntries(
bin) * h2->GetBinContent(
bin);
984 sum->SetBinContent(bin, content);
985 sum->SetBinError(bin, error);
986 sum->SetBinEntries(bin, entries);
989 sum->SetEntries(entries);
990 sum->PutStats(stats3);
992 sum->SetCanExtend(TH1::kAllAxes);
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];
1007 bool isRebinOn = sum->CanExtendAllAxes();
1008 sum->SetCanExtend(TH1::kNoAxis);
1010 for (Int_t
i = 0;
i < NUM_STAT; ++
i)
1011 stats1[
i] = stats2[
i] = stats3[
i] = 0;
1013 h1->GetStats(stats1);
1014 h2->GetStats(stats2);
1016 for (Int_t
i = 0;
i < NUM_STAT;
i++)
1017 stats3[
i] = c1 * stats1[
i] + c2 * stats2[
i];
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);
1029 c1 * h1->GetBinEntries(bin) * h1->GetBinContent(bin) + c2 * h2->GetBinEntries(bin) * h2->GetBinContent(bin);
1031 TMath::Sqrt(c1 *
TMath::Abs(c1) * h1sumw2->fArray[bin] + c2 *
TMath::Abs(c2) * h2sumw2->fArray[bin]);
1033 sum->SetBinContent(bin, content);
1034 sum->SetBinError(bin, error);
1035 sum->SetBinEntries(bin, entries);
1037 sum->SetEntries(entries);
1038 sum->PutStats(stats3);
1040 sum->SetCanExtend(TH1::kAllAxes);
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);
1050 if (!strcmp(obj->IsA()->GetName(),
"TPaveStats"))
1053 if (
auto *
fn = dynamic_cast<TF1 *>(obj))
1054 tof->Add(
new TF1(*
fn));
1059 "Cannot extract function '%s' of type" 1060 " '%s' from monitor element '%s' for a copy",
1062 obj->IsA()->GetName(),
1069 if (orig->GetTitle() != from->GetTitle())
1070 orig->SetTitle(from->GetTitle());
1088 if (pos ==
end && !create)
1090 else if (pos ==
end) {
1098 q.
message =
"NO_MESSAGE_ASSIGNED";
1121 qv->
message =
"NO_MESSAGE_ASSIGNED";
1130 switch (qreport.code) {
1230 int oldStatus = qv.
code;
1234 if (oldStatus != qv.
code || oldMessage != qv.
message)
virtual std::string getTitle() const
get MonitorElement title
static const uint32_t DQM_PROP_REPORT_WARN
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_
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()
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
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
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
edm::propagate_const< std::unique_ptr< TH1 > > object_
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)
Kind kind() const
Get the type of the monitor element.
void updateQReportStats()
Refresh QReport stats, usually after MEs were read in from a file.
const std::string * dirname
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
const std::string getFullname() const
get full name of ME including Pathname
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
virtual void setXTitle(std::string const &title)
virtual TProfile2D * getTProfile2D()
static const uint32_t DQM_PROP_HAS_REFERENCE
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
void addQReport(const DQMNet::QValue &desc, QCriterion *qc)
Add quality report, from DQMStore.
void doFill(int64_t x)
"Fill" ME method for int64_t
static const int DID_NOT_RUN
virtual ~MonitorElement()
static const uint32_t DQM_PROP_REPORT_ERROR
const uint32_t moduleId() const
void copyFunctions(TH1 *from, TH1 *to)
static const uint32_t DQM_PROP_REPORT_OTHER
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()
element_type const * get() const
MonitorElementData::Value & value
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)
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)
virtual double getRMS(int axis=1) const
get RMS of histogram along x, y or z axis (axis=1, 2, 3 respectively)
static void packQualityData(std::string &into, const QReports &qr)
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
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 getName() const
get name of quality test
static const int STATUS_OK
virtual void enableSumw2()
void runQTests()
run all quality tests
auto zw(V v) -> Vec2< typename std::remove_reference< decltype(v[0])>::type >
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
TH1 const * accessRootObject(Access const &access, const char *func, int reqdim) const
virtual TObject const * getRootObject() const
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
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,...)