Belle II Software development
ChooseableFilter.dcl.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8#pragma once
9
10#include <tracking/trackFindingCDC/filters/base/FilterFactory.fwd.h>
11
12#include <tracking/trackFindingCDC/filters/base/FilterParamMap.h>
13
14#include <tracking/trackFindingCDC/numerics/Weight.h>
15
16#include <string>
17
18#include <memory>
19
20#include <vector>
21
22namespace Belle2 {
27 class ModuleParamList;
28
29 namespace TrackFindingCDC {
31 template <class AFilter>
32 class Chooseable : public AFilter {
33
34 private:
36 using Super = AFilter;
37
38 public:
40 using Object = typename AFilter::Object;
41
42 public:
44 explicit Chooseable(std::unique_ptr<FilterFactory<AFilter>> filterFactory);
45
47 Chooseable(std::unique_ptr<FilterFactory<AFilter>> filterFactory,
48 const std::string& filterName);
49
51 void exposeParameters(ModuleParamList* moduleParamList, const std::string& prefix) final;
52
54 void initialize() override;
55
57 bool needsTruthInformation() override;
58
67 Weight operator()(const Object& object) final;
68
70 Weight operator()(const Object& object) const;
71
73 virtual std::vector<float> operator()(const std::vector <Object*>& objs) override;
74
75 public:
77 std::string getFilterName() const
78 {
79 return m_param_filterName;
80 }
81
82 private:
84 std::string m_param_filterName;
85
88 // std::map<std::string, FilterParamVariant> m_param_filterParameters;
89
91 std::unique_ptr<FilterFactory<AFilter> > m_filterFactory;
92
94 std::unique_ptr<AFilter> m_filter;
95 };
96
102 template <class AFilterFactory>
104 : public Chooseable<typename AFilterFactory::CreatedFilter> {
105
106 private:
109
110 public:
113
115 explicit ChooseableFilter(const std::string& filterName);
116 };
117 }
119}
The Module parameter list class.
Convenvience wrapper to setup a Chooseable filter from a specific factory object.
ChooseableFilter()
Constructor of the chooseable filter.
Filter can delegate to a filter chosen and set up at run time by parameters.
void initialize() override
Initialize before event processing.
std::unique_ptr< FilterFactory< AFilter > > m_filterFactory
Filter factor to construct a chosen filter.
bool needsTruthInformation() override
Indicates if the filter requires Monte Carlo information.
AFilter Super
Type of the base class.
std::unique_ptr< AFilter > m_filter
Chosen filter.
std::string m_param_filterName
Parameters : Name of the selected filter.
std::string getFilterName() const
Return name of the selected filter.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the set of parameters of the filter to the module parameter list.
typename AFilter::Object Object
Type of the object to be analysed.
Weight operator()(const Object &object) final
Function to evaluate the object.
FilterParamMap m_param_filterParameters
Parameter: Parameter keys and values to be forwarded to the chosen filter.
Factory that can create apropriate filter instances from a name.
Variant of types allowed to be forwarded to a filter selected at runtime.
Abstract base class for different kinds of events.