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

Member Typedef Documentation

Definition at line 241 of file EPStates.h.

Constructor & Destructor Documentation

statemachine::HandleRuns::HandleRuns ( my_context  ctx)

Definition at line 188 of file EPStates.cc.

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

Definition at line 202 of file EPStates.cc.

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

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

Member Function Documentation

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

Definition at line 229 of file EPStates.cc.

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

Referenced by beginRunIfNotDoneAlready(), and setupCurrentRun().

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

Definition at line 214 of file EPStates.cc.

References beginRunCalled_.

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

Definition at line 261 of file EPStates.cc.

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

261  {
263  }
Run const & currentRun() const
Definition: EPStates.cc:215
void beginRun(Run const &run)
Definition: EPStates.cc:229
Run const & statemachine::HandleRuns::currentRun ( ) const

Definition at line 215 of file EPStates.cc.

References currentRun_.

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

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

Definition at line 237 of file EPStates.cc.

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

Referenced by finalizeRun().

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

Definition at line 196 of file EPStates.cc.

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

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

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

Definition at line 245 of file EPStates.cc.

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

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

Definition at line 249 of file EPStates.cc.

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

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

Definition at line 216 of file EPStates.cc.

References runException_.

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

Definition at line 218 of file EPStates.cc.

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

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

Member Data Documentation

bool statemachine::HandleRuns::beginRunCalled_
private

Definition at line 255 of file EPStates.h.

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

Run statemachine::HandleRuns::currentRun_
private

Definition at line 256 of file EPStates.h.

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

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

Definition at line 253 of file EPStates.h.

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

bool statemachine::HandleRuns::exitCalled_
private

Definition at line 254 of file EPStates.h.

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

bool statemachine::HandleRuns::runException_
private

Definition at line 257 of file EPStates.h.

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