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 ()
 
 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 313 of file EPStates.h.

Member Typedef Documentation

Definition at line 339 of file EPStates.h.

Constructor & Destructor Documentation

statemachine::HandleLumis::HandleLumis ( my_context  ctx)

Definition at line 437 of file EPStates.cc.

References checkInvariant().

437  :
438  my_base(ctx),
439  ep_(context<Machine>().ep()),
440  exitCalled_(false),
441  currentLumiEmpty_(true),
442  currentLumi_(InvalidLumiID),
443  lumiException_(false)
444  {
445  checkInvariant();
446  }
edm::IEventProcessor & ep_
Definition: EPStates.h:342
statemachine::HandleLumis::~HandleLumis ( )

Definition at line 457 of file EPStates.cc.

References checkInvariant(), ep_, cmsCodeRules.cppFunctionSkipper::exception, exitCalled_, cms::Exception::explainSelf(), finalizeLumi(), lumiException_, argparse::message, runTheMatrix::msg, and edm::IEventProcessor::setExceptionMessageLumis().

457  {
458  if (!exitCalled_) {
459  try {
460  checkInvariant();
461  if (!lumiException_ && !context<HandleRuns>().runException()) {
462  finalizeLumi();
463  }
464  }
465  catch (cms::Exception& e) {
466  std::ostringstream message;
467  message << "------------------------------------------------------------\n"
468  << "Another exception was caught while trying to clean up lumis after\n"
469  << "the primary exception. We give up trying to clean up lumis at\n"
470  << "this point. The description of this additional exception follows:\n"
471  << "cms::Exception\n"
472  << e.explainSelf();
473  std::string msg(message.str());
475  }
476  catch (std::bad_alloc& e) {
477  std::ostringstream message;
478  message << "------------------------------------------------------------\n"
479  << "Another exception was caught while trying to clean up lumis\n"
480  << "after the primary exception. We give up trying to clean up lumis\n"
481  << "at this point. This additional exception was a\n"
482  << "std::bad_alloc exception thrown inside HandleLumis::finalizeLumi.\n"
483  << "The job has probably exhausted the virtual memory available\n"
484  << "to the process.\n";
485  std::string msg(message.str());
487  }
488  catch (std::exception& e) {
489  std::ostringstream message;
490  message << "------------------------------------------------------------\n"
491  << "Another exception was caught while trying to clean up lumis after\n"
492  << "the primary exception. We give up trying to clean up lumis at\n"
493  << "this point. This additional exception was a\n"
494  << "standard library exception thrown inside HandleLumis::finalizeLumi\n"
495  << e.what() << "\n";
496  std::string msg(message.str());
498  }
499  catch (...) {
500  std::ostringstream message;
501  message << "------------------------------------------------------------\n"
502  << "Another exception was caught while trying to clean up lumis after\n"
503  << "the primary exception. We give up trying to clean up lumis at\n"
504  << "this point. This additional exception was of unknown type and\n"
505  << "thrown inside HandleLumis::finalizeLumi\n";
506  std::string msg(message.str());
508  }
509  }
510  }
edm::IEventProcessor & ep_
Definition: EPStates.h:342
virtual std::string explainSelf() const
Definition: Exception.cc:56
virtual void setExceptionMessageLumis(std::string &message)=0
string message
Definition: argparse.py:126

Member Function Documentation

bool statemachine::HandleLumis::checkInvariant ( )

Definition at line 512 of file EPStates.cc.

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

512  {
513  assert(context<HandleRuns>().currentRun() != INVALID_RUN);
514  return true;
515  }
HandleLumis::LumiID const & statemachine::HandleLumis::currentLumi ( ) const

Definition at line 517 of file EPStates.cc.

References currentLumi_.

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

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

Definition at line 519 of file EPStates.cc.

References currentLumiEmpty_.

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

Definition at line 448 of file EPStates.cc.

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

Referenced by argparse.ArgumentParser::error().

448  {
449  if (ep_.alreadyHandlingException()) return;
450  exitCalled_ = true;
451  checkInvariant();
452  if (!lumiException_ && !context<HandleRuns>().runException()) {
453  finalizeLumi();
454  }
455  }
edm::IEventProcessor & ep_
Definition: EPStates.h:342
virtual bool alreadyHandlingException() const =0
void statemachine::HandleLumis::finalizeLumi ( )

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

538  {
539 
540  lumiException_ = true;
541 
542  if (!currentLumiEmpty_ ||
543  context<Machine>().emptyRunLumiMode() == handleEmptyRunsAndLumis) {
544  ep_.endLumi(currentLumi().processHistoryID(), currentLumi().run(), currentLumi().lumi());
545  }
546 
547  ep_.writeLumi(currentLumi().processHistoryID(), currentLumi().run(), currentLumi().lumi());
548  ep_.deleteLumiFromCache(currentLumi().processHistoryID(), currentLumi().run(), currentLumi().lumi());
549  currentLumi_ = InvalidLumiID;
550 
551  lumiException_ = false;
552  }
edm::IEventProcessor & ep_
Definition: EPStates.h:342
virtual void writeLumi(ProcessHistoryID const &phid, int run, int lumi)=0
tuple lumi
Definition: fjr2json.py:41
LumiID const & currentLumi() const
Definition: EPStates.cc:517
virtual void deleteLumiFromCache(ProcessHistoryID const &phid, int run, int lumi)=0
virtual void endLumi(ProcessHistoryID const &phid, int run, int lumi)=0
void statemachine::HandleLumis::markLumiNonEmpty ( )

Definition at line 554 of file EPStates.cc.

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

554  {
555  if (currentLumiEmpty_) {
556 
557  if (context<Machine>().emptyRunLumiMode() != handleEmptyRunsAndLumis) {
558  lumiException_ = true;
559  ep_.beginLumi(currentLumi().processHistoryID(), currentLumi().run(), currentLumi().lumi());
560  lumiException_ = false;
561  }
562  currentLumiEmpty_ = false;
563  }
564  }
edm::IEventProcessor & ep_
Definition: EPStates.h:342
tuple lumi
Definition: fjr2json.py:41
LumiID const & currentLumi() const
Definition: EPStates.cc:517
virtual void beginLumi(ProcessHistoryID const &phid, int run, int lumi)=0
void statemachine::HandleLumis::setupCurrentLumi ( )

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

521  {
522 
523  Run const& run = context<HandleRuns>().currentRun();
524  assert (run != INVALID_RUN);
525  lumiException_ = true;
526  currentLumi_ = HandleLumis::LumiID(run.processHistoryID(), run.runNumber(), ep_.readAndCacheLumi());
527 
528  if (context<Machine>().emptyRunLumiMode() == handleEmptyRunsAndLumis) {
529  assert(context<HandleRuns>().beginRunCalled());
530  ep_.beginLumi(currentLumi().processHistoryID(), currentLumi().run(), currentLumi().lumi());
531  }
532 
533  lumiException_ = false;
534 
535  currentLumiEmpty_ = true;
536  }
edm::IEventProcessor & ep_
Definition: EPStates.h:342
virtual int readAndCacheLumi()=0
tuple lumi
Definition: fjr2json.py:41
LumiID const & currentLumi() const
Definition: EPStates.cc:517
virtual void beginLumi(ProcessHistoryID const &phid, int run, int lumi)=0

Member Data Documentation

LumiID statemachine::HandleLumis::currentLumi_
private

Definition at line 345 of file EPStates.h.

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

bool statemachine::HandleLumis::currentLumiEmpty_
private

Definition at line 344 of file EPStates.h.

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

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

Definition at line 342 of file EPStates.h.

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

bool statemachine::HandleLumis::exitCalled_
private

Definition at line 343 of file EPStates.h.

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

bool statemachine::HandleLumis::lumiException_
private

Definition at line 346 of file EPStates.h.

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