Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 74735
b: "refs/heads/CMSSW_7_1_X"
c: 585a3af
h: "refs/heads/CMSSW_7_1_X"
i:
  74733: 0fba79e
  74731: 815a1f3
  74727: 4786284
  74719: f550046
v: v3
  • Loading branch information
Lassi Tuura committed Oct 5, 2009
1 parent f75cc7f commit 02ef71c
Show file tree
Hide file tree
Showing 3 changed files with 427 additions and 325 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
refs/heads/gh-pages: 09c786f70121f131b3715aaf3464996502bbeb7e
"refs/heads/CMSSW_7_1_X": 577f3dd9f6169f571ece1d91e80eecc4d3088a85
"refs/heads/CMSSW_7_1_X": 585a3af8ed67ff66a1af6d5c78a81f3ef5dee2a7
136 changes: 72 additions & 64 deletions trunk/DQMServices/Core/interface/MonitorElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,90 +33,94 @@ class QCriterion;
/** The base class for all MonitorElements (ME) */
class MonitorElement
{
friend class DQMStore;
friend class DQMService;
public:
struct Value
struct Scalar
{
int64_t num;
double real;
std::string str;
TObject *tobj;
};

enum Kind
{
DQM_KIND_INVALID,
DQM_KIND_INT,
DQM_KIND_REAL,
DQM_KIND_STRING,
DQM_KIND_TH1F,
DQM_KIND_TH1S,
DQM_KIND_TH1D,
DQM_KIND_TH2F,
DQM_KIND_TH2S,
DQM_KIND_TH2D,
DQM_KIND_TH3F,
DQM_KIND_TPROFILE,
DQM_KIND_TPROFILE2D
DQM_KIND_INVALID = DQMNet::DQM_PROP_TYPE_INVALID,
DQM_KIND_INT = DQMNet::DQM_PROP_TYPE_INT,
DQM_KIND_REAL = DQMNet::DQM_PROP_TYPE_REAL,
DQM_KIND_STRING = DQMNet::DQM_PROP_TYPE_STRING,
DQM_KIND_TH1F = DQMNet::DQM_PROP_TYPE_TH1F,
DQM_KIND_TH1S = DQMNet::DQM_PROP_TYPE_TH1S,
DQM_KIND_TH1D = DQMNet::DQM_PROP_TYPE_TH1D,
DQM_KIND_TH2F = DQMNet::DQM_PROP_TYPE_TH2F,
DQM_KIND_TH2S = DQMNet::DQM_PROP_TYPE_TH2S,
DQM_KIND_TH2D = DQMNet::DQM_PROP_TYPE_TH2D,
DQM_KIND_TH3F = DQMNet::DQM_PROP_TYPE_TH3F,
DQM_KIND_TPROFILE = DQMNet::DQM_PROP_TYPE_TPROF,
DQM_KIND_TPROFILE2D = DQMNet::DQM_PROP_TYPE_TPROF2D
};

typedef std::vector<QReport>::const_iterator QReportIterator;

static const uint32_t DQM_FLAG_RESET = 0x01000000;
static const uint32_t DQM_FLAG_ACCUMULATE = 0x02000000;

private:
Kind kind_;
DQMNet::CoreObject data_;
std::string name_;
std::string path_;
std::vector<QReport> qreports_;
size_t nqerror_; //< errors from last set of quality tests
size_t nqwarning_; //< warnings from last set of quality tests
size_t nqother_; //< other quality reports (not an error, warning or ok)

Value curvalue_;
TH1 *refvalue_;

MonitorElement *initialise(Kind kind, const std::string &path);
MonitorElement *initialise(Kind kind, const std::string &path, TH1 *rootobj);
MonitorElement *initialise(Kind kind, const std::string &path, const std::string &value);
DQMNet::CoreObject data_; //< Core object information.
Scalar scalar_; //< Current scalar value.
TH1 *object_; //< Current ROOT object value.
TH1 *reference_; //< Current ROOT reference object.
TH1 *refvalue_; //< Soft reference if any.
std::vector<QReport> qreports_; //< QReports associated to this object.

MonitorElement *initialise(Kind kind);
MonitorElement *initialise(Kind kind, TH1 *rootobj);
MonitorElement *initialise(Kind kind, const std::string &value);

public:
MonitorElement(void);
MonitorElement(const std::string *path, const std::string &name);
MonitorElement(const MonitorElement &);
MonitorElement &operator=(const MonitorElement &);
~MonitorElement(void);

/// Get the type of the monitor element.
Kind kind(void) const
{ return kind_; }
{ return Kind(data_.flags & DQMNet::DQM_PROP_TYPE_MASK); }

/// Get the object flags.
uint32_t flags(void) const
{ return data_.flags; }

/// get name of ME
const std::string &getName(void) const
{ return name_; }
{ return data_.objname; }

/// get pathname of parent folder
const std::string &getPathname(void) const
{ return path_; }
{ return *data_.dirname; }

/// get full name of ME including Pathname
const std::string &getFullname(void) const
{ return data_.name; }
const std::string getFullname(void) const
{
std::string path;
path.reserve(data_.dirname->size() + data_.objname.size() + 2);
path += *data_.dirname;
if (! data_.dirname->empty())
path += '/';
path += data_.objname;
return path;
}

/// true if ME was updated in last monitoring cycle
bool wasUpdated(void) const
{ return data_.flags & DQMNet::DQM_FLAG_NEW; }
{ return data_.flags & DQMNet::DQM_PROP_NEW; }

/// Mark the object updated.
void update(void)
{ data_.flags |= DQMNet::DQM_FLAG_NEW; }
{ data_.flags |= DQMNet::DQM_PROP_NEW; }

/// specify whether ME should be reset at end of monitoring cycle (default:false);
/// (typically called by Sources that control the original ME)
void setResetMe(bool flag)
{ data_.flags |= DQM_FLAG_RESET; }
{ data_.flags |= DQMNet::DQM_PROP_RESET; }

void Fill(uint64_t x) { Fill(static_cast<int64_t>(x)); }
void Fill(int32_t x) { Fill(static_cast<int64_t>(x)); }
Expand All @@ -140,19 +144,22 @@ class MonitorElement

std::string valueString(void) const;
std::string tagString(void) const;
std::string tagLabelString(void) const;
std::string qualityTagString(const DQMNet::QValue &qv) const;
void packScalarData(std::string &into, const char *prefix) const;
void packQualityData(std::string &into) const;

/// true if at least of one of the quality tests returned an error
bool hasError(void) const
{ return nqerror_ > 0; }
{ return data_.flags & DQMNet::DQM_PROP_REPORT_ERROR; }

/// true if at least of one of the quality tests returned a warning
bool hasWarning(void) const
{ return nqwarning_ > 0; }
{ return data_.flags & DQMNet::DQM_PROP_REPORT_WARN; }

/// true if at least of one of the tests returned some other (non-ok) status
bool hasOtherReport(void) const
{ return nqother_ > 0; }
{ return data_.flags & DQMNet::DQM_PROP_REPORT_OTHER; }

/// get QReport corresponding to <qtname> (null pointer if QReport does not exist)
const QReport *getQReport(const std::string &qtname) const;
Expand Down Expand Up @@ -230,21 +237,21 @@ class MonitorElement

/// whether ME contents should be accumulated over multiple monitoring periods; default: false
bool isAccumulateEnabled(void) const
{ return data_.flags & DQM_FLAG_ACCUMULATE; }
{ return data_.flags & DQMNet::DQM_PROP_ACCUMULATE; }

private:
/// reset "was updated" flag
void resetUpdate(void)
{ data_.flags &= ~DQMNet::DQM_FLAG_NEW; }
{ data_.flags &= ~DQMNet::DQM_PROP_NEW; }

/// true if ME should be reset at end of monitoring cycle
bool resetMe(void) const
{ return data_.flags & DQM_FLAG_RESET; }
{ return data_.flags & DQMNet::DQM_PROP_RESET; }

/// if true, will accumulate ME contents (over many periods)
/// until method is called with flag = false again
void setAccumulate(bool flag)
{ data_.flags |= DQM_FLAG_ACCUMULATE; }
{ data_.flags |= DQMNet::DQM_PROP_ACCUMULATE; }

TAxis *getAxis(const char *func, int axis) const;

Expand Down Expand Up @@ -288,33 +295,34 @@ class MonitorElement
TProfile *getRefTProfile(void) const;
TProfile2D *getRefTProfile2D(void) const;

const int64_t &getIntValue(void) const
int64_t getIntValue(void) const
{
assert(kind_ == DQM_KIND_INT);
return curvalue_.num;
assert(kind() == DQM_KIND_INT);
return scalar_.num;
}

const double &getFloatValue(void) const
double getFloatValue(void) const
{
assert(kind_ == DQM_KIND_REAL);
return curvalue_.real;
assert(kind() == DQM_KIND_REAL);
return scalar_.real;
}

const std::string &getStringValue(void) const
{
assert(kind_ == DQM_KIND_STRING);
return curvalue_.str;
assert(kind() == DQM_KIND_STRING);
return scalar_.str;
}

const DQMNet::TagList &getTags(void) const
{ return data_.tags; }

private:
friend class DQMStore;
friend class DQMService;
DQMNet::TagList getTags(void) const // DEPRECATED
{
DQMNet::TagList tags;
if (data_.flags & DQMNet::DQM_PROP_TAGGED)
tags.push_back(data_.tag);
return tags;
}

//MonitorElement(const MonitorElement &);
//MonitorElement &operator=(const MonitorElement &);
const uint32_t getTag(void) const
{ return data_.tag; }
};

#endif // DQMSERVICES_CORE_MONITOR_ELEMENT_H
Loading

0 comments on commit 02ef71c

Please sign in to comment.