Skip to content

Commit

Permalink
Merge pull request #32761 from mmusich/PixelPhase1DQM_StatOverflows
Browse files Browse the repository at this point in the history
StatOverflows on PixelPhase1 DQM
  • Loading branch information
cmsbuild authored Jan 28, 2021
2 parents 24b65fa + 8b9dbcc commit 2b41484
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 1 deletion.
1 change: 1 addition & 0 deletions DQM/SiPixelPhase1Common/interface/HistogramManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ class HistogramManager {
int range_y_nbins;
double range_y_min;
double range_y_max;
bool statsOverflows;

// can be used in "custom" harvesting in online.
edm::LuminosityBlock const* lumisection = nullptr;
Expand Down
3 changes: 3 additions & 0 deletions DQM/SiPixelPhase1Common/python/HistogramManager_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@
# Setting this to False hides all plots of this HistogramManager. It does not even record any data.
enabled = cms.bool(True),

# If this is set to False Overflows will not be used for statistics evaluation (i.e. Mean,RMS)
statsOverflows = cms.bool(True),

# a.k.a. online harvesting. Might be useful in offline for custom harvesting,
# but the main purpose is online, where this is on by default.
perLumiHarvesting = cms.bool(False),
Expand Down
9 changes: 8 additions & 1 deletion DQM/SiPixelPhase1Common/src/HistogramManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ HistogramManager::HistogramManager(const edm::ParameterSet& iconfig, GeometryInt
range_x_max(iconfig.getParameter<double>("range_max")),
range_y_nbins(iconfig.getParameter<int>("range_y_nbins")),
range_y_min(iconfig.getParameter<double>("range_y_min")),
range_y_max(iconfig.getParameter<double>("range_y_max")) {
range_y_max(iconfig.getParameter<double>("range_y_max")),
statsOverflows(iconfig.getParameter<bool>("statsOverflows")) {
auto spec_configs = iconfig.getParameter<edm::VParameterSet>("specs");
for (const auto& spec : spec_configs) {
// this would fit better in SummationSpecification(...), but it has to
Expand Down Expand Up @@ -295,6 +296,8 @@ void HistogramManager::book(DQMStore::IBooker& iBooker, edm::EventSetup const& i
GeometryInterface::Value binwidth_y = 0;
std::string title, xlabel, ylabel, zlabel;
bool do_profile = false;
bool statsOverflows = true;
;
};
std::map<GeometryInterface::Values, MEInfo> toBeBooked;

Expand Down Expand Up @@ -342,6 +345,7 @@ void HistogramManager::book(DQMStore::IBooker& iBooker, edm::EventSetup const& i
// create new histo
MEInfo& mei = toBeBooked[significantvalues];
mei.title = this->title;
mei.statsOverflows = this->statsOverflows;
if (bookCounters)
mei.title =
"Number of " + mei.title + " per Event and " + geometryInterface.pretty(*(s.steps[0].columns.end() - 1));
Expand Down Expand Up @@ -518,6 +522,7 @@ void HistogramManager::book(DQMStore::IBooker& iBooker, edm::EventSetup const& i
assert(!"Illegal Histogram kind.");
}
h.th1 = h.me->getTH1();
h.me->setStatOverflows(mei.statsOverflows);
}
}
}
Expand Down Expand Up @@ -600,6 +605,7 @@ void HistogramManager::executeGroupBy(SummationStep const& step,
} else {
new_histo.th1->Add(th1);
}
new_histo.me->setStatOverflows(e.second.me->getStatOverflows());
}
t.swap(out);
}
Expand Down Expand Up @@ -681,6 +687,7 @@ void HistogramManager::executeExtend(SummationStep const& step,
} else {
assert(!"Reduction type not supported");
}
new_histo.me->setStatOverflows(e.second.me->getStatOverflows());
} else {
assert(!"2D extend not implemented in harvesting.");
}
Expand Down
1 change: 1 addition & 0 deletions DQMServices/Core/interface/MonitorElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ namespace dqm::impl {
// We should decide if we support this (or make it default)
DQM_DEPRECATED
virtual void setStatOverflows(bool value);
virtual bool getStatOverflows();

// these should be non-const, since they are potentially not thread-safe
virtual TObject const *getRootObject() const;
Expand Down
9 changes: 9 additions & 0 deletions DQMServices/Core/src/MonitorElement.cc
Original file line number Diff line number Diff line change
Expand Up @@ -912,6 +912,15 @@ namespace dqm::impl {
access.value.object_->SetStatOverflows(TH1::kIgnore);
}

bool MonitorElement::getStatOverflows() {
auto access = this->accessMut();
auto value = access.value.object_->GetStatOverflows();
if (value == TH1::kConsider)
return true;
else
return false;
}

int64_t MonitorElement::getIntValue() const {
assert(kind() == Kind::INT);
auto access = this->access();
Expand Down

0 comments on commit 2b41484

Please sign in to comment.