10#include <tracking/trackFindingCDC/filters/base/ChoosableFromVarSetFilter.dcl.h>
12#include <tracking/trackFindingCDC/filters/base/FilterOnVarSet.icc.h>
14#include <framework/core/ModuleParamList.templateDetails.h>
16#include <tracking/trackFindingCDC/utilities/StringManipulation.h>
26 namespace TrackFindingCDC {
28 template <
class AFilter>
32 , m_param_varName(varName)
36 template <
class AFilter>
39 template <
class AFilter>
41 const std::string& prefix)
43 Super::exposeParameters(moduleParamList, prefix);
45 if (m_param_varName ==
"") {
47 moduleParamList->
addParameter(prefixed(prefix,
"chosenVariable"),
49 "Choose the name of the variable "
50 "that will be put out as a weight.");
53 moduleParamList->
addParameter(prefixed(prefix,
"chosenVariable"),
55 "Choose the name of the variable "
56 "that will be put out as a weight.",
61 template <
class AFilter>
65 MayBePtr<Float_t> foundVariable = Super::getVarSet().find(m_param_varName);
66 if (not foundVariable) {
67 B2ERROR(
"Could not find request variable name " << m_param_varName <<
" in variable set");
68 B2INFO(
"Valid names are: ");
69 std::vector<Named<Float_t*>> namedVariables = Super::getVarSet().getNamedVariables();
71 std::string name = namedVariable.getName();
75 m_variable = foundVariable;
78 template <
class AFilter>
81 Weight extracted = Super::operator()(
object);
82 if (std::isnan(extracted)) {
93 template <
class AVarSet>
99 template <
class AVarSet>
The Module parameter list class.
ChoosableFromVarSetFilter(const std::string &varName="")
Constructor.
~ChoosableFromVarSetFilter()
Default destructor.
Filter adapter to make a filter work on a set of variables and return on variable as the result of th...
Weight operator()(const Object &object) override
Returns the variable with the set requested name from the variable set.
void exposeParameters(ModuleParamList *parameterList, const std::string &prefix) override
Add the parameters of this filter to the given parameter list.
void initialize() override
Initialisation method sets up a reference to the value in the variable set to be returned.
~ChoosableFromVarSet()
Default destructor.
typename AFilter::Object Object
Type of the filtered object.
ChoosableFromVarSet(std::unique_ptr< AVarSet > varSet, std::string varName="")
Constructor taking the variable set the filter should work on and the default name of the variable to...
A mixin class to attach a name to an object.
Filter adapter to make a filter work on a set of variables.
void addParameter(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.
Abstract base class for different kinds of events.