18 static const std::string s_safe =
"/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+=_()# ";
45 scope_ = MonitorElementData::Scope::JOB;
76 size_t pos = pathToCheck.find(limiter);
78 pathToCheck.erase(0,
pos + limiter.size());
80 if (pathToCheck.find_first_not_of(
s_safe) != std::string::npos) {
82 <<
" Monitor element path name: '" << pathToCheck.c_str() <<
"' uses unacceptable characters." 83 <<
"\n Acceptable characters are: " <<
s_safe.c_str();
98 TH1* th1 = makeobject();
106 bool pathInList =
false;
109 medata.
key_.
scope_ = MonitorElementData::Scope::LUMI;
121 if (medata.
key_.
scope_ == MonitorElementData::Scope::JOB) {
123 }
else if (medata.
key_.
scope_ == MonitorElementData::Scope::RUN) {
125 }
else if (medata.
key_.
scope_ == MonitorElementData::Scope::LUMI) {
143 TH1* th1 = makeobject();
147 me->switchObject(std::unique_ptr<TH1>(th1));
184 if (existing_new.second ==
true) {
191 assert(!
"Currently, this should never happen.");
192 return *(existing_new.first);
204 auto existing_new = localmes.insert(local_me);
206 assert(existing_new.second ==
true);
212 edm::LogInfo(
"DQMStore") <<
"ME " <<
me->getFullname() <<
" booked twice in the same module.";
219 if (!local_me->isValid()) {
220 local_me->switchData(
me);
227 template <
typename MELIKE>
230 for (
auto& [runlumi, meset] : this->
globalMEs_) {
231 auto it = meset.find(
path);
232 if (
it != meset.end()) {
246 std::regex s_rxtrace{
"(.*)\\((.*)\\+0x.*\\).*(\\[.*\\])"};
247 std::regex s_rxself{
"^[^()]*dqm::implementation::.*|^[^()]*edm::.*|.*edm::convertException::wrap.*"};
252 int demangle_status = 0;
253 std::vector<std::string> clean_trace;
256 size = backtrace(
array, 10);
270 if (match[2].length() == 0) {
276 demangled = abi::__cxa_demangle(
std::string(match[2]).c_str(),
nullptr,
nullptr, &demangle_status);
277 if (!
demangled || demangle_status != 0) {
278 edm::LogWarning(
"DQMStoreBacktrace") <<
"failed demangle! status " << demangle_status <<
" on " << match[2];
282 if (std::regex_match(
demangled, s_rxself)) {
298 if (!clean_trace.empty()) {
299 logger << message <<
" at ";
300 for (
auto const&
s : clean_trace) {
304 logger << message <<
" : failed to collect stack trace.";
312 const char* scopename[] = {
"INVALID",
"JOB",
"RUN",
"LUMI"};
313 if (!this->
trackME_.empty() && (me_local || me_global)) {
315 if (
name.find(this->trackME_) != std::string::npos) {
317 logger << message <<
" for " <<
name <<
"(" << me_local <<
"," << me_global <<
")";
320 logger <<
" " <<
me->getRunLumi() <<
" scope " << scopename[
me->getScope()];
322 logger <<
" entries " <<
me->getEntries();
324 logger <<
" value " <<
me->getStringValue();
326 logger <<
" value " <<
me->getFloatValue();
328 logger <<
" value " <<
me->getIntValue();
368 auto proto = prototypes.find(
key.path_);
369 if (proto != prototypes.end()) {
372 prototypes.erase(proto);
373 auto medata = oldme->release();
375 medata->data_.key_.id_ =
key.id_;
379 oldme->switchData(medata);
380 auto result = targetset.insert(oldme);
382 auto newme = *
result.first;
385 debugTrackME(
"findOrRecycle (recycled)",
nullptr, newme);
406 auto& localset = this->
localMEs_[moduleID];
414 if (scope == MonitorElementData::Scope::JOB) {
415 return (
run == 0 &&
lumi == 0);
416 }
else if (scope == MonitorElementData::Scope::RUN) {
417 return (
run != 0 &&
lumi == 0);
418 }
else if (scope == MonitorElementData::Scope::LUMI) {
421 assert(!
"Impossible Scope.");
427 if (
target != targetset.end()) {
432 auto proto = prototypes.find(
me);
433 if (proto != prototypes.end()) {
437 if (checkScope((*proto)->getScope()) ==
false) {
442 prototypes.erase(proto);
443 auto medata = oldme->release();
449 oldme->switchData(medata);
450 auto result = targetset.insert(oldme);
458 assert(anyme || !
"local ME without any global ME!");
459 if (checkScope(anyme->getScope()) ==
false) {
471 auto result = targetset.insert(newme);
490 auto& localset = this->
localMEs_[moduleID];
496 if (scope == MonitorElementData::Scope::JOB) {
497 return (
run == 0 &&
lumi == 0);
498 }
else if (scope == MonitorElementData::Scope::RUN) {
499 return (
run != 0 &&
lumi == 0);
500 }
else if (scope == MonitorElementData::Scope::LUMI) {
503 assert(!
"Impossible Scope.");
509 if (
target == targetset.end()) {
512 assert(anyme && checkScope(anyme->getScope()) ==
false);
534 auto& localset = this->
localMEs_[moduleID];
537 if (scope == MonitorElementData::Scope::JOB) {
538 return (
run == 0 &&
lumi == 0);
539 }
else if (scope == MonitorElementData::Scope::RUN) {
540 return (
run != 0 &&
lumi == 0);
541 }
else if (scope == MonitorElementData::Scope::LUMI) {
544 assert(!
"Impossible Scope.");
550 if (
me->isValid() && checkScope(
me->getScope()) ==
true) {
571 auto meset = std::set<MonitorElement*, MonitorElement::MEComparison>();
577 auto torecycle = std::vector<MonitorElement*>();
581 if (scope == MonitorElementData::Scope::JOB) {
583 }
else if (scope == MonitorElementData::Scope::RUN) {
585 }
else if (scope == MonitorElementData::Scope::LUMI) {
588 assert(!
"Impossible Scope.");
594 checkScope(
me->getScope());
604 torecycle.push_back(
me);
611 auto medata =
me->release();
616 me->switchData(medata);
619 auto result = prototypes.insert(
me);
627 std::vector<MonitorElement*>
out;
631 auto it = meset.lower_bound(
path);
632 while (
it != meset.end() && (*it)->getPathname() ==
path.getDirname()) {
643 std::vector<MonitorElement*>
out;
647 auto path_str =
path.getFullname();
649 auto it = meset.lower_bound(
path);
651 while (
it != meset.end() && (*it)->getPathname().rfind(path_str, 0) == 0) {
665 uint32_t
lumi)
const {
667 std::vector<MonitorElement*>
out;
671 auto path_str =
path.getFullname();
673 auto it = meset.lower_bound(
path);
678 while (
it != meset.end() && (*it)->getFullname().rfind(path_str, 0) == 0) {
684 for (std::vector<std::string>::const_iterator ipath =
store_->
MEsToSave_.begin();
693 if (
name == nameToSave) {
722 auto it = meset.find(
key.path_);
723 if (
it != meset.end()) {
734 throw cms::Exception(
"iGetter Error") <<
"ME " << path <<
" was requested but not found.";
745 const auto& name =
me->getPathname();
746 auto subdirname =
name.substr(this->
cwd_.length(), std::string::npos);
747 auto dirname = subdirname.substr(0, subdirname.find(
'/'));
750 std::vector<std::string>
out;
752 if (
dir.length() == 0)
761 std::vector<std::string>
out;
762 out.reserve(mes.size());
763 for (
auto me : mes) {
764 out.push_back(
me->getName());
779 verbose_ =
pset.getUntrackedParameter<
int>(
"verbose", 0);
782 MEsToSave_ =
pset.getUntrackedParameter<std::vector<std::string>>(
"MEsToSave", std::vector<std::string>());
797 this->
setScope(MonitorElementData::Scope::JOB);
835 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)
const auto & getMEsToSave() const
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 free(void *ptr) noexcept
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_
key
prepare the HTCondor submission files and eventually submit them
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)
const bool & getMode() const
static const std::string s_safe
void cleanupLumi(edm::RunNumber_t run, edm::LuminosityBlockNumber_t lumi)
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