Belle II Software development
TrackCandidateResultRefiner Class Referenceabstract

Findlet for rejecting wrong SpacePointTrackCands and for removing bad hits. More...

#include <TrackCandidateResultRefiner.h>

Inheritance diagram for TrackCandidateResultRefiner:
Findlet< SpacePointTrackCand, SpacePointTrackCand > CompositeProcessingSignalListener ProcessingSignalListener

Public Types

using IOTypes = std::tuple< AIOTypes... >
 Types that should be served to apply on invocation.
 
using IOVectors = std::tuple< std::vector< AIOTypes >... >
 Vector types that should be served to apply on invocation.
 

Public Member Functions

 TrackCandidateResultRefiner ()
 Find intercepts in the 2D Hough space.
 
 ~TrackCandidateResultRefiner ()
 Default destructor.
 
void exposeParameters (ModuleParamList *moduleParamList, const std::string &prefix) override
 Expose the parameters of the sub findlets.
 
void initialize () override
 Create the store arrays.
 
void beginRun () override
 End run and write Root file.
 
void apply (std::vector< SpacePointTrackCand > &unrefinedResults, std::vector< SpacePointTrackCand > &refinedResults) override
 Reject bad SpacePointTrackCands and bad hits inside the remaining.
 
virtual std::string getDescription ()
 Brief description of the purpose of the concrete findlet.
 
virtual void apply (ToVector< AIOTypes > &... ioVectors)=0
 Main function executing the algorithm.
 
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 Types

using ToVector = typename ToVectorImpl< T >::Type
 Short hand for ToRangeImpl.
 

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 = TrackFindingCDC::Findlet< SpacePointTrackCand, SpacePointTrackCand >
 Parent 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
 
TrackCandidateOverlapResolver m_overlapResolver
 Resolve hit overlaps in track candidates.
 
double m_minQualitiyIndicatorSize3 = 0.5
 Cut on the quality estimator and only further propagate SPTCs with three hits that are above this value.
 
double m_minQualitiyIndicatorSize4 = 0.5
 Cut on the quality estimator and only further propagate SPTCs with four hits that are above this value.
 
double m_minQualitiyIndicatorSize5 = 0.5
 Cut on the quality estimator and only further propagate SPTCs with five hits that are above this value.
 
uint m_maxNumberOfEachPathLength = 15
 Accept nHits for each size at maximum.
 
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 happened before.
 
bool m_terminated = false
 Flag to keep track whether termination happened before.
 
std::string m_initializedAs
 Name of the type during initialisation.
 

Detailed Description

Findlet for rejecting wrong SpacePointTrackCands and for removing bad hits.

Definition at line 29 of file TrackCandidateResultRefiner.h.

Member Typedef Documentation

◆ IOTypes

using IOTypes = std::tuple<AIOTypes...>
inherited

Types that should be served to apply on invocation.

Definition at line 30 of file Findlet.h.

◆ IOVectors

using IOVectors = std::tuple< std::vector<AIOTypes>... >
inherited

Vector types that should be served to apply on invocation.

Definition at line 53 of file Findlet.h.

◆ Super

Parent class.

Definition at line 31 of file TrackCandidateResultRefiner.h.

◆ ToVector

using ToVector = typename ToVectorImpl<T>::Type
protectedinherited

Short hand for ToRangeImpl.

Definition at line 49 of file Findlet.h.

Constructor & Destructor Documentation

◆ TrackCandidateResultRefiner()

Find intercepts in the 2D Hough space.

Definition at line 26 of file TrackCandidateResultRefiner.cc.

26 : Super()
27{
29}
void addProcessingSignalListener(ProcessingSignalListener *psl)
Register a processing signal listener to be notified.
TrackFindingCDC::Findlet< SpacePointTrackCand, SpacePointTrackCand > Super
Parent class.
TrackCandidateOverlapResolver m_overlapResolver
Resolve hit overlaps in track candidates.

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.

◆ apply()

void apply ( std::vector< SpacePointTrackCand > &  unrefinedResults,
std::vector< SpacePointTrackCand > &  refinedResults 
)
override

Reject bad SpacePointTrackCands and bad hits inside the remaining.

Definition at line 95 of file TrackCandidateResultRefiner.cc.

97{
98 refinedResults.clear();
99 std::vector<SpacePointTrackCand> selectedResults;
100 selectedResults.reserve(unrefinedResults.size());
101 // assign a QI computed using the selected QualityEstimator for each given SpacePointTrackCand
102 for (SpacePointTrackCand& aTrackCandidate : unrefinedResults) {
103 double qi = m_estimator->estimateQuality(aTrackCandidate.getSortedHits());
104 aTrackCandidate.setQualityIndicator(qi);
105
106 // Track candidates of size >= 6 are very rare. If the track candidate already is quite long (>= 6 hits),
107 // it's very likely it's a valid track anyway, so QI is not checked.
108 if ((aTrackCandidate.getNHits() == 3 and qi >= m_minQualitiyIndicatorSize3) or
109 (aTrackCandidate.getNHits() == 4 and qi >= m_minQualitiyIndicatorSize4) or
110 (aTrackCandidate.getNHits() == 5 and qi >= m_minQualitiyIndicatorSize5) or
111 (aTrackCandidate.getNHits() >= 6)) {
112 selectedResults.emplace_back(aTrackCandidate);
113 }
114 }
115
116 // return early if nothing to do
117 if (selectedResults.size() <= 1) {
118 std::swap(selectedResults, refinedResults);
119 return;
120 }
121
122 // sort by number of hits in the track candidate and by the QI
123 std::sort(selectedResults.begin(), selectedResults.end(),
124 [](const SpacePointTrackCand & a, const SpacePointTrackCand & b) {
125 return ((a.getNHits() > b.getNHits()) or
126 (a.getNHits() == b.getNHits() and a.getQualityIndicator() > b.getQualityIndicator()));
127 });
128
129 std::array<uint, 8> numberOfHitsInCheckedSPTCs{{0, 0, 0, 0, 0, 0, 0, 0}};
130 refinedResults.reserve(selectedResults.size());
131 for (auto& currentSPTC : selectedResults) {
132 if (numberOfHitsInCheckedSPTCs[currentSPTC.size()] < m_maxNumberOfEachPathLength) {
133 numberOfHitsInCheckedSPTCs[currentSPTC.size()] += 1;
134 refinedResults.emplace_back(currentSPTC);
135 }
136 }
137
138 m_overlapResolver.apply(refinedResults);
139}
Storage for (VXD) SpacePoint-based track candidates.
void apply(std::vector< SpacePointTrackCand > &spacePointTrackCandsToResolve) override
Reject bad SpacePointTrackCands and bad hits inside the remaining.
double m_minQualitiyIndicatorSize4
Cut on the quality estimator and only further propagate SPTCs with four hits that are above this valu...
uint m_maxNumberOfEachPathLength
Accept nHits for each size at maximum.
double m_minQualitiyIndicatorSize3
Cut on the quality estimator and only further propagate SPTCs with three hits that are above this val...
std::unique_ptr< QualityEstimatorBase > m_estimator
pointer to the selected QualityEstimator
double m_minQualitiyIndicatorSize5
Cut on the quality estimator and only further propagate SPTCs with five hits that are above this valu...

◆ 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

End run and write Root file.

Reimplemented from CompositeProcessingSignalListener.

Definition at line 81 of file TrackCandidateResultRefiner.cc.

82{
84
85 // BField is required by all QualityEstimators
86 double bFieldZ = BFieldManager::getField(0, 0, 0).Z() / Unit::T;
87 m_estimator->setMagneticFieldStrength(bFieldZ);
88
89 if (m_EstimationMethod == "mcInfo") {
90 QualityEstimatorMC* MCestimator = static_cast<QualityEstimatorMC*>(m_estimator.get());
91 MCestimator->forceUpdateClusterNames();
92 }
93}
Class implementing the algorithm used for the MC based quality estimation.
void forceUpdateClusterNames()
Setter to force the class to update its cluster names.
void beginRun() override
Receive and dispatch signal for the beginning of a new run.
static const double T
[tesla]
Definition: Unit.h:120
std::string m_EstimationMethod
Identifier which estimation method to use.
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 of the sub findlets.

Reimplemented from Findlet< SpacePointTrackCand, SpacePointTrackCand >.

Definition at line 31 of file TrackCandidateResultRefiner.cc.

32{
33 Super::exposeParameters(moduleParamList, prefix);
34
35 m_overlapResolver.exposeParameters(moduleParamList, TrackFindingCDC::prefixed(prefix, "refinerOverlapResolver"));
36
37 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "trackQualityEstimationMethod"), m_EstimationMethod,
38 "Identifier which estimation method to use. Valid identifiers are: [mcInfo, circleFit, tripletFit, helixFit]",
40 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "MCRecoTracksStoreArrayName"), m_MCRecoTracksStoreArrayName,
41 "Only required for MCInfo method. Name of StoreArray containing MCRecoTracks.",
43 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "MCStrictQualityEstimator"), m_MCStrictQualityEstimator,
44 "Only required for MCInfo method. If false combining several MCTracks is allowed.",
46
47 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "minQualitiyIndicatorSize3"), m_minQualitiyIndicatorSize3,
48 "Cut on quality indicator value for track candidates of size 3. Only accept SpacePointTrackCands with QI above this value.",
50 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "minQualitiyIndicatorSize4"), m_minQualitiyIndicatorSize4,
51 "Cut on quality indicator value for track candidates of size 4. Only accept SpacePointTrackCands with QI above this value.",
53 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "minQualitiyIndicatorSize5"), m_minQualitiyIndicatorSize5,
54 "Cut on quality indicator value for track candidates of size 5. Only accept SpacePointTrackCands with QI above this value.",
56
57 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "maxNumberOfEachPathLength"), m_maxNumberOfEachPathLength,
58 "Maximum number of SpacePointTrackCands with a length of 3, 4, 5, or 6 each.",
60}
virtual void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix)
Forward prefixed parameters of this findlet to the module parameter list.
Definition: Findlet.h:69
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) override
Expose the parameters of the sub findlets.
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.

◆ getDescription()

virtual std::string getDescription ( )
inlinevirtualinherited

Brief description of the purpose of the concrete findlet.

Definition at line 60 of file Findlet.h.

61 {
62 return "(no description)";
63 }

◆ 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

Create the store arrays.

Reimplemented from CompositeProcessingSignalListener.

Definition at line 62 of file TrackCandidateResultRefiner.cc.

63{
65
66 // create pointer to chosen estimator
67 if (m_EstimationMethod == "mcInfo") {
68 StoreArray<RecoTrack> mcRecoTracks;
70 m_estimator = std::make_unique<QualityEstimatorMC>(m_MCRecoTracksStoreArrayName, m_MCStrictQualityEstimator);
71 } else if (m_EstimationMethod == "tripletFit") {
72 m_estimator = std::make_unique<QualityEstimatorTripletFit>();
73 } else if (m_EstimationMethod == "circleFit") {
74 m_estimator = std::make_unique<QualityEstimatorCircleFit>();
75 } else if (m_EstimationMethod == "helixFit") {
76 m_estimator = std::make_unique<QualityEstimatorRiemannHelixFit>();
77 }
78 B2ASSERT("QualityEstimator could not be initialized with method: " << m_EstimationMethod, m_estimator);
79}
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
void initialize() override
Receive and dispatch signal before the start of the event processing.

◆ 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 55 of file TrackCandidateResultRefiner.h.

◆ m_estimator

std::unique_ptr<QualityEstimatorBase> m_estimator
private

pointer to the selected QualityEstimator

Definition at line 61 of file TrackCandidateResultRefiner.h.

◆ m_initialized

bool m_initialized = false
privateinherited

Flag to keep track whether initialization happened 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_maxNumberOfEachPathLength

uint m_maxNumberOfEachPathLength = 15
private

Accept nHits for each size at maximum.

Definition at line 74 of file TrackCandidateResultRefiner.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 57 of file TrackCandidateResultRefiner.h.

◆ m_MCStrictQualityEstimator

bool m_MCStrictQualityEstimator = true
private

Only required for MCInfo method.

Definition at line 59 of file TrackCandidateResultRefiner.h.

◆ m_minQualitiyIndicatorSize3

double m_minQualitiyIndicatorSize3 = 0.5
private

Cut on the quality estimator and only further propagate SPTCs with three hits that are above this value.

Definition at line 67 of file TrackCandidateResultRefiner.h.

◆ m_minQualitiyIndicatorSize4

double m_minQualitiyIndicatorSize4 = 0.5
private

Cut on the quality estimator and only further propagate SPTCs with four hits that are above this value.

Definition at line 69 of file TrackCandidateResultRefiner.h.

◆ m_minQualitiyIndicatorSize5

double m_minQualitiyIndicatorSize5 = 0.5
private

Cut on the quality estimator and only further propagate SPTCs with five hits that are above this value.

Definition at line 71 of file TrackCandidateResultRefiner.h.

◆ m_overlapResolver

TrackCandidateOverlapResolver m_overlapResolver
private

Resolve hit overlaps in track candidates.

Definition at line 64 of file TrackCandidateResultRefiner.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 happened before.

Definition at line 55 of file ProcessingSignalListener.h.


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