1 #ifndef Framework_EPStates_h
2 #define Framework_EPStates_h
19 #include "boost/statechart/event.hpp"
20 #include "boost/statechart/state_machine.hpp"
21 #include <boost/statechart/state.hpp>
22 #include <boost/statechart/transition.hpp>
23 #include <boost/mpl/list.hpp>
24 #include <boost/statechart/custom_reaction.hpp>
27 namespace sc = boost::statechart;
28 namespace mpl = boost::mpl;
31 class IEventProcessor;
34 namespace statemachine {
93 class Machine :
public sc::state_machine<Machine, Starting>
120 class Starting :
public sc::state<Starting, Machine>
127 sc::transition<Event, Error>,
128 sc::transition<Lumi, Error>,
129 sc::transition<Run, Error>,
130 sc::transition<File, HandleFiles, Machine, &Machine::startingNewLoop>,
131 sc::transition<Stop, EndingLoop, Machine, &Machine::startingNewLoop>,
137 class HandleFiles :
public sc::state<HandleFiles, Machine, FirstFile>
145 sc::transition<Event, Error>,
146 sc::transition<Lumi, Error>,
147 sc::transition<Run, Error>,
148 sc::transition<File, Error>,
149 sc::transition<Stop, EndingLoop>,
152 void closeFiles(
bool cleaningUpAfterException);
166 sc::transition<Restart, Starting, Machine, &Machine::rewindAndPrepareForNextLoop>,
174 class Error :
public sc::state<Error, Machine>
177 Error(my_context ctx);
186 class FirstFile :
public sc::state<FirstFile, HandleFiles>
193 sc::transition<Run, HandleRuns>,
209 sc::transition<Run, HandleRuns>,
222 sc::transition<Run, HandleRuns>,
236 class HandleRuns :
public sc::state<HandleRuns, HandleFiles, NewRun>
243 typedef sc::transition<File, NewInputAndOutputFiles>
reactions;
250 void endRun(
Run const&
run,
bool cleaningUpAfterException);
264 class NewRun :
public sc::state<NewRun, HandleRuns>
271 sc::transition<Lumi, HandleLumis>,
272 sc::custom_reaction<Run>,
289 sc::custom_reaction<Run>,
304 sc::custom_reaction<Run>,
305 sc::custom_reaction<File>,
316 class HandleLumis :
public sc::state<HandleLumis, HandleRuns, FirstLumi>
342 typedef sc::transition<Run, NewRun, HandleRuns, &HandleRuns::finalizeRun>
reactions;
355 class FirstLumi :
public sc::state<FirstLumi, HandleLumis>
363 sc::transition<Event, HandleEvent>,
364 sc::custom_reaction<Lumi>,
379 sc::transition<Event, HandleEvent>,
380 sc::custom_reaction<Lumi>,
395 sc::transition<Event, HandleEvent>,
396 sc::transition<Lumi, AnotherLumi>,
414 sc::custom_reaction<Run>,
429 sc::custom_reaction<Run>,
430 sc::custom_reaction<Lumi>,
448 sc::transition<Event, HandleEvent>,
449 sc::custom_reaction<Lumi>,
mpl::list< sc::transition< Event, HandleEvent >, sc::custom_reaction< Lumi >, sc::custom_reaction< File > > reactions
HandleEvent(my_context ctx)
edm::IEventProcessor const & ep() const
sc::result react(File const &file)
edm::IEventProcessor & ep_
FirstFile(my_context ctx)
sc::transition< Run, NewRun, HandleRuns,&HandleRuns::finalizeRun > reactions
void endRun(Run const &run, bool cleaningUpAfterException)
HandleFiles(my_context ctx)
HandleLumis(my_context ctx)
edm::IEventProcessor & ep_
bool currentLumiEmpty() const
edm::IEventProcessor & ep_
FileMode fileMode() const
mpl::list< sc::transition< Lumi, HandleLumis >, sc::custom_reaction< Run >, sc::custom_reaction< File > > reactions
edm::ProcessHistoryID const & processHistoryID() const
edm::LuminosityBlockNumber_t lumi() const
edm::ProcessHistoryID processHistoryID_
edm::IEventProcessor & ep_
sc::result react(File const &file)
sc::result react(Lumi const &lumi)
ContinueLumi(my_context ctx)
void closeFiles(bool cleaningUpAfterException)
edm::IEventProcessor & ep_
mpl::list< sc::custom_reaction< Run >, sc::custom_reaction< File >, sc::transition< Lumi, HandleLumis > > reactions
unsigned int LuminosityBlockNumber_t
edm::LuminosityBlockNumber_t id_
mpl::list< sc::transition< Restart, Starting, Machine,&Machine::rewindAndPrepareForNextLoop >, sc::custom_reaction< Stop > > reactions
void readAndProcessEvent()
edm::IEventProcessor & ep_
void startingNewLoop(File const &file)
FirstLumi(my_context ctx)
bool operator!=(Run const &rh) const
EmptyRunLumiMode emptyRunLumiMode_
edm::LuminosityBlockNumber_t id() const
bool beginRunCalled() const
HandleRuns(my_context ctx)
edm::IEventProcessor & ep_
EndingLoop(my_context ctx)
ContinueRun2(my_context ctx)
LumiID const & currentLumi() const
mpl::list< sc::transition< Event, HandleEvent >, sc::custom_reaction< Lumi >, sc::custom_reaction< File > > reactions
bool operator==(Run const &rh) const
sc::transition< Stop, EndingLoop > reactions
sc::result react(Run const &run)
Run const & currentRun() const
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
mpl::list< sc::transition< Event, HandleEvent >, sc::custom_reaction< Lumi >, sc::custom_reaction< File > > reactions
mpl::list< sc::transition< Event, Error >, sc::transition< Lumi, Error >, sc::transition< Run, Error >, sc::transition< File, Error >, sc::transition< Stop, EndingLoop >, sc::transition< Restart, Error > > reactions
ContinueRun1(my_context ctx)
edm::IEventProcessor & ep_
edm::IEventProcessor & ep_
AnotherLumi(my_context ctx)
sc::result react(Lumi const &lumi)
void finalizeLumi(bool cleaningUpAfterException)
mpl::list< sc::transition< Event, HandleEvent >, sc::transition< Lumi, AnotherLumi >, sc::custom_reaction< File > > reactions
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)
edm::RunNumber_t runNumber_
edm::RunNumber_t run() const
sc::result react(Stop const &)
mpl::list< sc::custom_reaction< Run >, sc::custom_reaction< Lumi >, sc::custom_reaction< File > > reactions
edm::IEventProcessor & ep_
edm::RunNumber_t runNumber() const
void beginRun(Run const &run)
mpl::list< sc::transition< Run, HandleRuns >, sc::custom_reaction< File > > reactions
edm::LuminosityBlockNumber_t lumi_
mpl::list< sc::transition< Event, Error >, sc::transition< Lumi, Error >, sc::transition< Run, Error >, sc::transition< File, HandleFiles, Machine,&Machine::startingNewLoop >, sc::transition< Stop, EndingLoop, Machine,&Machine::startingNewLoop >, sc::transition< Restart, Error > > reactions
Lumi(edm::LuminosityBlockNumber_t id)
edm::ProcessHistoryID const & processHistoryID() const
sc::result react(Run const &run)
LumiID(edm::ProcessHistoryID const &phid, edm::RunNumber_t run, edm::LuminosityBlockNumber_t lumi)
void beginRunIfNotDoneAlready()
sc::result react(Run const &run)
sc::transition< File, NewInputAndOutputFiles > reactions
EmptyRunLumiMode emptyRunLumiMode() const
edm::propagate_const< edm::IEventProcessor * > ep_
edm::ProcessHistoryID processHistoryID_
bool runException() const
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run