25 if (value < 1 && value != -1)
27 <<
"Invalid '" << name <<
"' parameter '" << value
28 <<
"'. Must be -1 or >= 1.";
36 sprintf(suffix,
"R%09d", run);
40 sprintf(rewrite,
"\\1Run %d/\\2/Run summary", run);
46 wflow.reserve(workflow.size() + 3);
48 while ((pos = wflow.find(
'/', pos)) != std::string::npos)
49 wflow.replace(pos++, 1,
"__");
63 me =
dbe_->
get(
"Info/ProvInfo/runIsComplete");
76 "^(Reference/)?([^/]+)",
86 std::cout <<
" DQMFileSaver: storing EventInfo folders for Run: "
87 <<
irun_ <<
", Lumi Section: " <<
ilumi_ <<
", Subsystems: " ;
89 for (
size_t i = 0,
e = systems.size();
i !=
e; ++
i) {
90 if (systems[
i] !=
"Reference") {
94 systems[
i]+
"/EventInfo",
"^(Reference/)?([^/]+)", rewrite,
116 size_t numKeepSavedFiles,
125 store->
save(filename, directory , rxpat,
126 rewrite, saveref, saveRefQMin);
127 pastSavedFiles.push_back(filename);
128 if (pastSavedFiles.size() > numKeepSavedFiles)
130 remove(pastSavedFiles.front().c_str());
131 pastSavedFiles.pop_front();
140 for (
size_t i = 0,
e = systems.size();
i !=
e; ++
i)
142 if (systems[
i] !=
"Reference")
149 "",
"^(Reference/)?([^/]+)", rewrite,
158 for (
size_t i = 0,
e = systems.size();
i !=
e; ++
i)
159 if (systems[
i] !=
"Reference")
162 std::vector<MonitorElement*> pNamesVector =
dbe_->
getMatchingContents(
"^" + systems[
i] +
"/.*/EventInfo/processName",lat::Regexp::Perl);
163 if (pNamesVector.size() > 0){
166 "",
"^(Reference/)?([^/]+)", rewrite,
169 pNamesVector.clear();
175 for (
size_t i = 0,
e = systems.size();
i !=
e; ++
i)
176 if (systems[
i] !=
"Reference")
179 systems[
i],
"^(Reference/)?([^/]+)", rewrite,
192 std::map<std::string, std::string>
info;
193 info[
"Source"] =
"DQMStore";
194 info[
"FileClass"] =
"DQM";
202 : convention_ (Offline),
207 runIsComplete_ (
false),
208 saveByLumiSection_ (-1),
213 saveAtJobEnd_ (
false),
214 saveReference_ (
DQMStore::SaveWithReference),
215 saveReferenceQMin_ (dqm::qstatus::
STATUS_OK),
216 forceRunNumber_ (-1),
218 fileUpdate_ (
"RECREATE"),
227 numKeepSavedFiles_ (5)
231 if (convention ==
"Offline")
233 else if (convention ==
"Online")
237 <<
"Invalid 'convention' parameter '" << convention <<
"'."
238 <<
" Expected one of 'Online' or 'Offline'.";
248 ||
workflow_.find_first_not_of(
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
249 "abcdefghijklmnopqrstuvwxyz"
251 "-_/") != std::string::npos)
253 <<
"Invalid 'workflow' parameter '" <<
workflow_
254 <<
"'. Expected '/A/B/C'.";
258 <<
"The 'workflow' parameter must be empty in 'Online' convention.";
272 <<
"Invalid 'producer' parameter '" <<
producer_
273 <<
"'. Expected 'DQM', 'HLTDQM' or 'Playback'.";
278 <<
"Invalid 'producer' parameter '" <<
producer_
279 <<
"'. Expected 'DQM'.";
289 if (refsave ==
"default")
291 else if (refsave ==
"skip")
296 else if (refsave ==
"all")
301 else if (refsave ==
"qtests")
308 <<
"Invalid 'referenceHandling' parameter '" << refsave
309 <<
"'. Expected 'default', 'skip', 'all' or 'qtests'.";
317 if (dirName_.empty() || stat(dirName_.c_str(), &
s) == -1)
319 <<
"Invalid 'dirName' parameter '" << dirName_ <<
"'.";
347 <<
"If saving at the end of the job, the run number must be"
348 <<
" overridden to a specific value using 'forceRunNumber'.";
353 sprintf(version,
"_V%04d_",
int(
version_));
361 <<
"DQM file saving settings:\n"
367 <<
" saving every 2^n*" <<
saveByTime_ <<
" minutes \n"
368 <<
" saving every " <<
saveByRun_ <<
" run(s)\n"
369 <<
" saving at job end: " << (
saveAtJobEnd_ ?
"yes" :
"no") <<
"\n"
408 <<
"Internal error, can save files by event"
409 <<
" only in Online mode.";
421 <<
"Internal error, can save files by time"
422 <<
" only in Online mode.";
426 gettimeofday(&tv, 0);
428 double totalelapsed = ((tv.tv_sec + tv.tv_usec*1e-6)
430 double elapsed = ((tv.tv_sec + tv.tv_usec*1e-6)
439 sprintf(suffix,
"_R%09d_T%08d",
irun_,
int(totalelapsed));
440 char rewrite[64]; sprintf(rewrite,
"\\1Run %d/\\2/Run summary",
irun_);
454 <<
"Internal error, can save files at end of lumi block"
455 <<
" only in Online or Offline mode.";
480 char rewrite[64]; sprintf(rewrite,
"\\1Run %d/\\2/Run summary",
irun_);
487 <<
"Internal error. Can only save files in endRun()"
488 <<
" in Online and Offline modes.";
503 <<
"Internal error. Can only save files at the end of the"
504 <<
" job in Offline mode with run number overridden.";
LuminosityBlockID id() const
EventNumber_t event() const
T getUntrackedParameter(std::string const &, T const &) const
DQMFileSaver(const edm::ParameterSet &ps)
std::vector< std::string > getSubdirs(void) const
virtual void beginRun(const edm::Run &, const edm::EventSetup &)
void saveForOnline(const std::string &suffix, const std::string &rewrite)
void cd(void)
go to top directory (ie. root)
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
void reportAnalysisFile(std::string const &fileName, std::map< std::string, std::string > const &fileData)
std::list< std::string > pastSavedFiles_
std::vector< MonitorElement * > getMatchingContents(const std::string &pattern, lat::Regexp::Syntax syntaxType=lat::Regexp::Wildcard) const
void saveJobReport(const std::string &filename)
std::string fileBaseName_
static void doSaveForOnline(std::list< std::string > &pastSavedFiles, size_t numKeepSavedFiles, DQMStore *store, const std::string &filename, const std::string &directory, const std::string &rxpat, const std::string &rewrite, DQMStore::SaveReferenceTag saveref, int saveRefQMin)
MonitorElement * bookFloat(const char *name)
Book float.
virtual void beginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &)
static void getAnInt(const edm::ParameterSet &ps, int &value, const std::string &name)
MonitorElement * bookString(const char *name, const char *value)
Book string.
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. "my/long/dir/my_histo")
std::string getReleaseVersion()
LuminosityBlockNumber_t luminosityBlock() const
virtual void endLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &)
void saveForOffline(const std::string &workflow, int run, int lumi)
virtual void analyze(const edm::Event &e, const edm::EventSetup &)
static const int STATUS_OK
virtual void endRun(const edm::Run &, const edm::EventSetup &)
virtual void beginJob(void)
virtual void endJob(void)
void setCurrentFolder(const std::string &fullpath)