41 scope_ = MonitorElementData::Scope::JOB;
81 TH1* th1 = makeobject();
89 if (this->
scope_ == MonitorElementData::Scope::JOB) {
91 }
else if (this->
scope_ == MonitorElementData::Scope::RUN) {
93 }
else if (this->
scope_ == MonitorElementData::Scope::LUMI) {
111 TH1* th1 = makeobject();
115 me->switchObject(std::unique_ptr<TH1>(th1));
152 if (existing_new.second ==
true) {
159 assert(!
"Currently, this should never happen.");
160 return *(existing_new.first);
172 auto existing_new = localmes.insert(local_me);
174 assert(existing_new.second ==
true);
180 edm::LogInfo(
"DQMStore") <<
"ME " <<
me->getFullname() <<
" booked twice in the same module.";
187 if (!local_me->isValid()) {
188 local_me->switchData(
me);
195 template <
typename MELIKE>
198 for (
auto& [runlumi, meset] : this->
globalMEs_) {
199 auto it = meset.find(
path);
200 if (it != meset.end()) {
214 std::regex s_rxtrace{
"(.*)\\((.*)\\+0x.*\\).*(\\[.*\\])"};
215 std::regex s_rxself{
"^[^()]*dqm::implementation::.*|^[^()]*edm::.*|.*edm::convertException::wrap.*"};
220 int demangle_status = 0;
221 std::vector<std::string> clean_trace;
238 if (
match[2].length() == 0) {
245 if (!
demangled || demangle_status != 0) {
246 edm::LogWarning(
"DQMStoreBacktrace") <<
"failed demangle! status " << demangle_status <<
" on " <<
match[2];
250 if (std::regex_match(
demangled, s_rxself)) {
266 if (!clean_trace.empty()) {
267 logger << message <<
" at ";
268 for (
auto const&
s : clean_trace) {
272 logger << message <<
" : failed to collect stack trace.";
280 const char* scopename[] = {
"INVALID",
"JOB",
"RUN",
"LUMI"};
281 if (!this->
trackME_.empty() && (me_local || me_global)) {
283 if (
name.find(this->trackME_) != std::string::npos) {
285 logger << message <<
" for " <<
name <<
"(" << me_local <<
"," << me_global <<
")";
288 logger <<
" " <<
me->getRunLumi() <<
" scope " << scopename[
me->getScope()];
290 logger <<
" entries " <<
me->getEntries();
292 logger <<
" value " <<
me->getStringValue();
294 logger <<
" value " <<
me->getFloatValue();
296 logger <<
" value " <<
me->getIntValue();
336 auto proto = prototypes.find(
key.path_);
337 if (proto != prototypes.end()) {
340 prototypes.erase(proto);
341 auto medata = oldme->release();
343 medata->data_.key_.id_ =
key.id_;
347 oldme->switchData(medata);
348 auto result = targetset.insert(oldme);
350 auto newme = *
result.first;
353 debugTrackME(
"findOrRecycle (recycled)",
nullptr, newme);
374 auto& localset = this->
localMEs_[moduleID];
382 if (scope == MonitorElementData::Scope::JOB) {
383 return (
run == 0 &&
lumi == 0);
384 }
else if (scope == MonitorElementData::Scope::RUN) {
385 return (
run != 0 &&
lumi == 0);
386 }
else if (scope == MonitorElementData::Scope::LUMI) {
389 assert(!
"Impossible Scope.");
395 if (
target != targetset.end()) {
400 auto proto = prototypes.find(
me);
401 if (proto != prototypes.end()) {
405 if (checkScope((*proto)->getScope()) ==
false) {
410 prototypes.erase(proto);
411 auto medata = oldme->release();
417 oldme->switchData(medata);
418 auto result = targetset.insert(oldme);
426 assert(anyme || !
"local ME without any global ME!");
427 if (checkScope(anyme->getScope()) ==
false) {
439 auto result = targetset.insert(newme);
458 auto& localset = this->
localMEs_[moduleID];
464 if (scope == MonitorElementData::Scope::JOB) {
465 return (
run == 0 &&
lumi == 0);
466 }
else if (scope == MonitorElementData::Scope::RUN) {
467 return (
run != 0 &&
lumi == 0);
468 }
else if (scope == MonitorElementData::Scope::LUMI) {
471 assert(!
"Impossible Scope.");
477 if (
target == targetset.end()) {
480 assert(anyme && checkScope(anyme->getScope()) ==
false);
502 auto& localset = this->
localMEs_[moduleID];
505 if (scope == MonitorElementData::Scope::JOB) {
506 return (
run == 0 &&
lumi == 0);
507 }
else if (scope == MonitorElementData::Scope::RUN) {
508 return (
run != 0 &&
lumi == 0);
509 }
else if (scope == MonitorElementData::Scope::LUMI) {
512 assert(!
"Impossible Scope.");
518 if (
me->isValid() && checkScope(
me->getScope()) ==
true) {
539 auto meset = std::set<MonitorElement*, MonitorElement::MEComparison>();
545 auto torecycle = std::vector<MonitorElement*>();
549 if (scope == MonitorElementData::Scope::JOB) {
551 }
else if (scope == MonitorElementData::Scope::RUN) {
553 }
else if (scope == MonitorElementData::Scope::LUMI) {
556 assert(!
"Impossible Scope.");
562 checkScope(
me->getScope());
572 torecycle.push_back(
me);
579 auto medata =
me->release();
584 me->switchData(medata);
587 auto result = prototypes.insert(
me);
595 std::vector<MonitorElement*>
out;
599 auto it = meset.lower_bound(
path);
600 while (it != meset.end() && (*it)->getPathname() ==
path.getDirname()) {
611 std::vector<MonitorElement*>
out;
615 auto path_str =
path.getFullname();
617 auto it = meset.lower_bound(
path);
619 while (it != meset.end() && (*it)->getPathname().rfind(path_str, 0) == 0) {
633 uint32_t
lumi)
const {
635 std::vector<MonitorElement*>
out;
639 auto path_str =
path.getFullname();
641 auto it = meset.lower_bound(
path);
646 while (it != meset.end() && (*it)->getFullname().rfind(path_str, 0) == 0) {
652 for (std::vector<std::string>::const_iterator ipath =
store_->
MEsToSave_.begin();
661 if (
name == nameToSave) {
690 auto it = meset.find(
key.path_);
691 if (it != meset.end()) {
702 throw cms::Exception(
"iGetter Error") <<
"ME " << path <<
" was requested but not found.";
713 const auto& name =
me->getPathname();
714 auto subdirname =
name.substr(this->
cwd_.length(), std::string::npos);
715 auto dirname = subdirname.substr(0, subdirname.find(
'/'));
718 std::vector<std::string>
out;
720 if (
dir.length() == 0)
729 std::vector<std::string>
out;
730 out.reserve(mes.size());
731 for (
auto me : mes) {
732 out.push_back(
me->getName());
747 verbose_ =
pset.getUntrackedParameter<
int>(
"verbose", 0);
750 MEsToSave_ =
pset.getUntrackedParameter<std::vector<std::string>>(
"MEsToSave", std::vector<std::string>());
764 this->
setScope(MonitorElementData::Scope::JOB);
802 bool fileMustExist) {
DQMStore(edm::ParameterSet const &pset, edm::ActivityRegistry &)
LuminosityBlockNumber_t luminosityBlock() const
virtual DQM_DEPRECATED MonitorElement * getElement(std::string const &path) const
virtual void setCurrentFolder(std::string const &fullpath)
virtual std::vector< std::string > getMEs() const
virtual std::string pwd()
edm::propagate_const< std::unique_ptr< TH1 > > object_
virtual edm::LuminosityBlockID setRunLumi(edm::LuminosityBlockID runlumi)
virtual MonitorElementData::Scope setScope(MonitorElementData::Scope newscope)
void watchPreGlobalBeginLumi(PreGlobalBeginLumi::slot_type const &iSlot)
virtual bool dirExists(std::string const &path) const
void printTrace(std::string const &message)
std::map< uint64_t, std::set< MonitorElement *, MonitorElement::MEComparison > > localMEs_
virtual MonitorElement * bookME(TString const &name, MonitorElementData::Kind kind, std::function< TH1 *()> makeobject, bool forceReplace=false)
edm::LuminosityBlockID runlumi_
MonitorElementData::Scope scope_
unsigned int LuminosityBlockNumber_t
MonitorElement * findOrRecycle(MonitorElementData::Key const &)
void leaveLumi(edm::RunNumber_t run, edm::LuminosityBlockNumber_t lumi, uint64_t moduleID)
void initLumi(edm::RunNumber_t run, edm::LuminosityBlockNumber_t lumi)
void enterLumi(edm::RunNumber_t run, edm::LuminosityBlockNumber_t lumi, uint64_t moduleID)
std::recursive_mutex booking_mutex_
virtual std::vector< dqm::harvesting::MonitorElement * > getAllContents(std::string const &path) const
edm::LuminosityBlockID id_
void watchPostGlobalEndLumi(PostGlobalEndLumi::slot_type const &iSlot)
std::map< edm::LuminosityBlockID, std::set< MonitorElement *, MonitorElement::MEComparison > > globalMEs_
virtual uint64_t setModuleID(uint64_t moduleID)
LuminosityBlockID const & luminosityBlockID() const
MonitorElementData::Scope getScope()
void watchPreGlobalBeginRun(PreGlobalBeginRun::slot_type const &iSlot)
Log< level::Info, false > LogInfo
dqm::legacy::MonitorElement MonitorElement
std::string getFullname() const
get full name of ME including Pathname
unsigned long long uint64_t
void watchPostGlobalWriteRun(PostGlobalWriteRun::slot_type const &iSlot)
MonitorElement * findME(MELIKE const &path)
void watchPostGlobalEndRun(PostGlobalEndRun::slot_type const &iSlot)
virtual MonitorElement * get(std::string const &fullpath) const
std::vector< std::string > MEsToSave_
MonitorElement * putME(MonitorElement *me)
DQM_DEPRECATED void save(std::string const &filename, std::string const &path="")
void watchPostGlobalWriteLumi(PostGlobalEndLumi::slot_type const &iSlot)
void cleanupLumi(edm::RunNumber_t run, edm::LuminosityBlockNumber_t lumi)
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Log< level::Warning, false > LogWarning
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
void debugTrackME(const char *message, MonitorElement *me_local, MonitorElement *me_global) const
DQM_DEPRECATED bool open(std::string const &filename, bool overwrite=false, std::string const &path="", std::string const &prepend="", OpenRunDirs stripdirs=KeepRunDirs, bool fileMustExist=true)
virtual std::vector< dqm::harvesting::MonitorElement * > getContents(std::string const &path) const
virtual DQM_DEPRECATED std::vector< std::string > getSubdirs() const