18 #include <boost/regex.hpp>
19 #include <boost/format.hpp>
20 #include <boost/range.hpp>
21 #include <boost/filesystem.hpp>
22 #include <boost/algorithm/string/predicate.hpp>
61 static constexpr
double LUMI = 23.310893056;
66 runInputDir_{ps.getUntrackedParameter<
std::string>(
"runInputDir")},
67 streamLabels_{ps.getUntrackedParameter<std::vector<std::string>>(
"streamLabels")},
83 m.eventsAccepted =
ib.book1D(
"EventAccepted",
"# of accepted events per lumi", 4, 0., 4.);
84 m.eventsProcessed =
ib.book1D(
"EventProcessed",
"# of processed events per lumi", 4, 0., 4.);
85 m.deliveryDelayMTime =
86 ib.book1D(
"DeliveryDelayMTime",
"Observed delivery delay for the data file (mtime).", 4, 0., 4.);
87 m.deliveryDelayCTime =
88 ib.book1D(
"DeliveryDelayCTime",
"Observed delivery delay for the data file (ctime).", 4, 0., 4.);
90 m.eventsAccepted->getTH1F()->SetCanExtend(TH1::kXaxis);
91 m.eventsProcessed->getTH1F()->SetCanExtend(TH1::kXaxis);
92 m.deliveryDelayMTime->getTH1F()->SetCanExtend(TH1::kXaxis);
93 m.deliveryDelayCTime->getTH1F()->SetCanExtend(TH1::kXaxis);
95 m.eventsAccepted->setAxisTitle(
"Luminosity Section", 1);
96 m.eventsProcessed->setAxisTitle(
"Luminosity Section", 1);
97 m.deliveryDelayMTime->setAxisTitle(
"Luminosity Section", 1);
98 m.deliveryDelayCTime->setAxisTitle(
"Luminosity Section", 1);
100 m.eventsAccepted->setAxisTitle(
"Number of events", 2);
101 m.eventsProcessed->setAxisTitle(
"Number of events", 2);
102 m.deliveryDelayMTime->setAxisTitle(
"Delay (s.)", 2);
103 m.deliveryDelayCTime->setAxisTitle(
"Delay (s.)", 2);
115 if (::
stat(run_global.c_str(), &st) != 0) {
141 LumiEntry lumi_jsn = LumiEntry::load_json(
runPath_,
fn,
lumi, -1);
142 m.eventsAccepted->setBinContent(
lumi, lumi_jsn.n_events_accepted);
143 m.eventsProcessed->setBinContent(
lumi, lumi_jsn.n_events_processed);
147 if (::
stat(
fn.c_str(), &st) != 0) {
155 if (start_offset <= 0)
160 double mtime = st.st_mtime;
161 double ctime = st.st_ctime;
164 double start_offset_mtime = mtime - start_offset -
LUMI;
165 double start_offset_ctime = ctime - start_offset -
LUMI;
166 double lumi_offset = (
lumi - 1) *
LUMI;
169 double delay_mtime = start_offset_mtime - lumi_offset;
170 double delay_ctime = start_offset_ctime - lumi_offset;
172 m.deliveryDelayMTime->setBinContent(
lumi, delay_mtime);
173 m.deliveryDelayCTime->setBinContent(
lumi, delay_ctime);
179 using boost::filesystem::directory_entry;
180 using boost::filesystem::directory_iterator;
182 directory_iterator dend;
183 for (directory_iterator di(
runPath_); di != dend; ++di) {
184 const boost::regex fn_re(
"run(\\d+)_ls(\\d+)_([a-zA-Z0-9]+)(_.*)?\\.jsn");
225 return std::shared_ptr<dqm::rdm::Empty>();
232 "Analyses file timestams in the /fff/ramdisk and creates monitor "
235 desc.
addUntracked<std::vector<std::string>>(
"streamLabels")->setComment(
"List of streams to monitor.");
237 desc.
addUntracked<
unsigned int>(
"runNumber")->setComment(
"Run number passed via configuration file.");
241 d.add(
"RamdiskMonitor", desc);