Belle II Software development
RawTrackCandCleaner< AHit > Class Template Referenceabstract

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

#include <RawTrackCandCleaner.dcl.h>

Inheritance diagram for RawTrackCandCleaner< AHit >:
Findlet< std::vector< AHit * >, SpacePointTrackCand > CompositeProcessingSignalListener ProcessingSignalListener

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

 RawTrackCandCleaner ()
 Find intercepts in the 2D Hough space.
 
 ~RawTrackCandCleaner ()
 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< std::vector< AHit * > > &rawTrackCandidates, std::vector< SpacePointTrackCand > &trackCandidates) 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<std::vector<AHit*>, SpacePointTrackCand>
 Parent class.
 
using Result = std::vector<TrackingUtilities::WithWeight<const AHit*>>
 Shortcut definition for Result.
 

Private Attributes

RelationCreator< AHit, ChooseableRelationFilter > m_relationCreator
 create relations between the hits in each raw track candidate
 
SVDHoughTrackingTreeSearcher< AHit, ChooseablePathFilter, Result > m_treeSearcher
 perform a tree search using a cellular automaton for all the hits and relations of each raw track candidate
 
TrackCandidateResultRefiner m_resultRefiner
 sort and refine the results for each raw track cand, performing a fit and a basic overlap check
 
std::vector< TrackingUtilities::WeightedRelation< AHit > > m_relations
 vector containing the relations between the hits in the raw track candidate
 
std::vector< Result > m_results
 vector containing track candidates after tree search
 
std::vector< SpacePointTrackCand > m_unfilteredResults
 vector containing unfiltered results, i.e.
 
std::vector< SpacePointTrackCand > m_filteredResults
 vector containing the filtered and pruned results the filtered results of each raw track candidate will be collected and given back to the caller
 
ushort m_maxRelations = 100
 maximum number of relations that can be created per track candidate
 
DBObjPtr< SVDHoughParameters > m_SVDHoughParameters
 DB object containing the SVDHough parameters.
 
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.
 

Static Private Attributes

static constexpr ushort c_MaxAllowedVectorSize = 256
 maximum allowed size of the vectors before resizing
 

Detailed Description

template<class AHit>
class Belle2::vxdHoughTracking::RawTrackCandCleaner< AHit >

Findlet for rejecting wrong SpacePointTrackCands and for removing bad hits.

Definition at line 32 of file RawTrackCandCleaner.dcl.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.

◆ Result

template<class AHit>
using Result = std::vector<TrackingUtilities::WithWeight<const AHit*>>
private

Shortcut definition for Result.

Definition at line 37 of file RawTrackCandCleaner.dcl.h.

◆ Super

template<class AHit>
using Super = TrackingUtilities::Findlet<std::vector<AHit*>, SpacePointTrackCand>
private

Parent class.

Definition at line 34 of file RawTrackCandCleaner.dcl.h.

◆ ToVector

using ToVector
protectedinherited

Short hand for ToRangeImpl.

Definition at line 49 of file Findlet.h.

Constructor & Destructor Documentation

◆ RawTrackCandCleaner()

template<class AHit>
RawTrackCandCleaner ( )

Find intercepts in the 2D Hough space.

Definition at line 27 of file RawTrackCandCleaner.icc.h.

27 : Super()
28 {
29 Super::addProcessingSignalListener(&m_relationCreator);
30 Super::addProcessingSignalListener(&m_treeSearcher);
31 Super::addProcessingSignalListener(&m_resultRefiner);
32 }

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()

template<class AHit>
void apply ( std::vector< std::vector< AHit * > > & rawTrackCandidates,
std::vector< SpacePointTrackCand > & trackCandidates )
override

Reject bad SpacePointTrackCands and bad hits inside the remaining.

Definition at line 68 of file RawTrackCandCleaner.icc.h.

70 {
71
72 uint family = 0; // family of the SpacePointTrackCands
73 for (auto& rawTrackCand : rawTrackCandidates) {
74
75 // If the capacity of a std::vector is too large, start with a fresh one, but only do this if the capacity is too big.
76 // Since std::vector.shrink() or std::vector.shrink_to_fit() not necessarily reduce the capacity in the desired way,
77 // create a temporary vector of the same type and swap them to use the vector at the new location afterwards.
78 if (m_relations.capacity() <= c_MaxAllowedVectorSize) {
79 m_relations.clear();
80 } else {
81 checkResizeClear<TrackingUtilities::WeightedRelation<AHit>>(m_relations, c_MaxAllowedVectorSize);
82 }
83 if (m_results.capacity() <= c_MaxAllowedVectorSize) {
84 m_results.clear();
85 } else {
86 checkResizeClear<Result>(m_results, c_MaxAllowedVectorSize);
87 }
88 if (m_unfilteredResults.capacity() <= c_MaxAllowedVectorSize) {
89 m_unfilteredResults.clear();
90 } else {
91 checkResizeClear<SpacePointTrackCand>(m_unfilteredResults, c_MaxAllowedVectorSize);
92 }
93 if (m_filteredResults.capacity() <= c_MaxAllowedVectorSize) {
94 m_filteredResults.clear();
95 } else {
96 checkResizeClear<SpacePointTrackCand>(m_filteredResults, c_MaxAllowedVectorSize);
97 }
98
99 m_relationCreator.apply(rawTrackCand, m_relations);
100
101 // The m_relationCreator stops creating relations at m_maxRelations and clears the m_relations vector
102 // This sets the size of m_relations to 0 and there is nothing more to do for this track candidate.
103 if (m_relations.size() == 0) {
104 continue;
105 }
106
107 m_treeSearcher.apply(rawTrackCand, m_relations, m_results);
108
109 m_unfilteredResults.reserve(m_results.size());
110 for (const std::vector<TrackingUtilities::WithWeight<const AHit*>>& result : m_results) {
111 std::vector<const SpacePoint*> spacePointsInResult;
112 spacePointsInResult.reserve(result.size());
113 for (const TrackingUtilities::WithWeight<const AHit*>& hit : result) {
114 spacePointsInResult.emplace_back(hit->getHit());
115 }
116 std::sort(spacePointsInResult.begin(), spacePointsInResult.end(), [](const SpacePoint * a, const SpacePoint * b) {
117 return
118 (a->getVxdID().getLayerNumber() < b->getVxdID().getLayerNumber()) or
119 (a->getVxdID().getLayerNumber() == b->getVxdID().getLayerNumber()
120 and a->getPosition().Perp() < b->getPosition().Perp());
121 });
122 m_unfilteredResults.emplace_back(spacePointsInResult);
123 }
124
125 for (auto aTC : m_unfilteredResults) {
126 aTC.setFamily(family);
127 }
128
129 m_resultRefiner.apply(m_unfilteredResults, m_filteredResults);
130
131 for (const SpacePointTrackCand& trackCand : m_filteredResults) {
132 trackCandidates.emplace_back(trackCand);
133 }
134
135 family++;
136 }
137 }

◆ 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()

template<class AHit>
void beginRun ( )
overridevirtual

Check dbobject validity.

Reimplemented from CompositeProcessingSignalListener.

Definition at line 53 of file RawTrackCandCleaner.icc.h.

54 {
55
56 Super::beginRun();
57
58 if (!m_SVDHoughParameters.isValid()) {
59 B2FATAL("SVDHough - RawTrackCandCleaner: SVDHoughParameter dbobject not found.");
60 } else {
61 m_maxRelations = m_SVDHoughParameters->getMaxRelations();
62 }
63 m_relationCreator.setMaxRelations(m_maxRelations);
64
65 }

◆ 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()

template<class AHit>
void exposeParameters ( ModuleParamList * moduleParamList,
const std::string & prefix )
overridevirtual

Expose the parameters of the sub findlets.

Reimplemented from CompositeProcessingSignalListener.

Definition at line 35 of file RawTrackCandCleaner.icc.h.

36 {
37 Super::exposeParameters(moduleParamList, prefix);
38 m_relationCreator.exposeParameters(moduleParamList, prefix);
39 m_treeSearcher.exposeParameters(moduleParamList, prefix);
40 m_resultRefiner.exposeParameters(moduleParamList, prefix);
41
42 moduleParamList->addParameter(TrackingUtilities::prefixed(prefix, "maxRelations"), m_maxRelations,
43 "Maximum number of relations allowed for entering tree search.", m_maxRelations);
44 }

◆ 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()

template<class AHit>
void initialize ( )
overridevirtual

Create the store arrays.

Reimplemented from CompositeProcessingSignalListener.

Definition at line 47 of file RawTrackCandCleaner.icc.h.

48 {
49 Super::initialize();
50 }

◆ 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

◆ c_MaxAllowedVectorSize

template<class AHit>
ushort c_MaxAllowedVectorSize = 256
staticconstexprprivate

maximum allowed size of the vectors before resizing

Definition at line 88 of file RawTrackCandCleaner.dcl.h.

◆ m_filteredResults

template<class AHit>
std::vector<SpacePointTrackCand> m_filteredResults
private

vector containing the filtered and pruned results the filtered results of each raw track candidate will be collected and given back to the caller

Definition at line 79 of file RawTrackCandCleaner.dcl.h.

◆ 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_maxRelations

template<class AHit>
ushort m_maxRelations = 100
private

maximum number of relations that can be created per track candidate

Definition at line 82 of file RawTrackCandCleaner.dcl.h.

◆ m_relationCreator

template<class AHit>
RelationCreator<AHit, ChooseableRelationFilter> m_relationCreator
private

create relations between the hits in each raw track candidate

Definition at line 61 of file RawTrackCandCleaner.dcl.h.

◆ m_relations

template<class AHit>
std::vector<TrackingUtilities::WeightedRelation<AHit> > m_relations
private

vector containing the relations between the hits in the raw track candidate

Definition at line 70 of file RawTrackCandCleaner.dcl.h.

◆ m_resultRefiner

template<class AHit>
TrackCandidateResultRefiner m_resultRefiner
private

sort and refine the results for each raw track cand, performing a fit and a basic overlap check

Definition at line 67 of file RawTrackCandCleaner.dcl.h.

◆ m_results

template<class AHit>
std::vector<Result> m_results
private

vector containing track candidates after tree search

Definition at line 73 of file RawTrackCandCleaner.dcl.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_SVDHoughParameters

template<class AHit>
DBObjPtr<SVDHoughParameters> m_SVDHoughParameters
private

DB object containing the SVDHough parameters.

Definition at line 85 of file RawTrackCandCleaner.dcl.h.

◆ m_terminated

bool m_terminated
privateinherited

Flag to keep track whether termination happened before.

Definition at line 55 of file ProcessingSignalListener.h.

◆ m_treeSearcher

template<class AHit>
SVDHoughTrackingTreeSearcher<AHit, ChooseablePathFilter, Result> m_treeSearcher
private

perform a tree search using a cellular automaton for all the hits and relations of each raw track candidate

Definition at line 64 of file RawTrackCandCleaner.dcl.h.

◆ m_unfilteredResults

template<class AHit>
std::vector<SpacePointTrackCand> m_unfilteredResults
private

vector containing unfiltered results, i.e.

SpacePointTrackCands containing only the SpacePoins of the hits in m_results

Definition at line 76 of file RawTrackCandCleaner.dcl.h.


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