1 #ifndef Framework_EPStates_h
2 #define Framework_EPStates_h
18 #include "boost/statechart/event.hpp"
19 #include "boost/statechart/state_machine.hpp"
20 #include <boost/statechart/state.hpp>
21 #include <boost/statechart/transition.hpp>
22 #include <boost/mpl/list.hpp>
23 #include <boost/statechart/custom_reaction.hpp>
26 namespace sc = boost::statechart;
27 namespace mpl = boost::mpl;
30 class IEventProcessor;
33 namespace statemachine {
92 class Machine :
public sc::state_machine<Machine, Starting>
118 class Starting :
public sc::state<Starting, Machine>
125 sc::transition<Event, Error>,
126 sc::transition<Lumi, Error>,
127 sc::transition<Run, Error>,
128 sc::transition<File, HandleFiles, Machine, &Machine::startingNewLoop>,
129 sc::transition<Stop, EndingLoop, Machine, &Machine::startingNewLoop>,
135 class HandleFiles :
public sc::state<HandleFiles, Machine, FirstFile>
143 sc::transition<Event, Error>,
144 sc::transition<Lumi, Error>,
145 sc::transition<Run, Error>,
146 sc::transition<File, Error>,
147 sc::transition<Stop, EndingLoop>,
150 void closeFiles(
bool cleaningUpAfterException);
164 sc::transition<Restart, Starting, Machine, &Machine::rewindAndPrepareForNextLoop>,
172 class Error :
public sc::state<Error, Machine>
175 Error(my_context ctx);
184 class FirstFile :
public sc::state<FirstFile, HandleFiles>
191 sc::transition<Run, HandleRuns>,
207 sc::transition<Run, HandleRuns>,
220 sc::transition<Run, HandleRuns>,
234 class HandleRuns :
public sc::state<HandleRuns, HandleFiles, NewRun>
241 typedef sc::transition<File, NewInputAndOutputFiles>
reactions;
248 void endRun(
Run const&
run,
bool cleaningUpAfterException);
262 class NewRun :
public sc::state<NewRun, HandleRuns>
269 sc::transition<Lumi, HandleLumis>,
270 sc::custom_reaction<Run>,
287 sc::custom_reaction<Run>,
302 sc::custom_reaction<Run>,
303 sc::custom_reaction<File>,
314 class HandleLumis :
public sc::state<HandleLumis, HandleRuns, FirstLumi>
340 typedef sc::transition<Run, NewRun, HandleRuns, &HandleRuns::finalizeRun>
reactions;
353 class FirstLumi :
public sc::state<FirstLumi, HandleLumis>
361 sc::transition<Event, HandleEvent>,
362 sc::custom_reaction<Lumi>,
377 sc::transition<Event, HandleEvent>,
378 sc::custom_reaction<Lumi>,
393 sc::transition<Event, HandleEvent>,
394 sc::transition<Lumi, AnotherLumi>,
412 sc::custom_reaction<Run>,
427 sc::custom_reaction<Run>,
428 sc::custom_reaction<Lumi>,
446 sc::transition<Event, HandleEvent>,
447 sc::custom_reaction<Lumi>,
mpl::list< sc::transition< Event, HandleEvent >, sc::custom_reaction< Lumi >, sc::custom_reaction< File > > reactions
HandleEvent(my_context ctx)
sc::result react(File const &file)
edm::IEventProcessor & ep_
FirstFile(my_context ctx)
edm::IEventProcessor * ep_
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
edm::IEventProcessor & ep() 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::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