Belle II Software development
ObserverFilter< AFilter > Class Template Reference

Observer listening to the number of yes and no answers from the filter. More...

#include <ObserverFilter.dcl.h>

Inheritance diagram for ObserverFilter< AFilter >:

Public Types

using Object = typename AFilter::Object
 Object type to be filtered.
 

Public Member Functions

void terminate () override
 Terminate the filter after event processing.
 
Weight operator() (const Object &object) override
 Function to evaluate the object.
 

Private Types

using Super = AFilter
 Type of the filter base class.
 

Private Attributes

unsigned int m_yesAnswers = 0
 Number of counted yes answers.
 
unsigned int m_noAnswers = 0
 Number of counted no answers.
 

Detailed Description

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

Observer listening to the number of yes and no answers from the filter.

Definition at line 21 of file ObserverFilter.dcl.h.

Member Typedef Documentation

◆ Object

using Object = typename AFilter::Object

Object type to be filtered.

Definition at line 32 of file ObserverFilter.dcl.h.

◆ Super

using Super = AFilter
private

Type of the filter base class.

Definition at line 25 of file ObserverFilter.dcl.h.

Member Function Documentation

◆ operator()()

Weight operator() ( const Object object)
override

Function to evaluate the object.

Base implementation rejects all objects.

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 33 of file ObserverFilter.icc.h.

34 {
35 Weight result = Super::operator()(object);
36 if (std::isnan(result)) {
37 m_noAnswers += 1;
38 } else {
39 m_yesAnswers += 1;
40 }
41
42 return result;
43 }
unsigned int m_yesAnswers
Number of counted yes answers.
unsigned int m_noAnswers
Number of counted no answers.

◆ terminate()

void terminate
override

Terminate the filter after event processing.

Definition at line 26 of file ObserverFilter.icc.h.

27 {
28 B2INFO("Filter said " << m_yesAnswers << " times yes and " << m_noAnswers << " times no.");
29 Super::terminate();
30 }

Member Data Documentation

◆ m_noAnswers

unsigned int m_noAnswers = 0
private

Number of counted no answers.

Definition at line 54 of file ObserverFilter.dcl.h.

◆ m_yesAnswers

unsigned int m_yesAnswers = 0
private

Number of counted yes answers.

Definition at line 51 of file ObserverFilter.dcl.h.


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