10#include <tracking/trackFindingCDC/filters/base/FilterVarSet.dcl.h>
12#include <framework/core/ModuleParamList.templateDetails.h>
13#include <framework/core/ModuleParam.h>
15#include <RtypesCore.h>
28 namespace TrackFindingCDC {
31 static char const*
const filterVarNames[] = {
37 template<
class AFilter>
40 template<
class AFilter>
43 return filterVarNames[iName];
46 template <
class AFilter>
55 template <
class AFilter>
57 std::unique_ptr<Filter> ptrFilter)
65 template <
class AFilter>
70 Weight weight = (*m_ptrFilter)(*obj);
71 this->
template var<
named(
"weight")>() = weight;
72 this->
template var<
named(
"accept")>() = not std::isnan(weight) and not(weight <
m_cut);
73 this->
template var<
named(
"positive")>() = weight > 0 and not(weight <
m_cut);
82 template <
class AFilter>
86 const std::string prefix =
"";
87 m_ptrFilter->exposeParameters(&moduleParamList, prefix);
91 if (std::count(paramNames.begin(), paramNames.end(),
"cut")) {
101 template <
class AFilter>
107 template <
class AFilter>
112 MayBePtr<Float_t> found =
Super::find(varNameWithoutPrefix);
113 if (found)
return found;
The Module parameter list class.
std::vector< std::string > getParameterNames() const
Returns the names of all parameters in this parameter list.
A single parameter of the module.
virtual bool extract(const Object *obj)
std::vector< Named< Float_t * > > getNamedVariables()
Getter for the named references to the individual variables.
void initialize() override
void addProcessingSignalListener(ProcessingSignalListener *psl)
FilterVarSet(const std::string &filterName="")
Construct the varset making an instance of the template filter.
static constexpr int named(const char *name)
Getter for the index from the name.
VarSet< FilterVarNames< AFilter > > Super
Type of the base class.
std::string m_filterNamePrefix
Prefix to be put in front of the filter variables.
std::string m_filterName
Name of the filter.
void initialize() final
Initialize the filter before event processing.
bool extract(const Object *obj) final
Generate filter weight variable from the object.
typename Filter::Object Object
Type of the object from which the filter judgement should be extracted.
std::unique_ptr< Filter > m_ptrFilter
Filter from which to generate weight as a variable set;.
AFilter Filter
Type of the filter.
double m_cut
The cut on the filter output.
MayBePtr< Float_t > find(const std::string &varName) override
Pointer to the variable with the given name.
std::vector< Named< Float_t * > > getNamedVariables(const std::string &prefix) override
MayBePtr< Float_t > find(const std::string &varName) override
ModuleParam< T > & getParameter(const std::string &name) const
Returns a reference to a parameter.
T & getValue()
Returns the value of the parameter.
void setDefaultValue(const T &defaultValue)
Sets the default value of a parameter.
Abstract base class for different kinds of events.
static const size_t nVars
Number of variables to be generated.
static constexpr char const * getName(int iName)
Getter for the name at the given index.