19 #include <boost/regex.hpp>
20 #include <boost/format.hpp>
21 #include <boost/range.hpp>
22 #include <boost/filesystem.hpp>
23 #include <boost/algorithm/string/predicate.hpp>
63 const double LUMI = 23.310893056;
88 ib.
book1D(
"EventAccepted",
"# of accepted events per lumi", 4, 0., 4.);
90 "# of processed events per lumi", 4, 0., 4.);
93 "Observed delivery delay for the data file (mtime).", 4, 0., 4.);
96 "Observed delivery delay for the data file (ctime).", 4, 0., 4.);
123 if (::stat(run_global.c_str(), &st) != 0) {
141 edm::LogPrint(
"RamdiskMonitor") <<
"Stream not monitored [" << label
149 LumiEntry lumi_jsn = LumiEntry::load_json(
runPath_, fn, lumi, -1);
155 if (::stat(fn.c_str(), &st) != 0) {
163 if (start_offset <= 0)
return;
167 double mtime = st.st_mtime;
168 double ctime = st.st_ctime;
171 double start_offset_mtime = mtime - start_offset -
LUMI;
172 double start_offset_ctime = ctime - start_offset -
LUMI;
173 double lumi_offset = (lumi - 1) * LUMI;
176 double delay_mtime = start_offset_mtime - lumi_offset;
177 double delay_ctime = start_offset_ctime - lumi_offset;
189 using boost::filesystem::directory_iterator;
190 using boost::filesystem::directory_entry;
192 directory_iterator dend;
193 for (directory_iterator di(
runPath_); di != dend; ++di) {
194 const boost::regex fn_re(
"run(\\d+)_ls(\\d+)_([a-zA-Z0-9]+)(_.*)?\\.jsn");
204 if (boost::regex_match(filename, result, fn_re)) {
205 unsigned int run = std::stoi(result[1]);
206 unsigned int lumi = std::stoi(result[2]);
214 if ((lumi == 0) && (label ==
"EoR")) {
240 "Analyses file timestams in the /fff/ramdisk and creates monitor "
243 desc.
addUntracked<std::vector<std::string> >(
"streamLabels")
244 ->setComment(
"List of streams to monitor.");
247 ->setComment(
"Run number passed via configuration file.");
250 ->setComment(
"Directory where the DQM files will appear.");
252 d.
add(
"RamdiskMonitor", desc);
T getUntrackedParameter(std::string const &, T const &) const
void setBinContent(int binx, double content)
set content of bin (1-D)
std::map< std::string, StreamME > streams_
std::chrono::high_resolution_clock::time_point runPathLastCollect_
std::vector< std::string > streamLabels_
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
virtual ~RamdiskMonitor()
#define DEFINE_FWK_MODULE(type)
string format
Some error handling for the usage.
MonitorElement * eventsAccepted
MonitorElement * eventsProcessed
void setComment(std::string const &value)
MonitorElement * deliveryDelayCTime
MonitorElement * book1D(Args &&...args)
void analyzeFile(std::string fn, unsigned int run, unsigned int lumi, std::string label)
void setCurrentFolder(const std::string &fullpath)
virtual void beginLuminosityBlock(edm::LuminosityBlock const &lumi, edm::EventSetup const &eSetup) override
TH1F * getTH1F(void) const
MonitorElement * deliveryDelayMTime
virtual void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
RamdiskMonitor(const edm::ParameterSet &ps)
dqm::RamdiskMonitor RamdiskMonitor
virtual void analyze(edm::Event const &e, edm::EventSetup const &eSetup) override
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
std::set< std::string > filesSeen_