![]() |
Diana Software
|
Base class for diana drivers. More...
Classes | |
| class | Action |
| class to store ActionId and fEventNumber (in case fActionId=ACT_GOTOEV) More... | |
Public Types | |
| enum | ActionId { ACT_NONE , ACT_NEXTEV , ACT_SKIP , ACT_PREVEV , ACT_GOTOEV , ACT_RERUN , ACT_QUIT } |
| actions that the driver can perform More... | |
Public Types inherited from QBaseModule | |
| enum | Type { Module , Filter , Reader , Writer , Driver } |
Public Member Functions | |
| QDriver () | |
| virtual | ~QDriver () |
| virtual Action | Init (QEventAssembler &eva) |
| Init method is called before event loop. More... | |
| virtual Action | Do (QEventAssembler &eva) |
| Do method is called for each event, getting the QEventAssembler as argument. More... | |
| virtual Action | Do (QEventAssembler &eva, const QEventList &neigh) |
| Do method is called for each event, getting the QEventAssembler and list of neighbours as argument. More... | |
| virtual Action | Done ()=0 |
| Done method is called after event loop. More... | |
Public Member Functions inherited from QBaseModule | |
| QBaseModule (Type type) | |
| constructor More... | |
| virtual | ~QBaseModule () |
| constructor More... | |
| double | GetDouble (const std::string &parname, double defVal, bool warnCfg=true) const |
| Get a double parameter from config file. More... | |
| std::vector< double > | GetVectorDouble (const std::string &parname, std::vector< double > defVal, bool warnCfg=true) const |
| Get a std::vector<double> parameter from config file with syntax "{x,y,z}". More... | |
| int | GetInt (const std::string &parname, int defVal, bool warnCfg=true) const |
| Get an int parameter from config file ( see GetDouble() ) More... | |
| std::vector< int > | GetVectorInt (const std::string &parname, std::vector< int > defVal, bool warnCfg=true) const |
| Get an vector<int> parameter from config file ( see GetVectorDouble() ) More... | |
| bool | GetBool (const std::string &parname, bool defVal, bool warnCfg=true) const |
| Get a bool parameter from config file ( see GetDouble() ) More... | |
| std::vector< bool > | GetVectorBool (const std::string &parname, std::vector< bool > defVal, bool warnCfg=true) const |
| Get a vector<bool> parameter from config file ( see GetVectorDouble() ) More... | |
| const std::string & | GetString (const std::string &parname, const std::string &defVal, bool warnCfg=true) const |
| Get a string parameter from config file ( see GetDouble() ) More... | |
| std::vector< std::string > | GetVectorString (const std::string &parname, std::vector< std::string > defVal, bool warnCfg=true) const |
| Get a vector<string> parameter from config file ( see GetVectorDouble() ) More... | |
| void | Debug (const char *descr,...) const |
| Send a debug message (used to debug the module) with printf syntax. More... | |
| void | Info (const char *descr,...) const |
| Send an info message (information) with printf syntax. More... | |
| void | Warn (const char *descr,...) const |
| Send a warning message (an error that the framework can recover) with printf syntax. More... | |
| void | Error (const char *descr,...) const |
| Send an error message (an error that the framework cannot recover) with printf syntax. More... | |
| void | Panic (const char *descr,...) const |
| Send a panic message (stops the framework) with printf syntax. More... | |
| const QGlobalDataManager & | GlobalData () const |
| interface for saving and loading global QObjects More... | |
| bool | GetRunAgain () const |
| Check if the sequence will be reiterated. More... | |
| void | SetRunAgain (bool b) |
| Set that the sequence will be reiterated. More... | |
| unsigned int | GetIteration () const |
| Get Current sequence iteration. More... | |
| unsigned int | GetOccurrence () const |
| get the number of times the same module is loaded inside a QSequence More... | |
| bool | isEnabled () const |
| check if module is enabled More... | |
| std::string | GetFullPath () const |
| Get Full Path of module "GetName() + "." + GetOccurrence". More... | |
| const std::string & | GetName () const |
| Get Module name. More... | |
| const std::string & | GetLabel () const |
| Get Module name + the optional ExtraLabel ("name_extralabel") More... | |
| MsgLevel | GetVerbosity () |
| get verbosity level set from config file More... | |
| const QSequence & | GetSequence () const |
| get reference to this sequence More... | |
| void | Update (QSequence *s, unsigned int occurrence) |
| set the occurrence in the same sequence. MV FIXME: should not be public More... | |
| bool | NeedNeighbours () |
| check wheter this module needs neighbours (available after the first event is processed) More... | |
| void | BeginBase (QEventAssembler &ev) |
| Begin Base method is called before event loop. More... | |
| bool | ProcessBase (QEventAssembler &ev, QEventList &evl, const bool exec, QEventList &ovl) |
| ProcessBase method is called for each event, getting the event and as argument. More... | |
| void | EndBase () |
| EndBase method is called after event loop. More... | |
| const std::vector< QEventLabel > & | GetRequiredLabels () const |
| Get labels of objects required by this module. More... | |
Protected Member Functions | |
| const std::vector< QBaseModule * > & | GetModulesList () const |
| get const list of QBaseModule (s) in the QSequence More... | |
| std::map< std::string, QVdt * > | GetModuleParameters (const std::string &name, int occ) |
| get list of parameters for a given QBaseModule with name name and occurrence occ More... | |
| QSequence & | GetSequence () const |
| get non-const reference to this sequence More... | |
Protected Member Functions inherited from QBaseModule | |
| QModuleConfig & | GetConfig () |
| Get module config. More... | |
| void | SetNeedNeighbours (bool need) |
| set wheter this module needs neighbours More... | |
Protected Member Functions inherited from QModuleTimeProfiling | |
| QModuleTimeProfiling () | |
| ctor initialized internal variables More... | |
| virtual | ~QModuleTimeProfiling () |
| dtor does nothing More... | |
| void | SetTimeProfilingOn (bool val) |
| Set the time profiling on/off. More... | |
| bool | GetTimeProfilingOn () const |
| Check if the time profiling is on. More... | |
| void | ResetTimer () |
| Reset the timer to now. More... | |
| double | GetTimer () const |
| return the time since the last reset More... | |
| virtual void | StartProcessCall () |
| Start of a process call. More... | |
| virtual void | EndProcessCall () |
| End a process call and increment time and calls. More... | |
| unsigned long long | GetProcessCalls () const |
| Return the total number of process calls. More... | |
| double | GetTotalProcessTime () const |
| Return the total processing time. More... | |
| double | GetProcessCallTime () const |
| Return the average time of a single process call. More... | |
| std::string | GetTimeProfileReport (const std::string &prefix="") const |
| Report the time profiling. More... | |
Private Member Functions | |
| void | Begin (QEventAssembler &eva) |
| Begin method is called before event loop, and calls Init() More... | |
| bool | Process (QEventAssembler &eva, QEventList &neigh, const bool exec, QEventList &oneigh) |
| Process method is called for each event, getting the QEventAssembler as argument and calls Do() More... | |
| void | End () |
| End method is called after event loop and calls Done() More... | |
| void | HandleAction (Action action) |
| internal method to handle action returned by inheriting classes More... | |
| bool | StopRun () |
| method used by QSequence to check if the run should be stopped More... | |
| void | SetModulesList (const std::vector< QBaseModule * > &modList) |
| method used by QSequence to set the list of modules in the QSequence More... | |
| const QError & | JumpToEvent (Long64_t event) |
| next iteration diana will jump to event More... | |
Private Attributes | |
| Action | fLastAction |
| last action performed More... | |
| bool | fStopRun |
| stop run or not More... | |
| bool | fSkip |
| skip event More... | |
| int | fCurrentEventNumber |
| current event number to make ACT_PREV use JumpToEvent(fCurrentEventNumber-1) More... | |
| std::vector< QBaseModule * > | fModules |
| list of current modules More... | |
| bool | fSkipEvents |
| skip filtered events More... | |
Friends | |
| class | QSequence |
Additional Inherited Members | |
Protected Attributes inherited from QBaseModule | |
| bool | fExecuted |
Protected Attributes inherited from QModuleTimeProfiling | |
| bool | fTimeProfilingOn |
| Report the time profiling. More... | |
| unsigned long long int | fProcessCalls |
| NUmber of calls to the process. More... | |
| double | fProcessTime |
| Total time spent running the process. More... | |
Base class for diana drivers.
QDriver modules can control the flow of diana through events, and the QSequence execution. QDrivers may have full access to the QEvent, when methods with QEventAssembler as argument are implemented. Inheriting modules must implement the Init() Do() and Done() methods, that return the Action to be performed. Actions can be of different types, as documented below. Only one driver is allowed in a QSequence, and can be loaded with the -D inline option without dclaring it in the cfg. By default drivers do not see filters, i.e. the Do is executed on all events, and all neighbours are contained in the QEventList. To disable this behavior, set SkipEvents = true in the cfg.
This class defines the following config file parameters (see QBaseModule for inherited parameters).
Definition at line 32 of file QDriver.hh.
| enum QDriver::ActionId |
actions that the driver can perform
| Enumerator | |
|---|---|
| ACT_NONE | No action is performed, do not interfere with diana |
| ACT_NEXTEV | go to next QEvent (default diana behavior) |
| ACT_SKIP | skip execution of writer module on this event |
| ACT_PREVEV | go to previous QEvent |
| ACT_GOTOEV | go to event with number (see Action) |
| ACT_RERUN | rerun the sequence right now (and not at the end of the QEvent loop like QBaseModule::SetRunAgain()) |
| ACT_QUIT | stop the sequence right now |
Definition at line 41 of file QDriver.hh.
|
inline |
Definition at line 36 of file QDriver.hh.
|
inlinevirtual |
Definition at line 38 of file QDriver.hh.
|
privatevirtual |
Begin method is called before event loop, and calls Init()
Implements QBaseModule.
Definition at line 27 of file QDriver.cc.
References ACT_NEXTEV, ACT_PREVEV, QEvent::Add(), QBaseModule::Error(), QDriver::Action::fActionId, fLastAction, fSkipEvents, QBaseModule::GetBool(), QEventAssembler::GetEvent(), HandleAction(), QBaseModule::Info(), Init(), and QBaseModule::SetNeedNeighbours().
|
virtual |
Do method is called for each event, getting the QEventAssembler as argument.
Definition at line 16 of file QDriver.cc.
References ACT_NEXTEV, and QBaseModule::Panic().
|
virtual |
Do method is called for each event, getting the QEventAssembler and list of neighbours as argument.
Definition at line 22 of file QDriver.cc.
References Do().
|
pure virtual |
Done method is called after event loop.
Referenced by End().
|
privatevirtual |
End method is called after event loop and calls Done()
Implements QBaseModule.
Definition at line 46 of file QDriver.cc.
References ACT_QUIT, ACT_RERUN, Done(), QDriver::Action::fActionId, fLastAction, and HandleAction().
|
inlineprotected |
get list of parameters for a given QBaseModule with name name and occurrence occ
Definition at line 84 of file QDriver.hh.
References QOptions::GetInstance(), QOptions::GetModuleParameters(), QBaseModule::GetName(), and GetSequence().
|
inlineprotected |
get const list of QBaseModule (s) in the QSequence
Definition at line 81 of file QDriver.hh.
References fModules.
|
inlineprotected |
get non-const reference to this sequence
Definition at line 87 of file QDriver.hh.
References QBaseModule::my_sequence.
Referenced by GetModuleParameters(), and JumpToEvent().
|
private |
internal method to handle action returned by inheriting classes
Definition at line 71 of file QDriver.cc.
References ACT_GOTOEV, ACT_NEXTEV, ACT_PREVEV, ACT_QUIT, ACT_RERUN, ACT_SKIP, err, QBaseModule::Error(), QDriver::Action::fActionId, fCurrentEventNumber, QDriver::Action::fEventNumber, fSkip, fStopRun, JumpToEvent(), QERR_SUCCESS, and QBaseModule::SetRunAgain().
|
virtual |
Init method is called before event loop.
Definition at line 9 of file QDriver.cc.
References ACT_NEXTEV, and QBaseModule::Panic().
Referenced by Begin().
|
inlineprivate |
next iteration diana will jump to event
Definition at line 109 of file QDriver.hh.
References GetSequence(), and QSequence::JumpToEvent().
Referenced by HandleAction().
|
privatevirtual |
Process method is called for each event, getting the QEventAssembler as argument and calls Do()
Implements QBaseModule.
Definition at line 54 of file QDriver.cc.
References ACT_QUIT, ACT_RERUN, Do(), QDriver::Action::fActionId, fCurrentEventNumber, QBaseModule::fExecuted, fLastAction, fSkip, fSkipEvents, QEvent::Get(), QEventAssembler::GetEvent(), QEvent::GetReadNumber(), and HandleAction().
|
inlineprivate |
method used by QSequence to set the list of modules in the QSequence
Definition at line 106 of file QDriver.hh.
References fModules.
Referenced by QSequence::Run().
|
inlineprivate |
method used by QSequence to check if the run should be stopped
Definition at line 103 of file QDriver.hh.
References fStopRun.
Referenced by QSequence::Run().
|
friend |
Definition at line 125 of file QDriver.hh.
|
private |
current event number to make ACT_PREV use JumpToEvent(fCurrentEventNumber-1)
Definition at line 119 of file QDriver.hh.
Referenced by HandleAction(), and Process().
|
private |
last action performed
Definition at line 113 of file QDriver.hh.
|
private |
list of current modules
Definition at line 121 of file QDriver.hh.
Referenced by GetModulesList(), and SetModulesList().
|
private |
|
private |
skip filtered events
Definition at line 123 of file QDriver.hh.
|
private |
stop run or not
Definition at line 115 of file QDriver.hh.
Referenced by HandleAction(), and StopRun().