Belle II Software prerelease-11-00-00a
TrackCandidateOverlapResolver Class Referenceabstract

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

#include <TrackCandidateOverlapResolver.h>

Inheritance diagram for TrackCandidateOverlapResolver:
Collaboration diagram for TrackCandidateOverlapResolver:

Public Types

using IOTypes
 Types that should be served to apply on invocation.
 
using IOVectors
 Vector types that should be served to apply on invocation.
 

Public Member Functions

 TrackCandidateOverlapResolver ()
 Find intercepts in the 2D Hough space.
 
 ~TrackCandidateOverlapResolver ()
 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
 Check dbobject validity.
 
void apply (std::vector< SpacePointTrackCand > &spacePointTrackCandsToResolve) override
 Reject bad SpacePointTrackCands and bad hits inside the remaining.
 
virtual std::string getDescription ()
 Brief description of the purpose of the concrete findlet.
 
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
 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 = TrackingUtilities::Findlet<SpacePointTrackCand>
 Parent class.
 

Private Attributes

StoreArray< SVDClusterm_svdClusters
 Stay connected to the DataStore for timing improvement.
 
std::string m_nameSVDClusters = "SVDClusters"
 Name of array of SVDCluster.
 
std::string m_resolveMethod = "greedy"
 Strategy used to resolve overlaps.
 
double m_minActivityState = 0.7
 Minimum of activityState of candidate required to be accepted by the algorithm.
 
DBObjPtr< SVDHoughParametersm_SVDHoughParameters
 DB object containing the SVDHough parameters.
 
std::string m_prefix = ""
 parameters prefix (finalOverlapResolver, refinerOverlapResolver)
 
std::vector< ProcessingSignalListener * > m_subordinaryProcessingSignalListeners
 References to subordinary signal processing listener contained in this findlet.
 
bool m_initialized
 Flag to keep track whether initialization happened before.
 
bool m_terminated
 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 27 of file TrackCandidateOverlapResolver.h.

Member Typedef Documentation

◆ IOTypes

using IOTypes
inherited

Types that should be served to apply on invocation.

Definition at line 30 of file Findlet.h.

◆ IOVectors

using IOVectors
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 29 of file TrackCandidateOverlapResolver.h.

◆ ToVector

using ToVector
protectedinherited

Short hand for ToRangeImpl.

Definition at line 49 of file Findlet.h.

Constructor & Destructor Documentation

◆ TrackCandidateOverlapResolver()

Find intercepts in the 2D Hough space.

Definition at line 27 of file TrackCandidateOverlapResolver.cc.

27 : Super()
28{
29}
TrackingUtilities::Findlet< SpacePointTrackCand > Super
Parent class.

Member Function Documentation

◆ addProcessingSignalListener()

void addProcessingSignalListener ( ProcessingSignalListener * psl)
protectedinherited

Register a processing signal listener to be notified.

Definition at line 53 of file CompositeProcessingSignalListener.cc.

56{
58}
Interface for a minimal algorithm part that wants to expose some parameters to a module.
Definition Findlet.h:26

◆ apply()

void apply ( std::vector< SpacePointTrackCand > & spacePointTrackCandsToResolve)
override

Reject bad SpacePointTrackCands and bad hits inside the remaining.

Definition at line 72 of file TrackCandidateOverlapResolver.cc.

73{
74 //Create matrix[svdCluster][track]
75 unsigned short nHits = m_svdClusters.getEntries();
76
77 //Create subset of active Candidates
78 std::vector<SpacePointTrackCand*> activeCandidates;
79 auto requiredSpace = spacePointTrackCandsToResolve.size();
80 activeCandidates.reserve(requiredSpace);
81 for (SpacePointTrackCand& sptc : spacePointTrackCandsToResolve) {
82 if (sptc.hasRefereeStatus(SpacePointTrackCand::c_isActive)) activeCandidates.push_back(&sptc);
83 }
84 unsigned short const nActiveCandidates = activeCandidates.size();
85 if (nActiveCandidates < 2) {
86 B2DEBUG(29, "Less than 2 active SPTC. No reason to do SVDOverlapResolver!");
87 return;
88 }
89
90 //now fill the cluster/track matrix:
91 std::vector<std::vector<unsigned short> > svdHitRelatedTracks(nHits);
92 //TODO: Check if one saves time by reserving some space for each single of those vectors;
93 for (unsigned short iCand = 0; iCand < nActiveCandidates; ++iCand) {
94
95 for (const SpacePoint* spacePointPointer : activeCandidates.at(iCand)->getHits()) {
96 //only SVD is handled with this algorithm
97 if (spacePointPointer->getType() != VXD::SensorInfoBase::SensorType::SVD) continue;
98
99 //at the position of the svdCluster Index, the track index is pushed back;
100 RelationVector<SVDCluster> svdClusterRelations = spacePointPointer->getRelationsTo<SVDCluster>(m_nameSVDClusters);
101 for (SVDCluster const& svdClusterPointer : svdClusterRelations) {
102 svdHitRelatedTracks[svdClusterPointer.getArrayIndex()].push_back(iCand);
103 }
104 }
105 }
106
107 //Create the overlap matrix and store it into the OverlapNetwork
108 OverlapMatrixCreator overlapMatrixCreator(svdHitRelatedTracks, nActiveCandidates);
109 auto overlapMatrix = overlapMatrixCreator.getOverlapMatrix();
110
111 //Resolve overlap
112 //Create an empty object of the type,
113 //that needs to be given to Scrooge.
114 std::vector<OverlapResolverNodeInfo> qiTrackOverlap;
115 qiTrackOverlap.reserve(nActiveCandidates);
116
117 //fill this object with the necessary information:
118 for (unsigned short iCand = 0; iCand < nActiveCandidates; ++iCand) {
119 qiTrackOverlap.emplace_back(
120 activeCandidates[iCand]->getQualityIndicator(),
121 iCand,
122 overlapMatrix.at(iCand),
123 1);
124 }
125
126 if (m_resolveMethod == "greedy") {
127 //make a Scrooge and update the activity
128 Scrooge scrooge;
129 scrooge.performSelection(qiTrackOverlap);
130
131 } else if (m_resolveMethod == "hopfield") {
132 //Performs the actual HNN.
133 //As the parameter is taken as reference, the values are changed and can be reused below.
134 HopfieldNetwork hopfieldNetwork;
135 unsigned maxIterations = 20;
136 if (hopfieldNetwork.doHopfield(qiTrackOverlap, maxIterations) == maxIterations) {
137 B2WARNING("Hopfield Network failed converge.");
138 }
139 }
140
141 for (auto&& track : qiTrackOverlap) {
142 if (track.activityState < m_minActivityState) {
143 activeCandidates[track.trackIndex]->removeRefereeStatus(SpacePointTrackCand::c_isActive);
144 }
145 }
146}
unsigned short doHopfield(std::vector< OverlapResolverNodeInfo > &overlapResolverNodeInfos, unsigned short nIterations=20)
Performance of the actual algorithm.
void performSelection(std::vector< OverlapResolverNodeInfo > &overlapResolverNodeInfo)
Sets the isActive flag in m_qiTrackOverlap to false, for killed tracks.
Definition Scrooge.h:33
@ c_isActive
bit 11: SPTC is active (i.e.
StoreArray< SVDCluster > m_svdClusters
Stay connected to the DataStore for timing improvement.
std::string m_resolveMethod
Strategy used to resolve overlaps.
double m_minActivityState
Minimum of activityState of candidate required to be accepted by the algorithm.

◆ beginEvent()

void beginEvent ( )
overrideinherited

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

Definition at line 36 of file CompositeProcessingSignalListener.cc.

32{
35 psl->beginEvent();
36 }
37}
void beginEvent() override
Receive and dispatch signal for the start of a new event.
virtual void beginEvent()
Receive signal for the start of a new event.

◆ beginRun()

void beginRun ( )
overridevirtual

Check dbobject validity.

Reimplemented from CompositeProcessingSignalListener.

Definition at line 59 of file TrackCandidateOverlapResolver.cc.

60{
61 if (!m_SVDHoughParameters.isValid()) {
62 B2FATAL("SVDHough - TrackCandidateOverlapResolver: SVDHoughParameter dbobject not found, using default parameters.");
63 } else {
64 if (m_prefix == "finalOverlapResolver") {
65 m_minActivityState = m_SVDHoughParameters->getFinalOverlapResolverMinActivityState();
66 } else if (m_prefix == "refinerOverlapResolver") {
67 m_minActivityState = m_SVDHoughParameters->getRefinerOverlapResolverMinActivityState();
68 }
69 }
70}
std::string m_prefix
parameters prefix (finalOverlapResolver, refinerOverlapResolver)
DBObjPtr< SVDHoughParameters > m_SVDHoughParameters
DB object containing the SVDHough parameters.

◆ endRun()

void endRun ( )
overrideinherited

Receive and dispatch signal for the end of the run.

Definition at line 39 of file CompositeProcessingSignalListener.cc.

40{
42 psl->endRun();
43 }
45}
void endRun() override
Receive and dispatch signal for the end of the run.
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 CompositeProcessingSignalListener.

Definition at line 31 of file TrackCandidateOverlapResolver.cc.

32{
33 Super::exposeParameters(moduleParamList, prefix);
34
35 m_prefix = prefix;
36
37 moduleParamList->addParameter(TrackingUtilities::prefixed(prefix, "ResolveMethod"), m_resolveMethod,
38 "Strategy used to resolve overlaps. Currently implemented are \"greedy\" and \"hopfield\".",
40 moduleParamList->addParameter(TrackingUtilities::prefixed(prefix, "NameSVDClusters"), m_nameSVDClusters,
41 "Name of expected SVDClusters StoreArray.", m_nameSVDClusters);
42
43 moduleParamList->addParameter(TrackingUtilities::prefixed(prefix, "minActivityState"), m_minActivityState,
44 "Sets the minimal value of activity for acceptance. [0,1]", m_minActivityState);
45}
virtual void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix)
void addParameter(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.

◆ getDescription() [1/2]

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 }

◆ getDescription() [2/2]

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 56 of file CompositeProcessingSignalListener.cc.

61{
63}

◆ initialize()

void initialize ( )
overridevirtual

Create the store arrays.

Reimplemented from CompositeProcessingSignalListener.

Definition at line 48 of file TrackCandidateOverlapResolver.cc.

49{
51
53
54 B2ASSERT("ResolveMethod has to be either 'greedy' or 'hopfield'. Selected ResolveMethod: " << m_resolveMethod,
55 m_resolveMethod == "greedy" || m_resolveMethod == "hopfield");
56
57}

◆ terminate()

void terminate ( )
overrideinherited

Receive and dispatch Signal for termination of the event processing.

Definition at line 42 of file CompositeProcessingSignalListener.cc.

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

Member Data Documentation

◆ m_initialized

bool m_initialized
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_minActivityState

double m_minActivityState = 0.7
private

Minimum of activityState of candidate required to be accepted by the algorithm.

Definition at line 60 of file TrackCandidateOverlapResolver.h.

◆ m_nameSVDClusters

std::string m_nameSVDClusters = "SVDClusters"
private

Name of array of SVDCluster.

Definition at line 54 of file TrackCandidateOverlapResolver.h.

◆ m_prefix

std::string m_prefix = ""
private

parameters prefix (finalOverlapResolver, refinerOverlapResolver)

Definition at line 66 of file TrackCandidateOverlapResolver.h.

◆ m_resolveMethod

std::string m_resolveMethod = "greedy"
private

Strategy used to resolve overlaps.

Definition at line 57 of file TrackCandidateOverlapResolver.h.

◆ m_subordinaryProcessingSignalListeners

std::vector<ProcessingSignalListener*> m_subordinaryProcessingSignalListeners
privateinherited

References to subordinary signal processing listener contained in this findlet.

Definition at line 60 of file CompositeProcessingSignalListener.h.

◆ m_svdClusters

StoreArray<SVDCluster> m_svdClusters
private

Stay connected to the DataStore for timing improvement.

Definition at line 52 of file TrackCandidateOverlapResolver.h.

◆ m_SVDHoughParameters

DBObjPtr<SVDHoughParameters> m_SVDHoughParameters
private

DB object containing the SVDHough parameters.

Definition at line 63 of file TrackCandidateOverlapResolver.h.

◆ m_terminated

bool m_terminated
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: