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

Member Typedef Documentation

Definition at line 340 of file EPStates.h.

Constructor & Destructor Documentation

statemachine::HandleLumis::HandleLumis ( my_context  ctx)

Definition at line 365 of file EPStates.cc.

References checkInvariant().

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

Definition at line 384 of file EPStates.cc.

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

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

Member Function Documentation

bool statemachine::HandleLumis::checkInvariant ( )

Definition at line 399 of file EPStates.cc.

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

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

Definition at line 404 of file EPStates.cc.

References currentLumi_.

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

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

Definition at line 406 of file EPStates.cc.

References currentLumiEmpty_.

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

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

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

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

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

Definition at line 441 of file EPStates.cc.

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

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

Definition at line 408 of file EPStates.cc.

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

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

Member Data Documentation

LumiID statemachine::HandleLumis::currentLumi_
private

Definition at line 346 of file EPStates.h.

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

bool statemachine::HandleLumis::currentLumiEmpty_
private

Definition at line 345 of file EPStates.h.

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

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

Definition at line 343 of file EPStates.h.

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

bool statemachine::HandleLumis::exitCalled_
private

Definition at line 344 of file EPStates.h.

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

bool statemachine::HandleLumis::lumiException_
private

Definition at line 347 of file EPStates.h.

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