6 #include <fmt/printf.h> 7 #include <boost/algorithm/string/predicate.hpp> 8 #include <boost/range.hpp> 9 #include <boost/regex.hpp> 58 static constexpr
double LUMI = 23.310893056;
63 runInputDir_{ps.getUntrackedParameter<
std::string>(
"runInputDir")},
64 streamLabels_{ps.getUntrackedParameter<std::vector<std::string>>(
"streamLabels")},
65 runPath_{fmt::sprintf(
"%s/run%06d", runInputDir_,
runNumber_)}
80 m.eventsAccepted =
ib.book1D(
"EventAccepted",
"# of accepted events per lumi", 4, 0., 4.);
81 m.eventsProcessed =
ib.book1D(
"EventProcessed",
"# of processed events per lumi", 4, 0., 4.);
82 m.deliveryDelayMTime =
83 ib.book1D(
"DeliveryDelayMTime",
"Observed delivery delay for the data file (mtime).", 4, 0., 4.);
84 m.deliveryDelayCTime =
85 ib.book1D(
"DeliveryDelayCTime",
"Observed delivery delay for the data file (ctime).", 4, 0., 4.);
87 m.eventsAccepted->getTH1F()->SetCanExtend(TH1::kXaxis);
88 m.eventsProcessed->getTH1F()->SetCanExtend(TH1::kXaxis);
89 m.deliveryDelayMTime->getTH1F()->SetCanExtend(TH1::kXaxis);
90 m.deliveryDelayCTime->getTH1F()->SetCanExtend(TH1::kXaxis);
92 m.eventsAccepted->setAxisTitle(
"Luminosity Section", 1);
93 m.eventsProcessed->setAxisTitle(
"Luminosity Section", 1);
94 m.deliveryDelayMTime->setAxisTitle(
"Luminosity Section", 1);
95 m.deliveryDelayCTime->setAxisTitle(
"Luminosity Section", 1);
97 m.eventsAccepted->setAxisTitle(
"Number of events", 2);
98 m.eventsProcessed->setAxisTitle(
"Number of events", 2);
99 m.deliveryDelayMTime->setAxisTitle(
"Delay (s.)", 2);
100 m.deliveryDelayCTime->setAxisTitle(
"Delay (s.)", 2);
112 if (::
stat(run_global.c_str(), &st) != 0) {
138 LumiEntry lumi_jsn = LumiEntry::load_json(
runPath_,
fn,
lumi, -1);
139 m.eventsAccepted->setBinContent(
lumi, lumi_jsn.n_events_accepted);
140 m.eventsProcessed->setBinContent(
lumi, lumi_jsn.n_events_processed);
144 if (::
stat(
fn.c_str(), &st) != 0) {
152 if (start_offset <= 0)
157 double mtime = st.st_mtime;
158 double ctime = st.st_ctime;
161 double start_offset_mtime = mtime - start_offset -
LUMI;
162 double start_offset_ctime = ctime - start_offset -
LUMI;
163 double lumi_offset = (
lumi - 1) *
LUMI;
166 double delay_mtime = start_offset_mtime - lumi_offset;
167 double delay_ctime = start_offset_ctime - lumi_offset;
169 m.deliveryDelayMTime->setBinContent(
lumi, delay_mtime);
170 m.deliveryDelayCTime->setBinContent(
lumi, delay_ctime);
176 using std::filesystem::directory_entry;
177 using std::filesystem::directory_iterator;
179 directory_iterator dend;
180 for (directory_iterator di(
runPath_); di != dend; ++di) {
181 const boost::regex fn_re(
"run(\\d+)_ls(\\d+)_([a-zA-Z0-9]+)(_.*)?\\.jsn");
222 return std::shared_ptr<dqm::rdm::Empty>();
229 "Analyses file timestams in the /fff/ramdisk and creates monitor " 232 desc.addUntracked<std::vector<std::string>>(
"streamLabels")->setComment(
"List of streams to monitor.");
234 desc.addUntracked<
unsigned int>(
"runNumber")->setComment(
"Run number passed via configuration file.");
236 desc.addUntracked<
std::string>(
"runInputDir")->setComment(
"Directory where the DQM files will appear.");
238 d.add(
"RamdiskMonitor",
desc);
static const char runNumber_[]
void globalEndLuminosityBlock(edm::LuminosityBlock const &lumi, edm::EventSetup const &eSetup) final
void analyzeFile(std::string fn, unsigned int run, unsigned int lumi, std::string label) const
std::map< std::string, StreamME > streams_
const std::string runPath_
MonitorElement * eventsAccepted
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
MonitorElement * eventsProcessed
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * deliveryDelayCTime
~RamdiskMonitor() override
#define DEFINE_FWK_MODULE(type)
std::shared_ptr< rdm::Empty > globalBeginLuminosityBlock(edm::LuminosityBlock const &lumi, edm::EventSetup const &eSetup) const override
Log< level::Warning, true > LogPrint
Log< level::Info, false > LogInfo
const std::vector< std::string > streamLabels_
MonitorElement * deliveryDelayMTime
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
double getRunTimestamp() const
void analyze(edm::Event const &e, edm::EventSetup const &eSetup) override
RamdiskMonitor(const edm::ParameterSet &ps)
dqm::RamdiskMonitor RamdiskMonitor
const std::string runInputDir_
Log< level::Warning, false > LogWarning
std::set< std::string > filesSeen_
const unsigned int runNumber_
static constexpr double LUMI