![]() |
Diana Software
|
Base class for diana modules. More...
Public Member Functions | |
| QModule () | |
| constuctor More... | |
| virtual | ~QModule () |
| destructor More... | |
| virtual void | Init (QEvent &ev)=0 |
| Init method is called before event loop. More... | |
| virtual void | Do (QEvent &ev) |
| Do method is called on each event, getting the event as argument. More... | |
| virtual void | Do (QEvent &ev, const QEventList &neighbours) |
| Do method is called on each event, getting the event and its neighbours as argument. More... | |
| virtual void | 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... | |
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, and calls Do() More... | |
| void | End () |
| End method is called after event loop, and calls Done() More... | |
Private Attributes | |
| bool | fSkipEvents |
| flag to skip the Do() execution on filtered events More... | |
| bool | fSkipRequiredNotValid |
| Skip events containing non-valid required objects. More... | |
| bool | fFirstCall |
| flag to check first Do() call More... | |
| size_t | fRunOnIteration |
| Specify on which iteration the module runs. More... | |
Additional Inherited Members | |
Public Types inherited from QBaseModule | |
| enum | Type { Module , Filter , Reader , Writer , Driver } |
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... | |
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 modules.
QModule is the base class for modules that really do something inside this framework full of meaningless C++ layers. QModules compute analysis quantities and increase our understanding of Physics (maybe).
This class defines the following config file parameters (see QBaseModule for inherited parameters)
Optional Parameters:
Inheriting modules must implement the Init() method, called before the QEvent loop, the Do() method, called on each QEvent, and the Done() method, called at the end of the QEvent loop. In the Init() method, the module should fetch config file variables through the QBaseModule inherited methods, and add QObejct (s) to the QEvent (see QEvent). In the Do() method, the module reads the QEvent and sets its QObject(s). In the Done() method, the module finalizes its operations. In all the three methods the module can get/set global quantities getting the QGlobalDataManager instance of Diana, using the GlobalData() method inherited from QBaseModule. Two kind of Do() methods exists, one that reads and writes the current event [Do(QEvent& ev)], and one that reads also the neighbour events [Do(QEvent& ev, const QEventList& neighbours)]. Users can implement only one of the two, depending if the module needs to read neighbours events or not.
If the option SkipEvents is set to false, the Do() will be executed on all the events, the result of the filters is anyhow stored (but not written in output files) in the "SkipEvent" QBool owned by the module. To check this variable:
bool skipEvent = ev.Get<QBool>("SkipEvent");
If the option SkipRequiredNotValid is set to true, the Do() will be executed only on events with valid required objets The result of this selection is anyhow stored (but not written in output files) in the "SkipRequiredNotValid" QBool owned by the module. To check this variable:
bool skipRequiredNotValid = ev.Get<QBool>("SkipRequiredNotValid");
This option does not act on neighbours. To remove from neighbours events with non-valid QObjects use the filter MRejectNotValid
Definition at line 54 of file QModule.hh.
| Q_BEGIN_NAMESPACE QModule::QModule | ( | ) |
constuctor
Definition at line 7 of file QModule.cc.
|
virtual |
destructor
Definition at line 11 of file QModule.cc.
|
privatevirtual |
Begin method is called before event loop, and calls Init()
Implements QBaseModule.
Definition at line 15 of file QModule.cc.
References QEvent::Add(), QBaseModule::Debug(), fFirstCall, fRunOnIteration, fSkipEvents, fSkipRequiredNotValid, QBaseModule::GetBool(), QEventAssembler::GetEvent(), QBaseModule::GetInt(), QBaseModule::GetIteration(), QBaseModule::Info(), Init(), QBaseModule::Panic(), and QBaseModule::SetNeedNeighbours().
|
virtual |
Do method is called on each event, getting the event as argument.
Definition at line 71 of file QModule.cc.
References QBaseModule::Panic().
|
virtual |
Do method is called on each event, getting the event and its neighbours as argument.
Definition at line 77 of file QModule.cc.
References Do(), fFirstCall, and QBaseModule::SetNeedNeighbours().
|
pure virtual |
Done method is called after event loop.
Implemented in MTimeSort, MTimeEnergy, MSorter, MFlagCoincidence, MCoincidenceTiming, MCoincidenceMultiplicity, MTimeSort, MCoincidenceMultiplicity, and MTimeSort.
Referenced by End().
|
privatevirtual |
End method is called after event loop, and calls Done()
Implements QBaseModule.
Definition at line 87 of file QModule.cc.
References Done(), fRunOnIteration, QBaseModule::GetIteration(), and QBaseModule::SetRunAgain().
|
pure virtual |
Init method is called before event loop.
Referenced by Begin().
|
privatevirtual |
Process method is called for each event, and calls Do()
Implements QBaseModule.
Definition at line 39 of file QModule.cc.
References Do(), QBaseModule::fExecuted, QBaseModule::fLabel, fRunOnIteration, fSkipEvents, fSkipRequiredNotValid, QEvent::Get(), QEventAssembler::GetEvent(), QBaseModule::GetIteration(), QBaseModule::GetRequiredLabels(), and rHandle.
|
private |
flag to check first Do() call
Definition at line 92 of file QModule.hh.
|
private |
Specify on which iteration the module runs.
Definition at line 95 of file QModule.hh.
|
private |
flag to skip the Do() execution on filtered events
Definition at line 86 of file QModule.hh.
|
private |
Skip events containing non-valid required objects.
Definition at line 89 of file QModule.hh.