Belle II Software development
QualityIndicatorFilter Class Reference

Filter for >= 3 hits using QualityEstimators. More...

#include <QualityIndicatorFilter.h>

Inheritance diagram for QualityIndicatorFilter:
Filter< AObject > CompositeProcessingSignalListener ProcessingSignalListener

Public Types

using Object = AObject
 Type of the object to be analysed.
 
using Interface = Filter< AObject >
 Mark this class as the basic interface.
 

Public Member Functions

TrackFindingCDC::Weight operator() (const BasePathFilter::Object &pair) override
 Return the weight based on the quality estimator.
 
void exposeParameters (ModuleParamList *moduleParamList, const std::string &prefix) override
 Expose the parameters.
 
void initialize () override
 initialize quality estimator
 
void beginRun () override
 set BField value for estimator
 
virtual bool needsTruthInformation ()
 Indicates if the filter requires Monte Carlo information.
 
Weight operator() (const Object *obj)
 Function to evaluate the object.
 
virtual std::vector< float > operator() (const std::vector< Object * > &objs)
 Function to evaluate a vector of objects Base implementation applies the function to each object.
 
void beginEvent () override
 Receive and dispatch signal for the start of a new event.
 
void endRun () override
 Receive and dispatch signal for the end of the run.
 
void terminate () override
 Receive and dispatch Signal for termination of the event processing.
 

Protected Member Functions

void addProcessingSignalListener (ProcessingSignalListener *psl)
 Register a processing signal listener to be notified.
 
int getNProcessingSignalListener ()
 Get the number of currently registered listeners.
 

Private Types

using Super = ProcessingSignalListener
 Type of the base class.
 

Private Attributes

std::string m_EstimationMethod = "tripletFit"
 Identifier which estimation method to use.
 
std::string m_MCRecoTracksStoreArrayName = "MCRecoTracks"
 sets the name of the expected StoreArray containing MCRecoTracks. Only required for MCInfo method
 
bool m_MCStrictQualityEstimator = true
 Only required for MCInfo method.
 
std::unique_ptr< QualityEstimatorBasem_estimator
 pointer to the selected QualityEstimator
 
double m_QIcut = 0.0
 cut on quality indicator
 
std::vector< ProcessingSignalListener * > m_subordinaryProcessingSignalListeners
 References to subordinary signal processing listener contained in this findlet.
 
bool m_initialized = false
 Flag to keep track whether initialization happend before.
 
bool m_terminated = false
 Flag to keep track whether termination happend before.
 
std::string m_initializedAs
 Name of the type during initialisation.
 

Detailed Description

Filter for >= 3 hits using QualityEstimators.

Definition at line 22 of file QualityIndicatorFilter.h.

Member Typedef Documentation

◆ Interface

using Interface = Filter<AObject>
inherited

Mark this class as the basic interface.

Definition at line 38 of file Filter.dcl.h.

◆ Object

using Object = AObject
inherited

Type of the object to be analysed.

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

◆ Super

using Super = ProcessingSignalListener
privateinherited

Type of the base class.

Definition at line 25 of file CompositeProcessingSignalListener.h.

Member Function Documentation

◆ addProcessingSignalListener()

void addProcessingSignalListener ( ProcessingSignalListener psl)
protectedinherited

Register a processing signal listener to be notified.

Definition at line 55 of file CompositeProcessingSignalListener.cc.

56{
58}
std::vector< ProcessingSignalListener * > m_subordinaryProcessingSignalListeners
References to subordinary signal processing listener contained in this findlet.

◆ beginEvent()

void beginEvent ( )
overridevirtualinherited

Receive and dispatch signal for the start of a new event.

Reimplemented from ProcessingSignalListener.

Reimplemented in SpacePointTagger< Belle2::CKFToPXDResult, Belle2::PXDCluster >, SpacePointTagger< Belle2::CKFToSVDResult, Belle2::SVDCluster >, BaseEventTimeExtractor< RecoTrack * >, BaseEventTimeExtractor< TrackFindingCDC::CDCWireHit & >, SharingHitsMatcher< Belle2::TrackFindingCDC::CDCTrack, Belle2::TrackFindingCDC::CDCSegment2D >, MCSymmetric< BaseAxialSegmentPairFilter >, MCSymmetric< BaseFacetFilter >, MCSymmetric< BaseFacetRelationFilter >, MCSymmetric< BaseSegmentPairFilter >, MCSymmetric< BaseSegmentPairRelationFilter >, MCSymmetric< BaseSegmentRelationFilter >, MCSymmetric< BaseSegmentTripleFilter >, MCSymmetric< BaseSegmentTripleRelationFilter >, MCSymmetric< BaseTrackRelationFilter >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCFacet >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCWireHit, true >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCSegment2D >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCTrack >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCSegmentPair >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCSegmentTriple >, RecoTrackStorer, ROIFinder, and SVDHoughTracking.

Definition at line 31 of file CompositeProcessingSignalListener.cc.

32{
35 psl->beginEvent();
36 }
37}
Interface for an algorithm part that needs to receive the module processing signals.
virtual void beginEvent()
Receive signal for the start of a new event.

◆ beginRun()

void beginRun ( )
overridevirtual

set BField value for estimator

Reimplemented from CompositeProcessingSignalListener.

Definition at line 40 of file QualityIndicatorFilter.cc.

41{
42 const double bFieldZ = BFieldManager::getField(0, 0, 0).Z() / Unit::T;
43 m_estimator->setMagneticFieldStrength(bFieldZ);
44
45 if (m_EstimationMethod == "mcInfo") {
46 QualityEstimatorMC* MCestimator = static_cast<QualityEstimatorMC*>(m_estimator.get());
47 MCestimator->forceUpdateClusterNames();
48 }
49}
Class implementing the algorithm used for the MC based quality estimation.
void forceUpdateClusterNames()
Setter to force the class to update its cluster names.
static const double T
[tesla]
Definition: Unit.h:120
std::string m_EstimationMethod
Identifier which estimation method to use.
std::unique_ptr< QualityEstimatorBase > m_estimator
pointer to the selected QualityEstimator
static void getField(const double *pos, double *field)
return the magnetic field at a given position.
Definition: BFieldManager.h:91

◆ endRun()

void endRun ( )
overridevirtualinherited

Receive and dispatch signal for the end of the run.

Reimplemented from ProcessingSignalListener.

Definition at line 39 of file CompositeProcessingSignalListener.cc.

40{
42 psl->endRun();
43 }
45}
virtual void endRun()
Receive signal for the end of the run.

◆ exposeParameters()

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

Expose the parameters.

Reimplemented from Filter< AObject >.

Definition at line 22 of file QualityIndicatorFilter.cc.

23{
24 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "trackQualityEstimationMethod"), m_EstimationMethod,
25 "Identifier which estimation method to use. Valid identifiers are: [mcInfo, circleFit, tripletFit, helixFit]",
27
28 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "MCRecoTracksStoreArrayName"), m_MCRecoTracksStoreArrayName,
29 "Only required for MCInfo method. Name of StoreArray containing MCRecoTracks.",
31
32 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "MCStrictQualityEstimator"), m_MCStrictQualityEstimator,
33 "Only required for MCInfo method. If false combining several MCTracks is allowed.",
35
36 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "QICut"), m_QIcut,
37 "Cut on the quality indicator. Only process QI values larger than this.", m_QIcut);
38}
bool m_MCStrictQualityEstimator
Only required for MCInfo method.
std::string m_MCRecoTracksStoreArrayName
sets the name of the expected StoreArray containing MCRecoTracks. Only required for MCInfo method
void addParameter(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.

◆ getNProcessingSignalListener()

int getNProcessingSignalListener ( )
protectedinherited

Get the number of currently registered listeners.

Definition at line 60 of file CompositeProcessingSignalListener.cc.

61{
63}

◆ initialize()

void initialize ( )
overridevirtual

initialize quality estimator

Reimplemented from CompositeProcessingSignalListener.

Definition at line 51 of file QualityIndicatorFilter.cc.

52{
53 // create pointer to chosen estimator
54 if (m_EstimationMethod == "mcInfo") {
55 StoreArray<RecoTrack> mcRecoTracks;
57 m_estimator = std::make_unique<QualityEstimatorMC>(m_MCRecoTracksStoreArrayName, m_MCStrictQualityEstimator);
58 } else if (m_EstimationMethod == "tripletFit") {
59 m_estimator = std::make_unique<QualityEstimatorTripletFit>();
60 } else if (m_EstimationMethod == "circleFit") {
61 m_estimator = std::make_unique<QualityEstimatorCircleFit>();
62 } else if (m_EstimationMethod == "helixFit") {
63 m_estimator = std::make_unique<QualityEstimatorRiemannHelixFit>();
64 }
65 B2ASSERT("QualityEstimator could not be initialized with method: " << m_EstimationMethod, m_estimator);
66}
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113

◆ needsTruthInformation()

◆ operator()() [1/3]

TrackFindingCDC::Weight operator() ( const BasePathFilter::Object pair)
overridevirtual

Return the weight based on the quality estimator.

Returns the QI value obtained from the fit with the chosen QualityEstimator if above the m_QIcut, and NAN if the QI is below the cut.

Reimplemented from Filter< AObject >.

Definition at line 69 of file QualityIndicatorFilter.cc.

70{
71 const std::vector<TrackFindingCDC::WithWeight<const VXDHoughState*>>& previousHits = pair.first;
72
73 std::vector<const SpacePoint*> spacePoints;
74 spacePoints.reserve(previousHits.size() + 1);
75 for (auto& hit : previousHits) {
76 spacePoints.emplace_back(hit->getHit());
77 }
78 spacePoints.emplace_back(pair.second->getHit());
79
80 // The path is outwards-in, and thus the SPs are added outwards-in, too.
81 // The tripletFit only works with hits inside-out, so reverse the SP vector
82 std::reverse(spacePoints.begin(), spacePoints.end());
83
84 const auto& estimatorResult = m_estimator->estimateQualityAndProperties(spacePoints);
85
86 if (estimatorResult.qualityIndicator < m_QIcut) {
87 return NAN;
88 }
89
90 return estimatorResult.qualityIndicator;
91}

◆ operator()() [2/3]

Weight operator() ( const Object obj)
inherited

Function to evaluate the object.

Base implementation accepts all objects, except nullptr.

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

Definition at line 58 of file Filter.icc.h.

59 {
60 return obj ? operator()(*obj) : NAN;
61 }
virtual Weight operator()(const Object &obj)
Function to evaluate the object.
Definition: Filter.icc.h:52

◆ operator()() [3/3]

std::vector< float > operator() ( const std::vector< Object * > &  objs)
virtualinherited

Function to evaluate a vector of objects Base implementation applies the function to each object.

Can be optimized for MVA filters

Parameters
objsA vector of pointers to objects
Returns
A vector of float or NAN values. See above

Definition at line 64 of file Filter.icc.h.

65 {
66 std::vector<float> out;
67 for (const auto& obj : objs) {
68 out.push_back(operator()(obj));
69 }
70 return out;
71 }

◆ terminate()

void terminate ( )
overridevirtualinherited

Receive and dispatch Signal for termination of the event processing.

Reimplemented from ProcessingSignalListener.

Reimplemented in StereoHitTrackQuadTreeMatcher< Belle2::TrackFindingCDC::HyperHough >, StereoHitTrackQuadTreeMatcher< Belle2::TrackFindingCDC::QuadraticLegendre >, and StereoHitTrackQuadTreeMatcher< Belle2::TrackFindingCDC::Z0TanLambdaLegendre >.

Definition at line 47 of file CompositeProcessingSignalListener.cc.

48{
50 psl->terminate();
51 }
53}
virtual void terminate()
Receive Signal for termination of the event processing.

Member Data Documentation

◆ m_EstimationMethod

std::string m_EstimationMethod = "tripletFit"
private

Identifier which estimation method to use.

Valid identifiers are: mcInfo, circleFit, tripletFit, helixFit

Definition at line 39 of file QualityIndicatorFilter.h.

◆ m_estimator

std::unique_ptr<QualityEstimatorBase> m_estimator
private

pointer to the selected QualityEstimator

Definition at line 45 of file QualityIndicatorFilter.h.

◆ m_initialized

bool m_initialized = false
privateinherited

Flag to keep track whether initialization happend before.

Definition at line 52 of file ProcessingSignalListener.h.

◆ m_initializedAs

std::string m_initializedAs
privateinherited

Name of the type during initialisation.

Definition at line 58 of file ProcessingSignalListener.h.

◆ m_MCRecoTracksStoreArrayName

std::string m_MCRecoTracksStoreArrayName = "MCRecoTracks"
private

sets the name of the expected StoreArray containing MCRecoTracks. Only required for MCInfo method

Definition at line 41 of file QualityIndicatorFilter.h.

◆ m_MCStrictQualityEstimator

bool m_MCStrictQualityEstimator = true
private

Only required for MCInfo method.

Definition at line 43 of file QualityIndicatorFilter.h.

◆ m_QIcut

double m_QIcut = 0.0
private

cut on quality indicator

Definition at line 48 of file QualityIndicatorFilter.h.

◆ m_subordinaryProcessingSignalListeners

std::vector<ProcessingSignalListener*> m_subordinaryProcessingSignalListeners
privateinherited

References to subordinary signal processing listener contained in this findlet.

Definition at line 52 of file CompositeProcessingSignalListener.h.

◆ m_terminated

bool m_terminated = false
privateinherited

Flag to keep track whether termination happend before.

Definition at line 55 of file ProcessingSignalListener.h.


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