CMS 3D CMS Logo

DQMFileSaverBase.h
Go to the documentation of this file.
1 #ifndef DQMSERVICES_COMPONENTS_DQMFILESAVERBASE_H
2 #define DQMSERVICES_COMPONENTS_DQMFILESAVERBASE_H
3 
6 
9 
12 
13 #include <sys/time.h>
14 #include <string>
15 #include <mutex>
16 
17 #include <boost/property_tree/ptree.hpp>
18 
19 namespace dqm {
20 
21  struct NoCache {};
22 
23  class DQMFileSaverBase : public edm::global::EDAnalyzer<edm::RunCache<NoCache>, edm::LuminosityBlockCache<NoCache> > {
24  public:
27 
29  ~DQMFileSaverBase() override;
30 
31  protected:
32  // file name components, in order
33  struct FileParameters {
35  std::string producer_; // DQM or Playback
36  int version_;
38  long run_;
39  long lumi_;
40  std::string child_; // child of a fork
41  };
42 
43  protected:
44  //virtual void beginJob(void) const override final;
45  //virtual void endJob(void) const override final;
46 
47  std::shared_ptr<NoCache> globalBeginRun(const edm::Run &, const edm::EventSetup &) const final;
48 
49  std::shared_ptr<NoCache> globalBeginLuminosityBlock(const edm::LuminosityBlock &,
50  const edm::EventSetup &) const final;
51 
52  void analyze(edm::StreamID, const edm::Event &e, const edm::EventSetup &) const final;
53 
54  void globalEndLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &) const final;
55  void globalEndRun(const edm::Run &, const edm::EventSetup &) const final;
56 
57  // these method (and only these) should be overriden
58  // so we need to call all file savers
59  virtual void initRun() const {};
60  virtual void saveLumi(const FileParameters &fp) const {};
61  virtual void saveRun(const FileParameters &fp) const {};
62 
63  static const std::string filename(const FileParameters &fp, bool useLumi = false);
64 
65  // utilities
66  void logFileAction(const std::string &msg, const std::string &fileName) const;
67  void saveJobReport(const std::string &filename) const;
68 
69  // members
73 
74  public:
76  };
77 
78 } // namespace dqm
79 
80 #endif // DQMSERVICES_COMPONENTS_DQMFILESAVERBASE_H
DQMFileSaverBase(const edm::ParameterSet &ps)
void logFileAction(const std::string &msg, const std::string &fileName) const
~DQMFileSaverBase() override
virtual void saveLumi(const FileParameters &fp) const
static std::mutex mutex
Definition: Proxy.cc:8
void analyze(edm::StreamID, const edm::Event &e, const edm::EventSetup &) const final
static const std::string filename(const FileParameters &fp, bool useLumi=false)
void saveJobReport(const std::string &filename) const
virtual void initRun() const
virtual void saveRun(const FileParameters &fp) const
d
Definition: ztail.py:151
dqm::legacy::MonitorElement MonitorElement
std::shared_ptr< NoCache > globalBeginRun(const edm::Run &, const edm::EventSetup &) const final
std::shared_ptr< NoCache > globalBeginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &) const final
void globalEndRun(const edm::Run &, const edm::EventSetup &) const final
tuple msg
Definition: mps_check.py:285
FileParameters initial_fp_
static void fillDescription(edm::ParameterSetDescription &d)
dqm::legacy::DQMStore DQMStore
Definition: DQMStore.h:18
void globalEndLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &) const final
Definition: Run.h:45