Belle II Software development
SingleHoughSpaceFastInterceptFinder.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 <framework/datastore/StoreArray.h>
12
13#include <string>
14#include <vector>
15
16namespace Belle2 {
21 class ModuleParamList;
22
23 namespace vxdHoughTracking {
24 class VXDHoughState;
25
31 class SingleHoughSpaceFastInterceptFinder : public TrackFindingCDC::Findlet<VXDHoughState, std::vector<VXDHoughState*>> {
34
35 public:
38
40 void exposeParameters(ModuleParamList* moduleParamList, const std::string& prefix) override;
41
43 void initialize() override;
44
46 void apply(std::vector<VXDHoughState>& hits, std::vector<std::vector<VXDHoughState*>>& rawTrackCandidates) override;
47
48 private:
49
52 inline unsigned short layerFilter(const std::bitset<8>& layer)
53 {
54 uint layercount = layer.count();
55 return (layercount >= 3 ? layercount : 0);
56 }
57
66 void fastInterceptFinder2d(const std::vector<VXDHoughState*>& hits, uint xmin, uint xmax, uint ymin, uint ymax,
67 uint currentRecursion);
68
72
76 void DepthFirstSearch(uint lastIndexX, uint lastIndexY);
77
78 // Parameters
81
83 uint m_nAngleSectors = 256;
84
87
90
92 double m_minimumX = -3.168;
94 double m_maximumX = 3.168;
95
104
105 // class variables
107 double m_unitX = 0;
109 double m_unitY = 0;
110
113 std::array<double, 16385> m_HSSinValuesLUT = {0};
115 std::array<double, 16385> m_HSCosValuesLUT = {0};
117 std::array<double, 16384> m_HSCenterSinValuesLUT = {0};
119 std::array<double, 16384> m_HSCenterCosValuesLUT = {0};
121 std::array<double, 16385> m_HSYLUT = {0};
123 std::array<double, 16384> m_HSYCenterLUT = {0};
125 std::array<double, 16385> m_HSXLUT = {0};
127 std::array<double, 16384> m_HSXCenterLUT = {0};
128
143 struct paircompare {
145 bool operator()(const std::pair<uint, uint>& lhs, const std::pair<uint, uint>& rhs) const
146 {return ((int)rhs.second - (int)lhs.second) * 16384 < (int)rhs.first - (int)lhs.first;}
147 };
153 std::map<std::pair<uint, uint>, std::pair<int, std::vector<VXDHoughState*>>, paircompare> m_activeSectors;
154
159
161 std::pair<uint, uint> m_clusterInitialPosition = std::make_pair(0, 0);
163 std::pair<int, int> m_clusterCoG = std::make_pair(0, 0);
164
166 std::vector<VXDHoughState*> m_currentTrackCandidate;
167
169 std::vector<std::vector<VXDHoughState*>> m_trackCandidates;
170
171 };
172
173 }
175}
The Module parameter list class.
Interface for a minimal algorithm part that wants to expose some parameters to a module.
Definition: Findlet.h:26
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
uint m_MinimumHSClusterSize
minimum cluster size of sectors belonging to intercepts in the Hough Space
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
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 assinged 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
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
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