10 namespace statemachine {
15 HandleLumis::LumiID
const InvalidLumiID = HandleLumis::LumiID(
edm::ProcessHistoryID(), INVALID_RUN_NUMBER, INVALID_LUMI);
19 processHistoryID_(phid),
30 emptyRunLumiMode_(emptyRunLumiMode) {
58 exitCalled_(
false) { }
72 std::string message(
"Another exception was caught while trying to clean up files after the primary fatal exception.");
131 if(context<HandleFiles>().shouldWeCloseOutput()) {
132 return transit<NewInputAndOutputFiles>();
134 return transit<HandleNewInputFile1>();
147 context<HandleFiles>().goToNewInputFile();
153 if(context<HandleFiles>().shouldWeCloseOutput()) {
154 return transit<NewInputAndOutputFiles>();
156 return transit<HandleNewInputFile1>();
169 if(context<HandleFiles>().shouldWeCloseOutput()) {
170 return transit<NewInputAndOutputFiles>();
172 return transit<HandleNewInputFile1>();
192 beginRunCalled_(
false),
193 currentRun_(INVALID_RUN),
194 runException_(
false) { }
208 std::string message(
"Another exception was caught while trying to clean up runs after the primary fatal exception.");
241 ep_.
endRun(run, cleaningUpAfterException);
267 assert(context<HandleRuns>().currentRun() == INVALID_RUN);
268 context<HandleRuns>().setupCurrentRun();
273 assert(context<HandleRuns>().currentRun() != INVALID_RUN);
279 if(run == context<HandleRuns>().currentRun()) {
280 return transit<ContinueRun1>();
282 context<HandleRuns>().finalizeRun(
false);
283 return transit<NewRun>();
287 if(!context<HandleFiles>().shouldWeCloseOutput()) {
288 return transit<HandleNewInputFile2>();
290 return forward_event();
295 context<HandleFiles>().goToNewInputFile();
304 assert(context<HandleRuns>().currentRun() != INVALID_RUN);
311 if(context<HandleRuns>().currentRun() != run) {
314 return transit<ContinueRun1>();
320 if(!context<HandleFiles>().shouldWeCloseOutput()) {
321 return transit<HandleNewInputFile2>();
323 return forward_event();
338 assert(context<HandleRuns>().currentRun() != INVALID_RUN);
344 if(context<HandleRuns>().currentRun() != run) {
347 return transit<ContinueRun1>();
353 if(!context<HandleFiles>().shouldWeCloseOutput()) {
354 return transit<HandleNewInputFile2>();
356 return forward_event();
360 processHistoryID_(phid),
393 std::string message(
"Another exception was caught while trying to clean up lumis after the primary fatal exception.");
400 assert(context<HandleRuns>().currentRun() != INVALID_RUN);
410 Run const&
run = context<HandleRuns>().currentRun();
411 assert(run != INVALID_RUN);
416 assert(context<HandleRuns>().beginRunCalled());
455 context<HandleLumis>().setupCurrentLumi();
464 assert(context<HandleRuns>().currentRun() != INVALID_RUN);
465 assert(context<HandleLumis>().currentLumi().processHistoryID() == context<HandleRuns>().currentRun().processHistoryID());
466 assert(context<HandleLumis>().currentLumi().
run() == context<HandleRuns>().currentRun().
runNumber());
467 assert(context<HandleLumis>().currentLumi().
lumi() != INVALID_LUMI);
468 assert(context<HandleLumis>().currentLumiEmpty() ==
true);
473 if(lumi.
id() == context<HandleLumis>().currentLumi().lumi()) {
474 return transit<ContinueLumi>();
476 return transit<AnotherLumi>();
481 if(!context<HandleFiles>().shouldWeCloseOutput()) {
482 return transit<HandleNewInputFile3>();
484 return forward_event();
489 context<HandleLumis>().finalizeLumi(
false);
490 context<HandleLumis>().setupCurrentLumi();
499 assert(context<HandleRuns>().currentRun() != INVALID_RUN);
500 assert(context<HandleLumis>().currentLumi().processHistoryID() == context<HandleRuns>().currentRun().processHistoryID());
501 assert(context<HandleLumis>().currentLumi().
run() == context<HandleRuns>().currentRun().
runNumber());
502 assert(context<HandleLumis>().currentLumi().
lumi() != INVALID_LUMI);
503 assert(context<HandleLumis>().currentLumiEmpty() ==
true);
508 if(lumi.
id() == context<HandleLumis>().currentLumi().lumi()) {
509 return transit<ContinueLumi>();
511 return transit<AnotherLumi>();
516 if(!context<HandleFiles>().shouldWeCloseOutput()) {
517 return transit<HandleNewInputFile3>();
519 return forward_event();
534 assert(context<HandleRuns>().currentRun() != INVALID_RUN);
535 assert(context<HandleRuns>().beginRunCalled());
536 assert(context<HandleLumis>().currentLumi().processHistoryID() == context<HandleRuns>().currentRun().processHistoryID());
537 assert(context<HandleLumis>().currentLumi().
run() == context<HandleRuns>().currentRun().
runNumber());
538 assert(context<HandleLumis>().currentLumi().
lumi() != INVALID_LUMI);
539 assert(context<HandleLumis>().currentLumiEmpty() ==
false);
545 if(!context<HandleFiles>().shouldWeCloseOutput()) {
546 return transit<HandleNewInputFile3>();
548 return forward_event();
558 context<HandleRuns>().beginRunIfNotDoneAlready();
559 context<HandleLumis>().markLumiNonEmpty();
565 context<HandleFiles>().goToNewInputFile();
574 assert(context<HandleRuns>().currentRun() != INVALID_RUN);
575 assert(context<HandleLumis>().currentLumi().processHistoryID() == context<HandleRuns>().currentRun().processHistoryID());
576 assert(context<HandleLumis>().currentLumi().
run() == context<HandleRuns>().currentRun().
runNumber());
577 assert(context<HandleLumis>().currentLumi().
lumi() != INVALID_LUMI);
584 if(context<HandleRuns>().currentRun() == run) {
585 return transit<ContinueRun2>();
587 return forward_event();
592 if(!context<HandleFiles>().shouldWeCloseOutput()) {
593 return transit<HandleNewInputFile3>();
595 return forward_event();
610 assert(context<HandleRuns>().currentRun() != INVALID_RUN);
611 assert(context<HandleLumis>().currentLumi().processHistoryID() == context<HandleRuns>().currentRun().processHistoryID());
612 assert(context<HandleLumis>().currentLumi().
run() == context<HandleRuns>().currentRun().
runNumber());
613 assert(context<HandleLumis>().currentLumi().
lumi() != INVALID_LUMI);
619 if(context<HandleRuns>().currentRun() != run) {
620 return forward_event();
622 return transit<ContinueRun2>();
629 if(context<HandleLumis>().currentLumi().
lumi() != lumi.
id()) {
630 return transit<AnotherLumi>();
632 return transit<ContinueLumi>();
638 if(!context<HandleFiles>().shouldWeCloseOutput()) {
639 return transit<HandleNewInputFile3>();
641 return forward_event();
656 assert(context<HandleRuns>().currentRun() != INVALID_RUN);
657 assert(context<HandleLumis>().currentLumi().processHistoryID() == context<HandleRuns>().currentRun().processHistoryID());
658 assert(context<HandleLumis>().currentLumi().
run() == context<HandleRuns>().currentRun().
runNumber());
659 assert(context<HandleLumis>().currentLumi().
lumi() != INVALID_LUMI);
665 if(context<HandleLumis>().currentLumi().
lumi() != lumi.
id()) {
666 return transit<AnotherLumi>();
668 return transit<ContinueLumi>();
674 if(!context<HandleFiles>().shouldWeCloseOutput()) {
675 return transit<HandleNewInputFile3>();
677 return forward_event();
static const char runNumber_[]
HandleEvent(my_context ctx)
sc::result react(File const &file)
edm::IEventProcessor & ep_
FirstFile(my_context ctx)
edm::IEventProcessor * ep_
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
virtual void rewindInput()=0
void readAndProcessEvent()
edm::IEventProcessor & ep_
void startingNewLoop(File const &file)
virtual void startingNewLoop()=0
FirstLumi(my_context ctx)
EmptyRunLumiMode emptyRunLumiMode_
virtual statemachine::Run readAndMergeRun()=0
edm::LuminosityBlockNumber_t id() const
virtual void readFile()=0
edm::IEventProcessor & ep() const
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
bool runException() const
virtual void deleteLumiFromCache(ProcessHistoryID const &phid, RunNumber_t run, LuminosityBlockNumber_t lumi)=0
virtual void writeRun(statemachine::Run const &run)=0
virtual void prepareForNextLoop()=0