12 #include <tracking/trackFindingCDC/filters/base/ChoosableFromVarSetFilter.dcl.h>
14 #include <tracking/trackFindingCDC/filters/base/FilterOnVarSet.icc.h>
16 #include <framework/core/ModuleParamList.templateDetails.h>
18 #include <tracking/trackFindingCDC/utilities/StringManipulation.h>
28 namespace TrackFindingCDC {
30 template <
class AFilter>
33 : Super(std::move(varSet))
34 , m_param_varName(varName)
38 template <
class AFilter>
41 template <
class AFilter>
43 const std::string& prefix)
45 Super::exposeParameters(moduleParamList, prefix);
47 if (m_param_varName ==
"") {
49 moduleParamList->
addParameter(prefixed(prefix,
"chosenVariable"),
51 "Choose the name of the variable "
52 "that will be put out as a weight.");
55 moduleParamList->
addParameter(prefixed(prefix,
"chosenVariable"),
57 "Choose the name of the variable "
58 "that will be put out as a weight.",
63 template <
class AFilter>
64 void ChoosableFromVarSet<AFilter>::initialize()
67 MayBePtr<Float_t> foundVariable = Super::getVarSet().find(m_param_varName);
68 if (not foundVariable) {
69 B2ERROR(
"Could not find request variable name " << m_param_varName <<
" in variable set");
70 B2INFO(
"Valid names are: ");
71 std::vector<Named<Float_t*>> namedVariables = Super::getVarSet().getNamedVariables();
73 std::string name = namedVariable.getName();
77 m_variable = foundVariable;
80 template <
class AFilter>
81 Weight ChoosableFromVarSet<AFilter>::operator()(
const Object&
object)
83 Weight extracted = Super::operator()(
object);
84 if (std::isnan(extracted)) {
95 template <
class AVarSet>
96 ChoosableFromVarSetFilter<AVarSet>::ChoosableFromVarSetFilter(
const std::string& varName)
97 : Super(std::make_unique<AVarSet>(), varName)
101 template <
class AVarSet>
102 ChoosableFromVarSetFilter<AVarSet>::~ChoosableFromVarSetFilter() =
default;