Belle II Software development
MultiHoughSpaceFastInterceptFinder.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8#pragma once
9
10#include <tracking/trackFindingCDC/findlets/base/Findlet.h>
11#include <tracking/vxdHoughTracking/findlets/HitSelector.h>
12#include <framework/datastore/StoreArray.h>
13
14#include <string>
15#include <vector>
16
17namespace Belle2 {
22 class ModuleParamList;
23 class VxdID;
24
25 namespace vxdHoughTracking {
26 class VXDHoughState;
27
35 class MultiHoughSpaceFastInterceptFinder : public TrackFindingCDC::Findlet<VXDHoughState, std::vector<VXDHoughState*>> {
38
40 typedef std::map<VxdID, std::vector<VxdID>> friendSensorMap;
41
42 public:
45
47 void exposeParameters(ModuleParamList* moduleParamList, const std::string& prefix) override;
48
50 void initialize() override;
51
53 void apply(std::vector<VXDHoughState>& hits, std::vector<std::vector<VXDHoughState*>>& rawTrackCandidates) override;
54
55 private:
56 // sub-findlets
60
63
66 inline unsigned short layerFilter(const std::bitset<8>& layer)
67 {
68 uint layercount = layer.count();
69 return (layercount >= 3 ? layercount : 0);
70 }
71
80 void fastInterceptFinder2d(const std::vector<VXDHoughState*>& hits, uint xmin, uint xmax, uint ymin, uint ymax,
81 uint currentRecursion);
82
86
90 void DepthFirstSearch(uint lastIndexX, uint lastIndexY);
91
92 // Parameters
95
97 uint m_nAngleSectors = 256;
98
101
104
106 double m_minimumX = -3.168;
108 double m_maximumX = 3.168;
109
118
119 // class variables
121 double m_unitX = 0;
123 double m_unitY = 0;
124
127
129 std::vector<VXDHoughState*> m_currentSensorsHitList;
130
133 std::array<double, 16385> m_HSSinValuesLUT = {0};
135 std::array<double, 16385> m_HSCosValuesLUT = {0};
137 std::array<double, 16384> m_HSCenterSinValuesLUT = {0};
139 std::array<double, 16384> m_HSCenterCosValuesLUT = {0};
141 std::array<double, 16385> m_HSYLUT = {0};
143 std::array<double, 16384> m_HSYCenterLUT = {0};
145 std::array<double, 16385> m_HSXLUT = {0};
147 std::array<double, 16384> m_HSXCenterLUT = {0};
148
163 struct paircompare {
165 bool operator()(const std::pair<uint, uint>& lhs, const std::pair<uint, uint>& rhs) const
166 {return ((int)rhs.second - (int)lhs.second) * 16384 < (int)rhs.first - (int)lhs.first;}
167 };
173 std::map<std::pair<uint, uint>, std::pair<int, std::vector<VXDHoughState*>>, paircompare> m_activeSectors;
174
179
181 std::pair<uint, uint> m_clusterInitialPosition = std::make_pair(0, 0);
183 std::pair<int, int> m_clusterCoG = std::make_pair(0, 0);
184
186 std::vector<VXDHoughState*> m_currentTrackCandidate;
187
189 std::vector<std::vector<VXDHoughState*>> m_trackCandidates;
190 };
191
192 }
194}
The Module parameter list class.
Interface for a minimal algorithm part that wants to expose some parameters to a module.
Definition: Findlet.h:26
Select hits to be analysed in the Hough Space intercept finder for a given layer 6 sensor based on th...
Definition: HitSelector.h:29
Findlet for finding intersections of sinusoidal curves in the 2D Hough space by iteratively calling F...
std::array< double, 16384 > m_HSCenterSinValuesLUT
sine values of the Hough Space sector center coordinates
uint m_nVerticalSectors
number of sectors of the Hough Space on the vertical axis
std::vector< VXDHoughState * > m_currentSensorsHitList
hits that are in the acceptance region (= on friend sensors) for the current L6 senosr
uint m_MinimumHSClusterSize
minimum cluster size of sectors belonging to intercepts in the Hough Space
std::map< VxdID, std::vector< VxdID > > friendSensorMap
Map that contains the "friend" sensors for each SVD L6 sensor.
std::array< double, 16384 > m_HSYCenterLUT
y values of the Hough Space sector centers
std::array< double, 16385 > m_HSYLUT
y values of the Hough Space sector boarders
std::array< double, 16384 > m_HSCenterCosValuesLUT
cosine values of the Hough Space sector center coordinates
std::map< std::pair< uint, uint >, std::pair< int, std::vector< VXDHoughState * > >, paircompare > m_activeSectors
Map containing only active HS sectors, i.e.
uint m_nAngleSectors
number of sectors of the Hough Space on the horizontal axis
HitSelector m_HitSelector
Use the friend map to just fill the hits in the acceptance region of the current L6 sensor into the m...
std::array< double, 16385 > m_HSXLUT
x values of the Hough Space sector boarders
double m_minimumX
minimum x value of the Hough Space, defaults to the value for u-side
std::vector< std::vector< VXDHoughState * > > m_trackCandidates
vector containing track candidates, consisting of the found intersection values in the Hough Space
double m_verticalHoughSpaceSize
vertical size of the Hough Space, defaults to the value for u-side
unsigned short layerFilter(const std::bitset< 8 > &layer)
layer filter, checks if at least hits from 3 layers are in a set of hits
void DepthFirstSearch(uint lastIndexX, uint lastIndexY)
Perform depth first search recursive algorithm to find clusters in the Hough Space.
std::pair< uint, uint > m_clusterInitialPosition
start cell of the recursive cluster finding in the Hough Space
uint m_MaximumHSClusterSizeX
maximum cluster size in x of sectors belonging to intercepts in the Hough Space
void fastInterceptFinder2d(const std::vector< VXDHoughState * > &hits, uint xmin, uint xmax, uint ymin, uint ymax, uint currentRecursion)
find intercepts in the 2D Hough Space by recursively calling itself until no hits are assigned to a g...
std::pair< int, int > m_clusterCoG
center of gravity containing describing the current best track parameters in the Hough Space
std::array< double, 16385 > m_HSSinValuesLUT
Look-Up-Tables for values as cache to speed up calculation sine values of the Hough Space sector boar...
std::vector< VXDHoughState * > m_currentTrackCandidate
the current track candidate
void initializeSectorFriendMap()
fill the map of friend sensors for each L6 sensor to
double m_maximumX
maximum x value of the Hough Space, defaults to the value for u-side
uint m_MaximumHSClusterSizeY
maximum cluster size in y of sectors belonging to intercepts in the Hough Space
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) override
Expose the parameters of the sub findlets.
uint m_MaximumHSClusterSize
maximum cluster size of sectors belonging to intercepts in the Hough Space
void apply(std::vector< VXDHoughState > &hits, std::vector< std::vector< VXDHoughState * > > &rawTrackCandidates) override
Load in the prepared hits and create track candidates for further processing like hit filtering and f...
std::array< double, 16385 > m_HSCosValuesLUT
cosine values of the Hough Space sector boarder coordinates
std::array< double, 16384 > m_HSXCenterLUT
x values of the Hough Space sector centers
friendSensorMap m_fullFriendMap
friendMap for all the SVD L6 sensors
uint m_maxRecursionLevel
maximum number of recursive calls of fastInterceptFinder2d
Abstract base class for different kinds of events.
this sorting makes sure the clusters can be searched from bottom left of the HS to top right normally...
bool operator()(const std::pair< uint, uint > &lhs, const std::pair< uint, uint > &rhs) const
comparison operator for the active HS sector map