CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
24  : public edm::global::EDAnalyzer<edm::RunCache<NoCache>,
25  edm::LuminosityBlockCache<NoCache> > {
26  public:
29 
30  protected:
31 
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  // other parameters
45  };
46 
47  protected:
48  virtual void beginJob(void);
49  virtual std::shared_ptr<NoCache> globalBeginRun(
50  const edm::Run &, const edm::EventSetup &) const;
51  virtual std::shared_ptr<NoCache> globalBeginLuminosityBlock(
52  const edm::LuminosityBlock &, const edm::EventSetup &) const;
53  virtual void analyze(edm::StreamID, const edm::Event &e,
54  const edm::EventSetup &) const;
56  const edm::EventSetup &) const;
57  virtual void globalEndRun(const edm::Run &, const edm::EventSetup &) const;
58  virtual void endJob(void);
59  virtual void postForkReacquireResources(unsigned int childIndex,
60  unsigned int numberOfChildren);
61 
62  // these two should be overwritten
63  // in some cases, hsitograms are deleted after saving
64  // so we need to call all file savers
65  virtual void saveLumi(FileParameters fp) const {};
66  virtual void saveRun(FileParameters fp) const {};
67 
68  static const std::string filename(FileParameters fp, bool useLumi = false);
69 
70  // also used by the JsonWritingTimedPoolOutputModule,
71  // fms will be nullptr in such case
72  static boost::property_tree::ptree fillJson(
73  int run, int lumi, const std::string &dataFilePathName, const std::string transferDestinationStr,
75 
76  static const std::string fillOrigin(const std::string filename,
77  const std::string final_filename);
78 
79  // utilities
80  void logFileAction(const std::string& msg, const std::string& fileName) const;
81  void saveJobReport(const std::string &filename) const;
82 
83  // members
86 
87 
88  public:
90 };
91 
92 } // dqm namespace
93 
94 #endif // DQMSERVICES_COMPONENTS_DQMFILESAVERBASE_H
DQMFileSaverBase(const edm::ParameterSet &ps)
void saveJobReport(const std::string &filename) const
static boost::mutex mutex
Definition: LHEProxy.cc:11
tuple lumi
Definition: fjr2json.py:35
static const std::string fillOrigin(const std::string filename, const std::string final_filename)
static const std::string filename(FileParameters fp, bool useLumi=false)
virtual void endJob(void)
virtual void analyze(edm::StreamID, const edm::Event &e, const edm::EventSetup &) const
SaveReferenceTag
Definition: DQMStore.h:78
virtual void beginJob(void)
virtual void globalEndRun(const edm::Run &, const edm::EventSetup &) const
tuple d
Definition: ztail.py:151
virtual void postForkReacquireResources(unsigned int childIndex, unsigned int numberOfChildren)
virtual std::shared_ptr< NoCache > globalBeginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &) const
void logFileAction(const std::string &msg, const std::string &fileName) const
virtual std::shared_ptr< NoCache > globalBeginRun(const edm::Run &, const edm::EventSetup &) const
DQMStore::SaveReferenceTag saveReference_
virtual void saveLumi(FileParameters fp) const
FileParameters initial_fp_
virtual void saveRun(FileParameters fp) const
static boost::property_tree::ptree fillJson(int run, int lumi, const std::string &dataFilePathName, const std::string transferDestinationStr, evf::FastMonitoringService *fms)
static void fillDescription(edm::ParameterSetDescription &d)
virtual void globalEndLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &) const
Definition: Run.h:41