CMS 3D CMS Logo

DQMStore.h
Go to the documentation of this file.
1 #ifndef DQMSERVICES_CORE_DQM_STORE_H
2 # define DQMSERVICES_CORE_DQM_STORE_H
3 
4 # if __GNUC__ && ! defined DQM_DEPRECATED
5 # define DQM_DEPRECATED __attribute__((deprecated))
6 # endif
7 
9 # include "classlib/utils/Regexp.h"
10 # include <vector>
11 # include <string>
12 # include <list>
13 # include <map>
14 # include <set>
15 # include <cassert>
16 # include <mutex>
17 # include <thread>
18 # include <execinfo.h>
19 # include <stdio.h>
20 # include <stdlib.h>
21 # include <cxxabi.h>
22 # include <iosfwd>
23 
24 namespace edm { class DQMHttpSource; class ParameterSet; class ActivityRegistry;}
25 namespace lat { class Regexp; }
26 namespace dqmstorepb {class ROOTFilePB; class ROOTFilePB_Histo;}
27 
28 class MonitorElement;
29 class QCriterion;
30 class TFile;
31 class TBufferFile;
32 class TObject;
33 class TH1;
34 class TObjString;
35 class TH1F;
36 class TH1S;
37 class TH1D;
38 class TH2F;
39 class TH2S;
40 class TH2D;
41 class TH3F;
42 class TProfile;
43 class TProfile2D;
44 class TNamed;
45 
46 
51 class fastmatch
52 {
53  private:
54  enum MatchingHeuristicEnum { UseFull, OneStarStart, OneStarEnd, TwoStar };
55 
56  public:
57  fastmatch (std::string const& _fastString);
58  ~fastmatch();
59 
60  bool match (std::string const& s) const;
61 
62  private:
63  // checks if two strings are equal, starting at the back of the strings
64  bool compare_strings_reverse (std::string const& pattern,
65  std::string const& input) const;
66  // checks if two strings are equal, starting at the front of the strings
67  bool compare_strings (std::string const& pattern,
68  std::string const& input) const;
69 
70  lat::Regexp * regexp_;
73 };
74 
75 class DQMStore
76 {
77  public:
79  {
82  SaveWithReferenceForQTest
83  };
85  {
87  StripRunDirs
88  };
89 
90  class IBooker
91  {
92  public:
93  friend class DQMStore;
94 
95  // for the supported syntaxes, see the declarations of DQMStore::bookString
96  template <typename... Args>
97  MonitorElement * bookString(Args && ... args) {
98  return owner_->bookString(std::forward<Args>(args)...);
99  }
100 
101  // for the supported syntaxes, see the declarations of DQMStore::bookInt
102  template <typename... Args>
103  MonitorElement * bookInt(Args && ... args) {
104  return owner_->bookInt(std::forward<Args>(args)...);
105  }
106 
107  // for the supported syntaxes, see the declarations of DQMStore::bookFloat
108  template <typename... Args>
109  MonitorElement * bookFloat(Args && ... args) {
110  return owner_->bookFloat(std::forward<Args>(args)...);
111  }
112 
113  // for the supported syntaxes, see the declarations of DQMStore::book1D
114  template <typename... Args>
115  MonitorElement * book1D(Args && ... args) {
116  return owner_->book1D(std::forward<Args>(args)...);
117  }
118 
119  // for the supported syntaxes, see the declarations of DQMStore::book1S
120  template <typename... Args>
121  MonitorElement * book1S(Args && ... args) {
122  return owner_->book1S(std::forward<Args>(args)...);
123  }
124 
125  // for the supported syntaxes, see the declarations of DQMStore::book1DD
126  template <typename... Args>
127  MonitorElement * book1DD(Args && ... args) {
128  return owner_->book1DD(std::forward<Args>(args)...);
129  }
130 
131  // for the supported syntaxes, see the declarations of DQMStore::book2D
132  template <typename... Args>
133  MonitorElement * book2D(Args && ... args) {
134  return owner_->book2D(std::forward<Args>(args)...);
135  }
136 
137  // for the supported syntaxes, see the declarations of DQMStore::book2S
138  template <typename... Args>
139  MonitorElement * book2S(Args && ... args) {
140  return owner_->book2S(std::forward<Args>(args)...);
141  }
142 
143  // for the supported syntaxes, see the declarations of DQMStore::book2DD
144  template <typename... Args>
145  MonitorElement * book2DD(Args && ... args) {
146  return owner_->book2DD(std::forward<Args>(args)...);
147  }
148 
149  // for the supported syntaxes, see the declarations of DQMStore::book3D
150  template <typename... Args>
151  MonitorElement * book3D(Args && ... args) {
152  return owner_->book3D(std::forward<Args>(args)...);
153  }
154 
155  // for the supported syntaxes, see the declarations of DQMStore::bookProfile
156  template <typename... Args>
157  MonitorElement * bookProfile(Args && ... args) {
158  return owner_->bookProfile(std::forward<Args>(args)...);
159  }
160 
161  // for the supported syntaxes, see the declarations of DQMStore::bookProfile2D
162  template <typename... Args>
164  return owner_->bookProfile2D(std::forward<Args>(args)...);
165  }
166 
167  void cd(void);
168  void cd(const std::string &dir);
169  void setCurrentFolder(const std::string &fullpath);
170  void goUp(void);
171  const std::string & pwd(void);
172  void tag(MonitorElement *, unsigned int);
173  void tagContents(const std::string &, unsigned int);
174 
175  private:
176  explicit IBooker(DQMStore * store):owner_(0) {
177  assert(store);
178  owner_ = store;
179  }
180 
181  IBooker();
182  IBooker(const IBooker&);
183 
184  // Embedded classes do not natively own a pointer to the embedding
185  // class. We therefore need to store a pointer to the main
186  // DQMStore instance (owner_).
188  }; // IBooker
189 
190  class IGetter
191  {
192  public:
193  friend class DQMStore;
194 
195  // for the supported syntaxes, see the declarations of DQMStore::getContents
196  template <typename... Args>
197  std::vector<MonitorElement *> getContents(Args && ... args) {
198  return owner_->getContents(std::forward<Args>(args)...);
199  }
200  // for the supported syntaxes, see the declarations of DQMStore::removeElements
201  template <typename... Args>
202  void removeElement(Args && ... args) {
203  return owner_->removeElement(std::forward<Args>(args)...);
204  }
205 
206  std::vector<MonitorElement*> getAllContents(const std::string &path,
207  uint32_t runNumber = 0,
208  uint32_t lumi = 0);
209  MonitorElement * get(const std::string &path);
210 
211  // same as get, throws an exception if histogram not found
212  MonitorElement * getElement(const std::string &path);
213 
214  std::vector<std::string> getSubdirs(void);
215  std::vector<std::string> getMEs(void);
216  bool containsAnyMonitorable(const std::string &path);
217  bool dirExists(const std::string &path);
218  void cd(void);
219  void cd(const std::string &dir);
220  void setCurrentFolder(const std::string &fullpath);
221 
222  private:
223  explicit IGetter(DQMStore * store):owner_(0) {
224  assert(store);
225  owner_ = store;
226  }
227 
228  IGetter();
229  IGetter(const IGetter&);
230 
231  // Embedded classes do not natively own a pointer to the embedding
232  // class. We therefore need to store a pointer to the main
233  // DQMStore instance (owner_).
235  }; //IGetter
236 
237  // Template function to be used inside each DQM Modules' lambda
238  // functions to book MonitorElements into the DQMStore. The function
239  // calls whatever user-supplied code via the function f. The latter
240  // is passed the instance of the IBooker class (owned by the *only*
241  // DQMStore instance), that is capable of booking MonitorElements
242  // into the DQMStore via a public API. The central mutex is acquired
243  // *before* invoking fand automatically released upon returns.
244  template <typename iFunc>
245  void bookTransaction(iFunc f,
246  uint32_t run,
247  uint32_t streamId,
248  uint32_t moduleId) {
249  std::lock_guard<std::mutex> guard(book_mutex_);
250  /* If enableMultiThread is not enabled we do not set run_,
251  streamId_ and moduleId_ to 0, since we rely on their default
252  initialization in DQMStore constructor. */
253  if (enableMultiThread_) {
254  run_ = run;
255  streamId_ = streamId;
256  moduleId_ = moduleId;
257  }
258  f(*ibooker_);
259 
260  /* Initialize to 0 the run_, streamId_ and moduleId_ variables
261  in case we run in mixed conditions with DQMEDAnalyzers and
262  legacy modules */
263  if (enableMultiThread_) {
264  run_ = 0;
265  streamId_ = 0;
266  moduleId_ = 0;
267  }
268  }
269  // Signature needed in the harvesting where the booking is done
270  // in the endJob. No handles to the run there. Two arguments ensure
271  // the capability of booking and getting. The method relies on the
272  // initialization of run, stream and module ID to 0. The mutex
273  // is not needed.
274  template <typename iFunc>
275  void meBookerGetter(iFunc f) {
276  f(*ibooker_, *igetter_);
277  }
278  // Signature needed in the harvesting where it might be needed to get
279  // the LS based histograms. Handle to the Lumi and to the iSetup are available.
280  // No need to book anything there. The method relies on the
281  // initialization of run, stream and module ID to 0. The mutex
282  // is not needed.
283  template <typename iFunc>
284  void meGetter(iFunc f) {
285  f(*igetter_);
286  }
287 
288  //-------------------------------------------------------------------------
289  // ---------------------- Constructors ------------------------------------
291  DQMStore(const edm::ParameterSet &pset);
292  ~DQMStore(void);
293 
294  //-------------------------------------------------------------------------
295  void setVerbose(unsigned level);
296 
297  // ---------------------- public navigation -------------------------------
298  const std::string & pwd(void) const;
299  void cd(void);
300  void cd(const std::string &subdir);
301  void setCurrentFolder(const std::string &fullpath);
302  void goUp(void);
303 
304  bool dirExists(const std::string &path) const;
305 
306  //-------------------------------------------------------------------------
307  // ---------------------- public ME booking -------------------------------
308 
309  MonitorElement * bookInt (const char *name);
310  MonitorElement * bookInt (const std::string &name);
311 
312  MonitorElement * bookFloat (const char *name);
313  MonitorElement * bookFloat (const std::string &name);
314 
315  MonitorElement * bookString (const char *name,
316  const char *value);
317  MonitorElement * bookString (const std::string &name,
318  const std::string &value);
319 
320  MonitorElement * book1D (const char *name,
321  const char *title,
322  int nchX, double lowX, double highX);
323  MonitorElement * book1D (const std::string &name,
324  const std::string &title,
325  int nchX, double lowX, double highX);
326  MonitorElement * book1D (const char *name,
327  const char *title,
328  int nchX, const float *xbinsize);
329  MonitorElement * book1D (const std::string &name,
330  const std::string &title,
331  int nchX, const float *xbinsize);
332  MonitorElement * book1D (const char *name, TH1F *h);
333  MonitorElement * book1D (const std::string &name, TH1F *h);
334 
335  MonitorElement * book1S (const char *name,
336  const char *title,
337  int nchX, double lowX, double highX);
338  MonitorElement * book1S (const std::string &name,
339  const std::string &title,
340  int nchX, double lowX, double highX);
341  MonitorElement * book1S (const char *name,
342  const char *title,
343  int nchX, const float *xbinsize);
344  MonitorElement * book1S (const std::string &name,
345  const std::string &title,
346  int nchX, const float *xbinsize);
347  MonitorElement * book1S (const char *name, TH1S *h);
348  MonitorElement * book1S (const std::string &name, TH1S *h);
349 
350  MonitorElement * book1DD (const char *name,
351  const char *title,
352  int nchX, double lowX, double highX);
353  MonitorElement * book1DD (const std::string &name,
354  const std::string &title,
355  int nchX, double lowX, double highX);
356  MonitorElement * book1DD (const char *name,
357  const char *title,
358  int nchX, const float *xbinsize);
359  MonitorElement * book1DD (const std::string &name,
360  const std::string &title,
361  int nchX, const float *xbinsize);
362  MonitorElement * book1DD (const char *name, TH1D *h);
363  MonitorElement * book1DD (const std::string &name, TH1D *h);
364 
365  MonitorElement * book2D (const char *name,
366  const char *title,
367  int nchX, double lowX, double highX,
368  int nchY, double lowY, double highY);
369  MonitorElement * book2D (const std::string &name,
370  const std::string &title,
371  int nchX, double lowX, double highX,
372  int nchY, double lowY, double highY);
373  MonitorElement * book2D (const char *name,
374  const char *title,
375  int nchX, const float *xbinsize,
376  int nchY, const float *ybinsize);
377  MonitorElement * book2D (const std::string &name,
378  const std::string &title,
379  int nchX, const float *xbinsize,
380  int nchY, const float *ybinsize);
381  MonitorElement * book2D (const char *name, TH2F *h);
382  MonitorElement * book2D (const std::string &name, TH2F *h);
383 
384  MonitorElement * book2S (const char *name,
385  const char *title,
386  int nchX, double lowX, double highX,
387  int nchY, double lowY, double highY);
388  MonitorElement * book2S (const std::string &name,
389  const std::string &title,
390  int nchX, double lowX, double highX,
391  int nchY, double lowY, double highY);
392  MonitorElement * book2S (const char *name,
393  const char *title,
394  int nchX, const float *xbinsize,
395  int nchY, const float *ybinsize);
396  MonitorElement * book2S (const std::string &name,
397  const std::string &title,
398  int nchX, const float *xbinsize,
399  int nchY, const float *ybinsize);
400  MonitorElement * book2S (const char *name, TH2S *h);
401  MonitorElement * book2S (const std::string &name, TH2S *h);
402 
403  MonitorElement * book2DD (const char *name,
404  const char *title,
405  int nchX, double lowX, double highX,
406  int nchY, double lowY, double highY);
407  MonitorElement * book2DD (const std::string &name,
408  const std::string &title,
409  int nchX, double lowX, double highX,
410  int nchY, double lowY, double highY);
411  MonitorElement * book2DD (const char *name,
412  const char *title,
413  int nchX, const float *xbinsize,
414  int nchY, const float *ybinsize);
415  MonitorElement * book2DD (const std::string &name,
416  const std::string &title,
417  int nchX, const float *xbinsize,
418  int nchY, const float *ybinsize);
419  MonitorElement * book2DD (const char *name, TH2D *h);
420  MonitorElement * book2DD (const std::string &name, TH2D *h);
421 
422  MonitorElement * book3D (const char *name,
423  const char *title,
424  int nchX, double lowX, double highX,
425  int nchY, double lowY, double highY,
426  int nchZ, double lowZ, double highZ);
427  MonitorElement * book3D (const std::string &name,
428  const std::string &title,
429  int nchX, double lowX, double highX,
430  int nchY, double lowY, double highY,
431  int nchZ, double lowZ, double highZ);
432  MonitorElement * book3D (const char *name, TH3F *h);
433  MonitorElement * book3D (const std::string &name, TH3F *h);
434 
435  MonitorElement * bookProfile (const char *name,
436  const char *title,
437  int nchX, double lowX, double highX,
438  int nchY, double lowY, double highY,
439  const char *option = "s");
440  MonitorElement * bookProfile (const std::string &name,
441  const std::string &title,
442  int nchX, double lowX, double highX,
443  int nchY, double lowY, double highY,
444  const char *option = "s");
445  MonitorElement * bookProfile (const char *name,
446  const char *title,
447  int nchX, double lowX, double highX,
448  double lowY, double highY,
449  const char *option = "s");
450  MonitorElement * bookProfile (const std::string &name,
451  const std::string &title,
452  int nchX, double lowX, double highX,
453  double lowY, double highY,
454  const char *option = "s");
455  MonitorElement * bookProfile (const char *name,
456  const char *title,
457  int nchX, const double *xbinsize,
458  int nchY, double lowY, double highY,
459  const char *option = "s");
460  MonitorElement * bookProfile (const std::string &name,
461  const std::string &title,
462  int nchX, const double *xbinsize,
463  int nchY, double lowY, double highY,
464  const char *option = "s");
465  MonitorElement * bookProfile (const char *name,
466  const char *title,
467  int nchX, const double *xbinsize,
468  double lowY, double highY,
469  const char *option = "s");
470  MonitorElement * bookProfile (const std::string &name,
471  const std::string &title,
472  int nchX, const double *xbinsize,
473  double lowY, double highY,
474  const char *option = "s");
475  MonitorElement * bookProfile (const char *name, TProfile *h);
476  MonitorElement * bookProfile (const std::string &name, TProfile *h);
477 
478  MonitorElement * bookProfile2D(const char *name,
479  const char *title,
480  int nchX, double lowX, double highX,
481  int nchY, double lowY, double highY,
482  int nchZ, double lowZ, double highZ,
483  const char *option = "s");
485  const std::string &title,
486  int nchX, double lowX, double highX,
487  int nchY, double lowY, double highY,
488  int nchZ, double lowZ, double highZ,
489  const char *option = "s");
490  MonitorElement * bookProfile2D(const char *name,
491  const char *title,
492  int nchX, double lowX, double highX,
493  int nchY, double lowY, double highY,
494  double lowZ, double highZ,
495  const char *option = "s");
497  const std::string &title,
498  int nchX, double lowX, double highX,
499  int nchY, double lowY, double highY,
500  double lowZ, double highZ,
501  const char *option = "s");
502  MonitorElement * bookProfile2D(const char *name, TProfile2D *h);
503  MonitorElement * bookProfile2D(const std::string &name, TProfile2D *h);
504 
505  //-------------------------------------------------------------------------
506  // ---------------------- public tagging ----------------------------------
507  void tag(MonitorElement *me, unsigned int myTag);
508  void tag(const std::string &path, unsigned int myTag);
509  void tagContents(const std::string &path, unsigned int myTag);
510  void tagAllContents(const std::string &path, unsigned int myTag);
511 
512  //-------------------------------------------------------------------------
513  // ---------------------- public ME getters -------------------------------
514  std::vector<std::string> getSubdirs(void) const;
515  std::vector<std::string> getMEs(void) const;
516  bool containsAnyMonitorable(const std::string &path) const;
517 
518  MonitorElement * get(const std::string &path) const;
519  std::vector<MonitorElement *> get(unsigned int tag) const;
520  std::vector<MonitorElement *> getContents(const std::string &path) const;
521  std::vector<MonitorElement *> getContents(const std::string &path, unsigned int tag) const;
522  void getContents(std::vector<std::string> &into, bool showContents = true) const;
523 
524  // ---------------------- softReset methods -------------------------------
525  void softReset(MonitorElement *me);
527 
528  // ---------------------- Public deleting ---------------------------------
529  void rmdir(const std::string &fullpath);
530  void removeContents(void);
531  void removeContents(const std::string &dir);
532  void removeElement(const std::string &name);
533  void removeElement(const std::string &dir, const std::string &name, bool warning = true);
534 
535  //-------------------------------------------------------------------------
536  // ---------------------- public I/O --------------------------------------
537  void savePB(const std::string &filename,
538  const std::string &path = "",
539  const uint32_t run = 0,
540  const uint32_t lumi = 0,
541  const bool resetMEsAfterWriting = false);
542  void save(const std::string &filename,
543  const std::string &path = "",
544  const std::string &pattern = "",
545  const std::string &rewrite = "",
546  const uint32_t run = 0,
547  const uint32_t lumi = 0,
550  const std::string &fileupdate = "RECREATE",
551  const bool resetMEsAfterWriting = false);
552  bool open(const std::string &filename,
553  bool overwrite = false,
554  const std::string &path ="",
555  const std::string &prepend = "",
556  OpenRunDirs stripdirs = KeepRunDirs,
557  bool fileMustExist = true);
558  bool load(const std::string &filename,
559  OpenRunDirs stripdirs = StripRunDirs,
560  bool fileMustExist = true);
561  bool mtEnabled() { return enableMultiThread_; };
562 
563  //-------------------------------------------------------------------------
564  // ---------------------- Public print methods -----------------------------
565  void showDirStructure(void) const;
566 
567  // ---------------------- Public check options -----------------------------
568  bool isCollate(void) const;
569 
570  //-------------------------------------------------------------------------
571  // ---------------------- Quality Test methods -----------------------------
572  QCriterion * getQCriterion(const std::string &qtname) const;
573  QCriterion * createQTest(const std::string &algoname, const std::string &qtname);
574  void useQTest(const std::string &dir, const std::string &qtname);
575  int useQTestByMatch(const std::string &pattern, const std::string &qtname);
576  void runQTests(void);
577  int getStatus(const std::string &path = "") const;
578  void scaleElements(void);
579 
580  private:
581  // ---------------- Navigation -----------------------
582  bool cdInto(const std::string &path) const;
583 
584  // ------------------- Reference ME -------------------------------
585  bool isCollateME(MonitorElement *me) const;
586 
587  // ------------------- Private "getters" ------------------------------
588  bool readFilePB(const std::string &filename,
589  bool overwrite = false,
590  const std::string &path ="",
591  const std::string &prepend = "",
592  OpenRunDirs stripdirs = StripRunDirs,
593  bool fileMustExist = true);
594  bool readFile(const std::string &filename,
595  bool overwrite = false,
596  const std::string &path ="",
597  const std::string &prepend = "",
598  OpenRunDirs stripdirs = StripRunDirs,
599  bool fileMustExist = true);
600  void makeDirectory(const std::string &path);
601  unsigned int readDirectory(TFile *file,
602  bool overwrite,
603  const std::string &path,
604  const std::string &prepend,
605  const std::string &curdir,
606  OpenRunDirs stripdirs);
607 
609  const std::string &name,
610  const uint32_t run = 0,
611  const uint32_t lumi = 0,
612  const uint32_t streamId = 0,
613  const uint32_t moduleId = 0) const;
614 
617  std::string & objname,
618  TObject ** obj);
619 
620  public:
621  void getAllTags(std::vector<std::string> &into) const;
622  std::vector<MonitorElement*> getAllContents(const std::string &path,
623  uint32_t runNumber = 0,
624  uint32_t lumi = 0) const;
625  std::vector<MonitorElement*> getMatchingContents(const std::string &pattern, lat::Regexp::Syntax syntaxType = lat::Regexp::Wildcard) const;
626 
627  // Multithread SummaryCache manipulations
628  void mergeAndResetMEsRunSummaryCache(uint32_t run,
629  uint32_t streamId,
630  uint32_t moduleId);
631  void mergeAndResetMEsLuminositySummaryCache(uint32_t run,
632  uint32_t lumi,
633  uint32_t streamId,
634  uint32_t moduleId);
635 
636  void deleteUnusedLumiHistograms(uint32_t run, uint32_t lumi);
637  private:
638 
639  // ---------------- Miscellaneous -----------------------------
640  void initializeFrom(const edm::ParameterSet&);
641  void reset(void);
642  void forceReset(void);
643 
644  bool extract(TObject *obj, const std::string &dir, bool overwrite, bool collateHistograms);
645  TObject * extractNextObject(TBufferFile&) const;
646 
647  // ---------------------- Booking ------------------------------------
649  MonitorElement * book(const std::string &dir,
650  const std::string &name,
651  const char *context);
652  template <class HISTO, class COLLATE>
653  MonitorElement * book(const std::string &dir, const std::string &name,
654  const char *context, int kind,
655  HISTO *h, COLLATE collate);
656 
657  MonitorElement * bookInt(const std::string &dir, const std::string &name);
658  MonitorElement * bookFloat(const std::string &dir, const std::string &name);
659  MonitorElement * bookString(const std::string &dir, const std::string &name, const std::string &value);
660  MonitorElement * book1D(const std::string &dir, const std::string &name, TH1F *h);
661  MonitorElement * book1S(const std::string &dir, const std::string &name, TH1S *h);
662  MonitorElement * book1DD(const std::string &dir, const std::string &name, TH1D *h);
663  MonitorElement * book2D(const std::string &dir, const std::string &name, TH2F *h);
664  MonitorElement * book2S(const std::string &dir, const std::string &name, TH2S *h);
665  MonitorElement * book2DD(const std::string &dir, const std::string &name, TH2D *h);
666  MonitorElement * book3D(const std::string &dir, const std::string &name, TH3F *h);
667  MonitorElement * bookProfile(const std::string &dir, const std::string &name, TProfile *h);
668  MonitorElement * bookProfile2D(const std::string &folder, const std::string &name, TProfile2D *h);
669 
670  static bool checkBinningMatches(MonitorElement *me, TH1 *h, unsigned verbose);
671 
672  static void collate1D(MonitorElement *me, TH1F *h, unsigned verbose);
673  static void collate1S(MonitorElement *me, TH1S *h, unsigned verbose);
674  static void collate1DD(MonitorElement *me, TH1D *h, unsigned verbose);
675  static void collate2D(MonitorElement *me, TH2F *h, unsigned verbose);
676  static void collate2S(MonitorElement *me, TH2S *h, unsigned verbose);
677  static void collate2DD(MonitorElement *me, TH2D *h, unsigned verbose);
678  static void collate3D(MonitorElement *me, TH3F *h, unsigned verbose);
679  static void collateProfile(MonitorElement *me, TProfile *h, unsigned verbose);
680  static void collateProfile2D(MonitorElement *me, TProfile2D *h, unsigned verbose);
681 
682  // --- Operations on MEs that are normally reset at end of monitoring cycle ---
683  void setAccumulate(MonitorElement *me, bool flag);
684 
685  void print_trace(const std::string &dir, const std::string &name);
686 
687  // ----------------------- Unavailable ---------------------------------------
688  DQMStore(const DQMStore&);
689  const DQMStore& operator=(const DQMStore&);
690 
691  //-------------------------------------------------------------------------------
692  //-------------------------------------------------------------------------------
693  typedef std::pair<fastmatch *, QCriterion *> QTestSpec;
694  typedef std::list<QTestSpec> QTestSpecs;
695  typedef std::set<MonitorElement> MEMap;
696  typedef std::map<std::string, QCriterion *> QCMap;
697  typedef std::map<std::string, QCriterion *(*)(const std::string &)> QAMap;
698 
699  unsigned verbose_;
700  unsigned verboseQT_;
701  bool reset_;
702  double scaleFlag_;
708  uint32_t run_;
709  uint32_t streamId_;
710  uint32_t moduleId_;
711  std::ofstream * stream_;
712 
714  MEMap data_;
715  std::set<std::string> dirs_;
716 
717  QCMap qtests_;
718  QAMap qalgos_;
719  QTestSpecs qtestspecs_;
720 
724 
725  friend class edm::DQMHttpSource;
726  friend class DQMService;
727  friend class DQMNet;
728  friend class DQMArchiver;
729  friend class DQMStoreExample; // for get{All,Matching}Contents -- sole user of this method!
730  friend class DQMRootOutputModule;
731  friend class DQMRootSource;
732  friend class DQMFileSaver;
733  friend class MEtoEDMConverter;
734 };
735 
736 #endif // DQMSERVICES_CORE_DQM_STORE_H
QCriterion * getQCriterion(const std::string &qtname) const
Definition: DQMStore.cc:3281
IGetter * igetter_
Definition: DQMStore.h:723
std::pair< fastmatch *, QCriterion * > QTestSpec
Definition: DQMStore.h:693
std::vector< MonitorElement * > getContents(Args &&...args)
Definition: DQMStore.h:197
def dirExists(dir)
MonitorElement * book1S(Args &&...args)
Definition: DQMStore.h:121
MonitorElement * book2S(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2S histogram.
Definition: DQMStore.cc:1185
std::map< std::string, QCriterion * > QCMap
Definition: DQMStore.h:696
bool containsAnyMonitorable(const std::string &path) const
Definition: DQMStore.cc:1779
bool isCollateME(MonitorElement *me) const
Definition: DQMStore.cc:3474
bool cdInto(const std::string &path) const
Definition: DQMStore.cc:2478
int getStatus(const std::string &path="") const
Definition: DQMStore.cc:3387
static void get_info(const dqmstorepb::ROOTFilePB::Histo &h, std::string &dirname, std::string &objname, TObject **obj)
Definition: fastHadd.cc:189
std::vector< std::string > getSubdirs(void) const
Definition: DQMStore.cc:1740
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:1035
void rmdir(const std::string &fullpath)
Definition: DQMStore.cc:3214
static void collate3D(MonitorElement *me, TH3F *h, unsigned verbose)
Definition: DQMStore.cc:1644
bool readFile(const std::string &filename, bool overwrite=false, const std::string &path="", const std::string &prepend="", OpenRunDirs stripdirs=StripRunDirs, bool fileMustExist=true)
Definition: DQMStore.cc:3049
MonitorElement * bookProfile(Args &&...args)
Definition: DQMStore.h:157
static boost::mutex mutex
Definition: LHEProxy.cc:11
MonitorElement * findObject(const std::string &dir, const std::string &name, const uint32_t run=0, const uint32_t lumi=0, const uint32_t streamId=0, const uint32_t moduleId=0) const
Definition: DQMStore.cc:1919
static void collateProfile(MonitorElement *me, TProfile *h, unsigned verbose)
Definition: DQMStore.cc:1651
TObject * extractNextObject(TBufferFile &buf)
Definition: fastHadd.cc:181
MonitorElement * book3D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, int nchZ, double lowZ, double highZ)
Book 3D histogram.
Definition: DQMStore.cc:1297
MatchingHeuristicEnum
Definition: DQMStore.h:54
Definition: DQMNet.h:23
void cd(void)
go to top directory (ie. root)
Definition: DQMStore.cc:718
MonitorElement * book2DD(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D double histogram.
Definition: DQMStore.cc:1207
uint32_t streamId_
Definition: DQMStore.h:709
static void collate2DD(MonitorElement *me, TH2D *h, unsigned verbose)
Definition: DQMStore.cc:1637
MonitorElement * bookInt(Args &&...args)
Definition: DQMStore.h:103
std::vector< MonitorElement * > getMatchingContents(const std::string &pattern, lat::Regexp::Syntax syntaxType=lat::Regexp::Wildcard) const
Definition: DQMStore.cc:2051
MonitorElement * bookString(Args &&...args)
Definition: DQMStore.h:97
MatchingHeuristicEnum matching_
Definition: DQMStore.h:72
bool reset_
Definition: DQMStore.h:701
MonitorElement * book1DD(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1S histogram.
Definition: DQMStore.cc:1067
void initializeFrom(const edm::ParameterSet &)
Definition: DQMStore.cc:579
OpenRunDirs
Definition: DQMStore.h:84
Definition: DQMStore.h:25
uint32_t moduleId_
Definition: DQMStore.h:710
QCMap qtests_
Definition: DQMStore.h:717
MonitorElement * book(const std::string &dir, const std::string &name, const char *context)
Definition: DQMStore.cc:890
std::mutex book_mutex_
Definition: DQMStore.h:721
MonitorElement * bookFloat(const char *name)
Book float.
Definition: DQMStore.cc:972
static std::string const input
Definition: EdmProvDump.cc:44
SaveReferenceTag
Definition: DQMStore.h:78
~DQMStore(void)
Definition: DQMStore.cc:565
void disableSoftReset(MonitorElement *me)
Definition: DQMStore.cc:3426
void forceReset(void)
Definition: DQMStore.cc:2111
std::vector< MonitorElement * > getAllContents(const std::string &path, uint32_t runNumber=0, uint32_t lumi=0) const
Definition: DQMStore.cc:2002
unsigned verboseQT_
Definition: DQMStore.h:700
QTestSpecs qtestspecs_
Definition: DQMStore.h:719
void removeContents(void)
erase all monitoring elements in current directory (not including subfolders);
Definition: DQMStore.cc:3248
double scaleFlag_
Definition: DQMStore.h:702
void deleteUnusedLumiHistograms(uint32_t run, uint32_t lumi)
Definition: DQMStore.cc:2135
MonitorElement * bookString(const char *name, const char *value)
Book string.
Definition: DQMStore.cc:1001
MonitorElement * bookProfile2D(Args &&...args)
Definition: DQMStore.h:163
std::set< MonitorElement > MEMap
Definition: DQMStore.h:695
bool isCollate(void) const
Definition: DQMStore.cc:3465
void removeElement(const std::string &name)
Definition: DQMStore.cc:3256
static void collateProfile2D(MonitorElement *me, TProfile2D *h, unsigned verbose)
Definition: DQMStore.cc:1661
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
MonitorElement * book2S(Args &&...args)
Definition: DQMStore.h:139
double f[11][100]
uint32_t run_
Definition: DQMStore.h:708
MonitorElement * bookProfile(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const char *option="s")
Definition: DQMStore.cc:1349
void setVerbose(unsigned level)
Definition: DQMStore.cc:705
Definition: value.py:1
void softReset(MonitorElement *me)
Definition: DQMStore.cc:3418
std::string pwd_
Definition: DQMStore.h:713
void runQTests(void)
Definition: DQMStore.cc:3366
lat::Regexp * regexp_
Definition: DQMStore.h:70
IBooker * ibooker_
Definition: DQMStore.h:722
QAMap qalgos_
Definition: DQMStore.h:718
std::vector< MonitorElement * > getContents(const std::string &path) const
Definition: DQMStore.cc:1818
std::string readSelectedDirectory_
Definition: DQMStore.h:707
void mergeAndResetMEsRunSummaryCache(uint32_t run, uint32_t streamId, uint32_t moduleId)
Definition: DQMStore.cc:360
std::string fastString_
Definition: DQMStore.h:71
void meGetter(iFunc f)
Definition: DQMStore.h:284
int extract(std::vector< int > *output, const std::string &dati)
void savePB(const std::string &filename, const std::string &path="", const uint32_t run=0, const uint32_t lumi=0, const bool resetMEsAfterWriting=false)
Definition: DQMStore.cc:2520
void getAllTags(std::vector< std::string > &into) const
Definition: DQMStore.cc:1949
const DQMStore & operator=(const DQMStore &)
void scaleElements(void)
Definition: DQMStore.cc:3482
static void collate1DD(MonitorElement *me, TH1D *h, unsigned verbose)
Definition: DQMStore.cc:1616
void tagAllContents(const std::string &path, unsigned int myTag)
Definition: DQMStore.cc:1718
MonitorElement * initialise(MonitorElement *me, const std::string &path)
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
unsigned verbose_
Definition: DQMStore.h:699
std::list< QTestSpec > QTestSpecs
Definition: DQMStore.h:694
MEMap data_
Definition: DQMStore.h:714
def load(fileName)
Definition: svgfig.py:546
void print_trace(const std::string &dir, const std::string &name)
Definition: DQMStore.cc:640
int useQTestByMatch(const std::string &pattern, const std::string &qtname)
attach quality test <qc> to monitor elements matching <pattern>.
Definition: DQMStore.cc:3331
static void collate1D(MonitorElement *me, TH1F *h, unsigned verbose)
Definition: DQMStore.cc:1602
void bookTransaction(iFunc f, uint32_t run, uint32_t streamId, uint32_t moduleId)
Definition: DQMStore.h:245
std::vector< std::string > getMEs(void) const
get list of (non-dir) MEs of current directory
Definition: DQMStore.cc:1763
DQMStore * owner_
Definition: DQMStore.h:187
unsigned int readDirectory(TFile *file, bool overwrite, const std::string &path, const std::string &prepend, const std::string &curdir, OpenRunDirs stripdirs)
Definition: DQMStore.cc:2852
IBooker(DQMStore *store)
Definition: DQMStore.h:176
bool forceResetOnBeginLumi_
Definition: DQMStore.h:706
HLT enums.
void tagContents(const std::string &path, unsigned int myTag)
tag all children of folder (does NOT include subfolders)
Definition: DQMStore.cc:1706
std::map< std::string, QCriterion *(*)(const std::string &)> QAMap
Definition: DQMStore.h:697
bool readFilePB(const std::string &filename, bool overwrite=false, const std::string &path="", const std::string &prepend="", OpenRunDirs stripdirs=StripRunDirs, bool fileMustExist=true)
Definition: DQMStore.cc:3133
void useQTest(const std::string &dir, const std::string &qtname)
Definition: DQMStore.cc:3313
MonitorElement * book2DD(Args &&...args)
Definition: DQMStore.h:145
void goUp(void)
equivalent to "cd .."
Definition: DQMStore.cc:752
bool open(const std::string &filename, bool overwrite=false, const std::string &path="", const std::string &prepend="", OpenRunDirs stripdirs=KeepRunDirs, bool fileMustExist=true)
Definition: DQMStore.cc:3007
static const int STATUS_OK
void setAccumulate(MonitorElement *me, bool flag)
Definition: DQMStore.cc:3435
static void collate1S(MonitorElement *me, TH1S *h, unsigned verbose)
Definition: DQMStore.cc:1609
void meBookerGetter(iFunc f)
Definition: DQMStore.h:275
std::ofstream * stream_
Definition: DQMStore.h:711
QCriterion * createQTest(const std::string &algoname, const std::string &qtname)
Definition: DQMStore.cc:3292
MonitorElement * bookFloat(Args &&...args)
Definition: DQMStore.h:109
static bool checkBinningMatches(MonitorElement *me, TH1 *h, unsigned verbose)
Definition: DQMStore.cc:1575
dbl *** dir
Definition: mlp_gen.cc:35
void showDirStructure(void) const
Definition: DQMStore.cc:3445
static void collate2D(MonitorElement *me, TH2F *h, unsigned verbose)
Definition: DQMStore.cc:1623
MonitorElement * bookInt(const char *name)
Book int.
Definition: DQMStore.cc:942
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:1163
MonitorElement * book3D(Args &&...args)
Definition: DQMStore.h:151
void mergeAndResetMEsLuminositySummaryCache(uint32_t run, uint32_t lumi, uint32_t streamId, uint32_t moduleId)
Definition: DQMStore.cc:434
DQMStore * owner_
Definition: DQMStore.h:234
std::set< std::string > dirs_
Definition: DQMStore.h:715
void reset(double vett[256])
Definition: TPedValues.cc:11
bool collateHistograms_
Definition: DQMStore.h:703
void removeElement(Args &&...args)
Definition: DQMStore.h:202
MonitorElement * book1DD(Args &&...args)
Definition: DQMStore.h:127
save
Definition: cuy.py:1163
bool LSbasedMode_
Definition: DQMStore.h:705
MonitorElement * book1S(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1S histogram.
Definition: DQMStore.cc:1051
void makeDirectory(const std::string &path)
Definition: DQMStore.cc:765
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:741
static void collate2S(MonitorElement *me, TH2S *h, unsigned verbose)
Definition: DQMStore.cc:1630
bool mtEnabled()
Definition: DQMStore.h:561
bool enableMultiThread_
Definition: DQMStore.h:704
std::string match(BranchDescription const &a, BranchDescription const &b, std::string const &fileName)
MonitorElement * bookProfile2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, int nchZ, double lowZ, double highZ, const char *option="s")
Definition: DQMStore.cc:1493
IGetter(DQMStore *store)
Definition: DQMStore.h:223