CMS 3D CMS Logo

DQMHarvestingMetadata.cc
Go to the documentation of this file.
2 
4 
6 public:
9 
11  ~DQMHarvestingMetadata() override;
12 
13 protected:
15  void dqmEndRun(DQMStore::IBooker& ibooker,
16  DQMStore::IGetter& igetter,
17  edm::Run const& iRun,
18  edm::EventSetup const& /* iSetup */) override;
20  DQMStore::IGetter& igetter,
21  edm::LuminosityBlock const& iLumi,
22  edm::EventSetup const& /* iSetup */) override;
23 
25 
26 private:
29 
36 
41 
42  double currentTime_;
43 };
44 
45 static inline double stampToReal(edm::Timestamp time) {
46  return (time.value() >> 32) + 1e-6 * (time.value() & 0xffffffff);
47 }
48 
49 static inline double stampToReal(const timeval& time) { return time.tv_sec + 1e-6 * time.tv_usec; }
50 
52  struct timeval now;
53  gettimeofday(&now, nullptr);
55 
56  // read config parms
57  std::string folder = ps.getUntrackedParameter<std::string>("eventInfoFolder", "EventInfo");
58  subsystemname_ = ps.getUntrackedParameter<std::string>("subSystemFolder", "YourSubsystem");
59 
61 }
62 
64 
66  DQMStore::IGetter& igetter,
67  edm::Run const& iRun,
68  edm::EventSetup const& /* iSetup */) {
70 
71  runList_ = ibooker.bookString("Run", "");
72  runId_ = ibooker.bookInt("iRun");
73  runStartTimeStamp_ = ibooker.bookFloat("runStartTimeStamp");
74 
75  if (runList_->getStringValue().empty()) {
76  std::string run = std::to_string(iRun.id().run());
77  runList_->Fill(run);
78  runId_->Fill(iRun.id().run());
79  // in case of multiple runs, record start time of the first.
81  } else {
83  runList_->Fill(run);
84  // this is the agreed-upon pseudo-runnumber for multi-run harvesting.
85  runId_->Fill(999999);
86  }
87 
88  processTimeStamp_ = ibooker.bookFloat("processTimeStamp");
90 
91  char hostname[65];
92  gethostname(hostname, 64);
93  hostname[64] = 0;
94  hostName_ = ibooker.bookString("hostName", hostname);
95  char* pwd = getcwd(nullptr, 0);
96  workingDir_ = ibooker.bookString("workingDir", pwd);
97  free(pwd);
98  cmsswVer_ = ibooker.bookString("CMSSW_Version", edm::getReleaseVersion());
99 }
100 
102  DQMStore::IGetter& igetter,
103  edm::LuminosityBlock const& iLumi,
104  edm::EventSetup const& /* iSetup */) {
105  int lumi = iLumi.luminosityBlock();
106 
108  firstLumisecId_ = ibooker.bookInt("firstLumiSection");
109  lastLumisecId_ = ibooker.bookInt("lastLumiSection");
110  lumisecId_ = ibooker.bookInt("iLumiSection");
111  lumisecId_->Fill(lumi);
112 
115  }
118  }
119 }
120 
~DQMHarvestingMetadata() override
Destructor.
MonitorElement * bookFloat(TString const &name, FUNC onbooking=NOOP())
Definition: DQMStore.h:80
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
MonitorElement * runStartTimeStamp_
void dqmEndLuminosityBlock(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, edm::LuminosityBlock const &iLumi, edm::EventSetup const &) override
MonitorElement * lumisecId_
UTC time of the run start.
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
MonitorElement * cmsswVer_
Current working directory of the job.
MonitorElement * processTimeStamp_
DQMHarvestingMetadata(const edm::ParameterSet &ps)
Constructor.
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
std::string to_string(const V &value)
Definition: OMSAccess.h:71
MonitorElement * bookString(TString const &name, TString const &value, FUNC onbooking=NOOP())
Definition: DQMStore.h:87
MonitorElement * hostName_
The UTC time of the job initialization.
T getUntrackedParameter(std::string const &, T const &) const
void Fill(long long x)
MonitorElement * workingDir_
Hostname of the local machine.
static double stampToReal(edm::Timestamp time)
RunID const & id() const
Definition: RunBase.h:39
std::string getReleaseVersion()
MonitorElement * bookInt(TString const &name, FUNC onbooking=NOOP())
Definition: DQMStore.h:73
void dqmEndRun(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, edm::Run const &iRun, edm::EventSetup const &) override
Analyze.
Timestamp const & beginTime() const
Definition: RunBase.h:41
virtual const std::string & getStringValue() const
double currentTime_
CMSSW version run for this job.
MonitorElement * firstLumisecId_
MonitorElement * lastLumisecId_
LuminosityBlockNumber_t luminosityBlock() const
RunNumber_t run() const
Definition: RunID.h:36
Definition: Run.h:45
virtual int64_t getIntValue() const