CMS 3D CMS Logo

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

#include <EPStates.h>

Inheritance diagram for statemachine::HandleLumis:

Classes

class  LumiID
 

Public Types

typedef sc::transition< Run,
NewRun, HandleRuns,&HandleRuns::finalizeRun
reactions
 

Public Member Functions

bool checkInvariant ()
 
LumiID const & currentLumi () const
 
bool currentLumiEmpty () const
 
void exit ()
 
void finalizeLumi (bool cleaningUpAfterException)
 
 HandleLumis (my_context ctx)
 
void markLumiNonEmpty ()
 
void setupCurrentLumi ()
 
 ~HandleLumis ()
 

Private Attributes

LumiID currentLumi_
 
bool currentLumiEmpty_
 
edm::IEventProcessorep_
 
bool exitCalled_
 
bool lumiException_
 

Detailed Description

Definition at line 316 of file EPStates.h.

Member Typedef Documentation

Definition at line 342 of file EPStates.h.

Constructor & Destructor Documentation

statemachine::HandleLumis::HandleLumis ( my_context  ctx)

Definition at line 366 of file EPStates.cc.

References checkInvariant().

366  :
367  my_base(ctx),
368  ep_(context<Machine>().ep()),
369  exitCalled_(false),
370  currentLumiEmpty_(true),
371  currentLumi_(InvalidLumiID),
372  lumiException_(false) {
373  checkInvariant();
374  }
edm::IEventProcessor & ep_
Definition: EPStates.h:345
statemachine::HandleLumis::~HandleLumis ( )

Definition at line 385 of file EPStates.cc.

References checkInvariant(), ep_, exitCalled_, finalizeLumi(), lumiException_, python.rootplot.argparse::message, edm::IEventProcessor::setExceptionMessageLumis(), and AlCaHLTBitMon_QueryRunRegistry::string.

385  {
386  if(!exitCalled_) {
387  try {
388  checkInvariant();
389  if(!lumiException_ && !context<HandleRuns>().runException()) {
390  finalizeLumi(true);
391  }
392  }
393  catch(...) {
394  std::string message("Another exception was caught while trying to clean up lumis after the primary fatal exception.");
396  }
397  }
398  }
edm::IEventProcessor & ep_
Definition: EPStates.h:345
virtual void setExceptionMessageLumis(std::string &message)=0
void finalizeLumi(bool cleaningUpAfterException)
Definition: EPStates.cc:426

Member Function Documentation

bool statemachine::HandleLumis::checkInvariant ( )

Definition at line 400 of file EPStates.cc.

References assert().

Referenced by exit(), HandleLumis(), and ~HandleLumis().

400  {
401  assert(context<HandleRuns>().currentRun() != INVALID_RUN);
402  return true;
403  }
assert(m_qm.get())
HandleLumis::LumiID const & statemachine::HandleLumis::currentLumi ( ) const

Definition at line 405 of file EPStates.cc.

References currentLumi_.

Referenced by finalizeLumi(), markLumiNonEmpty(), and setupCurrentLumi().

405 { return currentLumi_; }
bool statemachine::HandleLumis::currentLumiEmpty ( ) const

Definition at line 407 of file EPStates.cc.

References currentLumiEmpty_.

407 { return currentLumiEmpty_; }
void statemachine::HandleLumis::exit ( )

Definition at line 376 of file EPStates.cc.

References edm::IEventProcessor::alreadyHandlingException(), checkInvariant(), ep_, exitCalled_, finalizeLumi(), and lumiException_.

Referenced by argparse.ArgumentParser::error(), and python.rootplot.argparse.ArgumentParser::error().

376  {
377  if(ep_.alreadyHandlingException()) return;
378  exitCalled_ = true;
379  checkInvariant();
380  if(!lumiException_ && !context<HandleRuns>().runException()) {
381  finalizeLumi(false);
382  }
383  }
edm::IEventProcessor & ep_
Definition: EPStates.h:345
void finalizeLumi(bool cleaningUpAfterException)
Definition: EPStates.cc:426
virtual bool alreadyHandlingException() const =0
void statemachine::HandleLumis::finalizeLumi ( bool  cleaningUpAfterException)

Definition at line 426 of file EPStates.cc.

References currentLumi(), currentLumi_, currentLumiEmpty_, edm::IEventProcessor::deleteLumiFromCache(), edm::IEventProcessor::endLumi(), ep_, statemachine::handleEmptyRunsAndLumis, fjr2json::lumi, lumiException_, DTTTrigCorrFirst::run, and edm::IEventProcessor::writeLumi().

Referenced by exit(), and ~HandleLumis().

426  {
427 
428  lumiException_ = true;
429 
430  if(!currentLumiEmpty_ ||
431  context<Machine>().emptyRunLumiMode() == handleEmptyRunsAndLumis) {
432  ep_.endLumi(currentLumi().processHistoryID(), currentLumi().run(), currentLumi().lumi(), cleaningUpAfterException);
433  }
434 
435  ep_.writeLumi(currentLumi().processHistoryID(), currentLumi().run(), currentLumi().lumi());
436  ep_.deleteLumiFromCache(currentLumi().processHistoryID(), currentLumi().run(), currentLumi().lumi());
437  currentLumi_ = InvalidLumiID;
438 
439  lumiException_ = false;
440  }
edm::IEventProcessor & ep_
Definition: EPStates.h:345
tuple lumi
Definition: fjr2json.py:35
virtual void writeLumi(ProcessHistoryID const &phid, RunNumber_t run, LuminosityBlockNumber_t lumi)=0
virtual void endLumi(ProcessHistoryID const &phid, RunNumber_t run, LuminosityBlockNumber_t lumi, bool cleaningUpAfterException)=0
LumiID const & currentLumi() const
Definition: EPStates.cc:405
virtual void deleteLumiFromCache(ProcessHistoryID const &phid, RunNumber_t run, LuminosityBlockNumber_t lumi)=0
void statemachine::HandleLumis::markLumiNonEmpty ( )

Definition at line 442 of file EPStates.cc.

References edm::IEventProcessor::beginLumi(), currentLumi(), currentLumiEmpty_, ep_, statemachine::handleEmptyRunsAndLumis, fjr2json::lumi, lumiException_, and DTTTrigCorrFirst::run.

442  {
443  if(currentLumiEmpty_) {
444 
445  if(context<Machine>().emptyRunLumiMode() != handleEmptyRunsAndLumis) {
446  lumiException_ = true;
447  ep_.beginLumi(currentLumi().processHistoryID(), currentLumi().run(), currentLumi().lumi());
448  lumiException_ = false;
449  }
450  currentLumiEmpty_ = false;
451  }
452  }
edm::IEventProcessor & ep_
Definition: EPStates.h:345
virtual void beginLumi(ProcessHistoryID const &phid, RunNumber_t run, LuminosityBlockNumber_t lumi)=0
tuple lumi
Definition: fjr2json.py:35
LumiID const & currentLumi() const
Definition: EPStates.cc:405
void statemachine::HandleLumis::setupCurrentLumi ( )

Definition at line 409 of file EPStates.cc.

References assert(), edm::IEventProcessor::beginLumi(), currentLumi(), currentLumi_, currentLumiEmpty_, ep_, statemachine::handleEmptyRunsAndLumis, fjr2json::lumi, lumiException_, statemachine::Run::processHistoryID(), edm::IEventProcessor::readLuminosityBlock(), DTTTrigCorrFirst::run, and statemachine::Run::runNumber().

409  {
410 
411  Run const& run = context<HandleRuns>().currentRun();
412  assert(run != INVALID_RUN);
413  lumiException_ = true;
414  currentLumi_ = HandleLumis::LumiID(run.processHistoryID(), run.runNumber(), ep_.readLuminosityBlock());
415 
416  if(context<Machine>().emptyRunLumiMode() == handleEmptyRunsAndLumis) {
417  assert(context<HandleRuns>().beginRunCalled());
418  ep_.beginLumi(currentLumi().processHistoryID(), currentLumi().run(), currentLumi().lumi());
419  }
420 
421  lumiException_ = false;
422 
423  currentLumiEmpty_ = true;
424  }
edm::IEventProcessor & ep_
Definition: EPStates.h:345
virtual void beginLumi(ProcessHistoryID const &phid, RunNumber_t run, LuminosityBlockNumber_t lumi)=0
tuple lumi
Definition: fjr2json.py:35
assert(m_qm.get())
virtual int readLuminosityBlock()=0
LumiID const & currentLumi() const
Definition: EPStates.cc:405

Member Data Documentation

LumiID statemachine::HandleLumis::currentLumi_
private

Definition at line 348 of file EPStates.h.

Referenced by currentLumi(), finalizeLumi(), and setupCurrentLumi().

bool statemachine::HandleLumis::currentLumiEmpty_
private

Definition at line 347 of file EPStates.h.

Referenced by currentLumiEmpty(), finalizeLumi(), markLumiNonEmpty(), and setupCurrentLumi().

edm::IEventProcessor& statemachine::HandleLumis::ep_
private

Definition at line 345 of file EPStates.h.

Referenced by exit(), finalizeLumi(), markLumiNonEmpty(), setupCurrentLumi(), and ~HandleLumis().

bool statemachine::HandleLumis::exitCalled_
private

Definition at line 346 of file EPStates.h.

Referenced by exit(), and ~HandleLumis().

bool statemachine::HandleLumis::lumiException_
private

Definition at line 349 of file EPStates.h.

Referenced by exit(), finalizeLumi(), markLumiNonEmpty(), setupCurrentLumi(), and ~HandleLumis().