CMS 3D CMS Logo

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

#include <EPStates.h>

Inheritance diagram for statemachine::HandleRuns:

Public Types

typedef sc::transition< File,
NewInputAndOutputFiles
reactions
 

Public Member Functions

void beginRun (Run const &run)
 
bool beginRunCalled () const
 
void beginRunIfNotDoneAlready ()
 
Run const & currentRun () const
 
void endRun (Run const &run, bool cleaningUpAfterException)
 
void exit ()
 
void finalizeRun (Run const &)
 
void finalizeRun (bool cleaningUpAfterException)
 
 HandleRuns (my_context ctx)
 
bool runException () const
 
void setupCurrentRun ()
 
 ~HandleRuns ()
 

Private Attributes

bool beginRunCalled_
 
Run currentRun_
 
edm::IEventProcessorep_
 
bool exitCalled_
 
bool runException_
 

Detailed Description

Definition at line 236 of file EPStates.h.

Member Typedef Documentation

Definition at line 243 of file EPStates.h.

Constructor & Destructor Documentation

statemachine::HandleRuns::HandleRuns ( my_context  ctx)

Definition at line 189 of file EPStates.cc.

189  :
190  my_base(ctx),
191  ep_(context<Machine>().ep()),
192  exitCalled_(false),
193  beginRunCalled_(false),
194  currentRun_(INVALID_RUN),
195  runException_(false) { }
edm::IEventProcessor & ep_
Definition: EPStates.h:255
statemachine::HandleRuns::~HandleRuns ( )

Definition at line 203 of file EPStates.cc.

References ep_, exitCalled_, finalizeRun(), python.rootplot.argparse::message, edm::IEventProcessor::setExceptionMessageRuns(), and AlCaHLTBitMon_QueryRunRegistry::string.

203  {
204  if(!exitCalled_) {
205  try {
206  finalizeRun(true);
207  }
208  catch(...) {
209  std::string message("Another exception was caught while trying to clean up runs after the primary fatal exception.");
211  }
212  }
213  }
edm::IEventProcessor & ep_
Definition: EPStates.h:255
void finalizeRun(Run const &)
Definition: EPStates.cc:246
virtual void setExceptionMessageRuns(std::string &message)=0

Member Function Documentation

void statemachine::HandleRuns::beginRun ( Run const &  run)

Definition at line 230 of file EPStates.cc.

References edm::IEventProcessor::beginRun(), beginRunCalled_, ep_, and runException_.

Referenced by beginRunIfNotDoneAlready(), and setupCurrentRun().

230  {
231  beginRunCalled_ = true;
232 
233  runException_ = true;
234  ep_.beginRun(run);
235  runException_ = false;
236  }
edm::IEventProcessor & ep_
Definition: EPStates.h:255
virtual void beginRun(statemachine::Run const &run)=0
bool statemachine::HandleRuns::beginRunCalled ( ) const

Definition at line 215 of file EPStates.cc.

References beginRunCalled_.

215 { return beginRunCalled_; }
void statemachine::HandleRuns::beginRunIfNotDoneAlready ( )

Definition at line 262 of file EPStates.cc.

References beginRun(), beginRunCalled_, and currentRun().

262  {
264  }
Run const & currentRun() const
Definition: EPStates.cc:216
void beginRun(Run const &run)
Definition: EPStates.cc:230
Run const & statemachine::HandleRuns::currentRun ( ) const

Definition at line 216 of file EPStates.cc.

References currentRun_.

Referenced by beginRunIfNotDoneAlready(), finalizeRun(), and setupCurrentRun().

216 { return currentRun_; }
void statemachine::HandleRuns::endRun ( Run const &  run,
bool  cleaningUpAfterException 
)

Definition at line 238 of file EPStates.cc.

References beginRunCalled_, edm::IEventProcessor::endRun(), ep_, and runException_.

Referenced by finalizeRun().

238  {
239  beginRunCalled_ = false;
240 
241  runException_ = true;
242  ep_.endRun(run, cleaningUpAfterException);
243  runException_ = false;
244  }
virtual void endRun(statemachine::Run const &run, bool cleaningUpAfterException)=0
edm::IEventProcessor & ep_
Definition: EPStates.h:255
void statemachine::HandleRuns::exit ( )

Definition at line 197 of file EPStates.cc.

References edm::IEventProcessor::alreadyHandlingException(), ep_, exitCalled_, and finalizeRun().

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

197  {
198  if(ep_.alreadyHandlingException()) return;
199  exitCalled_ = true;
200  finalizeRun(false);
201  }
edm::IEventProcessor & ep_
Definition: EPStates.h:255
void finalizeRun(Run const &)
Definition: EPStates.cc:246
virtual bool alreadyHandlingException() const =0
void statemachine::HandleRuns::finalizeRun ( Run const &  )

Definition at line 246 of file EPStates.cc.

Referenced by exit(), statemachine::HandleNewInputFile2::react(), statemachine::ContinueRun1::react(), and ~HandleRuns().

246  {
247  finalizeRun(false);
248  }
void finalizeRun(Run const &)
Definition: EPStates.cc:246
void statemachine::HandleRuns::finalizeRun ( bool  cleaningUpAfterException)

Definition at line 250 of file EPStates.cc.

References beginRunCalled_, currentRun(), currentRun_, edm::IEventProcessor::deleteRunFromCache(), endRun(), ep_, runException_, and edm::IEventProcessor::writeRun().

250  {
251 
252  if(runException_) return;
253  runException_ = true;
254 
255  if(beginRunCalled_) endRun(currentRun(), cleaningUpAfterException);
258  currentRun_ = INVALID_RUN;
259  runException_ = false;
260  }
void endRun(Run const &run, bool cleaningUpAfterException)
Definition: EPStates.cc:238
edm::IEventProcessor & ep_
Definition: EPStates.h:255
virtual void deleteRunFromCache(statemachine::Run const &run)=0
Run const & currentRun() const
Definition: EPStates.cc:216
virtual void writeRun(statemachine::Run const &run)=0
bool statemachine::HandleRuns::runException ( ) const

Definition at line 217 of file EPStates.cc.

References runException_.

217 { return runException_; }
void statemachine::HandleRuns::setupCurrentRun ( )

Definition at line 219 of file EPStates.cc.

References beginRun(), currentRun(), currentRun_, statemachine::doNotHandleEmptyRunsAndLumis, ep_, edm::IEventProcessor::readRun(), and runException_.

219  {
220 
221  runException_ = true;
222  currentRun_ = ep_.readRun();
223  runException_ = false;
224 
225  if(context<Machine>().emptyRunLumiMode() != doNotHandleEmptyRunsAndLumis) {
226  beginRun(currentRun());
227  }
228  }
edm::IEventProcessor & ep_
Definition: EPStates.h:255
Run const & currentRun() const
Definition: EPStates.cc:216
virtual statemachine::Run readRun()=0
void beginRun(Run const &run)
Definition: EPStates.cc:230

Member Data Documentation

bool statemachine::HandleRuns::beginRunCalled_
private

Definition at line 257 of file EPStates.h.

Referenced by beginRun(), beginRunCalled(), beginRunIfNotDoneAlready(), endRun(), and finalizeRun().

Run statemachine::HandleRuns::currentRun_
private

Definition at line 258 of file EPStates.h.

Referenced by currentRun(), finalizeRun(), and setupCurrentRun().

edm::IEventProcessor& statemachine::HandleRuns::ep_
private

Definition at line 255 of file EPStates.h.

Referenced by beginRun(), endRun(), exit(), finalizeRun(), setupCurrentRun(), and ~HandleRuns().

bool statemachine::HandleRuns::exitCalled_
private

Definition at line 256 of file EPStates.h.

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

bool statemachine::HandleRuns::runException_
private

Definition at line 259 of file EPStates.h.

Referenced by beginRun(), endRun(), finalizeRun(), runException(), and setupCurrentRun().