12 #include <tracking/trackFindingCDC/filters/base/FilterVarSet.dcl.h>
14 #include <framework/core/ModuleParamList.templateDetails.h>
15 #include <framework/core/ModuleParam.h>
17 #include <RtypesCore.h>
30 namespace TrackFindingCDC {
33 static char const*
const filterVarNames[] = {
39 template<
class AFilter>
42 template<
class AFilter>
45 return filterVarNames[iName];
48 template <
class AFilter>
51 , m_filterName(filterName)
52 , m_filterNamePrefix(filterName +
'_')
53 , m_ptrFilter(std::make_unique<
Filter>())
57 template <
class AFilter>
59 std::unique_ptr<Filter> ptrFilter)
61 , m_filterName(filterName)
62 , m_filterNamePrefix(filterName +
'_')
63 , m_ptrFilter(std::move(ptrFilter))
67 template <
class AFilter>
70 bool extracted = Super::extract(obj);
71 if (m_ptrFilter and obj) {
72 Weight weight = (*m_ptrFilter)(*obj);
73 this->
template var<named(
"weight")>() = weight;
74 this->
template var<named(
"accept")>() = not std::isnan(weight) and not(weight < m_cut);
75 this->
template var<named(
"positive")>() = weight > 0 and not(weight < m_cut);
84 template <
class AFilter>
87 ModuleParamList moduleParamList;
88 const std::string prefix =
"";
89 m_ptrFilter->exposeParameters(&moduleParamList, prefix);
92 std::vector<std::string> paramNames = moduleParamList.getParameterNames();
93 if (std::count(paramNames.begin(), paramNames.end(),
"cut")) {
99 this->addProcessingSignalListener(m_ptrFilter.get());
103 template <
class AFilter>
106 return Super::getNamedVariables(prefix + m_filterNamePrefix);
109 template <
class AFilter>
112 if (varName.find(m_filterNamePrefix) == 0) {
113 std::string varNameWithoutPrefix = varName.substr(m_filterNamePrefix.size());
114 MayBePtr<Float_t> found = Super::find(varNameWithoutPrefix);
115 if (found)
return found;