CMS 3D CMS Logo

DQMStore.h
Go to the documentation of this file.
1 #ifndef DQMServices_Core_DQMStore_h
2 #define DQMServices_Core_DQMStore_h
3 
6 
8 
9 #include <type_traits>
10 #include <functional>
11 #include <mutex>
12 
13 // TODO: Remove at some point:
14 #define TRACE(msg) \
15  std::cout << "TRACE: " << __FILE__ << ":" << __LINE__ << "(" << __FUNCTION__ << ") " << msg << std::endl;
16 #define TRACE_ TRACE("");
17 
18 namespace dqm {
19  namespace implementation {
21  class DQMStore;
22 
23  // The common implementation to change folders
24  class NavigatorBase {
25  public:
26  virtual void cd();
27  // cd is identical to setCurrentFolder!
29  virtual void cd(std::string const& dir);
30  // This is the only method that is allowed to change cwd_ value
31  virtual void setCurrentFolder(std::string const& fullpath);
32  virtual void goUp();
33  // returns the current directory without (!) trailing slash or empty string.
34  virtual std::string pwd();
35 
36  virtual ~NavigatorBase() {}
37 
38  protected:
41  };
42 
44  public:
45  // DQMStore configures the IBooker in bookTransaction.
46  friend class DQMStore;
47 
48  // functor to be passed as a default argument that does not do anything.
49  struct NOOP {
50  void operator()(TH1*) const {};
51  void operator()() const {};
52  };
53 
54  //
55  // Booking Methods, templated to allow passing in lambdas.
56  // The variations taking ROOT object pointers do NOT take ownership of
57  // the object; it will be clone'd.
58  //
59 
60  // The function argument as an optional template parameter adds a lot of
61  // ambiguity to the overload resolution, since it accepts *anything* by
62  // default (and it does not help that we rely on implicit conversions for
63  // almost all of the arguments in many cases, converting string literal
64  // to TString and ints to floats, and 0 also prefers to convert to float*
65  // and so on ...).
66  // So, we use SFINAE to restrict the template parameter type, but that is
67  // also not that easy: there is no way to check for sth. callable in
68  // type_traits (`is_function` is not the right thing!), so instead we
69  // check for not-numeric things, which works most of the time (though e.g.
70  // enum constants somehow still pass as not arithmetic and need an
71  // explicit cast to resolve the ambiguity).
73  MonitorElement* bookInt(TString const& name, FUNC onbooking = NOOP()) {
75  onbooking();
76  return nullptr;
77  });
78  }
80  MonitorElement* bookFloat(TString const& name, FUNC onbooking = NOOP()) {
82  onbooking();
83  return nullptr;
84  });
85  }
87  MonitorElement* bookString(TString const& name, TString const& value, FUNC onbooking = NOOP()) {
88  std::string initial_value(value);
90  onbooking();
91  return nullptr;
92  });
93  me->Fill(initial_value);
94  return me;
95  }
96 
98  MonitorElement* book1D(TString const& name,
99  TString const& title,
100  int const nchX,
101  double const lowX,
102  double const highX,
103  FUNC onbooking = NOOP()) {
105  auto th1 = new TH1F(name, title, nchX, lowX, highX);
106  onbooking(th1);
107  return th1;
108  });
109  }
112  TString const& name, TString const& title, int nchX, float const* xbinsize, FUNC onbooking = NOOP()) {
114  auto th1 = new TH1F(name, title, nchX, xbinsize);
115  onbooking(th1);
116  return th1;
117  });
118  }
120  MonitorElement* book1D(TString const& name, TH1F* object, FUNC onbooking = NOOP()) {
121  return bookME(
122  name,
124  [=]() {
125  auto th1 = static_cast<TH1F*>(object->Clone(name));
126  onbooking(th1);
127  return th1;
128  },
129  /* forceReplace */ true);
130  }
131 
134  TString const& name, TString const& title, int nchX, double lowX, double highX, FUNC onbooking = NOOP()) {
136  auto th1 = new TH1S(name, title, nchX, lowX, highX);
137  onbooking(th1);
138  return th1;
139  });
140  }
142  MonitorElement* book1S(TString const& name, TH1S* object, FUNC onbooking = NOOP()) {
143  return bookME(
144  name,
146  [=]() {
147  auto th1 = static_cast<TH1S*>(object->Clone(name));
148  onbooking(th1);
149  return th1;
150  },
151  /* forceReplace */ true);
152  }
153 
156  TString const& name, TString const& title, int nchX, double lowX, double highX, FUNC onbooking = NOOP()) {
158  auto th1 = new TH1D(name, title, nchX, lowX, highX);
159  onbooking(th1);
160  return th1;
161  });
162  }
164  MonitorElement* book1DD(TString const& name, TH1D* object, FUNC onbooking = NOOP()) {
165  return bookME(
166  name,
168  [=]() {
169  auto th1 = static_cast<TH1D*>(object->Clone(name));
170  onbooking(th1);
171  return th1;
172  },
173  /* forceReplace */ true);
174  }
175 
177  MonitorElement* book1I(TString const& name,
178  TString const& title,
179  int const nchX,
180  double const lowX,
181  double const highX,
182  FUNC onbooking = NOOP()) {
184  auto th1 = new TH1I(name, title, nchX, lowX, highX);
185  onbooking(th1);
186  return th1;
187  });
188  }
191  TString const& name, TString const& title, int nchX, float const* xbinsize, FUNC onbooking = NOOP()) {
193  auto th1 = new TH1I(name, title, nchX, xbinsize);
194  onbooking(th1);
195  return th1;
196  });
197  }
199  MonitorElement* book1I(TString const& name, TH1I* object, FUNC onbooking = NOOP()) {
200  return bookME(
201  name,
203  [=]() {
204  auto th1 = static_cast<TH1I*>(object->Clone(name));
205  onbooking(th1);
206  return th1;
207  },
208  /* forceReplace */ true);
209  }
210 
212  MonitorElement* book2D(TString const& name,
213  TString const& title,
214  int nchX,
215  double lowX,
216  double highX,
217  int nchY,
218  double lowY,
219  double highY,
220  FUNC onbooking = NOOP()) {
222  auto th2 = new TH2F(name, title, nchX, lowX, highX, nchY, lowY, highY);
223  onbooking(th2);
224  return th2;
225  });
226  }
228  MonitorElement* book2D(TString const& name,
229  TString const& title,
230  int nchX,
231  float const* xbinsize,
232  int nchY,
233  float const* ybinsize,
234  FUNC onbooking = NOOP()) {
236  auto th2 = new TH2F(name, title, nchX, xbinsize, nchY, ybinsize);
237  onbooking(th2);
238  return th2;
239  });
240  }
242  MonitorElement* book2D(TString const& name, TH2F* object, FUNC onbooking = NOOP()) {
243  return bookME(
244  name,
246  [=]() {
247  auto th2 = static_cast<TH2F*>(object->Clone(name));
248  onbooking(th2);
249  return th2;
250  },
251  /* forceReplace */ true);
252  }
254  MonitorElement* book2S(TString const& name,
255  TString const& title,
256  int nchX,
257  double lowX,
258  double highX,
259  int nchY,
260  double lowY,
261  double highY,
262  FUNC onbooking = NOOP()) {
264  auto th2 = new TH2S(name, title, nchX, lowX, highX, nchY, lowY, highY);
265  onbooking(th2);
266  return th2;
267  });
268  }
270  MonitorElement* book2S(TString const& name,
271  TString const& title,
272  int nchX,
273  float const* xbinsize,
274  int nchY,
275  float const* ybinsize,
276  FUNC onbooking = NOOP()) {
278  auto th2 = new TH2S(name, title, nchX, xbinsize, nchY, ybinsize);
279  onbooking(th2);
280  return th2;
281  });
282  }
284  MonitorElement* book2S(TString const& name, TH2S* object, FUNC onbooking = NOOP()) {
285  return bookME(
286  name,
288  [=]() {
289  auto th2 = static_cast<TH2S*>(object->Clone(name));
290  onbooking(th2);
291  return th2;
292  },
293  /* forceReplace */ true);
294  }
296  MonitorElement* book2I(TString const& name,
297  TString const& title,
298  int nchX,
299  double lowX,
300  double highX,
301  int nchY,
302  double lowY,
303  double highY,
304  FUNC onbooking = NOOP()) {
306  auto th2 = new TH2I(name, title, nchX, lowX, highX, nchY, lowY, highY);
307  onbooking(th2);
308  return th2;
309  });
310  }
312  MonitorElement* book2I(TString const& name,
313  TString const& title,
314  int nchX,
315  float const* xbinsize,
316  int nchY,
317  float const* ybinsize,
318  FUNC onbooking = NOOP()) {
320  auto th2 = new TH2I(name, title, nchX, xbinsize, nchY, ybinsize);
321  onbooking(th2);
322  return th2;
323  });
324  }
326  MonitorElement* book2I(TString const& name, TH2I* object, FUNC onbooking = NOOP()) {
327  return bookME(
328  name,
330  [=]() {
331  auto th2 = static_cast<TH2I*>(object->Clone(name));
332  onbooking(th2);
333  return th2;
334  },
335  /* forceReplace */ true);
336  }
338  MonitorElement* book2DD(TString const& name,
339  TString const& title,
340  int nchX,
341  double lowX,
342  double highX,
343  int nchY,
344  double lowY,
345  double highY,
346  FUNC onbooking = NOOP()) {
348  auto th2 = new TH2D(name, title, nchX, lowX, highX, nchY, lowY, highY);
349  onbooking(th2);
350  return th2;
351  });
352  }
354  MonitorElement* book2DD(TString const& name, TH2D* object, FUNC onbooking = NOOP()) {
355  return bookME(
356  name,
358  [=]() {
359  auto th2 = static_cast<TH2D*>(object->Clone(name));
360  onbooking(th2);
361  return th2;
362  },
363  /* forceReplace */ true);
364  }
365 
367  MonitorElement* book3D(TString const& name,
368  TString const& title,
369  int nchX,
370  double lowX,
371  double highX,
372  int nchY,
373  double lowY,
374  double highY,
375  int nchZ,
376  double lowZ,
377  double highZ,
378  FUNC onbooking = NOOP()) {
380  auto th3 = new TH3F(name, title, nchX, lowX, highX, nchY, lowY, highY, nchZ, lowZ, highZ);
381  onbooking(th3);
382  return th3;
383  });
384  }
386  MonitorElement* book3D(TString const& name, TH3F* object, FUNC onbooking = NOOP()) {
387  return bookME(
388  name,
390  [=]() {
391  auto th3 = static_cast<TH3F*>(object->Clone(name));
392  onbooking(th3);
393  return th3;
394  },
395  /* forceReplace */ true);
396  }
397 
399  MonitorElement* bookProfile(TString const& name,
400  TString const& title,
401  int nchX,
402  double lowX,
403  double highX,
404  int /* nchY */,
405  double lowY,
406  double highY,
407  char const* option = "s",
408  FUNC onbooking = NOOP()) {
410  auto tprofile = new TProfile(name, title, nchX, lowX, highX, lowY, highY, option);
411  onbooking(tprofile);
412  return tprofile;
413  });
414  }
416  MonitorElement* bookProfile(TString const& name,
417  TString const& title,
418  int nchX,
419  double lowX,
420  double highX,
421  double lowY,
422  double highY,
423  char const* option = "s",
424  FUNC onbooking = NOOP()) {
426  auto tprofile = new TProfile(name, title, nchX, lowX, highX, lowY, highY, option);
427  onbooking(tprofile);
428  return tprofile;
429  });
430  }
432  MonitorElement* bookProfile(TString const& name,
433  TString const& title,
434  int nchX,
435  double const* xbinsize,
436  int /* nchY */,
437  double lowY,
438  double highY,
439  char const* option = "s",
440  FUNC onbooking = NOOP()) {
442  auto tprofile = new TProfile(name, title, nchX, xbinsize, lowY, highY, option);
443  onbooking(tprofile);
444  return tprofile;
445  });
446  }
448  MonitorElement* bookProfile(TString const& name,
449  TString const& title,
450  int nchX,
451  double const* xbinsize,
452  double lowY,
453  double highY,
454  char const* option = "s",
455  FUNC onbooking = NOOP()) {
457  auto tprofile = new TProfile(name, title, nchX, xbinsize, lowY, highY, option);
458  onbooking(tprofile);
459  return tprofile;
460  });
461  }
463  MonitorElement* bookProfile(TString const& name, TProfile* object, FUNC onbooking = NOOP()) {
464  return bookME(
465  name,
467  [=]() {
468  auto tprofile = static_cast<TProfile*>(object->Clone(name));
469  onbooking(tprofile);
470  return tprofile;
471  },
472  /* forceReplace */ true);
473  }
474 
477  TString const& title,
478  int nchX,
479  double lowX,
480  double highX,
481  int nchY,
482  double lowY,
483  double highY,
484  double lowZ,
485  double highZ,
486  char const* option = "s",
487  FUNC onbooking = NOOP()) {
489  auto tprofile = new TProfile2D(name, title, nchX, lowX, highX, nchY, lowY, highY, lowZ, highZ, option);
490  onbooking(tprofile);
491  return tprofile;
492  });
493  }
496  TString const& title,
497  int nchX,
498  double lowX,
499  double highX,
500  int nchY,
501  double lowY,
502  double highY,
503  int /* nchZ */,
504  double lowZ,
505  double highZ,
506  char const* option = "s",
507  FUNC onbooking = NOOP()) {
509  auto tprofile = new TProfile2D(name, title, nchX, lowX, highX, nchY, lowY, highY, lowZ, highZ, option);
510  onbooking(tprofile);
511  return tprofile;
512  });
513  }
515  MonitorElement* bookProfile2D(TString const& name, TProfile2D* object, FUNC onbooking = NOOP()) {
516  return bookME(
517  name,
519  [=]() {
520  auto tprofile = static_cast<TProfile2D*>(object->Clone(name));
521  onbooking(tprofile);
522  return tprofile;
523  },
524  /* forceReplace */ true);
525  }
526 
527  //
528  // all non-template interfaces are virtual.
529  //
530 
532  // RAII-Style guard to set and reset the Scope.
533  template <MonitorElementData::Scope SCOPE>
534  struct UseScope {
537  UseScope(IBooker& booker) : parent(booker) { oldscope = parent.setScope(SCOPE); }
539  };
543 
544  ~IBooker() override;
545 
546  private:
547  IBooker(DQMStore* store);
548  virtual uint64_t setModuleID(uint64_t moduleID);
550  virtual MonitorElement* bookME(TString const& name,
552  std::function<TH1*()> makeobject,
553  bool forceReplace = false);
554 
555  DQMStore* store_ = nullptr;
556  MonitorElementData::Scope scope_ = MonitorElementData::Scope::JOB;
560  };
561 
563  public:
564  // The IGetter interface is not really suitable for concurrent lumis/runs,
565  // so we don't even try much to get it right. Harvesting needs to run
566  // sequentially for now. Therefore, the methods just return the next-best
567  // global MEs that they find, ignoring Scope and run/lumi.
568  // Since these are global MEs, they may be deleted at some point; don't
569  // store the pointers!
570  // They are also shared with other modules. That is save when running
571  // multi-threaded as long as getTH1() etc. are not used, but of course
572  // all dependencies need to be properly declared to get correct results.
573 
574  // TODO: review and possibly rename the all methods below:
575  // get MEs that are direct children of full path `path`
576  virtual std::vector<dqm::harvesting::MonitorElement*> getContents(std::string const& path) const;
577 
578  // get all elements below full path `path`
579  // we have to discuss semantics here -- are run/lumi ever used?
580  virtual std::vector<dqm::harvesting::MonitorElement*> getAllContents(std::string const& path) const;
582  virtual std::vector<dqm::harvesting::MonitorElement*> getAllContents(std::string const& path,
583  uint32_t runNumber,
584  uint32_t lumi) const;
585  // TODO: rename to reflect the fact that it requires full path
586  // return ME identified by full path `path`, or nullptr
587  virtual MonitorElement* get(std::string const& fullpath) const;
588 
589  // This is the most specific way to get a ME, specifying also run and
590  // lumi in the key. Primarily for internal use.
591  virtual MonitorElement* get(MonitorElementData::Key const& key) const;
592 
593  // same as get, throws an exception if histogram not found
594  // Deprecated simply because it is barely used.
596  virtual MonitorElement* getElement(std::string const& path) const;
597 
598  // return sub-directories of current directory
599  // Deprecated because the current implementation is very slow and barely
600  // used, use getAllContents instead.
602  virtual std::vector<std::string> getSubdirs() const;
603  // return element names of direct children of current directory
604  virtual std::vector<std::string> getMEs() const;
605  // returns whether there are objects at full path `path`
606  virtual bool dirExists(std::string const& path) const;
607 
608  ~IGetter() override;
609 
610  protected:
611  IGetter(DQMStore* store);
612 
614  };
615 
616  class DQMStore : public IGetter, public IBooker {
617  public:
618  // IGetter uses the globalMEs_ directly.
619  friend IGetter;
621 
623  DQMStore(DQMStore const&) = delete;
624  DQMStore(DQMStore&&) = delete;
625  DQMStore& operator=(DQMStore const&) = delete;
626  ~DQMStore() override;
627 
628  // ------------------------------------------------------------------------
629  // ---------------------- public I/O --------------------------------------
631  void save(std::string const& filename, std::string const& path = "");
633  bool open(std::string const& filename,
634  bool overwrite = false,
635  std::string const& path = "",
636  std::string const& prepend = "",
637  OpenRunDirs stripdirs = KeepRunDirs,
638  bool fileMustExist = true);
639 
640  // ------------------------------------------------------------------------
641  // ------------ IBooker/IGetter overrides to prevent ambiguity ------------
642  void cd() override { this->IBooker::cd(); }
643  void cd(std::string const& dir) override { this->IBooker::cd(dir); }
644  void goUp() override { this->IBooker::goUp(); }
645  std::string pwd() override { return this->IBooker::pwd(); }
646 
647  void setCurrentFolder(std::string const& fullpath) override {
648  // only here we keep the two in sync -- all the others call this in the end!
649  this->IBooker::setCurrentFolder(fullpath);
650  this->IGetter::setCurrentFolder(fullpath);
651  }
652 
653  public:
654  // internal -- figure out better protection.
655  template <typename iFunc>
656  void bookTransaction(iFunc f, uint64_t moduleId, bool canSaveByLumi) {
657  // taking the lock here only to protect the single, global IBooker (as
658  // base class of DQMStore). We could avoid taking this lock by making a
659  // new IBooker instance for each transaction, and the DQMStore itself
660  // takes the lock before touching any data structures.
661  // There is a race in bookME when we don't take this lock, where two
662  // modules might prepare a global ME for the same name at the same time
663  // and only one of them succeeds in putME: this is is safe, but we need
664  // to remove the assertion over there and subsystem code has to be
665  // aware that the booking callback *can* run multiple times.
666  // Additionally, this lock is what keeps usage of getTH1() safe during
667  // booking... all code needs to be migrated to callbacks before this can
668  // be removed.
669  auto lock = std::scoped_lock(this->booking_mutex_);
670 
671  // This is to make sure everything gets reset in case of an exception.
672  // That is not really required (an exception here will crash the job
673  // anyways, and it is technically not required to reset everything), but
674  // it prevents misleading error messages in other threads.
675  struct ModuleIdScope {
676  IBooker& booker_;
677  uint64_t oldid_;
678  MonitorElementData::Scope oldscope_;
679  edm::LuminosityBlockID oldrunlumi_;
680  ModuleIdScope(IBooker& booker,
681  uint64_t newid,
682  MonitorElementData::Scope newscope,
683  edm::LuminosityBlockID newrunlumi)
684  : booker_(booker) {
685  oldid_ = booker_.setModuleID(newid);
686  oldscope_ = booker_.setScope(newscope);
687  oldrunlumi_ = booker_.setRunLumi(newrunlumi);
688  assert(newid != kInvalidModuleID || !"moduleID must be set for normal booking transaction");
689  assert(oldid_ == kInvalidModuleID || !"Nested booking transaction?");
690  }
691  ~ModuleIdScope() {
692  booker_.setModuleID(oldid_);
693  booker_.setScope(oldscope_);
694  booker_.setRunLumi(oldrunlumi_);
695  }
696  };
697 
698  ModuleIdScope booker(
699  *this,
700  moduleId,
701  // enable per-lumi-by-default here
702  canSaveByLumi && this->doSaveByLumi_ ? MonitorElementData::Scope::LUMI : MonitorElementData::Scope::RUN,
703  // always book prototypes
705 
706  f(booker.booker_);
707  };
708 
709  template <typename iFunc>
710  void meBookerGetter(iFunc f) {
711  auto lock = std::scoped_lock(this->booking_mutex_);
712  // here, we make much less assumptions compared to bookTransaction.
713  // This is essentially legacy semantics except we actually take the lock.
714  f(*this, *this);
715  // TODO: we should maybe make sure that Scope changes are reset here,
716  // but also it makes sense to inherit the Scope from the environement
717  // (e.g. when meBookerGetter is called *inside* a booking transaction).
718  };
719 
720  // For input modules: trigger recycling without local ME/enterLumi/moduleID.
722 
723  // this creates local all needed global MEs for the given run/lumi (and
724  // module), potentially cloning them if there are concurrent runs/lumis.
725  // Symmetrical to cleanupLumi, this is called from a framwork hook, to
726  // make sure it also runs when the module does not call anything.
729 
730  // modules are expected to call these callbacks when they change run/lumi.
731  // The DQMStore then updates the module's MEs local MEs to point to the
732  // new run/lumi.
735 
736  // this is triggered by a framework hook to remove/recycle MEs after a
737  // run/lumi is saved. We do this via the edm::Service interface to make
738  // sure it runs after *all* output modules, even if there are multiple.
740 
741  // Add ME to DQMStore datastructures. The object will be deleted if a
742  // similar object is already present.
743  // For global ME
745  // For local ME
747  // Find a global ME of matching name, in any state.
748  // MELIKE can be a MonitorElementData::Path or MonitorElement*.
749  template <typename MELIKE>
750  MonitorElement* findME(MELIKE const& path);
751  // Log a backtrace on booking.
752  void printTrace(std::string const& message);
753  // print a log message if ME matches trackME_.
754  void debugTrackME(const char* message, MonitorElement* me_local, MonitorElement* me_global) const;
755  // accesor to keep MEsToSave_ private
756  const auto& getMEsToSave() const { return MEsToSave_; }
757  // accesor to keep onlineMode_ private
758  const bool& getMode() const { return onlineMode_; }
759 
760  private:
761  // MEComparison is a name-only comparison on MEs and Paths, allowing
762  // heterogeneous lookup.
763  // The ME objects here are lightweight, all the important stuff is in the
764  // MEData. However we never handle MEData directly, but always keep it
765  // wrapped in MEs (created as needed). MEs can share MEData.
766  // ME objects must never appear more than once in these sets. ME objects
767  // in localMEs_ cannot be deleted, since the module might hold pointers.
768  // MEs in globalMEs_ can be deleted/recycled at the end of their scope,
769  // if there are no local MEs left that share the data.
770  // MEs can be _protoype MEs_ if their scope is not yet known (after
771  // booking, after leaveLumi). A prototype is kept if and only if there is
772  // no other global instance of the same ME. Prototype MEs have
773  // run = lumi = 0 and scope != JOB. If scope == JOB, a prototype is never
774  // required. Prototype MEs are reset *before* inserting, so fill calls
775  // can go into prototype MEs and not be lost.
776  // Key is (run, lumi), potentially one or both 0 for SCOPE::RUN or SCOPE::JOB
777  // NEVER modify the key_ of a ME in these datastructures. Since we use
778  // pointers, this may be possible (not everything is const), but it could
779  // still corrupt the datastructure.
780  std::map<edm::LuminosityBlockID, std::set<MonitorElement*, MonitorElement::MEComparison>> globalMEs_;
781  // Key is (moduleID [, run | , stream]), run is only needed for
782  // edm::global, stream only for edm::stream.
783  // Legacy MEs have moduleID 0.
784  std::map<uint64_t, std::set<MonitorElement*, MonitorElement::MEComparison>> localMEs_;
785  // Whenever modifying these sets, take this mutex. It's recursive, so we
786  // can be liberal -- lock on any access, but also lock on the full booking
787  // transaction.
788  std::recursive_mutex booking_mutex_;
789 
790  // Universal verbose flag.
791  // Only very few usages remain, the main debugging tool is trackME_.
792  int verbose_;
793 
794  // If set to true, error out whenever things happen that are not safe for
795  // legacy modules.
797 
798  // Book MEs by lumi by default whenever possible.
800  // Book MEs by lumi from list in DQMServices/Core/python/DQMStore_cfi.py
801  std::vector<std::string> MEsToSave_; //just if perLS is ON
802 
803  // if non-empty, debugTrackME calls will log some information whenever a
804  // ME path contains this string.
806 
807  // Online mode
809  };
810  } // namespace implementation
811 
812  // Since we still use a single, edm::Serivce instance of a DQMStore, these are all the same.
813  namespace legacy {
815  public:
818  // import constructors.
820  };
821  } // namespace legacy
822  namespace reco {
824  } // namespace reco
825  namespace harvesting {
827  } // namespace harvesting
828 } // namespace dqm
829 
830 #endif
DQMStore(edm::ParameterSet const &pset, edm::ActivityRegistry &)
Definition: DQMStore.cc:778
MonitorElement * book2D(TString const &name, TString const &title, int nchX, float const *xbinsize, int nchY, float const *ybinsize, FUNC onbooking=NOOP())
Definition: DQMStore.h:228
MonitorElement * bookFloat(TString const &name, FUNC onbooking=NOOP())
Definition: DQMStore.h:80
MonitorElement * book2S(TString const &name, TString const &title, int nchX, float const *xbinsize, int nchY, float const *ybinsize, FUNC onbooking=NOOP())
Definition: DQMStore.h:270
MonitorElement * book2D(TString const &name, TH2F *object, FUNC onbooking=NOOP())
Definition: DQMStore.h:242
MonitorElement * book1D(TString const &name, TString const &title, int nchX, float const *xbinsize, FUNC onbooking=NOOP())
Definition: DQMStore.h:111
MonitorElement * bookProfile2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, double lowZ, double highZ, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:476
virtual DQM_DEPRECATED MonitorElement * getElement(std::string const &path) const
Definition: DQMStore.cc:731
MonitorElement * book1I(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:177
MonitorElement * book2S(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:254
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
MonitorElement * book1D(TString const &name, TH1F *object, FUNC onbooking=NOOP())
Definition: DQMStore.h:120
MonitorElement * bookProfile(TString const &name, TProfile *object, FUNC onbooking=NOOP())
Definition: DQMStore.h:463
dqm::legacy::DQMStore DQMStore
Definition: DQMStore.h:826
const auto & getMEsToSave() const
Definition: DQMStore.h:756
virtual std::vector< std::string > getMEs() const
Definition: DQMStore.cc:759
virtual std::string pwd()
Definition: DQMStore.cc:20
virtual edm::LuminosityBlockID setRunLumi(edm::LuminosityBlockID runlumi)
Definition: DQMStore.cc:61
void setCurrentFolder(std::string const &fullpath) override
Definition: DQMStore.h:647
virtual MonitorElementData::Scope setScope(MonitorElementData::Scope newscope)
Definition: DQMStore.cc:50
virtual bool dirExists(std::string const &path) const
Definition: DQMStore.cc:769
void printTrace(std::string const &message)
Definition: DQMStore.cc:242
void bookTransaction(iFunc f, uint64_t moduleId, bool canSaveByLumi)
Definition: DQMStore.h:656
MonitorElement * book2DD(TString const &name, TH2D *object, FUNC onbooking=NOOP())
Definition: DQMStore.h:354
std::map< uint64_t, std::set< MonitorElement *, MonitorElement::MEComparison > > localMEs_
Definition: DQMStore.h:784
virtual MonitorElement * bookME(TString const &name, MonitorElementData::Kind kind, std::function< TH1 *()> makeobject, bool forceReplace=false)
Definition: DQMStore.cc:67
void cd(std::string const &dir) override
Definition: DQMStore.h:643
std::string pwd() override
Definition: DQMStore.h:645
edm::LuminosityBlockID runlumi_
Definition: DQMStore.h:559
MonitorElementData::Scope scope_
Definition: DQMStore.h:556
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:416
assert(be >=bs)
unsigned int LuminosityBlockNumber_t
DQMStore & operator=(DQMStore const &)=delete
MonitorElement * book1S(TString const &name, TH1S *object, FUNC onbooking=NOOP())
Definition: DQMStore.h:142
MonitorElement * bookString(TString const &name, TString const &value, FUNC onbooking=NOOP())
Definition: DQMStore.h:87
MonitorElement * findOrRecycle(MonitorElementData::Key const &)
Definition: DQMStore.cc:349
void leaveLumi(edm::RunNumber_t run, edm::LuminosityBlockNumber_t lumi, uint64_t moduleID)
Definition: DQMStore.cc:524
MonitorElement * book1DD(TString const &name, TString const &title, int nchX, double lowX, double highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:155
void initLumi(edm::RunNumber_t run, edm::LuminosityBlockNumber_t lumi)
Definition: DQMStore.cc:392
void enterLumi(edm::RunNumber_t run, edm::LuminosityBlockNumber_t lumi, uint64_t moduleID)
Definition: DQMStore.cc:480
std::recursive_mutex booking_mutex_
Definition: DQMStore.h:788
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:399
virtual std::vector< dqm::harvesting::MonitorElement * > getAllContents(std::string const &path) const
Definition: DQMStore.cc:641
MonitorElement * book2I(TString const &name, TString const &title, int nchX, float const *xbinsize, int nchY, float const *ybinsize, FUNC onbooking=NOOP())
Definition: DQMStore.h:312
IGetter(DQMStore *store)
Definition: DQMStore.cc:774
IBooker(DQMStore *store)
Definition: DQMStore.cc:43
void meBookerGetter(iFunc f)
Definition: DQMStore.h:710
MonitorElement * book1S(TString const &name, TString const &title, int nchX, double lowX, double highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:133
key
prepare the HTCondor submission files and eventually submit them
double f[11][100]
Definition: value.py:1
std::map< edm::LuminosityBlockID, std::set< MonitorElement *, MonitorElement::MEComparison > > globalMEs_
Definition: DQMStore.h:780
virtual uint64_t setModuleID(uint64_t moduleID)
Definition: DQMStore.cc:55
MonitorElement * book1I(TString const &name, TString const &title, int nchX, float const *xbinsize, FUNC onbooking=NOOP())
Definition: DQMStore.h:190
MonitorElement * book1I(TString const &name, TH1I *object, FUNC onbooking=NOOP())
Definition: DQMStore.h:199
MonitorElementData::Scope oldscope
Definition: DQMStore.h:536
dqm::legacy::MonitorElement MonitorElement
Definition: DQMStore.h:20
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double const *xbinsize, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:448
MonitorElement * bookProfile2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, int, double lowZ, double highZ, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:495
unsigned long long uint64_t
Definition: Time.h:13
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:212
MonitorElement * findME(MELIKE const &path)
Definition: DQMStore.cc:228
MonitorElement * bookInt(TString const &name, FUNC onbooking=NOOP())
Definition: DQMStore.h:73
MonitorElement * book2DD(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:338
std::vector< std::string > MEsToSave_
Definition: DQMStore.h:801
void operator()(TH1 *) const
Definition: DQMStore.h:50
MonitorElement * bookProfile2D(TString const &name, TProfile2D *object, FUNC onbooking=NOOP())
Definition: DQMStore.h:515
MonitorElement * putME(MonitorElement *me)
Definition: DQMStore.cc:180
DQM_DEPRECATED void save(std::string const &filename, std::string const &path="")
Definition: DQMStore.cc:824
MonitorElement * book2S(TString const &name, TH2S *object, FUNC onbooking=NOOP())
Definition: DQMStore.h:284
fixed size matrix
const bool & getMode() const
Definition: DQMStore.h:758
uint16_t *__restrict__ uint16_t const *__restrict__ uint32_t const *__restrict__ uint32_t *__restrict__ uint32_t const *__restrict__ moduleId
dqm::reco::DQMStore::IBooker IBooker
MonitorElement * book1DD(TString const &name, TH1D *object, FUNC onbooking=NOOP())
Definition: DQMStore.h:164
void cleanupLumi(edm::RunNumber_t run, edm::LuminosityBlockNumber_t lumi)
Definition: DQMStore.cc:558
unsigned int RunNumber_t
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double const *xbinsize, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:432
void debugTrackME(const char *message, MonitorElement *me_local, MonitorElement *me_global) const
Definition: DQMStore.cc:311
MonitorElement * book2I(TString const &name, TH2I *object, FUNC onbooking=NOOP())
Definition: DQMStore.h:326
Definition: DQMStore.h:18
MonitorElement * book3D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, int nchZ, double lowZ, double highZ, FUNC onbooking=NOOP())
Definition: DQMStore.h:367
MonitorElement * book2I(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:296
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)
Definition: DQMStore.cc:830
#define DQM_DEPRECATED
Definition: DQMStore.cc:2
virtual std::vector< dqm::harvesting::MonitorElement * > getContents(std::string const &path) const
Definition: DQMStore.cc:625
MonitorElement * book3D(TString const &name, TH3F *object, FUNC onbooking=NOOP())
Definition: DQMStore.h:386
static constexpr uint64_t kInvalidModuleID
Definition: DQMStore.h:557
virtual DQM_DEPRECATED std::vector< std::string > getSubdirs() const
Definition: DQMStore.cc:739