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>
19using namespace TrackFindingCDC;
20using namespace vxdHoughTracking;
34 "Number of angle sectors (= x-axis) dividing the Hough space.",
m_nAngleSectors);
37 "Number of vertical sectors (= y-axis) dividing the Hough space.",
m_nVerticalSectors);
43 "Minimum x value of the Hough space.",
m_minimumX);
46 "Maximum x value of the Hough space.",
m_maximumX);
69 B2ERROR(
"The maximum number of recursions (maximumRecursionLevel) must not be larger than 14, but it is " <<
71 ", please choose a smaller value for maximumRecursionLevel, and / or for nAngleSectors and / or nVerticalSectors.");
100 std::vector<std::vector<VXDHoughState*>>& rawTrackCandidates)
105 const std::vector<VXDHoughState*> currentEventHitList = TrackFindingCDC::as_pointers<VXDHoughState>(hits);
114 std::sort(trackCand.begin(), trackCand.end(),
117 (a->getDataCache().layer > b->getDataCache().layer) or
118 (a->getDataCache().layer == b->getDataCache().layer
119 and a->getHit()->getPosition().Perp() > b->getHit()->getPosition().Perp());
122 rawTrackCandidates.emplace_back(trackCand);
132 uint ymax, uint currentRecursion)
134 std::vector<VXDHoughState*> containedHits;
135 containedHits.reserve(hits.size());
136 std::bitset<8> layerHits;
141 const uint centerx = xmin + (uint)((xmax - xmin) / 2);
142 const uint centery = ymin + (uint)((ymax - ymin) / 2);
143 const uint xIndexCache[3] = {xmin, centerx, xmax};
144 const uint yIndexCache[3] = {ymin, centery, ymax};
146 for (
int i = 0; i < 2 ; ++i) {
147 const uint left = xIndexCache[i];
148 const uint right = xIndexCache[i + 1];
149 const uint localIndexX = left;
151 if (left == right)
continue;
163 for (
int j = 0; j < 2; ++j) {
164 const uint lowerIndex = yIndexCache[j];
165 const uint upperIndex = yIndexCache[j + 1];
167 if (lowerIndex == upperIndex)
continue;
169 const uint localIndexY = lowerIndex;
170 const double& localUpperCoordinate =
m_HSYLUT[lowerIndex];
171 const double& localLowerCoordinate =
m_HSYLUT[upperIndex];
175 containedHits.clear();
182 const double derivativeyLeft = m * -sinLeft + a * cosLeft;
183 const double derivativeyRight = m * -sinRight + a * cosRight;
184 const double derivativeyCenter = m * -sinCenter + a * cosCenter;
188 if (derivativeyLeft < 0 and derivativeyRight < 0 and derivativeyCenter < 0)
continue;
190 const double yLeft = m * cosLeft + a * sinLeft;
191 const double yRight = m * cosRight + a * sinRight;
192 const double yCenter = m * cosCenter + a * sinCenter;
195 if ((yLeft <= localUpperCoordinate and yRight >= localLowerCoordinate) or
196 (yCenter <= localUpperCoordinate and yLeft >= localLowerCoordinate and yRight >= localLowerCoordinate) or
197 (yCenter >= localLowerCoordinate and yLeft <= localUpperCoordinate and yRight <= localUpperCoordinate)) {
198 layerHits[hitData.
layer] =
true;
199 containedHits.emplace_back(hit);
226 if (currentCell.second.first > -1)
continue;
253 for (uint currentIndexY = lastIndexY; currentIndexY >= lastIndexY - 1; currentIndexY--) {
256 for (uint currentIndexX = lastIndexX; currentIndexX <= lastIndexX + 1; currentIndexX++) {
261 if (lastIndexX == currentIndexX && lastIndexY == currentIndexY)
continue;
267 auto activeSector =
m_activeSectors.find({currentIndexX, currentIndexY});
269 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)
Expose the set of parameters of the filter to the module parameter list.
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
void FindHoughSpaceCluster()
Find Hough Space clusters.
uint m_MinimumHSClusterSize
minimum cluster size of sectors belonging to intercepts in the Hough Space
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.
uint m_nAngleSectors
number of sectors of the Hough Space on the horizontal axis
void initialize() override
Create the store arrays.
SingleHoughSpaceFastInterceptFinder()
Find intercepts in the 2D Hough space.
double m_unitX
HS unit size in x.
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.
double m_unitY
HS unit size in y.
uint m_clusterCount
count the clusters
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::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
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