8 #include <tracking/vxdHoughTracking/findlets/MultiHoughSpaceFastInterceptFinder.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 MultiHoughSpaceFastInterceptFinder::MultiHoughSpaceFastInterceptFinder() :
Super()
68 B2ASSERT(
"The maximum number of recursions (maximumRecursionLevel) must not be larger than 14, but it is " <<
70 ", please choose a smaller value for maximumRecursionLevel, and / or for nAngleSectors and / or nVerticalSectors.",
102 std::vector<std::vector<VXDHoughState*>>& rawTrackCandidates)
120 std::sort(trackCand.begin(), trackCand.end(),
123 (a->getDataCache().layer > b->getDataCache().layer) or
124 (a->getDataCache().layer == b->getDataCache().layer
125 and a->getHit()->getPosition().Perp() > b->getHit()->getPosition().Perp());
128 rawTrackCandidates.emplace_back(trackCand);
137 const std::vector<VxdID> friends6XX1 = {
VxdID(3, 0, 1),
VxdID(3, 0, 2),
VxdID(4, 0, 1),
VxdID(4, 0, 2),
VxdID(5, 0, 1),
VxdID(5, 0, 2),
VxdID(5, 0, 3),
VxdID(6, 0, 2),
VxdID(6, 0, 3)};
138 const std::vector<VxdID> friends6XX5 = {
VxdID(3, 0, 2),
VxdID(4, 0, 2),
VxdID(4, 0, 3),
VxdID(5, 0, 3),
VxdID(5, 0, 4),
VxdID(6, 0, 3),
VxdID(6, 0, 4)};
141 thetaFriends.insert(std::make_pair(
VxdID(6, 0, 1), friends6XX1));
142 thetaFriends.insert(std::make_pair(
VxdID(6, 0, 5), friends6XX5));
144 const std::vector<VxdID> friends601X = {
VxdID(3, 1, 0),
VxdID(3, 6, 0),
VxdID(3, 7, 0),
VxdID(4, 1, 0),
VxdID(4, 2, 0),
VxdID(4, 10, 0),
VxdID(5, 1, 0),
VxdID(5, 2, 0),
VxdID(5, 12, 0),
VxdID(6, 1, 0)};
145 const std::vector<VxdID> friends602X = {
VxdID(3, 1, 0),
VxdID(3, 2, 0),
VxdID(3, 7, 0),
VxdID(4, 1, 0),
VxdID(4, 2, 0),
VxdID(4, 10, 0),
VxdID(5, 1, 0),
VxdID(5, 2, 0),
VxdID(5, 3, 0),
VxdID(6, 2, 0)};
146 const std::vector<VxdID> friends603X = {
VxdID(3, 1, 0),
VxdID(3, 2, 0),
VxdID(3, 7, 0),
VxdID(4, 1, 0),
VxdID(4, 2, 0),
VxdID(4, 3, 0),
VxdID(5, 2, 0),
VxdID(5, 3, 0),
VxdID(6, 3, 0)};
147 const std::vector<VxdID> friends604X = {
VxdID(3, 1, 0),
VxdID(3, 2, 0),
VxdID(4, 2, 0),
VxdID(4, 3, 0),
VxdID(5, 3, 0),
VxdID(5, 4, 0),
VxdID(6, 4, 0)};
148 const std::vector<VxdID> friends605X = {
VxdID(3, 1, 0),
VxdID(3, 2, 0),
VxdID(3, 3, 0),
VxdID(4, 2, 0),
VxdID(4, 3, 0),
VxdID(4, 4, 0),
VxdID(5, 3, 0),
VxdID(5, 4, 0),
VxdID(5, 5, 0),
VxdID(6, 5, 0)};
149 const std::vector<VxdID> friends606X = {
VxdID(3, 2, 0),
VxdID(3, 3, 0),
VxdID(4, 3, 0),
VxdID(4, 4, 0),
VxdID(4, 5, 0),
VxdID(5, 4, 0),
VxdID(5, 5, 0),
VxdID(5, 6, 0),
VxdID(6, 6, 0)};
150 const std::vector<VxdID> friends607X = {
VxdID(3, 2, 0),
VxdID(3, 3, 0),
VxdID(3, 4, 0),
VxdID(4, 4, 0),
VxdID(4, 5, 0),
VxdID(5, 5, 0),
VxdID(5, 6, 0),
VxdID(6, 7, 0)};
151 const std::vector<VxdID> friends608X = {
VxdID(3, 2, 0),
VxdID(3, 3, 0),
VxdID(3, 4, 0),
VxdID(4, 4, 0),
VxdID(4, 5, 0),
VxdID(4, 6, 0),
VxdID(5, 6, 0),
VxdID(5, 7, 0),
VxdID(6, 8, 0)};
152 const std::vector<VxdID> friends609X = {
VxdID(3, 3, 0),
VxdID(3, 4, 0),
VxdID(3, 5, 0),
VxdID(4, 5, 0),
VxdID(4, 6, 0),
VxdID(4, 7, 0),
VxdID(5, 6, 0),
VxdID(5, 7, 0),
VxdID(5, 8, 0),
VxdID(6, 9, 0)};
153 const std::vector<VxdID> friends610X = {
VxdID(3, 3, 0),
VxdID(3, 4, 0),
VxdID(3, 5, 0),
VxdID(4, 5, 0),
VxdID(4, 6, 0),
VxdID(4, 7, 0),
VxdID(5, 7, 0),
VxdID(5, 8, 0),
VxdID(5, 9, 0),
VxdID(6, 10, 0)};
154 const std::vector<VxdID> friends611X = {
VxdID(3, 4, 0),
VxdID(3, 5, 0),
VxdID(4, 6, 0),
VxdID(4, 7, 0),
VxdID(4, 8, 0),
VxdID(5, 8, 0),
VxdID(5, 9, 0),
VxdID(6, 11, 0)};
155 const std::vector<VxdID> friends612X = {
VxdID(3, 4, 0),
VxdID(3, 5, 0),
VxdID(3, 6, 0),
VxdID(4, 7, 0),
VxdID(4, 8, 0),
VxdID(5, 9, 0),
VxdID(5, 10, 0),
VxdID(6, 12, 0)};
156 const std::vector<VxdID> friends613X = {
VxdID(3, 5, 0),
VxdID(3, 6, 0),
VxdID(4, 7, 0),
VxdID(4, 8, 0),
VxdID(4, 9, 0),
VxdID(5, 9, 0),
VxdID(5, 10, 0),
VxdID(5, 11, 0),
VxdID(6, 13, 0)};
157 const std::vector<VxdID> friends614X = {
VxdID(3, 5, 0),
VxdID(3, 6, 0),
VxdID(3, 7, 0),
VxdID(4, 8, 0),
VxdID(4, 9, 0),
VxdID(4, 10, 0),
VxdID(5, 10, 0),
VxdID(5, 11, 0),
VxdID(5, 12, 0),
VxdID(6, 14, 0)};
158 const std::vector<VxdID> friends615X = {
VxdID(3, 6, 0),
VxdID(3, 7, 0),
VxdID(4, 9, 0),
VxdID(4, 10, 0),
VxdID(5, 11, 0),
VxdID(5, 12, 0),
VxdID(6, 15, 0)};
159 const std::vector<VxdID> friends616X = {
VxdID(3, 1, 0),
VxdID(3, 7, 0),
VxdID(4, 1, 0),
VxdID(4, 9, 0),
VxdID(4, 10, 0),
VxdID(5, 1, 0),
VxdID(5, 12, 0),
VxdID(6, 16, 0)};
162 phiFriends.insert(std::make_pair(
VxdID(6, 1, 0), friends601X));
163 phiFriends.insert(std::make_pair(
VxdID(6, 2, 0), friends602X));
164 phiFriends.insert(std::make_pair(
VxdID(6, 3, 0), friends603X));
165 phiFriends.insert(std::make_pair(
VxdID(6, 4, 0), friends604X));
166 phiFriends.insert(std::make_pair(
VxdID(6, 5, 0), friends605X));
167 phiFriends.insert(std::make_pair(
VxdID(6, 6, 0), friends606X));
168 phiFriends.insert(std::make_pair(
VxdID(6, 7, 0), friends607X));
169 phiFriends.insert(std::make_pair(
VxdID(6, 8, 0), friends608X));
170 phiFriends.insert(std::make_pair(
VxdID(6, 9, 0), friends609X));
171 phiFriends.insert(std::make_pair(
VxdID(6, 10, 0), friends610X));
172 phiFriends.insert(std::make_pair(
VxdID(6, 11, 0), friends611X));
173 phiFriends.insert(std::make_pair(
VxdID(6, 12, 0), friends612X));
174 phiFriends.insert(std::make_pair(
VxdID(6, 13, 0), friends613X));
175 phiFriends.insert(std::make_pair(
VxdID(6, 14, 0), friends614X));
176 phiFriends.insert(std::make_pair(
VxdID(6, 15, 0), friends615X));
177 phiFriends.insert(std::make_pair(
VxdID(6, 16, 0), friends616X));
179 std::vector<VxdID> friendSensors;
182 for (
auto& phiFriendPair : phiFriends) {
184 std::vector<VxdID> phiFriendLadders = phiFriendPair.second;
187 for (
auto& thetaFriendPair : thetaFriends) {
188 friendSensors.clear();
190 std::vector<VxdID> thetaFriendSensors = thetaFriendPair.second;
191 unsigned short layer6Sensor = thetaFriendPair.first.getSensorNumber();
194 for (
auto& phiFriend : phiFriendLadders) {
196 for (
auto& thetaFriend : thetaFriendSensors) {
197 if (phiFriend.getLayerNumber() == thetaFriend.getLayerNumber()) {
199 friendSensors.emplace_back(
VxdID(phiFriend.getLayerNumber(), phiFriend.getLadderNumber(), thetaFriend.getSensorNumber()));
204 friendSensors.emplace_back(
VxdID(6, layer6Ladder, layer6Sensor));
213 uint ymax, uint currentRecursion)
215 std::vector<VXDHoughState*> containedHits;
216 containedHits.reserve(hits.size());
217 std::bitset<8> layerHits;
222 const uint centerx = xmin + (uint)((xmax - xmin) / 2);
223 const uint centery = ymin + (uint)((ymax - ymin) / 2);
224 const uint xIndexCache[3] = {xmin, centerx, xmax};
225 const uint yIndexCache[3] = {ymin, centery, ymax};
227 for (
int i = 0; i < 2 ; ++i) {
228 const uint left = xIndexCache[i];
229 const uint right = xIndexCache[i + 1];
230 const uint localIndexX = left;
232 if (left == right)
continue;
244 for (
int j = 0; j < 2; ++j) {
245 const uint lowerIndex = yIndexCache[j];
246 const uint upperIndex = yIndexCache[j + 1];
248 if (lowerIndex == upperIndex)
continue;
250 const uint localIndexY = lowerIndex;
251 const double& localUpperCoordinate =
m_HSYLUT[lowerIndex];
252 const double& localLowerCoordinate =
m_HSYLUT[upperIndex];
256 containedHits.clear();
263 const double derivativeyLeft = m * -sinLeft + a * cosLeft;
264 const double derivativeyRight = m * -sinRight + a * cosRight;
265 const double derivativeyCenter = m * -sinCenter + a * cosCenter;
269 if (derivativeyLeft < 0 and derivativeyRight < 0 and derivativeyCenter < 0)
continue;
271 const double yLeft = m * cosLeft + a * sinLeft;
272 const double yRight = m * cosRight + a * sinRight;
273 const double yCenter = m * cosCenter + a * sinCenter;
276 if ((yLeft <= localUpperCoordinate and yRight >= localLowerCoordinate) or
277 (yCenter <= localUpperCoordinate and yLeft >= localLowerCoordinate and yRight >= localLowerCoordinate) or
278 (yCenter >= localLowerCoordinate and yLeft <= localUpperCoordinate and yRight <= localUpperCoordinate)) {
279 layerHits[hitData.
layer] =
true;
280 containedHits.emplace_back(hit);
307 if (currentCell.second.first > -1)
continue;
334 for (uint currentIndexY = lastIndexY; currentIndexY >= lastIndexY - 1; currentIndexY--) {
337 for (uint currentIndexX = lastIndexX; currentIndexX <= lastIndexX + 1; currentIndexX++) {
342 if (lastIndexX == currentIndexX && lastIndexY == currentIndexY)
continue;
348 auto activeSector =
m_activeSectors.find({currentIndexX, currentIndexY});
350 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.
void addProcessingSignalListener(ProcessingSignalListener *psl)
Register a processing signal listener to be notified.
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.
Class to uniquely identify a any structure of the PXD and SVD.
baseType getLadderNumber() const
Get the ladder id.
void apply(std::vector< VXDHoughState > &hits, const std::vector< VxdID > &friendSensorList, std::vector< VXDHoughState * > &selectedHits) override
Load the hits in a sensor friend list for a given L6 sensor from hits and store them in selectedHits,...
std::array< double, 16384 > m_HSCenterSinValuesLUT
sine values of the Hough Space sector center coordinates
std::vector< VXDHoughState * > m_currentSensorsHitList
hits that are in the acceptance region (= on friend sensors) for the current L6 senosr
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::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.
void initialize() override
Create the store arrays.
HitSelector m_HitSelector
Use the friend map to just fill the hits in the acceptance region of the current L6 sensor into the m...
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 initializeSectorFriendMap()
fill the map of friend sensors for each L6 sensor to
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
friendSensorMap m_fullFriendMap
friendMap for all the SVD L6 sensors
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