Belle II Software development
FilterVarSet.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/varsets/VarSet.h>
11#include <tracking/trackFindingCDC/varsets/VarNames.h>
12
13#include <tracking/trackFindingCDC/utilities/Named.h>
14#include <tracking/trackFindingCDC/utilities/MayBePtr.h>
15
16#include <RtypesCore.h>
17
18#include <string>
19#include <memory>
20
21namespace Belle2 {
26 namespace TrackFindingCDC {
27
29 template<class AFilter>
30 struct FilterVarNames : public VarNames<typename AFilter::Object> {
31
33 static const size_t nVars;
34
36 static constexpr char const* getName(int iName);
37 };
38
46 template <class AFilter>
47 class FilterVarSet : public VarSet<FilterVarNames<AFilter>> {
48
49 private:
52
53 public:
55 using Filter = AFilter;
56
58 using Object = typename Filter::Object;
59
61 FilterVarSet(const std::string& filterName = "");
62
64 FilterVarSet(const std::string& filterName, std::unique_ptr<Filter> ptrFilter);
65
66 using Super::named;
67
69 bool extract(const Object* obj) final;
70
72 void initialize() final;
73
78 std::vector<Named<Float_t*>> getNamedVariables(const std::string& prefix) override;
79
84 MayBePtr<Float_t> find(const std::string& varName) override;
85
86 public:
88 double m_cut = NAN;
89
92
95
97 std::unique_ptr<Filter> m_ptrFilter;
98 };
99 }
101}
std::vector< Named< Float_t * > > getNamedVariables()
Getter for the named references to the individual variables.
Definition: BaseVarSet.h:73
Class to compute floating point variables from a filter response which can be recorded as a flat TNtu...
std::string m_filterNamePrefix
Prefix to be put in front of the filter variables.
std::string m_filterName
Name of the filter.
void initialize() final
Initialize the filter before event processing.
bool extract(const Object *obj) final
Generate filter weight variable from the object.
typename Filter::Object Object
Type of the object from which the filter judgement should be extracted.
std::unique_ptr< Filter > m_ptrFilter
Filter from which to generate weight as a variable set;.
AFilter Filter
Type of the filter.
double m_cut
The cut on the filter output.
MayBePtr< Float_t > find(const std::string &varName) override
Pointer to the variable with the given name.
AObject Object
Type of the object to be analysed.
Definition: Filter.dcl.h:35
A mixin class to attach a name to an object.
Definition: Named.h:23
Class that specifies the names of the variables.
Definition: VarNames.h:21
Generic class that generates some named float values from a given object.
Definition: VarSet.h:36
static constexpr int named(const char *name)
Getter for the index from the name.
Definition: VarSet.h:78
Abstract base class for different kinds of events.
STL namespace.
Vehicle class to transport the variable names.
static const size_t nVars
Number of variables to be generated.
static constexpr char const * getName(int iName)
Getter for the name at the given index.