CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes
DQMFileSaver Class Reference

#include <DQMFileSaver.h>

Inheritance diagram for DQMFileSaver:
edm::EDAnalyzer

Public Member Functions

 DQMFileSaver (const edm::ParameterSet &ps)
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Protected Member Functions

virtual void analyze (const edm::Event &e, const edm::EventSetup &)
 
virtual void beginJob (void)
 
virtual void beginLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &)
 
virtual void beginRun (const edm::Run &, const edm::EventSetup &)
 
virtual void endJob (void)
 
virtual void endLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &)
 
virtual void endRun (const edm::Run &, const edm::EventSetup &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Private Types

enum  Convention { Online, Offline }
 

Private Member Functions

void saveForOffline (const std::string &workflow, int run, int lumi)
 
void saveForOnline (const std::string &suffix, const std::string &rewrite)
 
void saveJobReport (const std::string &filename)
 

Private Attributes

Convention convention_
 
DQMStoredbe_
 
std::string dirName_
 
std::string fileBaseName_
 
std::string fileUpdate_
 
MonitorElementfileVersion_
 
int forceRunNumber_
 
MonitorElementhostName_
 
int ievent_
 
int ilumi_
 
int ilumiprev_
 
int irun_
 
MonitorElementisComplete_
 The PID associated with this job. More...
 
int nevent_
 
int nlumi_
 
int nrun_
 
int numKeepSavedFiles_
 
std::list< std::string > pastSavedFiles_
 
MonitorElementprocessId_
 Current working directory of the job. More...
 
MonitorElementprocessName_
 Hostname of the local machine. More...
 
std::string producer_
 
bool runIsComplete_
 
bool saveAtJobEnd_
 
int saveByEvent_
 
int saveByLumiSection_
 
int saveByMinute_
 
int saveByRun_
 
int saveByTime_
 
timeval saved_
 
int saveReference_
 
int saveReferenceQMin_
 
timeval start_
 
MonitorElementversCMSSW_
 
MonitorElementversDataset_
 
MonitorElementversGlobaltag_
 
int version_
 
MonitorElementversTaglist_
 
std::string workflow_
 
MonitorElementworkingDir_
 DQM "name" of the job (eg, Hcal or DT) More...
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 

Detailed Description

Definition at line 10 of file DQMFileSaver.h.

Member Enumeration Documentation

Enumerator
Online 
Offline 

Definition at line 29 of file DQMFileSaver.h.

Constructor & Destructor Documentation

DQMFileSaver::DQMFileSaver ( const edm::ParameterSet ps)

Definition at line 184 of file DQMFileSaver.cc.

References convention_, prof2calltree::count, dirName_, edm::hlt::Exception, fileBaseName_, forceRunNumber_, getAnInt(), edm::ParameterSet::getUntrackedParameter(), numKeepSavedFiles_, Offline, Online, producer_, runIsComplete_, asciidump::s, saveAtJobEnd_, saveByEvent_, saveByLumiSection_, saveByMinute_, saveByRun_, saveByTime_, saved_, saveReference_, saveReferenceQMin_, DQMStore::SaveWithoutReference, DQMStore::SaveWithReference, DQMStore::SaveWithReferenceForQTest, start_, BeamSplash_cfg::version, version_, and workflow_.

185  : convention_ (Offline),
186  workflow_ (""),
187  producer_ ("DQM"),
188  dirName_ ("."),
189  version_ (1),
190  runIsComplete_ (false),
191  saveByLumiSection_ (-1),
192  saveByEvent_ (-1),
193  saveByMinute_ (-1),
194  saveByTime_ (-1),
195  saveByRun_ (1),
196  saveAtJobEnd_ (false),
199  forceRunNumber_ (-1),
200  fileBaseName_ (""),
201  fileUpdate_ ("RECREATE"),
203  irun_ (-1),
204  ilumi_ (-1),
205  ilumiprev_ (-1),
206  ievent_ (-1),
207  nrun_ (0),
208  nlumi_ (0),
209  nevent_ (0),
211 {
212  // Determine the file saving convention, and adjust defaults accordingly.
213  std::string convention = ps.getUntrackedParameter<std::string>("convention", "Offline");
214  if (convention == "Offline")
216  else if (convention == "Online")
218  else
219  throw cms::Exception("DQMFileSaver")
220  << "Invalid 'convention' parameter '" << convention << "'."
221  << " Expected one of 'Online' or 'Offline'.";
222 
223  // If this isn't online convention, check workflow.
224  if (convention_ != Online)
225  {
226  workflow_ = ps.getUntrackedParameter<std::string>("workflow", workflow_);
227  if (workflow_.empty()
228  || workflow_[0] != '/'
229  || *workflow_.rbegin() == '/'
230  || std::count(workflow_.begin(), workflow_.end(), '/') != 3
231  || workflow_.find_first_not_of("ABCDEFGHIJKLMNOPQRSTUVWXYZ"
232  "abcdefghijklmnopqrstuvwxyz"
233  "0123456789"
234  "-_/") != std::string::npos)
235  throw cms::Exception("DQMFileSaver")
236  << "Invalid 'workflow' parameter '" << workflow_
237  << "'. Expected '/A/B/C'.";
238  }
239  else if (! ps.getUntrackedParameter<std::string>("workflow", "").empty())
240  throw cms::Exception("DQMFileSaver")
241  << "The 'workflow' parameter must be empty in 'Online' convention.";
242  else // for online set parameters
243  {
244  workflow_="/Global/Online/P5";
245  }
246 
247  // Allow file producer to be set to specific values in certain conditions.
248  producer_ = ps.getUntrackedParameter<std::string>("producer", producer_);
249  if (convention_ == Online
250  && producer_ != "DQM"
251  && producer_ != "HLTDQM"
252  && producer_ != "Playback")
253  {
254  throw cms::Exception("DQMFileSaver")
255  << "Invalid 'producer' parameter '" << producer_
256  << "'. Expected 'DQM', 'HLTDQM' or 'Playback'.";
257  }
258  else if (convention_ != Online && producer_ != "DQM")
259  {
260  throw cms::Exception("DQMFileSaver")
261  << "Invalid 'producer' parameter '" << producer_
262  << "'. Expected 'DQM'.";
263  }
264 
265  // version number to be used in filename
266  version_ = ps.getUntrackedParameter<int>("version", version_);
267  // flag to signal that file contains data from complete run
268  runIsComplete_ = ps.getUntrackedParameter<bool>("runIsComplete", runIsComplete_);
269 
270  // Check how we should save the references.
271  std::string refsave = ps.getUntrackedParameter<std::string>("referenceHandling", "default");
272  if (refsave == "default")
273  ;
274  else if (refsave == "skip")
275  {
277  // std::cout << "skip saving all references" << std::endl;
278  }
279  else if (refsave == "all")
280  {
282  // std::cout << "saving all references" << std::endl;
283  }
284  else if (refsave == "qtests")
285  {
287  // std::cout << "saving qtest references" << std::endl;
288  }
289  else
290  throw cms::Exception("DQMFileSaver")
291  << "Invalid 'referenceHandling' parameter '" << refsave
292  << "'. Expected 'default', 'skip', 'all' or 'qtests'.";
293 
294  // Check minimum required quality test result for which reference is saved.
295  saveReferenceQMin_ = ps.getUntrackedParameter<int>("referenceRequireStatus", saveReferenceQMin_);
296 
297  // Get and check the output directory.
298  struct stat s;
299  dirName_ = ps.getUntrackedParameter<std::string>("dirName", dirName_);
300  if (dirName_.empty() || stat(dirName_.c_str(), &s) == -1)
301  throw cms::Exception("DQMFileSaver")
302  << "Invalid 'dirName' parameter '" << dirName_ << "'.";
303 
304  // Find out when and how to save files. The following contraints apply:
305  // - For online, allow files to be saved at event and time intervals.
306  // - For online and offline, allow files to be saved per run, lumi and job end
307  // - For offline allow run number to be overridden (for mc data).
308  if (convention_ == Online)
309  {
310  getAnInt(ps, saveByEvent_, "saveByEvent");
311  getAnInt(ps, saveByMinute_, "saveByMinute");
312  getAnInt(ps, saveByTime_, "saveByTime");
313  getAnInt(ps, numKeepSavedFiles_, "maxSavedFilesCount");
314  }
315 
316  if (convention_ == Online || convention_ == Offline)
317  {
318  getAnInt(ps, saveByRun_, "saveByRun");
319  getAnInt(ps, saveByLumiSection_, "saveByLumiSection");
320  }
321 
322  if (convention_ != Online)
323  {
324  getAnInt(ps, forceRunNumber_, "forceRunNumber");
325  saveAtJobEnd_ = ps.getUntrackedParameter<bool>("saveAtJobEnd", saveAtJobEnd_);
326  }
327 
328  if (saveAtJobEnd_ && forceRunNumber_ < 1)
329  throw cms::Exception("DQMFileSaver")
330  << "If saving at the end of the job, the run number must be"
331  << " overridden to a specific value using 'forceRunNumber'.";
332 
333 
334  // Set up base file name and determine the start time.
335  char version[8];
336  sprintf(version, "_V%04d_", int(version_));
337  version[7]='\0';
338  fileBaseName_ = dirName_ + "/" + producer_ + version;
339  gettimeofday(&start_, 0);
340  saved_ = start_;
341 
342  // Log some information what we will do.
343  edm::LogInfo("DQMFileSaver")
344  << "DQM file saving settings:\n"
345  << " using base file name '" << fileBaseName_ << "'\n"
346  << " forcing run number " << forceRunNumber_ << "\n"
347  << " saving every " << saveByLumiSection_ << " lumi section(s)\n"
348  << " saving every " << saveByEvent_ << " event(s)\n"
349  << " saving every " << saveByMinute_ << " minute(s)\n"
350  << " saving every 2^n*" << saveByTime_ << " minutes \n"
351  << " saving every " << saveByRun_ << " run(s)\n"
352  << " saving at job end: " << (saveAtJobEnd_ ? "yes" : "no") << "\n"
353  << " keeping at most " << numKeepSavedFiles_ << " files\n";
354 }
T getUntrackedParameter(std::string const &, T const &) const
int forceRunNumber_
Definition: DQMFileSaver.h:50
int saveReferenceQMin_
Definition: DQMFileSaver.h:49
std::string fileUpdate_
Definition: DQMFileSaver.h:53
Convention convention_
Definition: DQMFileSaver.h:35
DQMStore * dbe_
Definition: DQMFileSaver.h:55
std::string dirName_
Definition: DQMFileSaver.h:38
std::string fileBaseName_
Definition: DQMFileSaver.h:52
int saveByLumiSection_
Definition: DQMFileSaver.h:42
static void getAnInt(const edm::ParameterSet &ps, int &value, const std::string &name)
Definition: DQMFileSaver.cc:22
bool runIsComplete_
Definition: DQMFileSaver.h:40
timeval start_
Definition: DQMFileSaver.h:64
std::string workflow_
Definition: DQMFileSaver.h:36
std::string producer_
Definition: DQMFileSaver.h:37
int saveReference_
Definition: DQMFileSaver.h:48
bool saveAtJobEnd_
Definition: DQMFileSaver.h:47
timeval saved_
Definition: DQMFileSaver.h:65
static const int STATUS_OK
string s
Definition: asciidump.py:422
int numKeepSavedFiles_
Definition: DQMFileSaver.h:67

Member Function Documentation

void DQMFileSaver::analyze ( const edm::Event e,
const edm::EventSetup  
)
protectedvirtual

Implements edm::EDAnalyzer.

Definition at line 379 of file DQMFileSaver.cc.

References convention_, edm::EventID::event(), edm::hlt::Exception, edm::EventBase::id(), ievent_, irun_, nevent_, Online, saveByEvent_, saveByMinute_, saveByTime_, saved_, saveForOnline(), start_, and createPayload::suffix.

380 {
381  ++nevent_;
382 
383  ievent_ = e.id().event();
384 
385  // Check if we should save for this event.
386  char suffix[64];
387  if (ievent_ > 0 && saveByEvent_ > 0 && nevent_ == saveByEvent_)
388  {
389  if (convention_ != Online)
390  throw cms::Exception("DQMFileSaver")
391  << "Internal error, can save files by event"
392  << " only in Online mode.";
393 
394  sprintf(suffix, "_R%09d_E%08d", irun_, ievent_);
395  saveForOnline(suffix, "\\1\\2");
396  nevent_ = 0;
397  }
398 
399  // Check if we should save due to elapsed time.
400  if ( ievent_ > 0 && ( saveByMinute_ > 0 || saveByTime_ > 0 ) )
401  {
402  if (convention_ != Online)
403  throw cms::Exception("DQMFileSaver")
404  << "Internal error, can save files by time"
405  << " only in Online mode.";
406 
407  // Compute elapsed time in minutes.
408  struct timeval tv;
409  gettimeofday(&tv, 0);
410 
411  double totalelapsed = ((tv.tv_sec + tv.tv_usec*1e-6)
412  - (start_.tv_sec + start_.tv_usec*1e-6)) / 60;
413  double elapsed = ((tv.tv_sec + tv.tv_usec*1e-6)
414  - (saved_.tv_sec + saved_.tv_usec*1e-6)) / 60;
415 
416  // Save if enough time has elapsed since the last save.
417  if ( (saveByMinute_ > 0 && elapsed > saveByMinute_ ) ||
418  (saveByTime_ > 0 && totalelapsed > saveByTime_ ) )
419  {
420  if ( saveByTime_ > 0 ) saveByTime_ *= 2;
421  saved_ = tv;
422  sprintf(suffix, "_R%09d_T%08d", irun_, int(totalelapsed));
423  char rewrite[64]; sprintf(rewrite, "\\1Run %d/\\2/Run summary", irun_);
424  saveForOnline(suffix, rewrite);
425  }
426  }
427 }
EventNumber_t event() const
Definition: EventID.h:44
void saveForOnline(const std::string &suffix, const std::string &rewrite)
Convention convention_
Definition: DQMFileSaver.h:35
timeval start_
Definition: DQMFileSaver.h:64
edm::EventID id() const
Definition: EventBase.h:56
timeval saved_
Definition: DQMFileSaver.h:65
void DQMFileSaver::beginJob ( void  )
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 358 of file DQMFileSaver.cc.

References ievent_, ilumi_, ilumiprev_, irun_, nevent_, nlumi_, and nrun_.

359 {
360  irun_ = ilumi_ = ilumiprev_ = ievent_ = -1;
361  nrun_ = nlumi_ = nevent_ = 0;
362 }
void DQMFileSaver::beginLuminosityBlock ( const edm::LuminosityBlock l,
const edm::EventSetup  
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 372 of file DQMFileSaver.cc.

References edm::LuminosityBlockBase::id(), ilumi_, ilumiprev_, edm::LuminosityBlockID::luminosityBlock(), and nlumi_.

373 {
374  ilumi_ = l.id().luminosityBlock();
375  if (ilumiprev_ == -1) ilumiprev_ = ilumi_;
376  ++nlumi_;
377 }
LuminosityBlockID id() const
LuminosityBlockNumber_t luminosityBlock() const
void DQMFileSaver::beginRun ( const edm::Run r,
const edm::EventSetup  
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 365 of file DQMFileSaver.cc.

References forceRunNumber_, edm::RunBase::id(), irun_, nrun_, and edm::RunID::run().

366 {
367  irun_ = (forceRunNumber_ == -1 ? r.id().run() : forceRunNumber_);
368  ++nrun_;
369 }
int forceRunNumber_
Definition: DQMFileSaver.h:50
RunID const & id() const
Definition: RunBase.h:43
RunNumber_t run() const
Definition: RunID.h:44
void DQMFileSaver::endJob ( void  )
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 478 of file DQMFileSaver.cc.

References convention_, edm::hlt::Exception, forceRunNumber_, Offline, saveAtJobEnd_, saveForOffline(), and workflow_.

479 {
480  if (saveAtJobEnd_)
481  {
482  if (convention_ == Offline && forceRunNumber_ > 0)
484  else
485  throw cms::Exception("DQMFileSaver")
486  << "Internal error. Can only save files at the end of the"
487  << " job in Offline mode with run number overridden.";
488  }
489 
490 }
int forceRunNumber_
Definition: DQMFileSaver.h:50
Convention convention_
Definition: DQMFileSaver.h:35
std::string workflow_
Definition: DQMFileSaver.h:36
bool saveAtJobEnd_
Definition: DQMFileSaver.h:47
void saveForOffline(const std::string &workflow, int run, int lumi)
Definition: DQMFileSaver.cc:32
void DQMFileSaver::endLuminosityBlock ( const edm::LuminosityBlock ,
const edm::EventSetup  
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 430 of file DQMFileSaver.cc.

References convention_, edm::hlt::Exception, ilumi_, ilumiprev_, irun_, nlumi_, Offline, Online, saveByLumiSection_, saveForOffline(), saveForOnline(), createPayload::suffix, and workflow_.

431 {
432 
433  if (ilumi_ > 0 && saveByLumiSection_ > 0 )
434  {
435  if (convention_ != Online && convention_ != Offline )
436  throw cms::Exception("DQMFileSaver")
437  << "Internal error, can save files at end of lumi block"
438  << " only in Online or Offline mode.";
439 
440  if (convention_ == Online && nlumi_ == saveByLumiSection_) // insist on lumi section ordering
441  {
442  char suffix[64];
443  char rewrite[128];
444  sprintf(suffix, "_R%09d_L%06d", irun_, ilumi_);
445  sprintf(rewrite, "\\1Run %d/\\2/By Lumi Section %d-%d", irun_, ilumiprev_, ilumi_);
446  saveForOnline(suffix, rewrite);
447  ilumiprev_ = -1;
448  nlumi_ = 0;
449  }
450  if (convention_ == Offline)
452  }
453 }
void saveForOnline(const std::string &suffix, const std::string &rewrite)
Convention convention_
Definition: DQMFileSaver.h:35
int saveByLumiSection_
Definition: DQMFileSaver.h:42
std::string workflow_
Definition: DQMFileSaver.h:36
void saveForOffline(const std::string &workflow, int run, int lumi)
Definition: DQMFileSaver.cc:32
void DQMFileSaver::endRun ( const edm::Run ,
const edm::EventSetup  
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 456 of file DQMFileSaver.cc.

References convention_, edm::hlt::Exception, irun_, nrun_, Offline, Online, saveByRun_, saveForOffline(), saveForOnline(), createPayload::suffix, and workflow_.

457 {
458  if (irun_ > 0 && saveByRun_ > 0 && nrun_ == saveByRun_)
459  {
460  if (convention_ == Online)
461  {
462  char suffix[64]; sprintf(suffix, "_R%09d", irun_);
463  char rewrite[64]; sprintf(rewrite, "\\1Run %d/\\2/Run summary", irun_);
464  saveForOnline(suffix, rewrite);
465  }
466  else if (convention_ == Offline)
468  else
469  throw cms::Exception("DQMFileSaver")
470  << "Internal error. Can only save files in endRun()"
471  << " in Online and Offline modes.";
472 
473  nrun_ = 0;
474  }
475 }
void saveForOnline(const std::string &suffix, const std::string &rewrite)
Convention convention_
Definition: DQMFileSaver.h:35
std::string workflow_
Definition: DQMFileSaver.h:36
void saveForOffline(const std::string &workflow, int run, int lumi)
Definition: DQMFileSaver.cc:32
void DQMFileSaver::saveForOffline ( const std::string &  workflow,
int  run,
int  lumi 
)
private

Definition at line 32 of file DQMFileSaver.cc.

References DQMStore::bookFloat(), DQMStore::bookString(), DQMStore::cd(), gather_cfg::cout, dbe_, fileBaseName_, lut2db_cfg::filename, fileUpdate_, MonitorElement::Fill(), DQMStore::get(), edm::getReleaseVersion(), DQMStore::getSubdirs(), i, ilumi_, irun_, pastSavedFiles_, pos, runIsComplete_, DQMStore::save(), saveJobReport(), saveReference_, saveReferenceQMin_, DQMStore::SaveWithoutReference, DQMStore::setCurrentFolder(), dqm::qstatus::STATUS_OK, createPayload::suffix, and reco_calib_source_client_cfg::workflow.

Referenced by endJob(), endLuminosityBlock(), and endRun().

33 {
34 
35  char suffix[64];
36  sprintf(suffix, "R%09d", run);
37 
38  char rewrite[128];
39  if (lumi == 0) // save for run
40  sprintf(rewrite, "\\1Run %d/\\2/Run summary", run);
41  else
42  sprintf(rewrite, "\\1Run %d/\\2/By Lumi Section %d-%d", irun_, ilumi_, ilumi_);
43 
44  size_t pos = 0;
45  std::string wflow;
46  wflow.reserve(workflow.size() + 3);
47  wflow = workflow;
48  while ((pos = wflow.find('/', pos)) != std::string::npos)
49  wflow.replace(pos++, 1, "__");
50 
51  std::string filename = fileBaseName_ + suffix + wflow + ".root";
52 
53  if (lumi == 0) // save for run
54  {
55  // set run end flag
56  dbe_->cd();
57  dbe_->setCurrentFolder("Info/ProvInfo");
58 
59  // do this, because ProvInfo is not yet run in offline DQM
60  MonitorElement* me = dbe_->get("Info/ProvInfo/CMSSW");
61  if (!me) me = dbe_->bookString("CMSSW",edm::getReleaseVersion().c_str() );
62 
63  me = dbe_->get("Info/ProvInfo/runIsComplete");
64  if (!me) me = dbe_->bookFloat("runIsComplete");
65 
66  if (me)
67  {
68  if (runIsComplete_)
69  me->Fill(1.);
70  else
71  me->Fill(0.);
72  }
73 
74  dbe_->save(filename,
75  "",
76  "^(Reference/)?([^/]+)",
77  rewrite,
80  fileUpdate_);
81  }
82  else // save EventInfo folders for luminosity sections
83  {
84  std::vector<std::string> systems = (dbe_->cd(), dbe_->getSubdirs());
85 
86  std::cout << " DQMFileSaver: storing EventInfo folders for Run: "
87  << irun_ << ", Lumi Section: " << ilumi_ << ", Subsystems: " ;
88 
89  for (size_t i = 0, e = systems.size(); i != e; ++i) {
90  if (systems[i] != "Reference") {
91  dbe_->cd();
92  std::cout << systems[i] << " " ;
93  dbe_->save(filename,
94  systems[i]+"/EventInfo", "^(Reference/)?([^/]+)", rewrite,
97  fileUpdate_);
98  // from now on update newly created file
99  if (fileUpdate_=="RECREATE") fileUpdate_="UPDATE";
100  }
101  }
102  std::cout << "\n";
103  }
104 
105  if (pastSavedFiles_.size() == 0)
106  {
107  // save JobReport upon creation of file (once per job)
108  saveJobReport(filename);
109  pastSavedFiles_.push_back(filename);
110  }
111 
112 }
int i
Definition: DBlmapReader.cc:9
int saveReferenceQMin_
Definition: DQMFileSaver.h:49
std::vector< std::string > getSubdirs(void) const
Definition: DQMStore.cc:1216
std::string fileUpdate_
Definition: DQMFileSaver.h:53
void cd(void)
go to top directory (ie. root)
Definition: DQMStore.cc:209
tuple lumi
Definition: fjr2json.py:41
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")
Definition: DQMStore.cc:1898
std::list< std::string > pastSavedFiles_
Definition: DQMFileSaver.h:68
DQMStore * dbe_
Definition: DQMFileSaver.h:55
void saveJobReport(const std::string &filename)
std::string fileBaseName_
Definition: DQMFileSaver.h:52
MonitorElement * bookFloat(const char *name)
Book float.
Definition: DQMStore.cc:451
SaveReferenceTag
Definition: DQMStore.h:38
void Fill(long long x)
MonitorElement * bookString(const char *name, const char *value)
Book string.
Definition: DQMStore.cc:480
bool runIsComplete_
Definition: DQMFileSaver.h:40
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1265
std::string getReleaseVersion()
int saveReference_
Definition: DQMFileSaver.h:48
tuple filename
Definition: lut2db_cfg.py:20
static const int STATUS_OK
tuple cout
Definition: gather_cfg.py:41
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:232
void DQMFileSaver::saveForOnline ( const std::string &  suffix,
const std::string &  rewrite 
)
private

Definition at line 136 of file DQMFileSaver.cc.

References DQMStore::cd(), dbe_, doSaveForOnline(), fileBaseName_, DQMStore::get(), DQMStore::getSubdirs(), i, numKeepSavedFiles_, pastSavedFiles_, saveReference_, and saveReferenceQMin_.

Referenced by analyze(), endLuminosityBlock(), and endRun().

137 {
138  std::vector<std::string> systems = (dbe_->cd(), dbe_->getSubdirs());
139 
140  for (size_t i = 0, e = systems.size(); i != e; ++i)
141  {
142  if (systems[i] != "Reference")
143  {
144  dbe_->cd();
145  if (MonitorElement* me = dbe_->get(systems[i] + "/EventInfo/processName"))
146  {
148  fileBaseName_ + me->getStringValue() + suffix + ".root",
149  "", "^(Reference/)?([^/]+)", rewrite,
152  return;
153  }
154  }
155  }
156 
157  // if no EventInfo Folder is found, then store subsystem wise
158  for (size_t i = 0, e = systems.size(); i != e; ++i)
159  if (systems[i] != "Reference")
161  fileBaseName_ + systems[i] + suffix + ".root",
162  systems[i], "^(Reference/)?([^/]+)", rewrite,
165 }
int i
Definition: DBlmapReader.cc:9
int saveReferenceQMin_
Definition: DQMFileSaver.h:49
std::vector< std::string > getSubdirs(void) const
Definition: DQMStore.cc:1216
void cd(void)
go to top directory (ie. root)
Definition: DQMStore.cc:209
std::list< std::string > pastSavedFiles_
Definition: DQMFileSaver.h:68
DQMStore * dbe_
Definition: DQMFileSaver.h:55
std::string fileBaseName_
Definition: DQMFileSaver.h:52
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)
SaveReferenceTag
Definition: DQMStore.h:38
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1265
int saveReference_
Definition: DQMFileSaver.h:48
int numKeepSavedFiles_
Definition: DQMFileSaver.h:67
void DQMFileSaver::saveJobReport ( const std::string &  filename)
private

Definition at line 168 of file DQMFileSaver.cc.

References info, edm::Service< T >::isAvailable(), and edm::JobReport::reportAnalysisFile().

Referenced by saveForOffline().

169 {
170 
171  // Report the file to job report service.
173  if (jr.isAvailable())
174  {
175  std::map<std::string, std::string> info;
176  info["Source"] = "DQMStore";
177  info["FileClass"] = "DQM";
178  jr->reportAnalysisFile(filename, info);
179  }
180 
181 }
void reportAnalysisFile(std::string const &fileName, std::map< std::string, std::string > const &fileData)
Definition: JobReport.cc:652
bool isAvailable() const
Definition: Service.h:47
tuple filename
Definition: lut2db_cfg.py:20

Member Data Documentation

Convention DQMFileSaver::convention_
private

Definition at line 35 of file DQMFileSaver.h.

Referenced by analyze(), DQMFileSaver(), endJob(), endLuminosityBlock(), and endRun().

DQMStore* DQMFileSaver::dbe_
private

Definition at line 55 of file DQMFileSaver.h.

Referenced by saveForOffline(), and saveForOnline().

std::string DQMFileSaver::dirName_
private

Definition at line 38 of file DQMFileSaver.h.

Referenced by DQMFileSaver().

std::string DQMFileSaver::fileBaseName_
private

Definition at line 52 of file DQMFileSaver.h.

Referenced by DQMFileSaver(), saveForOffline(), and saveForOnline().

std::string DQMFileSaver::fileUpdate_
private

Definition at line 53 of file DQMFileSaver.h.

Referenced by saveForOffline().

MonitorElement* DQMFileSaver::fileVersion_
private

Definition at line 79 of file DQMFileSaver.h.

int DQMFileSaver::forceRunNumber_
private

Definition at line 50 of file DQMFileSaver.h.

Referenced by beginRun(), DQMFileSaver(), and endJob().

MonitorElement* DQMFileSaver::hostName_
private

Definition at line 74 of file DQMFileSaver.h.

int DQMFileSaver::ievent_
private

Definition at line 60 of file DQMFileSaver.h.

Referenced by analyze(), and beginJob().

int DQMFileSaver::ilumi_
private

Definition at line 58 of file DQMFileSaver.h.

Referenced by beginJob(), beginLuminosityBlock(), endLuminosityBlock(), and saveForOffline().

int DQMFileSaver::ilumiprev_
private

Definition at line 59 of file DQMFileSaver.h.

Referenced by beginJob(), beginLuminosityBlock(), and endLuminosityBlock().

int DQMFileSaver::irun_
private

Definition at line 57 of file DQMFileSaver.h.

Referenced by analyze(), beginJob(), beginRun(), endLuminosityBlock(), endRun(), and saveForOffline().

MonitorElement* DQMFileSaver::isComplete_
private

The PID associated with this job.

Definition at line 78 of file DQMFileSaver.h.

int DQMFileSaver::nevent_
private

Definition at line 63 of file DQMFileSaver.h.

Referenced by analyze(), and beginJob().

int DQMFileSaver::nlumi_
private

Definition at line 62 of file DQMFileSaver.h.

Referenced by beginJob(), beginLuminosityBlock(), and endLuminosityBlock().

int DQMFileSaver::nrun_
private

Definition at line 61 of file DQMFileSaver.h.

Referenced by beginJob(), beginRun(), and endRun().

int DQMFileSaver::numKeepSavedFiles_
private

Definition at line 67 of file DQMFileSaver.h.

Referenced by DQMFileSaver(), and saveForOnline().

std::list<std::string> DQMFileSaver::pastSavedFiles_
private

Definition at line 68 of file DQMFileSaver.h.

Referenced by saveForOffline(), and saveForOnline().

MonitorElement* DQMFileSaver::processId_
private

Current working directory of the job.

Definition at line 77 of file DQMFileSaver.h.

MonitorElement* DQMFileSaver::processName_
private

Hostname of the local machine.

Definition at line 75 of file DQMFileSaver.h.

std::string DQMFileSaver::producer_
private

Definition at line 37 of file DQMFileSaver.h.

Referenced by DQMFileSaver().

bool DQMFileSaver::runIsComplete_
private

Definition at line 40 of file DQMFileSaver.h.

Referenced by DQMFileSaver(), and saveForOffline().

bool DQMFileSaver::saveAtJobEnd_
private

Definition at line 47 of file DQMFileSaver.h.

Referenced by DQMFileSaver(), and endJob().

int DQMFileSaver::saveByEvent_
private

Definition at line 43 of file DQMFileSaver.h.

Referenced by analyze(), and DQMFileSaver().

int DQMFileSaver::saveByLumiSection_
private

Definition at line 42 of file DQMFileSaver.h.

Referenced by DQMFileSaver(), and endLuminosityBlock().

int DQMFileSaver::saveByMinute_
private

Definition at line 44 of file DQMFileSaver.h.

Referenced by analyze(), and DQMFileSaver().

int DQMFileSaver::saveByRun_
private

Definition at line 46 of file DQMFileSaver.h.

Referenced by DQMFileSaver(), and endRun().

int DQMFileSaver::saveByTime_
private

Definition at line 45 of file DQMFileSaver.h.

Referenced by analyze(), and DQMFileSaver().

timeval DQMFileSaver::saved_
private

Definition at line 65 of file DQMFileSaver.h.

Referenced by analyze(), and DQMFileSaver().

int DQMFileSaver::saveReference_
private

Definition at line 48 of file DQMFileSaver.h.

Referenced by DQMFileSaver(), saveForOffline(), and saveForOnline().

int DQMFileSaver::saveReferenceQMin_
private

Definition at line 49 of file DQMFileSaver.h.

Referenced by DQMFileSaver(), saveForOffline(), and saveForOnline().

timeval DQMFileSaver::start_
private

Definition at line 64 of file DQMFileSaver.h.

Referenced by analyze(), and DQMFileSaver().

MonitorElement* DQMFileSaver::versCMSSW_
private

Definition at line 70 of file DQMFileSaver.h.

MonitorElement* DQMFileSaver::versDataset_
private

Definition at line 71 of file DQMFileSaver.h.

MonitorElement* DQMFileSaver::versGlobaltag_
private

Definition at line 73 of file DQMFileSaver.h.

int DQMFileSaver::version_
private

Definition at line 39 of file DQMFileSaver.h.

Referenced by DQMFileSaver().

MonitorElement* DQMFileSaver::versTaglist_
private

Definition at line 72 of file DQMFileSaver.h.

std::string DQMFileSaver::workflow_
private

Definition at line 36 of file DQMFileSaver.h.

Referenced by DQMFileSaver(), endJob(), endLuminosityBlock(), and endRun().

MonitorElement* DQMFileSaver::workingDir_
private

DQM "name" of the job (eg, Hcal or DT)

Definition at line 76 of file DQMFileSaver.h.