Belle II Software  release-08-01-10
MultiHoughSpaceFastInterceptFinder Class Referenceabstract

Findlet for finding intersections of sinusoidal curves in the 2D Hough space by iteratively calling FastInterceptFinder2d. More...

#include <MultiHoughSpaceFastInterceptFinder.h>

Inheritance diagram for MultiHoughSpaceFastInterceptFinder:
Collaboration diagram for MultiHoughSpaceFastInterceptFinder:

Classes

struct  paircompare
 this sorting makes sure the clusters can be searched from bottom left of the HS to top right normally, a C++ array looks like a matrix: (0, 0 ) ... More...
 

Public Types

using IOTypes = std::tuple< AIOTypes... >
 Types that should be served to apply on invokation.
 
using IOVectors = std::tuple< std::vector< AIOTypes >... >
 Vector types that should be served to apply on invokation.
 

Public Member Functions

 MultiHoughSpaceFastInterceptFinder ()
 Find intercepts in the 2D Hough space.
 
void exposeParameters (ModuleParamList *moduleParamList, const std::string &prefix) override
 Expose the parameters of the sub findlets.
 
void initialize () override
 Create the store arrays.
 
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 fitting.
 
virtual std::string getDescription ()
 Brief description of the purpose of the concret findlet.
 
virtual void apply (ToVector< AIOTypes > &... ioVectors)=0
 Main function executing the algorithm.
 
void beginRun () override
 Receive and dispatch signal for the beginning of a new run.
 
void beginEvent () override
 Receive and dispatch signal for the start of a new event.
 
void endRun () override
 Receive and dispatch signal for the end of the run.
 
void terminate () override
 Receive and dispatch Signal for termination of the event processing.
 

Protected Types

using ToVector = typename ToVectorImpl< T >::Type
 Short hand for ToRangeImpl.
 

Protected Member Functions

void addProcessingSignalListener (ProcessingSignalListener *psl)
 Register a processing signal listener to be notified.
 
int getNProcessingSignalListener ()
 Get the number of currently registered listeners.
 

Private Types

using Super = TrackFindingCDC::Findlet< VXDHoughState, std::vector< VXDHoughState * > >
 Parent class.
 
typedef std::map< VxdID, std::vector< VxdID > > friendSensorMap
 Map that contains the "friend" sensors for each SVD L6 sensor.
 

Private Member Functions

void initializeSectorFriendMap ()
 fill the map of friend sensors for each L6 sensor to
 
unsigned short layerFilter (const std::bitset< 8 > &layer)
 layer filter, checks if at least hits from 3 layers are in a set of hits More...
 
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 given Hough Space cell, or until the maximum number of recursions (m_maxRecursionLevel) is reached More...
 
void FindHoughSpaceCluster ()
 Find Hough Space clusters. More...
 
void DepthFirstSearch (uint lastIndexX, uint lastIndexY)
 Perform depth first search recursive algorithm to find clusters in the Hough Space. More...
 

Private Attributes

HitSelector m_HitSelector
 Use the friend map to just fill the hits in the acceptance region of the current L6 sensor into the m_currentSensorsHitList which is then used the Hough trafo track finding.
 
uint m_maxRecursionLevel = 7
 maximum number of recursive calls of fastInterceptFinder2d
 
uint m_nAngleSectors = 256
 number of sectors of the Hough Space on the horizontal axis
 
uint m_nVerticalSectors = 256
 number of sectors of the Hough Space on the vertical axis
 
double m_verticalHoughSpaceSize = 0.25
 vertical size of the Hough Space, defaults to the value for u-side
 
double m_minimumX = -3.168
 minimum x value of the Hough Space, defaults to the value for u-side
 
double m_maximumX = 3.168
 maximum x value of the Hough Space, defaults to the value for u-side
 
uint m_MinimumHSClusterSize = 6
 minimum cluster size of sectors belonging to intercepts in the Hough Space
 
uint m_MaximumHSClusterSize = 100
 maximum cluster size of sectors belonging to intercepts in the Hough Space
 
uint m_MaximumHSClusterSizeX = 100
 maximum cluster size in x of sectors belonging to intercepts in the Hough Space
 
uint m_MaximumHSClusterSizeY = 100
 maximum cluster size in y of sectors belonging to intercepts in the Hough Space
 
double m_unitX = 0
 HS unit size in x.
 
double m_unitY = 0
 HS unit size in y.
 
friendSensorMap m_fullFriendMap
 friendMap for all the SVD L6 sensors
 
std::vector< VXDHoughState * > m_currentSensorsHitList
 hits that are in the acceptance region (= on friend sensors) for the current L6 senosr
 
std::array< double, 16385 > m_HSSinValuesLUT = {0}
 Look-Up-Tables for values as cache to speed up calculation sine values of the Hough Space sector boarder coordinates.
 
std::array< double, 16385 > m_HSCosValuesLUT = {0}
 cosine values of the Hough Space sector boarder coordinates
 
std::array< double, 16384 > m_HSCenterSinValuesLUT = {0}
 sine values of the Hough Space sector center coordinates
 
std::array< double, 16384 > m_HSCenterCosValuesLUT = {0}
 cosine values of the Hough Space sector center coordinates
 
std::array< double, 16385 > m_HSYLUT = {0}
 y values of the Hough Space sector boarders
 
std::array< double, 16384 > m_HSYCenterLUT = {0}
 y values of the Hough Space sector centers
 
std::array< double, 16385 > m_HSXLUT = {0}
 x values of the Hough Space sector boarders
 
std::array< double, 16384 > m_HSXCenterLUT = {0}
 x values of the Hough Space sector centers
 
std::map< std::pair< uint, uint >, std::pair< int, std::vector< VXDHoughState * > >, paircomparem_activeSectors
 Map containing only active HS sectors, i.e. More...
 
uint m_clusterCount = 0
 count the clusters
 
uint m_clusterSize = 0
 size of the current cluster
 
std::pair< uint, uint > m_clusterInitialPosition = std::make_pair(0, 0)
 start cell of the recursive cluster finding in the Hough Space
 
std::pair< int, int > m_clusterCoG = std::make_pair(0, 0)
 center of gravity containing describing the current best track parameters in the Hough Space
 
std::vector< VXDHoughState * > m_currentTrackCandidate
 the current track candidate
 
std::vector< std::vector< VXDHoughState * > > m_trackCandidates
 vector containing track candidates, consisting of the found intersection values in the Hough Space
 
std::vector< ProcessingSignalListener * > m_subordinaryProcessingSignalListeners
 References to subordinary signal processing listener contained in this findlet.
 
bool m_initialized = false
 Flag to keep track whether initialization happend before.
 
bool m_terminated = false
 Flag to keep track whether termination happend before.
 
std::string m_initializedAs
 Name of the type during initialisation.
 

Detailed Description

Findlet for finding intersections of sinusoidal curves in the 2D Hough space by iteratively calling FastInterceptFinder2d.

This is done 80 times for a subset of SVD sensors, one subset for each layer 6 sensor to reduce combinatorics in the Hough Space and to improve the purity of the found track candidates. The found track candidates are then clustered via a recursive search. Afterwards track candidates are formed and stored in the output vector.

Definition at line 35 of file MultiHoughSpaceFastInterceptFinder.h.

Member Function Documentation

◆ DepthFirstSearch()

void DepthFirstSearch ( uint  lastIndexX,
uint  lastIndexY 
)
private

Perform depth first search recursive algorithm to find clusters in the Hough Space.

Parameters
lastIndexXx-index of the last cell checked
lastIndexYy-index of the last cell checked

Definition at line 331 of file MultiHoughSpaceFastInterceptFinder.cc.

332 {
333  if (m_clusterSize >= m_MaximumHSClusterSize) return;
334 
335  for (uint currentIndexY = lastIndexY; currentIndexY >= lastIndexY - 1; currentIndexY--) {
336  if (abs((int)m_clusterInitialPosition.second - (int)currentIndexY) >= m_MaximumHSClusterSizeY or
337  m_clusterSize >= m_MaximumHSClusterSize or currentIndexY > m_nVerticalSectors) return;
338  for (uint currentIndexX = lastIndexX; currentIndexX <= lastIndexX + 1; currentIndexX++) {
339  if (abs((int)m_clusterInitialPosition.first - (int)currentIndexX) >= m_MaximumHSClusterSizeX or
340  m_clusterSize >= m_MaximumHSClusterSize or currentIndexX > m_nAngleSectors) return;
341 
342  // The cell (currentIndexX, currentIndexY) is the current one has already been checked, so continue
343  if (lastIndexX == currentIndexX && lastIndexY == currentIndexY) continue;
344 
345  // first check bounds to avoid out-of-bound array access
346  // as they are uints, they are always >= 0, and in case of an overflow they would be too large
347  if (currentIndexX < m_nAngleSectors and currentIndexY < m_nVerticalSectors) {
348 
349  auto activeSector = m_activeSectors.find({currentIndexX, currentIndexY});
350  // Only continue searching if the current cluster is smaller than the maximum cluster size
351  if (activeSector != m_activeSectors.end() and activeSector->second.first < 0 /*and m_clusterSize < m_MaximumHSClusterSize*/) {
352  activeSector->second.first = m_clusterCount;
353  m_clusterSize++;
354 
355  // No need to check whether currentIndex exists as a key in m_activeSectors as they were created at the same time
356  // so it's certain the key exists.
357  for (VXDHoughState* hit : activeSector->second.second) {
358  if (not TrackFindingCDC::is_in(hit, m_currentTrackCandidate)) {
359  m_currentTrackCandidate.emplace_back(hit);
360  }
361  }
362  // search in the next Hough Space cells...
363  DepthFirstSearch(currentIndexX, currentIndexY);
364  }
365  }
366  }
367  }
368 }
uint m_nVerticalSectors
number of sectors of the Hough Space on the vertical axis
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 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
std::vector< VXDHoughState * > m_currentTrackCandidate
the current track candidate
uint m_MaximumHSClusterSizeY
maximum cluster size in y of sectors belonging to intercepts in the Hough Space
uint m_MaximumHSClusterSize
maximum cluster size of sectors belonging to intercepts in the Hough Space
Simple container for hit information to be used during intercept finding.
Definition: VXDHoughState.h:24

◆ fastInterceptFinder2d()

void fastInterceptFinder2d ( const std::vector< VXDHoughState * > &  hits,
uint  xmin,
uint  xmax,
uint  ymin,
uint  ymax,
uint  currentRecursion 
)
private

find intercepts in the 2D Hough Space by recursively calling itself until no hits are assinged to a given Hough Space cell, or until the maximum number of recursions (m_maxRecursionLevel) is reached

Parameters
hitsvector containing the hits that are used for track finding
xminminimum x-index of the sub-Hough Space in the current recursion step
xmaxmaximum x-index of the sub-Hough Space in the current recursion step
yminminimum y-index of the sub-Hough Space in the current recursion step
ymaxmaximum y-index of the sub-Hough Space in the current recursion step
currentRecursioncurrent recursion step, has to be < m_maxRecursionLevel

Definition at line 212 of file MultiHoughSpaceFastInterceptFinder.cc.

◆ FindHoughSpaceCluster()

void FindHoughSpaceCluster ( )
private

Find Hough Space clusters.

Loop over all found sectors in m_SectorArray and then calls the DepthFirstSearch function to recursively find the clusters

Definition at line 298 of file MultiHoughSpaceFastInterceptFinder.cc.

◆ layerFilter()

unsigned short layerFilter ( const std::bitset< 8 > &  layer)
inlineprivate

layer filter, checks if at least hits from 3 layers are in a set of hits

Parameters
layerbitset containing information whether there as a hit in a layer

Definition at line 66 of file MultiHoughSpaceFastInterceptFinder.h.

67  {
68  uint layercount = layer.count();
69  return (layercount >= 3 ? layercount : 0);
70  }

Member Data Documentation

◆ m_activeSectors

std::map<std::pair<uint, uint>, std::pair<int, std::vector<VXDHoughState*> >, paircompare> m_activeSectors
private

Map containing only active HS sectors, i.e.

those with hits from enough layers contained in them. The keys are the indices of the HS cell, and the custom sort function above is used to sort the content. The value is a pair consisting of the (negative) number of layers hit in a given cell, and a vector containing the hit information of all hits that are contained in this cell. During cluster finding the first value of the value-pair will be assigned the current cluster number.

Definition at line 173 of file MultiHoughSpaceFastInterceptFinder.h.


The documentation for this class was generated from the following files: