Belle II Software development
AxialTrackCreatorHitHough Class Referenceabstract

Generates axial tracks from hit using the special leaf processing inspired by the legendre algorithm. More...

#include <AxialTrackCreatorHitHough.h>

Inheritance diagram for AxialTrackCreatorHitHough:
Findlet< const CDCWireHit *const, CDCTrack > 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

std::string getDescription () final
 Short description of the findlet.
 
void exposeParameters (ModuleParamList *moduleParamList, const std::string &prefix) final
 Expose the parameters to a module.
 
void initialize () final
 Initialize the findlet before event processing.
 
void apply (const std::vector< const CDCWireHit * > &axialWireHits, std::vector< CDCTrack > &tracks) final
 Generates the tracks from the given segments into the output argument.
 
void terminate () final
 Cleanup the findlet after event processing.
 
virtual void apply (ToVector< AIOTypes > &... ioVectors)=0
 Main function executing the algorithm.
 
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.
 

Static Public Member Functions

static std::vector< float > getDefaultCurvBounds (std::array< float, 2 > curvSpan, int granularityLevel)
 Get a series of parameters to be set for each pass over the rough hough space.
 

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 = Findlet<const CDCWireHit* const, CDCTrack>
 Type of the base class.
 
using SimpleRLTaggedWireHitPhi0CurvHough
 Type of the hough space tree search.
 

Private Attributes

const double m_curlCurv = 0.018
 Curvature below which particles from IP do not leave the CDC.
 
int m_param_granularityLevel = 12
 Parameter: Level of divisions in the hough space.
 
int m_param_sectorLevelSkip = 2
 Parameter: Number of levels to be skipped in the hough space on the first level to form sectors.
 
std::vector< float > m_param_curvBounds {{ -0.02, 0.14}}
 Parameter: hough bounds.
 
int m_param_discretePhi0Width = 19
 Parameter: Width of the phi0 bins at the highest level of the hough space.
 
int m_param_discretePhi0Overlap = 5
 Parameter: Overlap of the phi0 bins at the highest level of the hough space.
 
int m_param_discreteCurvWidth = 1
 Parameter: Width of the curvature bins at the highest level of the hough space.
 
int m_param_discreteCurvOverlap = -1
 Parameter: Overlap of the curvature bins at the highest level of the hough space.
 
std::vector< ParameterVariantMap > m_param_relaxationSchedule
 Parameter: Relaxation schedule for the leaf processor in the hough tree.
 
std::unique_ptr< SimpleRLTaggedWireHitPhi0CurvHoughm_houghTree
 The hough space tree search.
 
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.
 

Static Private Attributes

static const int c_phi0Divisions = 2
 Fixed parameter: Number of divisions in the phi0 direction.
 
static const int c_curvDivisions = 2
 Fixed parameter: Number of divisions in the curv direction.
 

Detailed Description

Generates axial tracks from hit using the special leaf processing inspired by the legendre algorithm.

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

◆ SimpleRLTaggedWireHitPhi0CurvHough

Initial value:
SimpleRLTaggedWireHitHoughTree<InPhi0CurvBox, c_phi0Divisions, c_curvDivisions>

Type of the hough space tree search.

Definition at line 96 of file AxialTrackCreatorHitHough.h.

◆ Super

using Super = Findlet<const CDCWireHit* const, CDCTrack>
private

Type of the base class.

Definition at line 36 of file AxialTrackCreatorHitHough.h.

◆ ToVector

using ToVector
protectedinherited

Short hand for ToRangeImpl.

Definition at line 49 of file Findlet.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.

◆ apply()

void apply ( const std::vector< const CDCWireHit * > & axialWireHits,
std::vector< CDCTrack > & tracks )
final

Generates the tracks from the given segments into the output argument.

Definition at line 149 of file AxialTrackCreatorHitHough.cc.

151{
152 // Reset the mask flag and select only the untaken hits
153 std::vector<const CDCWireHit*> unusedAxialWireHits;
154 for (const CDCWireHit* wireHit : axialWireHits) {
155 (*wireHit)->setMaskedFlag(false);
156 if ((*wireHit)->hasTakenFlag()) continue;
157 unusedAxialWireHits.push_back(wireHit);
158 }
159
160 // Setup the level processor and obtain its parameter list to be set.
161 using Node = typename SimpleRLTaggedWireHitPhi0CurvHough::Node;
163 AxialLegendreLeafProcessor<Node> leafProcessor(maxTreeLevel);
164 leafProcessor.setAxialWireHits(axialWireHits);
165 ModuleParamList moduleParamList;
166 const std::string prefix = "";
167 leafProcessor.exposeParameters(&moduleParamList, prefix);
168
169 // Find tracks with increasingly relaxed conditions in the hough grid
170 m_houghTree->seed(std::move(unusedAxialWireHits));
171 for (const ParameterVariantMap& passParameters : m_param_relaxationSchedule) {
172 AssignParameterVisitor::update(&moduleParamList, passParameters);
173 leafProcessor.beginWalk();
174 m_houghTree->findUsing(leafProcessor);
175 }
176 m_houghTree->fell();
177
178 // Write out tracks as return value
179 const std::vector<CDCTrack>& foundTracks = leafProcessor.getTracks();
180 tracks.insert(tracks.end(), foundTracks.begin(), foundTracks.end());
181}
std::unique_ptr< SimpleRLTaggedWireHitPhi0CurvHough > m_houghTree
The hough space tree search.
std::vector< ParameterVariantMap > m_param_relaxationSchedule
Parameter: Relaxation schedule for the leaf processor in the hough tree.
int m_param_sectorLevelSkip
Parameter: Number of levels to be skipped in the hough space on the first level to form sectors.
int m_param_granularityLevel
Parameter: Level of divisions in the hough space.
static void update(ModuleParamList *moduleParamList, const std::map< std::string, boost::variant< T... > > &valuesByName)
Transfer all the parameters from the map boost:variant values to the module parameter list.

◆ beginEvent()

void beginEvent ( )
overridevirtualinherited

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

Reimplemented from ProcessingSignalListener.

Reimplemented in DATCONFPGAFindlet, SpacePointTagger< AResult, ACluster >, SpacePointTagger< Belle2::CKFToPXDResult, Belle2::PXDCluster >, SpacePointTagger< Belle2::CKFToSVDResult, Belle2::SVDCluster >, FindletStoreArrayInput< TWrappedFindlet >, MCSymmetric< BaseAxialSegmentPairFilter >, MCSymmetric< BaseAxialSegmentPairFilter >, MCSymmetric< BaseFacetFilter >, MCSymmetric< BaseFacetFilter >, MCSymmetric< BaseFacetRelationFilter >, MCSymmetric< BaseFacetRelationFilter >, MCSymmetric< BaseSegmentPairFilter >, MCSymmetric< BaseSegmentPairFilter >, MCSymmetric< BaseSegmentPairRelationFilter >, MCSymmetric< BaseSegmentPairRelationFilter >, MCSymmetric< BaseSegmentRelationFilter >, MCSymmetric< BaseSegmentRelationFilter >, MCSymmetric< BaseSegmentTripleFilter >, MCSymmetric< BaseSegmentTripleFilter >, MCSymmetric< BaseSegmentTripleRelationFilter >, MCSymmetric< BaseSegmentTripleRelationFilter >, MCSymmetric< BaseTrackRelationFilter >, MCSymmetric< BaseTrackRelationFilter >, MonopoleStereoHitFinder, MonopoleStereoHitFinderQuadratic, SegmentCreatorMCTruth, SegmentFinderFacetAutomaton, SegmentTrackCombiner, SegmentTrackTruthVarSet, SharingHitsMatcher< ACollectorItem, ACollectionItem >, SharingHitsMatcher< Belle2::TrackFindingCDC::CDCTrack, Belle2::TrackFindingCDC::CDCSegment2D >, StereoHitFinder, StereoHitTruthVarSet, StoreVectorSwapper< IOType, a_alwaysWrite >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCFacet >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCSegment2D >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCSegmentPair >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCSegmentTriple >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCTrack >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCWireHit, true >, TrackFinderAutomaton, TrackFinderSegmentPairAutomaton, TrackFinderSegmentTripleAutomaton, TruthAxialSegmentPairVarSet, TruthSegmentVarSet, TruthTrackVarSet, WireHitMCMultiLoopBlocker, RecoTrackStorer, ROIFinder, and SVDHoughTracking.

Definition at line 31 of file CompositeProcessingSignalListener.cc.

32{
35 psl->beginEvent();
36 }
37}
virtual void beginEvent()
Receive signal for the start of a new event.
ProcessingSignalListener()
Allow default construction.

◆ beginRun()

void beginRun ( )
overridevirtualinherited

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

Reimplemented from ProcessingSignalListener.

Reimplemented in DATCONSVDClusterizer, LayerPXDRelationFilter< AFilter, APrefilter >, LayerPXDRelationFilter< TrackFindingCDC::ChooseableFilter< PXDPairFilterFactory > >, LayerPXDRelationFilter< TrackFindingCDC::ChooseableFilter< PXDPairFilterFactory > >, LayerSVDRelationFilter< AFilter, APrefilter >, LayerSVDRelationFilter< TrackFindingCDC::ChooseableFilter< SVDPairFilterFactory > >, LayerSVDRelationFilter< TrackFindingCDC::ChooseableFilter< SVDPairFilterFactory > >, SectorMapBasedSVDPairFilter, SimplePXDStateFilter, SimpleSVDStateFilter, CutsFromDBWireHitFilter, MVA< Filter< AVarSet::Object > >, MVA< Filter< typename AVarSet::Object > >, MVA< Filter< typename AVarSet::Object > >, WireHitCreator, FourHitFilter, LayerRelationFilter< AFilter >, LayerRelationFilter< TrackFindingCDC::ChooseableFilter< RelationFilterFactory > >, LayerRelationFilter< TrackFindingCDC::ChooseableFilter< RelationFilterFactory > >, QualityIndicatorFilter, RecoTrackStorer, ROIFinder, SpacePointLoaderAndPreparer, ThreeHitFilter, TrackCandidateResultRefiner, TwoHitVirtualIPFilter, and TwoHitVirtualIPQIFilter.

Definition at line 23 of file CompositeProcessingSignalListener.cc.

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

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

Expose the parameters to a module.

Reimplemented from CompositeProcessingSignalListener.

Definition at line 62 of file AxialTrackCreatorHitHough.cc.

64{
65 // Parameters for the hough space
66 moduleParamList->addParameter(prefixed(prefix, "granularityLevel"),
68 "Level of divisions in the hough space.",
70
71 moduleParamList->addParameter(prefixed(prefix, "sectorLevelSkip"),
73 "Number of levels to be skipped in the hough "
74 "space on the first level to form sectors",
76
77 moduleParamList->addParameter(prefixed(prefix, "curvBounds"),
79 "Curvature bounds of the hough space. Either 2 or all discrete bounds",
81
82 moduleParamList->addParameter(prefixed(prefix, "discretePhi0Width"),
84 "Width of the phi0 bins at the lowest level of the hough space.",
86
87 moduleParamList->addParameter(prefixed(prefix, "discretePhi0Overlap"),
89 "Overlap of the phi0 bins at the lowest level of the hough space.",
91
92 moduleParamList->addParameter(prefixed(prefix, "discreteCurvWidth"),
94 "Width of the curvature bins at the lowest level of the hough space.",
96
97 moduleParamList->addParameter(prefixed(prefix, "discreteCurvOverlap"),
99 "Overlap of the curvature bins at the lowest level of the hough space.",
101
102 // Relaxation schedule
103 moduleParamList->addParameter(prefixed(prefix, "relaxationSchedule"),
105 "Relaxation schedule for the leaf processor in the hough tree. "
106 "For content of the individual parameter maps consider the parameters of the "
107 "AxialLegendreLeafProcessor",
109
110}
int m_param_discretePhi0Width
Parameter: Width of the phi0 bins at the highest level of the hough space.
std::vector< float > m_param_curvBounds
Parameter: hough bounds.
int m_param_discreteCurvOverlap
Parameter: Overlap of the curvature bins at the highest level of the hough space.
int m_param_discreteCurvWidth
Parameter: Width of the curvature bins at the highest level of the hough space.
int m_param_discretePhi0Overlap
Parameter: Overlap of the phi0 bins at the highest level of the hough space.
void addParameter(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.

◆ getDefaultCurvBounds()

std::vector< float > getDefaultCurvBounds ( std::array< float, 2 > curvSpan,
int granularityLevel )
static

Get a series of parameters to be set for each pass over the rough hough space.

Definition at line 190 of file AxialTrackCreatorHitHough.cc.

191{
192 using BinSpan = std::array<float, 2>;
193 using BinSpans = std::vector<BinSpan>;
194 std::vector<BinSpans> binSpansByLevel(granularityLevel + 1);
195 binSpansByLevel[0].push_back(BinSpan({curvSpan[0], curvSpan[1]}));
196
197 for (int level = 1; level <= granularityLevel; ++level) {
198 for (const BinSpan& binSpan : binSpansByLevel[level - 1]) {
199 const float subBinWidth = std::fabs(binSpan[1] - binSpan[0]) / 2;
200 const float middle = binSpan[0] + (binSpan[1] - binSpan[0]) / 2.0;
201
202 // Expanding bins somewhat to have a overlap
203 // Assuming granularity level = 12
204 // For level 6 to 7 only expand 1 / 4, for higher levels expand 1 / 8.
205 // Never expand for curvatures lower than 0.005
206 // (copied from the Legendre method. Works well, but some experimentation
207 // needs to be made to know why)
208 const float extension = [&]() {
209 if ((level + 7 <= granularityLevel)
210 // or (std::fabs(middle) <= 0.007)
211 or (std::fabs(middle) <= 0.005)) {
212 return 0.0;
213 } else if (level + 5 < granularityLevel) {
214 return subBinWidth / 4.0;
215 } else {
216 return subBinWidth / 8.0;
217 }
218 }();
219
220 const float lower1 = binSpan[0] - extension;
221 const float upper1 = middle + extension;
222
223 const float lower2 = middle - extension;
224 const float upper2 = binSpan[1] + extension;
225
226 binSpansByLevel[level].push_back({lower1, upper1});
227 binSpansByLevel[level].push_back({lower2, upper2});
228 }
229 }
230
231 // Return highest level as prepared bin bounds.
232 std::vector<float> result;
233
234 for (BinSpan& binSpan : binSpansByLevel[granularityLevel]) {
235 result.push_back(binSpan[0]);
236 result.push_back(binSpan[1]);
237 }
238 return result;
239}

◆ getDescription()

std::string getDescription ( )
finalvirtual

Short description of the findlet.

Reimplemented from Findlet< const CDCWireHit *const, CDCTrack >.

Definition at line 57 of file AxialTrackCreatorHitHough.cc.

58{
59 return "Generates axial tracks from hits using several increasingly relaxed hough space search over phi0 and curvature.";
60}

◆ getNProcessingSignalListener()

int getNProcessingSignalListener ( )
protectedinherited

Get the number of currently registered listeners.

Definition at line 60 of file CompositeProcessingSignalListener.cc.

61{
63}

◆ initialize()

void initialize ( )
finalvirtual

Initialize the findlet before event processing.

Reimplemented from ProcessingSignalListener.

Definition at line 112 of file AxialTrackCreatorHitHough.cc.

113{
115
116 // Construct the hough space
117 const long nPhi0Bins = std::pow(c_phi0Divisions, m_param_granularityLevel);
118 const Phi0BinsSpec phi0BinsSpec(nPhi0Bins,
121
122 if (m_param_curvBounds.size() == 2) {
123 // If parameters are unchanged use the legendre default binning
124 if (m_param_discreteCurvOverlap == -1) {
126 std::array<float, 2> curvSpan({m_param_curvBounds[0], m_param_curvBounds[1]});
128 } else {
129 std::array<double, 2> curvBounds{{m_param_curvBounds.front(), m_param_curvBounds.back()}};
130 const long nCurvBins = std::pow(c_curvDivisions, m_param_granularityLevel);
131 const CurvBinsSpec curvBinsSpec(curvBounds.front(),
132 curvBounds.back(),
133 nCurvBins,
136 m_param_curvBounds = curvBinsSpec.constructArray();
137 }
138 }
139
140 // Construct hough tree
142 m_houghTree = std::make_unique<SimpleRLTaggedWireHitPhi0CurvHough>(maxTreeLevel, m_curlCurv);
143 m_houghTree->setSectorLevelSkip(m_param_sectorLevelSkip);
144 m_houghTree->assignArray<DiscretePhi0>(phi0BinsSpec.constructArray(), phi0BinsSpec.getNOverlap());
146 m_houghTree->initialize();
147}
const double m_curlCurv
Curvature below which particles from IP do not leave the CDC.
static const int c_curvDivisions
Fixed parameter: Number of divisions in the curv direction.
static std::vector< float > getDefaultCurvBounds(std::array< float, 2 > curvSpan, int granularityLevel)
Get a series of parameters to be set for each pass over the rough hough space.
static const int c_phi0Divisions
Fixed parameter: Number of divisions in the phi0 direction.
DiscreteCurv::Array constructArray() const
Construct the array of discrete curve positions.
Definition CurvRep.h:40
DiscretePhi0::Array constructArray() const
Construct the array of discrete phi0 positions.
Definition Phi0Rep.cc:23
int getNOverlap() const
Getter for the overlap in discrete number of positions.
Definition Phi0Rep.h:47

◆ terminate()

void terminate ( )
finalvirtual

Cleanup the findlet after event processing.

Reimplemented from ProcessingSignalListener.

Definition at line 183 of file AxialTrackCreatorHitHough.cc.

Member Data Documentation

◆ c_curvDivisions

const int c_curvDivisions = 2
staticprivate

Fixed parameter: Number of divisions in the curv direction.

Definition at line 92 of file AxialTrackCreatorHitHough.h.

◆ c_phi0Divisions

const int c_phi0Divisions = 2
staticprivate

Fixed parameter: Number of divisions in the phi0 direction.

Definition at line 89 of file AxialTrackCreatorHitHough.h.

◆ m_curlCurv

const double m_curlCurv = 0.018
private

Curvature below which particles from IP do not leave the CDC.

Definition at line 60 of file AxialTrackCreatorHitHough.h.

◆ m_houghTree

std::unique_ptr<SimpleRLTaggedWireHitPhi0CurvHough> m_houghTree
private

The hough space tree search.

Definition at line 100 of file AxialTrackCreatorHitHough.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_param_curvBounds

std::vector<float> m_param_curvBounds {{ -0.02, 0.14}}
private

Parameter: hough bounds.

Definition at line 71 of file AxialTrackCreatorHitHough.h.

71{{ -0.02, 0.14}};

◆ m_param_discreteCurvOverlap

int m_param_discreteCurvOverlap = -1
private

Parameter: Overlap of the curvature bins at the highest level of the hough space.

Definition at line 83 of file AxialTrackCreatorHitHough.h.

◆ m_param_discreteCurvWidth

int m_param_discreteCurvWidth = 1
private

Parameter: Width of the curvature bins at the highest level of the hough space.

Definition at line 80 of file AxialTrackCreatorHitHough.h.

◆ m_param_discretePhi0Overlap

int m_param_discretePhi0Overlap = 5
private

Parameter: Overlap of the phi0 bins at the highest level of the hough space.

Definition at line 77 of file AxialTrackCreatorHitHough.h.

◆ m_param_discretePhi0Width

int m_param_discretePhi0Width = 19
private

Parameter: Width of the phi0 bins at the highest level of the hough space.

Definition at line 74 of file AxialTrackCreatorHitHough.h.

◆ m_param_granularityLevel

int m_param_granularityLevel = 12
private

Parameter: Level of divisions in the hough space.

Definition at line 65 of file AxialTrackCreatorHitHough.h.

◆ m_param_relaxationSchedule

std::vector<ParameterVariantMap> m_param_relaxationSchedule
private

Parameter: Relaxation schedule for the leaf processor in the hough tree.

Definition at line 86 of file AxialTrackCreatorHitHough.h.

◆ m_param_sectorLevelSkip

int m_param_sectorLevelSkip = 2
private

Parameter: Number of levels to be skipped in the hough space on the first level to form sectors.

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