10 namespace statemachine {
15 HandleLumis::LumiID
const InvalidLumiID = HandleLumis::LumiID(
edm::ProcessHistoryID(), INVALID_RUN_NUMBER, INVALID_LUMI);
19 processHistoryID_(phid),
30 emptyRunLumiMode_(emptyRunLumiMode) {
39 ep_->startingNewLoop();
43 if(
ep_->alreadyHandlingException())
return;
44 ep_->startingNewLoop();
48 ep_->prepareForNextLoop();
59 exitCalled_(
false) { }
73 std::string message(
"Another exception was caught while trying to clean up files after the primary fatal exception.");
132 if(context<HandleFiles>().shouldWeCloseOutput()) {
133 return transit<NewInputAndOutputFiles>();
135 return transit<HandleNewInputFile1>();
148 context<HandleFiles>().goToNewInputFile();
154 if(context<HandleFiles>().shouldWeCloseOutput()) {
155 return transit<NewInputAndOutputFiles>();
157 return transit<HandleNewInputFile1>();
170 if(context<HandleFiles>().shouldWeCloseOutput()) {
171 return transit<NewInputAndOutputFiles>();
173 return transit<HandleNewInputFile1>();
193 beginRunCalled_(
false),
194 currentRun_(INVALID_RUN),
195 runException_(
false) { }
209 std::string message(
"Another exception was caught while trying to clean up runs after the primary fatal exception.");
242 ep_.
endRun(run, cleaningUpAfterException);
268 assert(context<HandleRuns>().currentRun() == INVALID_RUN);
269 context<HandleRuns>().setupCurrentRun();
274 assert(context<HandleRuns>().currentRun() != INVALID_RUN);
280 if(run == context<HandleRuns>().currentRun()) {
281 return transit<ContinueRun1>();
283 context<HandleRuns>().finalizeRun(
false);
284 return transit<NewRun>();
288 if(!context<HandleFiles>().shouldWeCloseOutput()) {
289 return transit<HandleNewInputFile2>();
291 return forward_event();
296 context<HandleFiles>().goToNewInputFile();
305 assert(context<HandleRuns>().currentRun() != INVALID_RUN);
312 if(context<HandleRuns>().currentRun() != run) {
315 return transit<ContinueRun1>();
321 if(!context<HandleFiles>().shouldWeCloseOutput()) {
322 return transit<HandleNewInputFile2>();
324 return forward_event();
339 assert(context<HandleRuns>().currentRun() != INVALID_RUN);
345 if(context<HandleRuns>().currentRun() != run) {
348 return transit<ContinueRun1>();
354 if(!context<HandleFiles>().shouldWeCloseOutput()) {
355 return transit<HandleNewInputFile2>();
357 return forward_event();
361 processHistoryID_(phid),
394 std::string message(
"Another exception was caught while trying to clean up lumis after the primary fatal exception.");
401 assert(context<HandleRuns>().currentRun() != INVALID_RUN);
411 Run const&
run = context<HandleRuns>().currentRun();
412 assert(run != INVALID_RUN);
417 assert(context<HandleRuns>().beginRunCalled());
456 context<HandleLumis>().setupCurrentLumi();
465 assert(context<HandleRuns>().currentRun() != INVALID_RUN);
466 assert(context<HandleLumis>().currentLumi().processHistoryID() == context<HandleRuns>().currentRun().processHistoryID());
467 assert(context<HandleLumis>().currentLumi().
run() == context<HandleRuns>().currentRun().
runNumber());
468 assert(context<HandleLumis>().currentLumi().
lumi() != INVALID_LUMI);
469 assert(context<HandleLumis>().currentLumiEmpty() ==
true);
474 if(lumi.
id() == context<HandleLumis>().currentLumi().lumi()) {
475 return transit<ContinueLumi>();
477 return transit<AnotherLumi>();
482 if(!context<HandleFiles>().shouldWeCloseOutput()) {
483 return transit<HandleNewInputFile3>();
485 return forward_event();
490 context<HandleLumis>().finalizeLumi(
false);
491 context<HandleLumis>().setupCurrentLumi();
500 assert(context<HandleRuns>().currentRun() != INVALID_RUN);
501 assert(context<HandleLumis>().currentLumi().processHistoryID() == context<HandleRuns>().currentRun().processHistoryID());
502 assert(context<HandleLumis>().currentLumi().
run() == context<HandleRuns>().currentRun().
runNumber());
503 assert(context<HandleLumis>().currentLumi().
lumi() != INVALID_LUMI);
504 assert(context<HandleLumis>().currentLumiEmpty() ==
true);
509 if(lumi.
id() == context<HandleLumis>().currentLumi().lumi()) {
510 return transit<ContinueLumi>();
512 return transit<AnotherLumi>();
517 if(!context<HandleFiles>().shouldWeCloseOutput()) {
518 return transit<HandleNewInputFile3>();
520 return forward_event();
535 assert(context<HandleRuns>().currentRun() != INVALID_RUN);
536 assert(context<HandleRuns>().beginRunCalled());
537 assert(context<HandleLumis>().currentLumi().processHistoryID() == context<HandleRuns>().currentRun().processHistoryID());
538 assert(context<HandleLumis>().currentLumi().
run() == context<HandleRuns>().currentRun().
runNumber());
539 assert(context<HandleLumis>().currentLumi().
lumi() != INVALID_LUMI);
540 assert(context<HandleLumis>().currentLumiEmpty() ==
false);
546 if(!context<HandleFiles>().shouldWeCloseOutput()) {
547 return transit<HandleNewInputFile3>();
549 return forward_event();
559 context<HandleRuns>().beginRunIfNotDoneAlready();
560 context<HandleLumis>().markLumiNonEmpty();
566 context<HandleFiles>().goToNewInputFile();
575 assert(context<HandleRuns>().currentRun() != INVALID_RUN);
576 assert(context<HandleLumis>().currentLumi().processHistoryID() == context<HandleRuns>().currentRun().processHistoryID());
577 assert(context<HandleLumis>().currentLumi().
run() == context<HandleRuns>().currentRun().
runNumber());
578 assert(context<HandleLumis>().currentLumi().
lumi() != INVALID_LUMI);
585 if(context<HandleRuns>().currentRun() == run) {
586 return transit<ContinueRun2>();
588 return forward_event();
593 if(!context<HandleFiles>().shouldWeCloseOutput()) {
594 return transit<HandleNewInputFile3>();
596 return forward_event();
611 assert(context<HandleRuns>().currentRun() != INVALID_RUN);
612 assert(context<HandleLumis>().currentLumi().processHistoryID() == context<HandleRuns>().currentRun().processHistoryID());
613 assert(context<HandleLumis>().currentLumi().
run() == context<HandleRuns>().currentRun().
runNumber());
614 assert(context<HandleLumis>().currentLumi().
lumi() != INVALID_LUMI);
620 if(context<HandleRuns>().currentRun() != run) {
621 return forward_event();
623 return transit<ContinueRun2>();
630 if(context<HandleLumis>().currentLumi().
lumi() != lumi.
id()) {
631 return transit<AnotherLumi>();
633 return transit<ContinueLumi>();
639 if(!context<HandleFiles>().shouldWeCloseOutput()) {
640 return transit<HandleNewInputFile3>();
642 return forward_event();
657 assert(context<HandleRuns>().currentRun() != INVALID_RUN);
658 assert(context<HandleLumis>().currentLumi().processHistoryID() == context<HandleRuns>().currentRun().processHistoryID());
659 assert(context<HandleLumis>().currentLumi().
run() == context<HandleRuns>().currentRun().
runNumber());
660 assert(context<HandleLumis>().currentLumi().
lumi() != INVALID_LUMI);
666 if(context<HandleLumis>().currentLumi().
lumi() != lumi.
id()) {
667 return transit<AnotherLumi>();
669 return transit<ContinueLumi>();
675 if(!context<HandleFiles>().shouldWeCloseOutput()) {
676 return transit<HandleNewInputFile3>();
678 return forward_event();
static const char runNumber_[]
HandleEvent(my_context ctx)
edm::IEventProcessor const & ep() const
sc::result react(File const &file)
edm::IEventProcessor & ep_
FirstFile(my_context ctx)
virtual void endRun(statemachine::Run const &run, bool cleaningUpAfterException)=0
void endRun(Run const &run, bool cleaningUpAfterException)
HandleFiles(my_context ctx)
HandleLumis(my_context ctx)
virtual void setExceptionMessageFiles(std::string &message)=0
edm::IEventProcessor & ep_
bool currentLumiEmpty() const
edm::IEventProcessor & ep_
virtual void beginLumi(ProcessHistoryID const &phid, RunNumber_t run, LuminosityBlockNumber_t lumi)=0
FileMode fileMode() const
edm::IEventProcessor & ep_
sc::result react(File const &file)
virtual bool shouldWeStop() const =0
sc::result react(Lumi const &lumi)
ContinueLumi(my_context ctx)
void closeFiles(bool cleaningUpAfterException)
edm::IEventProcessor & ep_
virtual void writeLumi(ProcessHistoryID const &phid, RunNumber_t run, LuminosityBlockNumber_t lumi)=0
virtual void openOutputFiles()=0
virtual void readAndProcessEvent()=0
unsigned int LuminosityBlockNumber_t
virtual void setExceptionMessageLumis(std::string &message)=0
virtual int readLuminosityBlock()=0
void readAndProcessEvent()
edm::IEventProcessor & ep_
void startingNewLoop(File const &file)
FirstLumi(my_context ctx)
EmptyRunLumiMode emptyRunLumiMode_
virtual statemachine::Run readAndMergeRun()=0
edm::LuminosityBlockNumber_t id() const
virtual void readFile()=0
bool beginRunCalled() const
HandleRuns(my_context ctx)
edm::IEventProcessor & ep_
EndingLoop(my_context ctx)
virtual void endLumi(ProcessHistoryID const &phid, RunNumber_t run, LuminosityBlockNumber_t lumi, bool cleaningUpAfterException)=0
virtual void deleteRunFromCache(statemachine::Run const &run)=0
ContinueRun2(my_context ctx)
LumiID const & currentLumi() const
virtual bool shouldWeCloseOutput() const =0
sc::result react(Run const &run)
virtual void closeOutputFiles()=0
Run const & currentRun() const
ContinueRun1(my_context ctx)
edm::IEventProcessor & ep_
edm::IEventProcessor & ep_
AnotherLumi(my_context ctx)
sc::result react(Lumi const &lumi)
virtual void respondToOpenInputFile()=0
virtual void respondToCloseInputFile()=0
void finalizeLumi(bool cleaningUpAfterException)
void finalizeRun(Run const &)
bool shouldWeCloseOutput()
Machine(edm::IEventProcessor *ep, FileMode fileMode, EmptyRunLumiMode emptyRunLumiMode)
void rewindAndPrepareForNextLoop(Restart const &restart)
Run(edm::ProcessHistoryID const &phid, edm::RunNumber_t runNumber)
sc::result react(Lumi const &lumi)
sc::result react(Stop const &)
virtual bool alreadyHandlingException() const =0
virtual statemachine::Run readRun()=0
edm::IEventProcessor & ep_
virtual void setExceptionMessageRuns(std::string &message)=0
virtual int readAndMergeLumi()=0
edm::RunNumber_t runNumber() const
void beginRun(Run const &run)
Lumi(edm::LuminosityBlockNumber_t id)
virtual bool endOfLoop()=0
edm::ProcessHistoryID const & processHistoryID() const
virtual void closeInputFile(bool cleaningUpAfterException)=0
sc::result react(Run const &run)
virtual void doErrorStuff()=0
LumiID(edm::ProcessHistoryID const &phid, edm::RunNumber_t run, edm::LuminosityBlockNumber_t lumi)
virtual void beginRun(statemachine::Run const &run)=0
void beginRunIfNotDoneAlready()
volatile std::atomic< bool > shutdown_flag false
sc::result react(Run const &run)
EmptyRunLumiMode emptyRunLumiMode() const
edm::propagate_const< edm::IEventProcessor * > ep_
bool runException() const
virtual void deleteLumiFromCache(ProcessHistoryID const &phid, RunNumber_t run, LuminosityBlockNumber_t lumi)=0
virtual void writeRun(statemachine::Run const &run)=0