Belle II Software  release-08-01-10
FilterOnVarSet.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/Filter.fwd.h>
11 
12 #include <tracking/trackFindingCDC/varsets/BaseVarSet.h>
13 
14 #include <tracking/trackFindingCDC/numerics/Weight.h>
15 
16 #include <memory>
17 
18 namespace Belle2 {
23  namespace TrackFindingCDC {
24 
26  template<class AFilter>
27  class OnVarSet : public AFilter {
28 
29  private:
31  using Super = AFilter;
32 
33  public:
35  using Object = typename AFilter::Object;
36 
37  private:
40 
41  public:
43  explicit OnVarSet(std::unique_ptr<AVarSet> varSet);
44 
47 
49  void initialize() override;
50 
52  bool needsTruthInformation() override;
53 
54  public:
56  Weight operator()(const Object& obj) override;
57 
58  public:
60  std::unique_ptr<AVarSet> releaseVarSet()&& ;
61 
62  protected:
64  AVarSet& getVarSet() const;
65 
67  void setVarSet(std::unique_ptr<AVarSet> varSet);
68 
69  private:
71  std::unique_ptr<AVarSet> m_varSet;
72  };
73  }
75 }
76 
77 #include <tracking/trackFindingCDC/filters/base/Filter.icc.h>
78 
79 namespace Belle2 {
84  namespace TrackFindingCDC {
85 
87  template<class AVarSet>
88  class FilterOnVarSet: public OnVarSet<Filter<typename AVarSet::Object> > {
89 
90  private:
93 
94  public:
96  using Object = typename AVarSet::Object;
97 
98  public:
100  FilterOnVarSet();
101 
104  };
105  }
107 }
Generic class that generates some named float values from a given object.
Definition: BaseVarSet.h:33
AObject Object
Object type from which variables shall be extracted.
Definition: BaseVarSet.h:37
Convience template to create a filter operating on a specific set of variables.
FilterOnVarSet()
Constructor of the filter.
AObject Object
Type of the object to be analysed.
Definition: Filter.dcl.h:33
Filter adapter to make a filter work on a set of variables.
void initialize() override
No reassignment of variable set possible for now.
bool needsTruthInformation() override
Checks if any variables need Monte Carlo information.
Weight operator()(const Object &obj) override
Function extracting the variables of the object into the variable set.
std::unique_ptr< AVarSet > m_varSet
Instance of the variable set to be used in the filter.
AFilter Super
Type of the base class.
std::unique_ptr< AVarSet > releaseVarSet() &&
Steal the set of variables form this filter - filter becomes disfunctional afterwards.
AVarSet & getVarSet() const
Getter for the set of variables.
typename AFilter::Object Object
Type of pbject to be filtered.
void setVarSet(std::unique_ptr< AVarSet > varSet)
Setter for the set of variables.
OnVarSet(std::unique_ptr< AVarSet > varSet)
Constructor from the variable set the filter should use.
~OnVarSet()
Default destructor.
Abstract base class for different kinds of events.