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 315 of file EPStates.h.

Member Typedef Documentation

Definition at line 341 of file EPStates.h.

Constructor & Destructor Documentation

statemachine::HandleLumis::HandleLumis ( my_context  ctx)

Definition at line 369 of file EPStates.cc.

References checkInvariant().

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

Definition at line 388 of file EPStates.cc.

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

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

Member Function Documentation

bool statemachine::HandleLumis::checkInvariant ( )

Definition at line 403 of file EPStates.cc.

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

403  {
404  assert(context<HandleRuns>().currentRun() != INVALID_RUN);
405  return true;
406  }
HandleLumis::LumiID const & statemachine::HandleLumis::currentLumi ( ) const

Definition at line 408 of file EPStates.cc.

References currentLumi_.

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

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

Definition at line 410 of file EPStates.cc.

References currentLumiEmpty_.

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

Definition at line 379 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().

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

Definition at line 429 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().

429  {
430 
431  lumiException_ = true;
432 
433  if(!currentLumiEmpty_ ||
434  context<Machine>().emptyRunLumiMode() == handleEmptyRunsAndLumis) {
435  ep_.endLumi(currentLumi().processHistoryID(), currentLumi().run(), currentLumi().lumi(), cleaningUpAfterException);
436  }
437 
438  ep_.writeLumi(currentLumi().processHistoryID(), currentLumi().run(), currentLumi().lumi());
439  ep_.deleteLumiFromCache(currentLumi().processHistoryID(), currentLumi().run(), currentLumi().lumi());
440  currentLumi_ = InvalidLumiID;
441 
442  lumiException_ = false;
443  }
edm::IEventProcessor & ep_
Definition: EPStates.h:344
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:408
virtual void deleteLumiFromCache(ProcessHistoryID const &phid, RunNumber_t run, LuminosityBlockNumber_t lumi)=0
void statemachine::HandleLumis::markLumiNonEmpty ( )

Definition at line 445 of file EPStates.cc.

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

445  {
446  if(currentLumiEmpty_) {
447 
448  if(context<Machine>().emptyRunLumiMode() != handleEmptyRunsAndLumis) {
449  lumiException_ = true;
450  ep_.beginLumi(currentLumi().processHistoryID(), currentLumi().run(), currentLumi().lumi());
451  lumiException_ = false;
452  }
453  currentLumiEmpty_ = false;
454  }
455  }
edm::IEventProcessor & ep_
Definition: EPStates.h:344
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:408
void statemachine::HandleLumis::setupCurrentLumi ( )

Definition at line 412 of file EPStates.cc.

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

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

Member Data Documentation

LumiID statemachine::HandleLumis::currentLumi_
private

Definition at line 347 of file EPStates.h.

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

bool statemachine::HandleLumis::currentLumiEmpty_
private

Definition at line 346 of file EPStates.h.

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

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

Definition at line 344 of file EPStates.h.

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

bool statemachine::HandleLumis::exitCalled_
private

Definition at line 345 of file EPStates.h.

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

bool statemachine::HandleLumis::lumiException_
private

Definition at line 348 of file EPStates.h.

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