![]() |
Diana Software
|
Base class for diana filters. More...
Public Member Functions | |
| QFilter () | |
| constructor More... | |
| virtual | ~QFilter () |
| destructor More... | |
| virtual void | GetCuts (const QEvent &ev)=0 |
| Initialize all cuts, possibly from config file. More... | |
| virtual bool | Filter (const QEvent &ev) |
| return true when ev passes the cuts, false otherwise More... | |
| virtual bool | Filter (const QEvent &ev, const QEventList &neigh) |
| return true when ev passes the cuts (also on the basis of neighbour events), false otherwise. More... | |
| virtual void | Done () |
| optionally one can also implement actions after the 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 Types | |
| enum | LogicFlag { AND , CASE , OR } |
Protected Member Functions | |
| LogicFlag | GetLogicFlag () const |
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 &ev) |
| Begin method is called before event loop, and calls GetCuts() More... | |
| bool | Process (QEventAssembler &ev, QEventList &neigh, const bool exec, QEventList &oneigh) |
| Process method is called for each event, and calls FilterAlgorithm() More... | |
| void | End () |
| End method is called after event loop, and calls no method of inheriting classes. More... | |
| bool | FilterAlgorithm (const QEvent &ev, QEventList &neigh, const bool exec) |
| called for each event, and calls Filter() of inheriting classes More... | |
Private Attributes | |
| unsigned long long | fTotEvents |
| unsigned long long | fTotNeighEvents |
| unsigned long long | fSelEvents |
| unsigned long long | fSelNeighEvents |
| bool | fFilterMainEvent |
| bool | fFilterNeighbours |
| bool | fFirstCall |
| bool | fSkipRequiredNotValid |
| bool | fNegate |
| LogicFlag | fLogicFlag |
| bool | fSave |
| store QBool result into event More... | |
| bool | fWrite |
| save QBool into files More... | |
Additional Inherited Members | |
Public Types inherited from QBaseModule | |
| enum | Type { Module , Filter , Reader , Writer , Driver } |
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 filters.
Filter modules are designed to skip events in a sequence according to a selection algorithm. When an event is not selected by a filter, modules declared after that filter are not executed on that particular event: e.g. the QModule::Do() is not executed. The writer module does not obey to this rule and will write all the events, irrespective of the filter(s) selection. To change this behaviour,set SkipEvents = true in the writer cfg (see QFileWriter). Filters can be combined (Logic = AND, Logic = OR ) and can ignore previous filters (Logic = CASE). Eeach filter saves the result in a QBool mamber of the event named "FilterName@Passed", that says if the event passed the cuts or not. When a filter is combined with previous filters (e.g. throug the Logic=AND option) the "FilterName@Passed" member stores the result of the combination, and not simply the result of the filter. As a consequence the last filter in a set of filters stores the result of the entire combination.
Config file parameters defined by this class are (see QBaseModule for inherited parameters):
Inheriting modules have to implement only the virtual methods GetCuts(), called before the event loop [like QModule::Init()], and Filter() called on each event [like QModule::Do()]. Two kinds of Filter() methods exists, one that reads the current event [Filter(const QEvent& ev)], and one that reads also the neighbour events [Filter(const QEvent& ev, const QEventList& neigh)]. Users can implement only one of the two, depending if the filter needs to read neighbours events or not. Note that this has nothing to deal with the FilterNeighbours cfg option, that filters neighbour events using the same algorithm that is used to filter main events. Inheriting modules cannot add QObjects to the QEvent. The result of each filter will be automatically stored in the QEvent as a QBool with label "FilterName@Passed".
Definition at line 56 of file QFilter.hh.
|
protected |
| Enumerator | |
|---|---|
| AND | |
| CASE | |
| OR | |
Definition at line 77 of file QFilter.hh.
| Q_BEGIN_NAMESPACE QFilter::QFilter | ( | ) |
constructor
Definition at line 9 of file QFilter.cc.
|
inlinevirtual |
destructor
Definition at line 63 of file QFilter.hh.
|
privatevirtual |
Begin method is called before event loop, and calls GetCuts()
Implements QBaseModule.
Definition at line 14 of file QFilter.cc.
References QEvent::Add(), AND, CASE, QBaseModule::Debug(), QBaseModule::Error(), fFilterMainEvent, fFilterNeighbours, fFirstCall, fLogicFlag, fNegate, fSave, fSelEvents, fSelNeighEvents, fSkipRequiredNotValid, fTotEvents, fTotNeighEvents, fWrite, QBaseModule::GetBool(), GetCuts(), QEventAssembler::GetEvent(), QBaseModule::GetString(), QBaseModule::Info(), OR, QEvent::SetAlias(), and QBaseModule::SetNeedNeighbours().
|
inlinevirtual |
optionally one can also implement actions after the event loop
Definition at line 75 of file QFilter.hh.
Referenced by End().
|
privatevirtual |
End method is called after event loop, and calls no method of inheriting classes.
Implements QBaseModule.
Definition at line 138 of file QFilter.cc.
References Done(), QBaseModule::Error(), fFilterMainEvent, fFilterNeighbours, fSelEvents, fSelNeighEvents, fTotEvents, fTotNeighEvents, and QBaseModule::Info().
|
virtual |
return true when ev passes the cuts, false otherwise
Definition at line 152 of file QFilter.cc.
References QBaseModule::Panic().
|
virtual |
return true when ev passes the cuts (also on the basis of neighbour events), false otherwise.
Definition at line 158 of file QFilter.cc.
References fFirstCall, QBaseModule::Filter, and QBaseModule::SetNeedNeighbours().
|
private |
called for each event, and calls Filter() of inheriting classes
Definition at line 106 of file QFilter.cc.
References AND, QBaseModule::fExecuted, QBaseModule::Filter, QBaseModule::fLabel, fLogicFlag, fNegate, fSkipRequiredNotValid, QEvent::Get(), QBaseModule::GetRequiredLabels(), OR, and rHandle.
Referenced by Process().
|
pure virtual |
Initialize all cuts, possibly from config file.
Referenced by Begin().
|
inlineprotected |
Definition at line 83 of file QFilter.hh.
References fLogicFlag.
|
privatevirtual |
Process method is called for each event, and calls FilterAlgorithm()
Implements QBaseModule.
Definition at line 66 of file QFilter.cc.
References fFilterMainEvent, fFilterNeighbours, FilterAlgorithm(), fSave, fSelEvents, fSelNeighEvents, fTotEvents, fTotNeighEvents, WriteHandle< T >::Get(), QEvent::Get(), QEventAssembler::GetEvent(), QEventList::Push(), and QEventList::Size().
|
private |
Definition at line 93 of file QFilter.hh.
|
private |
Definition at line 94 of file QFilter.hh.
|
private |
Definition at line 95 of file QFilter.hh.
|
private |
Definition at line 98 of file QFilter.hh.
Referenced by Begin(), FilterAlgorithm(), and GetLogicFlag().
|
private |
Definition at line 97 of file QFilter.hh.
Referenced by Begin(), and FilterAlgorithm().
|
private |
store QBool result into event
Definition at line 101 of file QFilter.hh.
|
private |
Definition at line 91 of file QFilter.hh.
|
private |
Definition at line 92 of file QFilter.hh.
|
private |
Definition at line 96 of file QFilter.hh.
Referenced by Begin(), and FilterAlgorithm().
|
private |
Definition at line 89 of file QFilter.hh.
|
private |
Definition at line 90 of file QFilter.hh.
|
private |