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> 42 double getRunTimestamp()
const;
59 mutable double global_start_ = 0.;
67 streamLabels_{ps.getUntrackedParameter<std::vector<std::string>>(
"streamLabels")},
86 ib.
book1D(
"DeliveryDelayMTime",
"Observed delivery delay for the data file (mtime).", 4, 0., 4.);
88 ib.
book1D(
"DeliveryDelayCTime",
"Observed delivery delay for the data file (ctime).", 4, 0., 4.);
115 if (::
stat(run_global.c_str(), &st) != 0) {
132 auto itStream =
streams_.find(label);
134 edm::LogPrint(
"RamdiskMonitor") <<
"Stream not monitored [" << label <<
"]: " <<
fn;
141 LumiEntry lumi_jsn = LumiEntry::load_json(
runPath_, fn, lumi, -1);
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;
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");
194 if (boost::regex_match(filename, result, fn_re)) {
195 unsigned int run = std::stoi(result[1]);
196 unsigned int lumi = std::stoi(result[2]);
205 if ((lumi == 0) && (label ==
"EoR")) {
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);
static const char runNumber_[]
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX)
void globalEndLuminosityBlock(edm::LuminosityBlock const &lumi, edm::EventSetup const &eSetup) final
T getUntrackedParameter(std::string const &, T const &) const
std::map< std::string, StreamME > streams_
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void setCurrentFolder(std::string const &fullpath)
std::shared_ptr< rdm::Empty > globalBeginLuminosityBlock(edm::LuminosityBlock const &lumi, edm::EventSetup const &eSetup) const override
const std::string runPath_
void analyzeFile(std::string fn, unsigned int run, unsigned int lumi, std::string label) const
MonitorElement * eventsAccepted
MonitorElement * eventsProcessed
void setComment(std::string const &value)
MonitorElement * deliveryDelayCTime
#define DEFINE_FWK_MODULE(type)
~RamdiskMonitor() override
double getRunTimestamp() const
const std::vector< std::string > streamLabels_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
example_stream void bookHistograms(DQMStore::IBooker &,@example_stream edm::Run const &,@example_stream edm::EventSetup const &) override
MonitorElement * deliveryDelayMTime
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)
void analyze(edm::Event const &e, edm::EventSetup const &eSetup) override
RamdiskMonitor(const edm::ParameterSet &ps)
dqm::RamdiskMonitor RamdiskMonitor
const std::string runInputDir_
std::set< std::string > filesSeen_
const unsigned int runNumber_
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)