Belle II Software development
OnVarSet< AFilter > Class Template Reference

Filter adapter to make a filter work on a set of variables. More...

#include <FilterOnVarSet.dcl.h>

Inheritance diagram for OnVarSet< AFilter >:
ChoosableFromVarSet< Filter< ATruthVarSet::Object > > MVA< Filter< AVarSet::Object > > MVA< BaseFacetFilter > MVA< BaseFacetRelationFilter > MVA< BaseAxialSegmentPairFilter > MVA< BaseSegmentRelationFilter > MVA< BaseTrackRelationFilter > MVA< BaseSegmentPairRelationFilter > Recording< Filter< AVarSet::Object > > Recording< AFilterFactory::CreatedFilter > ChoosableFromVarSet< AFilter > MVA< AFilter > Recording< AFilter >

Public Types

using Object = typename AFilter::Object
 Type of pbject to be filtered.
 

Public Member Functions

 OnVarSet (std::unique_ptr< AVarSet > varSet)
 Constructor from the variable set the filter should use.
 
 ~OnVarSet ()
 Default destructor.
 
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< AVarSetreleaseVarSet () &&
 Steal the set of variables form this filter - filter becomes dysfunctional afterwards.
 

Protected Member Functions

AVarSetgetVarSet () const
 Getter for the set of variables.
 
void setVarSet (std::unique_ptr< AVarSet > varSet)
 Setter for the set of variables.
 

Private Types

using Super = AFilter
 Type of the base class.
 
using AVarSet = BaseVarSet< Object >
 Type of the variable set usedi in this filter.
 

Private Attributes

std::unique_ptr< AVarSetm_varSet
 Instance of the variable set to be used in the filter.
 

Detailed Description

template<class AFilter>
class Belle2::TrackFindingCDC::OnVarSet< AFilter >

Filter adapter to make a filter work on a set of variables.

Definition at line 27 of file FilterOnVarSet.dcl.h.

Member Typedef Documentation

◆ AVarSet

using AVarSet = BaseVarSet<Object>
private

Type of the variable set usedi in this filter.

Definition at line 39 of file FilterOnVarSet.dcl.h.

◆ Object

using Object = typename AFilter::Object

Type of pbject to be filtered.

Definition at line 35 of file FilterOnVarSet.dcl.h.

◆ Super

using Super = AFilter
private

Type of the base class.

Definition at line 31 of file FilterOnVarSet.dcl.h.

Constructor & Destructor Documentation

◆ OnVarSet()

OnVarSet ( std::unique_ptr< AVarSet varSet)
explicit

Constructor from the variable set the filter should use.

Definition at line 32 of file FilterOnVarSet.icc.h.

33 : m_varSet(std::move(varSet))
34 {
35 B2ASSERT("Varset initialised as nullptr", m_varSet);
36 }
std::unique_ptr< AVarSet > m_varSet
Instance of the variable set to be used in the filter.

Member Function Documentation

◆ getVarSet()

auto getVarSet
protected

Getter for the set of variables.

Definition at line 80 of file FilterOnVarSet.icc.h.

81 {
82 return *m_varSet;
83 }

◆ initialize()

void initialize
override

No reassignment of variable set possible for now.

Definition at line 42 of file FilterOnVarSet.icc.h.

43 {
44 this->addProcessingSignalListener(m_varSet.get());
45 Super::initialize();
46 }

◆ needsTruthInformation()

bool needsTruthInformation
override

Checks if any variables need Monte Carlo information.

Definition at line 49 of file FilterOnVarSet.icc.h.

50 {
51 bool result = Super::needsTruthInformation();
52 if (result) return true;
53
54 const std::vector<Named<Float_t*>>& namedVariables = m_varSet->getNamedVariables();
55 for (const Named<Float_t*>& namedVariable : namedVariables) {
56 std::string name = namedVariable.getName();
57 // If the name contains the word truth it is considered to have Monte carlo information.
58 if (name.find("truth") != std::string::npos) {
59 return true;
60 }
61 }
62 return false;
63 }

◆ operator()()

Weight operator() ( const Object obj)
override

Function extracting the variables of the object into the variable set.

Definition at line 66 of file FilterOnVarSet.icc.h.

67 {
68 Weight weight = Super::operator()(obj);
69 if (std::isnan(weight)) return NAN;
70 bool extracted = m_varSet->extract(&obj);
71 return extracted ? weight : NAN;
72 }

◆ releaseVarSet()

auto releaseVarSet ( ) &&

Steal the set of variables form this filter - filter becomes dysfunctional afterwards.

Definition at line 75 of file FilterOnVarSet.icc.h.

75 {
76 return std::move(m_varSet);
77 }

◆ setVarSet()

void setVarSet ( std::unique_ptr< AVarSet varSet)
protected

Setter for the set of variables.

Definition at line 86 of file FilterOnVarSet.icc.h.

87 {
88 m_varSet = std::move(varSet);
89 }

Member Data Documentation

◆ m_varSet

std::unique_ptr<AVarSet> m_varSet
private

Instance of the variable set to be used in the filter.

Definition at line 71 of file FilterOnVarSet.dcl.h.


The documentation for this class was generated from the following files: