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>
36 template <
class AFilter>
39 template <
class AFilter>
41 const std::string& prefix)
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>
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();
78 template <
class AFilter>
82 if (std::isnan(extracted)) {
93 template <
class AVarSet>
99 template <
class AVarSet>
The Module parameter list class.
ChoosableFromVarSetFilter(const std::string &varName="")
Constructor.
ChoosableFromVarSet< Filter< typename ATruthVarSet::Object > > Super
Type of the super class.
~ChoosableFromVarSetFilter()
Default destructor.
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.
OnVarSet< AFilter > Super
Type of the super class.
~ChoosableFromVarSet()
Default destructor.
typename AFilter::Object Object
Type of the filtered object.
std::string m_param_varName
Memory for the name of the variable selected as the return value of the filter.
BaseVarSet< Object > AVarSet
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.
void initialize() override
No reassignment of variable set possible for now.
Weight operator()(const Object &obj) override
Function extracting the variables of the object into the variable set.
AVarSet & getVarSet() const
Getter for the set of variables.
virtual void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) override
Forward prefixed parameters of this findlet to the module parameter list.
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.