Belle II Software development
SizeSVDResultFilter Class Reference

Base filter for CKF SVD results (on overlap check) More...

#include <SizeSVDResultFilter.h>

Inheritance diagram for SizeSVDResultFilter:
ChoosableFromVarSetFilter< SVDResultVarSet > ChoosableFromVarSet< Filter< ATruthVarSet::Object > > OnVarSet< AFilter >

Public Types

using Object = typename ATruthVarSet::Object
 Type of the filtered object.
 

Public Member Functions

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.
 
Weight operator() (const Object &object) override
 Returns the variable with the set requested name from the variable set.
 
bool needsTruthInformation () override
 Checks if any variables need Monte Carlo information.
 
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 = ChoosableFromVarSet< Filter< typename ATruthVarSet::Object > >
 Type of the super class.
 
using AVarSet = BaseVarSet< Object >
 Type of the variable set.
 

Private Attributes

std::string m_param_varName
 Memory for the name of the variable selected as the return value of the filter.
 
Float_t * m_variable
 Reference to the location of the value in the variable set to be returned.
 
std::unique_ptr< AVarSetm_varSet
 Instance of the variable set to be used in the filter.
 

Detailed Description

Base filter for CKF SVD results (on overlap check)

Definition at line 19 of file SizeSVDResultFilter.h.

Member Typedef Documentation

◆ AVarSet

using AVarSet = BaseVarSet<Object>
privateinherited

Type of the variable set.

Definition at line 44 of file ChoosableFromVarSetFilter.dcl.h.

◆ Object

using Object = typename ATruthVarSet::Object
inherited

Type of the filtered object.

Definition at line 84 of file ChoosableFromVarSetFilter.dcl.h.

◆ Super

using Super = ChoosableFromVarSet<Filter<typename ATruthVarSet::Object> >
privateinherited

Type of the super class.

Definition at line 80 of file ChoosableFromVarSetFilter.dcl.h.

Constructor & Destructor Documentation

◆ SizeSVDResultFilter()

SizeSVDResultFilter ( )
inline

Definition at line 21 of file SizeSVDResultFilter.h.

21 : TrackFindingCDC::ChoosableFromVarSetFilter<SVDResultVarSet>("number_of_hits")
22 {
23
24 }

Member Function Documentation

◆ exposeParameters()

void exposeParameters ( ModuleParamList parameterList,
const std::string &  prefix 
)
overrideinherited

Add the parameters of this filter to the given parameter list.

Definition at line 57 of file ChoosableFromVarSetFilter.icc.h.

42 {
43 Super::exposeParameters(moduleParamList, prefix);
44
45 if (m_param_varName == "") {
46 // Make a forced parameter if no default variable name is present
47 moduleParamList->addParameter(prefixed(prefix, "chosenVariable"),
48 m_param_varName,
49 "Choose the name of the variable "
50 "that will be put out as a weight.");
51 } else {
52 // Normal unforced parameter if default name is present
53 moduleParamList->addParameter(prefixed(prefix, "chosenVariable"),
54 m_param_varName,
55 "Choose the name of the variable "
56 "that will be put out as a weight.",
57 m_param_varName);
58 }
59 }

◆ getVarSet()

auto getVarSet
protectedinherited

Getter for the set of variables.

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

81 {
82 return *m_varSet;
83 }
std::unique_ptr< AVarSet > m_varSet
Instance of the variable set to be used in the filter.

◆ initialize()

void initialize
overrideinherited

Initialisation method sets up a reference to the value in the variable set to be returned.

Definition at line 60 of file ChoosableFromVarSetFilter.icc.h.

63 {
64 Super::initialize();
65 MayBePtr<Float_t> foundVariable = Super::getVarSet().find(m_param_varName);
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();
70 for (const Named<Float_t*>& namedVariable : namedVariables) {
71 std::string name = namedVariable.getName();
72 B2INFO("* " << name);
73 }
74 }
75 m_variable = foundVariable;
76 }
Float_t * m_variable
Reference to the location of the value in the variable set to be returned.

◆ needsTruthInformation()

bool needsTruthInformation
overrideinherited

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 object)
overrideinherited

Returns the variable with the set requested name from the variable set.

Definition at line 63 of file ChoosableFromVarSetFilter.icc.h.

80 {
81 Weight extracted = Super::operator()(object);
82 if (std::isnan(extracted)) {
83 return NAN;
84 } else {
85 if (m_variable) {
86 return *m_variable;
87 } else {
88 return NAN;
89 }
90 }
91 }

◆ releaseVarSet()

auto releaseVarSet ( ) &&
inherited

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)
protectedinherited

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_param_varName

std::string m_param_varName
privateinherited

Memory for the name of the variable selected as the return value of the filter.

Definition at line 67 of file ChoosableFromVarSetFilter.dcl.h.

◆ m_variable

Float_t* m_variable
privateinherited

Reference to the location of the value in the variable set to be returned.

Definition at line 70 of file ChoosableFromVarSetFilter.dcl.h.

◆ m_varSet

std::unique_ptr<AVarSet> m_varSet
privateinherited

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 file: