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(
true);
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(
true);
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(
true);
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);
643 while (it != meset.end() && (*it)->getFullname().rfind(path_str, 0) == 0) {
661 auto it = meset.find(
key.path_);
662 if (it != meset.end()) {
673 throw cms::Exception(
"iGetter Error") <<
"ME " <<
path <<
" was requested but not found.";
682 std::set<std::string> subdirs;
684 const auto& name =
me->getPathname();
685 auto subdirname =
name.substr(this->
cwd_.length(), std::string::npos);
686 auto dirname = subdirname.substr(0, subdirname.find(
'/'));
689 std::vector<std::string>
out;
690 for (
const auto&
dir : subdirs) {
691 if (
dir.length() == 0)
700 std::vector<std::string>
out;
701 out.reserve(mes.size());
702 for (
auto me : mes) {
703 out.push_back(
me->getName());
718 verbose_ =
pset.getUntrackedParameter<
int>(
"verbose", 0);
734 this->
setScope(MonitorElementData::Scope::JOB);
772 bool fileMustExist) {