8 #include <tracking/vxdHoughTracking/findlets/SingleHoughSpaceFastInterceptFinder.h>
9 #include <tracking/vxdHoughTracking/entities/VXDHoughState.h>
10 #include <tracking/spacePointCreation/SpacePoint.h>
11 #include <tracking/spacePointCreation/SpacePointTrackCand.h>
12 #include <tracking/trackFindingCDC/utilities/StringManipulation.h>
13 #include <tracking/trackFindingCDC/utilities/Algorithms.h>
14 #include <vxd/dataobjects/VxdID.h>
15 #include <framework/core/ModuleParamList.h>
16 #include <framework/core/ModuleParamList.templateDetails.h>
19 using namespace TrackFindingCDC;
20 using namespace vxdHoughTracking;
22 SingleHoughSpaceFastInterceptFinder::SingleHoughSpaceFastInterceptFinder() :
Super()
67 B2ASSERT(
"The maximum number of recursions (maximumRecursionLevel) must not be larger than 14, but it is " <<
69 ", please choose a smaller value for maximumRecursionLevel, and / or for nAngleSectors and / or nVerticalSectors.",
98 std::vector<std::vector<VXDHoughState*>>& rawTrackCandidates)
103 const std::vector<VXDHoughState*> currentEventHitList = TrackFindingCDC::as_pointers<VXDHoughState>(hits);
112 std::sort(trackCand.begin(), trackCand.end(),
115 (a->getDataCache().layer > b->getDataCache().layer) or
116 (a->getDataCache().layer == b->getDataCache().layer
117 and a->getHit()->getPosition().Perp() > b->getHit()->getPosition().Perp());
120 rawTrackCandidates.emplace_back(trackCand);
130 uint ymax, uint currentRecursion)
132 std::vector<VXDHoughState*> containedHits;
133 containedHits.reserve(hits.size());
134 std::bitset<8> layerHits;
139 const uint centerx = xmin + (uint)((xmax - xmin) / 2);
140 const uint centery = ymin + (uint)((ymax - ymin) / 2);
141 const uint xIndexCache[3] = {xmin, centerx, xmax};
142 const uint yIndexCache[3] = {ymin, centery, ymax};
144 for (
int i = 0; i < 2 ; ++i) {
145 const uint left = xIndexCache[i];
146 const uint right = xIndexCache[i + 1];
147 const uint localIndexX = left;
149 if (left == right)
continue;
161 for (
int j = 0; j < 2; ++j) {
162 const uint lowerIndex = yIndexCache[j];
163 const uint upperIndex = yIndexCache[j + 1];
165 if (lowerIndex == upperIndex)
continue;
167 const uint localIndexY = lowerIndex;
168 const double& localUpperCoordinate =
m_HSYLUT[lowerIndex];
169 const double& localLowerCoordinate =
m_HSYLUT[upperIndex];
173 containedHits.clear();
180 const double derivativeyLeft = m * -sinLeft + a * cosLeft;
181 const double derivativeyRight = m * -sinRight + a * cosRight;
182 const double derivativeyCenter = m * -sinCenter + a * cosCenter;
186 if (derivativeyLeft < 0 and derivativeyRight < 0 and derivativeyCenter < 0)
continue;
188 const double yLeft = m * cosLeft + a * sinLeft;
189 const double yRight = m * cosRight + a * sinRight;
190 const double yCenter = m * cosCenter + a * sinCenter;
193 if ((yLeft <= localUpperCoordinate and yRight >= localLowerCoordinate) or
194 (yCenter <= localUpperCoordinate and yLeft >= localLowerCoordinate and yRight >= localLowerCoordinate) or
195 (yCenter >= localLowerCoordinate and yLeft <= localUpperCoordinate and yRight <= localUpperCoordinate)) {
196 layerHits[hitData.
layer] =
true;
197 containedHits.emplace_back(hit);
224 if (currentCell.second.first > -1)
continue;
251 for (uint currentIndexY = lastIndexY; currentIndexY >= lastIndexY - 1; currentIndexY--) {
254 for (uint currentIndexX = lastIndexX; currentIndexX <= lastIndexX + 1; currentIndexX++) {
259 if (lastIndexX == currentIndexX && lastIndexY == currentIndexY)
continue;
265 auto activeSector =
m_activeSectors.find({currentIndexX, currentIndexY});
267 if (activeSector !=
m_activeSectors.end() and activeSector->second.first < 0 ) {
The Module parameter list class.
void initialize() override
Receive and dispatch signal before the start of the event processing.
virtual void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix)
Forward prefixed parameters of this findlet to the module parameter list.
Interface for an algorithm part that needs to receive the module processing signals.
std::array< double, 16384 > m_HSCenterSinValuesLUT
sine values of the Hough Space sector center coordinates
uint m_param_MinimumHSClusterSize
minimum cluster size of sectors belonging to intercepts in the Hough Space
unsigned short layerFilter(std::bitset< 8 > &layer)
layer filter, checks if at least hits from 3 layers are in a set of hits
void FindHoughSpaceCluster()
Find Hough Space clusters.
double m_param_maximumX
maximum x value of the Hough Space, defaults to the value for u-side
uint m_clusterSize
size of the current cluster
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.
void initialize() override
Create the store arrays.
double m_unitX
HS unit size in x.
std::array< double, 16385 > m_HSXLUT
x values of the Hough Space sector boarders
std::vector< std::vector< VXDHoughState * > > m_trackCandidates
vector containing track candidates, consisting of the found intersection values in the Hough Space
uint m_param_nVerticalSectors
number of sectors of the Hough Space on the vertical axis
void DepthFirstSearch(uint lastIndexX, uint lastIndexY)
Perform depth first search recursive algorithm to find clusters in the Hough Space.
double m_unitY
HS unit size in y.
uint m_clusterCount
count the clusters
uint m_param_maxRecursionLevel
maximum number of recursive calls of fastInterceptFinder2d
std::pair< uint, uint > m_clusterInitialPosition
start cell of the recursive cluster finding 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...
double m_param_minimumX
minimum x value of the Hough Space, defaults to the value for u-side
uint m_param_nAngleSectors
number of sectors of the Hough Space on the horizontal axis
double m_param_verticalHoughSpaceSize
vertical size of the Hough Space, defaults to the value for u-side
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...
uint m_param_MaximumHSClusterSizeX
maximum cluster size in x 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...
uint m_param_MaximumHSClusterSize
maximum cluster size of sectors belonging to intercepts in the Hough Space
std::vector< VXDHoughState * > m_currentTrackCandidate
the current track candidate
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) override
Expose the parameters of the sub findlets.
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_param_MaximumHSClusterSizeY
maximum cluster size in y of sectors belonging to intercepts in the Hough Space
Simple container for hit information to be used during intercept finding.
void addParameter(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.
Abstract base class for different kinds of events.
Cache containing the most important information of this state which will often be needed.
float yConformal
conformal transformed y coordinate of this hit
unsigned short layer
Geometrical Layer this state is based on.
float xConformal
conformal transformed x coordinate of this hit