Belle II Software  release-08-01-10
Chooseable< AFilter > Class Template Reference

Filter can delegate to a filter chosen and set up at run time by parameters. More...

#include <ChooseableFilter.dcl.h>

Inheritance diagram for Chooseable< AFilter >:
Collaboration diagram for Chooseable< AFilter >:

Public Types

using Object = typename AFilter::Object
 Type of the object to be analysed.
 

Public Member Functions

 Chooseable (std::unique_ptr< FilterFactory< AFilter >> filterFactory)
 Setup the chooseable filter with available choices from the factory.
 
 Chooseable (std::unique_ptr< FilterFactory< AFilter >> filterFactory, const std::string &filterName)
 Setup the chooseable filter with available choices from the factory and a default name.
 
void exposeParameters (ModuleParamList *moduleParamList, const std::string &prefix) final
 Expose the set of parameters of the filter to the module parameter list. More...
 
void initialize () override
 Initialize before event processing. More...
 
bool needsTruthInformation () override
 Indicates if the filter requires Monte Carlo information.
 
Weight operator() (const Object &object) final
 Function to evaluate the object. More...
 
Weight operator() (const Object &object) const
 Const version of operator.
 
std::string getFilterName () const
 Return name of the selected filter.
 

Private Types

using Super = AFilter
 Type of the base class.
 

Private Attributes

std::string m_param_filterName
 Parameters : Name of the selected filter.
 
FilterParamMap m_param_filterParameters
 Parameter: Parameter keys and values to be forwarded to the chosen filter.
 
std::unique_ptr< FilterFactory< AFilter > > m_filterFactory
 Filter factor to construct a chosen filter.
 
std::unique_ptr< AFilter > m_filter
 Chosen filter.
 

Detailed Description

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

Filter can delegate to a filter chosen and set up at run time by parameters.

Definition at line 29 of file ChooseableFilter.dcl.h.

Member Function Documentation

◆ exposeParameters()

void exposeParameters ( ModuleParamList moduleParamList,
const std::string &  prefix 
)
final

Expose the set of parameters of the filter to the module parameter list.

Make a force parameter in case no default was given

Make a normal parameter in case default is known

Definition at line 48 of file ChooseableFilter.icc.h.

49  {
50  Super::exposeParameters(moduleParamList, prefix);
51  if (m_param_filterName == "") {
53  moduleParamList->addParameter(prefixed(prefix, "filter"),
55  m_filterFactory->createFiltersNameDescription());
56  } else {
58  moduleParamList->addParameter(prefixed(prefix, "filter"),
60  m_filterFactory->createFiltersNameDescription(),
62  }
63 
64  m_param_filterParameters.addParameter(moduleParamList,
65  prefixed(prefix, "filterParameters"),
66  m_filterFactory->createFiltersParametersDescription());
67  }
std::unique_ptr< FilterFactory< AFilter > > m_filterFactory
Filter factor to construct a chosen filter.
std::string m_param_filterName
Parameters : Name of the selected filter.
FilterParamMap m_param_filterParameters
Parameter: Parameter keys and values to be forwarded to the chosen filter.
void addParameter(ModuleParamList *moduleParamList, const std::string &name, const std::string &description)
Create one parameter in the parameter list for the module with the given name and desciption.

◆ initialize()

void initialize ( void  )
override

Initialize before event processing.

Transfer parameters

Definition at line 70 of file ChooseableFilter.icc.h.

◆ operator()()

Weight operator() ( const Object object)
final

Function to evaluate the object.

Delegates to the filter chosen by module parameters.

Parameters
objectThe object to be accepted or rejected.
Returns
A finit float value if the object is accepted. NAN if the object is rejected.

Definition at line 94 of file ChooseableFilter.icc.h.


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