CMS 3D CMS Logo

Classes | Public Types | Public Member Functions | Private Attributes

statemachine::HandleLumis Class Reference

#include <EPStates.h>

Inheritance diagram for statemachine::HandleLumis:
state

List of all members.

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

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

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().

                                         :
    my_base(ctx),
    ep_(context<Machine>().ep()),
    exitCalled_(false),
    currentLumiEmpty_(true),
    currentLumi_(InvalidLumiID),
    lumiException_(false)
  { 
    checkInvariant();
  }
statemachine::HandleLumis::~HandleLumis ( )

Definition at line 457 of file EPStates.cc.

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

                            {
    if (!exitCalled_) {
      try {
        checkInvariant();
        if (!lumiException_ && !context<HandleRuns>().runException()) {
          finalizeLumi();
        }
      }
      catch (cms::Exception& e) {
        std::ostringstream message;
        message << "------------------------------------------------------------\n"
                << "Another exception was caught while trying to clean up lumis after\n" 
                << "the primary exception.  We give up trying to clean up lumis at\n"
                << "this point.  The description of this additional exception follows:\n" 
                << "cms::Exception\n"
                << e.explainSelf();
        std::string msg(message.str());
        ep_.setExceptionMessageLumis(msg);
      }
      catch (std::bad_alloc& e) {
        std::ostringstream message;
        message << "------------------------------------------------------------\n"
                << "Another exception was caught while trying to clean up lumis\n" 
                << "after the primary exception.  We give up trying to clean up lumis\n"
                << "at this point.  This additional exception was a\n" 
                << "std::bad_alloc exception thrown inside HandleLumis::finalizeLumi.\n"
                << "The job has probably exhausted the virtual memory available\n"
                << "to the process.\n";
        std::string msg(message.str());
        ep_.setExceptionMessageLumis(msg);
      }
      catch (std::exception& e) {
        std::ostringstream message;
        message << "------------------------------------------------------------\n"
                << "Another exception was caught while trying to clean up lumis after\n" 
                << "the primary exception.  We give up trying to clean up lumis at\n"
                << "this point.  This additional exception was a\n" 
                << "standard library exception thrown inside HandleLumis::finalizeLumi\n"
                << e.what() << "\n";
        std::string msg(message.str());
        ep_.setExceptionMessageLumis(msg);
      }
      catch (...) {
        std::ostringstream message;
        message << "------------------------------------------------------------\n"
                << "Another exception was caught while trying to clean up lumis after\n" 
                << "the primary exception.  We give up trying to clean up lumis at\n"
                << "this point.  This additional exception was of unknown type and\n" 
                << "thrown inside HandleLumis::finalizeLumi\n";
        std::string msg(message.str());
        ep_.setExceptionMessageLumis(msg);
      }
    }
  }

Member Function Documentation

bool statemachine::HandleLumis::checkInvariant ( )

Definition at line 512 of file EPStates.cc.

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

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

Definition at line 517 of file EPStates.cc.

References currentLumi_.

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

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

Definition at line 519 of file EPStates.cc.

References currentLumiEmpty_.

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

Definition at line 448 of file EPStates.cc.

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

                         {
    if (ep_.alreadyHandlingException()) return;
    exitCalled_ = true;
    checkInvariant();
    if (!lumiException_ && !context<HandleRuns>().runException()) {
      finalizeLumi();
    }
  }
void statemachine::HandleLumis::finalizeLumi ( )
void statemachine::HandleLumis::markLumiNonEmpty ( )
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(), CrabTask::run, and statemachine::Run::runNumber().

                                     {

    Run const& run = context<HandleRuns>().currentRun();
    assert (run != INVALID_RUN);
    lumiException_ = true;
    currentLumi_ = HandleLumis::LumiID(run.processHistoryID(), run.runNumber(), ep_.readAndCacheLumi());

    if (context<Machine>().emptyRunLumiMode() == handleEmptyRunsAndLumis) {
      assert(context<HandleRuns>().beginRunCalled());
      ep_.beginLumi(currentLumi().processHistoryID(), currentLumi().run(), currentLumi().lumi());
    }

    lumiException_ = false;

    currentLumiEmpty_ = true;
  }

Member Data Documentation

Definition at line 345 of file EPStates.h.

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

Definition at line 344 of file EPStates.h.

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

Definition at line 342 of file EPStates.h.

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

Definition at line 343 of file EPStates.h.

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

Definition at line 346 of file EPStates.h.

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