Belle II Software development
SVDHoughTrackingTreeSearcher< AHit, APathFilter, AResult > Class Template Referenceabstract

Findlet for constructing result paths out of a list of hits, which are connected with weighted relations. More...

#include <SVDHoughTrackingTreeSearcher.dcl.h>

Inheritance diagram for SVDHoughTrackingTreeSearcher< AHit, APathFilter, AResult >:
Findlet< AHit *, const TrackFindingCDC::WeightedRelation< AHit >, AResult > 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

 SVDHoughTrackingTreeSearcher ()
 Construct this findlet and add the subfindlet as listener.
 
void exposeParameters (ModuleParamList *moduleParamList, const std::string &prefix) final
 Expose the parameters of the subfindlet.
 
void apply (std::vector< AHit * > &hits, const std::vector< TrackFindingCDC::WeightedRelation< AHit > > &relations, std::vector< AResult > &results) final
 Main function of this findlet: traverse a tree starting from a given seed hits.
 
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 initialize () override
 Receive and dispatch signal before the start of the event processing.
 
void beginRun () override
 Receive and dispatch signal for the beginning of a new run.
 
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 = TrackFindingCDC::Findlet<AHit*, const TrackFindingCDC::WeightedRelation<AHit>, AResult>
 Parent class.
 

Private Member Functions

void traverseTree (std::vector< TrackFindingCDC::WithWeight< const AHit * > > &path, const std::vector< TrackFindingCDC::WeightedRelation< AHit > > &relations, std::vector< AResult > &results)
 Implementation of the traverseTree function.
 

Private Attributes

APathFilter m_pathFilter
 State rejecter to decide which available continuations should be traversed next.
 
TrackFindingCDC::CellularAutomaton< AHit > m_automaton
 Findlet for adding a recursion cell state to the hits.
 
uint m_applyTwoHitFilterIfMoreChildStates = 50
 TwoHitFilter activarion cut.
 
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

template<class AHit, class APathFilter, class AResult>
class Belle2::vxdHoughTracking::SVDHoughTrackingTreeSearcher< AHit, APathFilter, AResult >

Findlet for constructing result paths out of a list of hits, which are connected with weighted relations.

At each step, the hits are again tested using a state rejector, which also knows the current path of hits.

This rejector is allowed to alter the hits, so using a cellular automaton it is assured, that the hits are traversed in the correct order without overriding each other. It is however crucial, that the relations do not create cycles in the graph!

Definition at line 37 of file SVDHoughTrackingTreeSearcher.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.

◆ Super

template<class AHit, class APathFilter, class AResult>
using Super = TrackFindingCDC::Findlet<AHit*, const TrackFindingCDC::WeightedRelation<AHit>, AResult>
private

Parent class.

Definition at line 41 of file SVDHoughTrackingTreeSearcher.dcl.h.

◆ ToVector

using ToVector
protectedinherited

Short hand for ToRangeImpl.

Definition at line 49 of file Findlet.h.

Constructor & Destructor Documentation

◆ SVDHoughTrackingTreeSearcher()

template<class AHit, class APathFilter, class AResult>
SVDHoughTrackingTreeSearcher ( )

Construct this findlet and add the subfindlet as listener.

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

26 : Super()
27 {
28 Super::addProcessingSignalListener(&m_pathFilter);
29 };

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, class APathFilter, class AResult>
void apply ( std::vector< AHit * > & hits,
const std::vector< TrackFindingCDC::WeightedRelation< AHit > > & relations,
std::vector< AResult > & results )
final

Main function of this findlet: traverse a tree starting from a given seed hits.

ATTENTION: As described above, the hits themselves can be altered during the tree traversal.

Definition at line 44 of file SVDHoughTrackingTreeSearcher.icc.h.

47 {
48 B2ASSERT("Expected relation to be sorted", std::is_sorted(relations.begin(), relations.end()));
49
50 m_automaton.applyTo(hits, relations);
51
52 std::vector<const AHit*> seedHits;
53 for (const AHit* hit : hits) {
54 if (hit->getDataCache().layer >= 5) {
55 seedHits.emplace_back(hit);
56 }
57 }
58
59 std::vector<TrackFindingCDC::WithWeight<const AHit*>> path;
60 for (const AHit* seedHit : seedHits) {
61 B2DEBUG(29, "Starting with new seed...");
62
63 path.emplace_back(seedHit, 0);
64 traverseTree(path, relations, results);
65 path.pop_back();
66 B2ASSERT("Something went wrong during the path traversal", path.empty());
67
68 B2DEBUG(29, "... finished with seed");
69 }
70 }

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

Receive and dispatch signal for the beginning of a new run.

Definition at line 33 of file CompositeProcessingSignalListener.cc.

24{
27 psl->beginRun();
28 }
29}
void beginRun() override
Receive and dispatch signal for the beginning of a new run.
virtual void beginRun()
Receive signal for the beginning of a new run.

◆ 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, class APathFilter, class AResult>
void exposeParameters ( ModuleParamList * moduleParamList,
const std::string & prefix )
finalvirtual

Expose the parameters of the subfindlet.

Reimplemented from CompositeProcessingSignalListener.

Definition at line 32 of file SVDHoughTrackingTreeSearcher.icc.h.

34 {
35 m_pathFilter.exposeParameters(moduleParamList, prefix);
36
37 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "twoHitFilterLimit"),
38 m_applyTwoHitFilterIfMoreChildStates,
39 "Use the TwoHitFilter (path length == 1) if there are more child states than this value.",
40 m_applyTwoHitFilterIfMoreChildStates);
41 }

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

Receive and dispatch signal before the start of the event processing.

Definition at line 30 of file CompositeProcessingSignalListener.cc.

16{
19 psl->initialize();
20 }
21}
void initialize() override
Receive and dispatch signal before the start of the event processing.
virtual void initialize()
Receive signal before the start of the event processing.

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

◆ traverseTree()

template<class AHit, class APathFilter, class AResult>
void traverseTree ( std::vector< TrackFindingCDC::WithWeight< const AHit * > > & path,
const std::vector< TrackFindingCDC::WeightedRelation< AHit > > & relations,
std::vector< AResult > & results )
private

Implementation of the traverseTree function.

Definition at line 73 of file SVDHoughTrackingTreeSearcher.icc.h.

77 {
78 // Implement only graph traversal logic and leave the extrapolation and selection to the
79 // rejecter.
80 const AHit* currentHit = path.back();
81 auto continuations =
82 TrackFindingCDC::asRange(std::equal_range(relations.begin(), relations.end(), currentHit));
83
84 std::vector<TrackFindingCDC::WithWeight<AHit*>> childHits;
85 for (const TrackFindingCDC::WeightedRelation<AHit>& continuation : continuations) {
86 AHit* childHit = continuation.getTo();
87 TrackFindingCDC::Weight weight = continuation.getWeight();
88 // the state may still include information from an other round of processing, so lets set it back
89
90 if (std::count(path.begin(), path.end(), childHit)) {
91 // Cycle detected -- is this the best handling?
92 // Other options: Raise an exception and bail out of this seed
93 B2FATAL("Cycle detected!");
94 }
95
96 childHits.emplace_back(childHit, weight);
97 }
98
99 // Do everything with child states, linking, extrapolation, teaching, discarding, what have you.
100 const std::vector<TrackFindingCDC::WithWeight<const AHit*>>& constPath = path;
101 if (path.size() > 1 or childHits.size() > m_applyTwoHitFilterIfMoreChildStates) {
102 m_pathFilter.apply(constPath, childHits);
103 }
104
105 if (childHits.empty()) {
106 B2DEBUG(29, "Terminating this route, as there are no possible child states.");
107 if (path.size() >= 3) {
108 results.emplace_back(path);
109 }
110 return;
111 }
112
113 // Traverse the tree from each new state on
114 std::sort(childHits.begin(), childHits.end(), TrackFindingCDC::GreaterOf<TrackFindingCDC::GetWeight>());
115
116 B2DEBUG(29, "Having found " << childHits.size() << " child states.");
117
118 for (const TrackFindingCDC::WithWeight<AHit*>& childHit : childHits) {
119 path.emplace_back(childHit, childHit.getWeight());
120 traverseTree(path, relations, results);
121 path.pop_back();
122 }
123 }

Member Data Documentation

◆ m_applyTwoHitFilterIfMoreChildStates

template<class AHit, class APathFilter, class AResult>
uint m_applyTwoHitFilterIfMoreChildStates = 50
private

TwoHitFilter activarion cut.

Definition at line 74 of file SVDHoughTrackingTreeSearcher.dcl.h.

◆ m_automaton

template<class AHit, class APathFilter, class AResult>
TrackFindingCDC::CellularAutomaton<AHit> m_automaton
private

Findlet for adding a recursion cell state to the hits.

Definition at line 71 of file SVDHoughTrackingTreeSearcher.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_pathFilter

template<class AHit, class APathFilter, class AResult>
APathFilter m_pathFilter
private

State rejecter to decide which available continuations should be traversed next.

Definition at line 68 of file SVDHoughTrackingTreeSearcher.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_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: