Belle II Software  release-08-01-10
NDFinder Class Reference

Class to represent the CDC NDFinder. More...

#include <NDFinder.h>

Collaboration diagram for NDFinder:

Classes

struct  ndparameters
 Struct of ndFinder parameters. More...
 

Public Member Functions

 NDFinder ()
 Default constructor.
 
virtual ~NDFinder ()
 Default destructor.
 
void init (int minweight, int minpts, bool diagonal, int minhits, int minhits_axial, double thresh, double minassign, int mincells, bool verbose, std::string &axialFile, std::string &stereoFile)
 initialization More...
 
void initBins ()
 Initialize the binnings and reserve the arrays. More...
 
void loadArray (const std::string &filename, ndbinning bins, c5array &hitsToTracks)
 Load an NDFinder array of hit representations in track phase space. More...
 
void restoreZeros (ndbinning zerobins, ndbinning compbins, c5array &expArray, const c5array &compArray)
 Restore non-zero suppressed hit curves. More...
 
void squeezeOne (c5array &writeArray, c5array &readArray, int outparcels, int inparcels, c5index ihit, c5index iprio, c5index itheta, c5elem nomega)
 Squeeze phi-axis in a 2D (omega,phi) plane. More...
 
void squeezeAll (ndbinning writebins, c5array &writeArray, c5array &readArray, int outparcels, int inparcels)
 Loop over all hits and theta bins and squeeze all 2D (omega,phi) planes.
 
void initHitModAxSt (c2array &hitMod)
 Initialize hit modulo mappings.
 
void reset ()
 NDFinder reset data structure to process next event.
 
void printParams ()
 Debug: print configured parameters.
 
void addHit (unsigned short hitId, unsigned short hitPrioPos)
 fill hit info of the event
 
void findTracks ()
 main function for track finding More...
 
std::vector< NDFinderTrack > * getFinderTracks ()
 retreive the results
 
void printArray3D (c3array &hitsToTracks, ndbinning bins, ushort, ushort, ushort, ushort)
 Debug Tool: Print part of the houghmap.
 

Public Attributes

std::vector< std::vector< float > > m_acceptRanges
 
std::vector< float > m_slotsizes
 

Protected Member Functions

void getCM ()
 NDFinder internal functions for track finding. More...
 
void addLookup (unsigned short ihit)
 Add a single axial or stereo hit to the houghmap. More...
 
void addC3Comp (ushort hitr, ushort prio, const c5array &hitsToTracks, short Dstart, ndbinning bins)
 In place array addition to houghmap Comp: A = A + B.
 
std::vector< std::vector< unsigned short > > getHitsVsClusters (std::vector< SimpleCluster > &clusters)
 Create hits to clusters confusion matrix.
 
cell_index getMax (const std::vector< cell_index > &)
 Peak cell in cluster.
 
ushort hitContrib (cell_index peak, ushort ihit)
 Determine weight contribution of a single hit to a single cell. More...
 
std::vector< SimpleClusterrelateHitsToClusters (std::vector< std::vector< unsigned short >> &hitsVsClusters, std::vector< SimpleCluster > &clusters)
 Use confusion matrix to related hits to clusters. More...
 
int hitToCluster (std::vector< std::vector< unsigned short >> &hitsVsClusters, unsigned short hit)
 Determine the best cluster for a single hit, given hitsVsClusters confusion matrix.
 
std::vector< cellweightgetHighWeight (std::vector< cell_index > entries, float cutoff)
 Candidate cells as seed for the clustering. More...
 
std::vector< double > getWeightedMean (std::vector< cellweight >)
 Calculate the weighted center of a cluster.
 
std::vector< double > getBinToVal (std::vector< double >)
 Scale the weighted center to track parameter values.
 
double cdc_track_radius (double pt)
 Transverse momentum to radius.
 
float transformVar (float estVal, int idx)
 Calculate physical units.
 
std::vector< double > transform (std::vector< double > estimate)
 

Private Attributes

boost::array< c5index, 5 > m_pc5shapeax
 NDFinder. More...
 
boost::array< c5index, 5 > m_pc5shapest
 
boost::array< c3index, 3 > m_pc3shape
 
boost::array< c2index, 2 > m_pc2shapeHitMod
 
boost::array< c5index, 5 > m_pc5shapeCompAx
 
boost::array< c5index, 5 > m_pc5shapeCompSt
 
boost::array< c5index, 5 > m_pc5shapeExpAx
 
boost::array< c5index, 5 > m_pc5shapeExpSt
 
c5array * m_parrayAxial = nullptr
 Array pointers to the hit patterns.
 
c5array * m_parrayStereo = nullptr
 
c3array * m_phoughPlane = nullptr
 
c2array * m_parrayHitMod = nullptr
 
c5array * m_pcompAxial = nullptr
 
c5array * m_pcompStereo = nullptr
 
c5array * m_parrayAxialExp = nullptr
 
c5array * m_parrayStereoExp = nullptr
 
std::vector< int > m_nWires
 Number of first priority wires in each super layer (TS per SL)
 
std::vector< NDFinderTrackm_NDFinderTracks
 Result: vector of the found tracks.
 
std::vector< unsigned short > m_hitIds
 TS-Ids of the hits in the current event elements: [0,2335] for 2336 TS in total.
 
std::vector< unsigned short > m_prioPos
 Priority positon within the TS in the current event elements basf2: [0,3] first, left, right, no hit elements stored: 3 - basf2prio.
 
std::vector< unsigned short > m_hitOrients
 Orients TS-Ids of the hits in the current event elements: [0,2335] for 2336 TS in total.
 
std::vector< short > m_vecDstart
 Phi-start of 7/32 hit representation in full track parameter space. More...
 
unsigned short m_nHits {0}
 Counter for the number of hits in the current event.
 
ndparameters m_params
 Configuration parameters of the 3DFinder.
 
ndbinning m_axbins
 Binnings in different hit pattern arrays.
 
ndbinning m_stbins
 
ndbinning m_fullbins
 
ndbinning m_compaxbins
 
ndbinning m_compstbins
 
ndbinning m_expaxbins
 
ndbinning m_expstbins
 
clusterer_params m_clusterer_params
 Configuration of the clustering module.
 
std::vector< ushort > m_planeShape
 
unsigned short m_nPhiFull {0}
 Default bins.
 
unsigned short m_nPhiOne {0}
 
unsigned short m_nPhiComp {0}
 
unsigned short m_nPhiExp {0}
 
unsigned short m_nPhiUse {0}
 
unsigned short m_nOmega {0}
 
unsigned short m_nTheta {0}
 
unsigned short m_nSL {0}
 
unsigned short m_nTS {0}
 
unsigned short m_nAx {0}
 
unsigned short m_nSt {0}
 
unsigned short m_nPrio {0}
 
Belle2::Clusterizend m_clusterer
 Clustering module.
 
bool m_verbose {false}
 Print Hough planes and verbose output.
 

Detailed Description

Class to represent the CDC NDFinder.

Definition at line 90 of file NDFinder.h.

Member Function Documentation

◆ addLookup()

void addLookup ( unsigned short  ihit)
protected

Add a single axial or stereo hit to the houghmap.

orient: {1 : axial, 0 : stereo}

Determines the phi window of the hit in the full houghmap (Dstart, Dend). Uses: m_arrayHitMod Fills: m_vecDstart, m_hitOrients

Definition at line 331 of file NDFinder.cc.

332 {
333  c2array& arrayHitMod = *m_parrayHitMod;
334 
335  c2elem orient = arrayHitMod[m_hitIds[ihit]][0];
336  c2elem hitr = arrayHitMod[m_hitIds[ihit]][1];
337  c2elem letter = arrayHitMod[m_hitIds[ihit]][2];
338 
339  unsigned short prio = m_prioPos[ ihit ];
340  short letterShort = (short) letter;
341 
342  // Get hit contribution to cluster:
343  // 7 of 32 phi parcels: center = 3
344  short DstartShort = (letterShort - 3) % m_params.phigeo * m_nPhiOne;
345  if (DstartShort < 0) {DstartShort = m_nPhiFull + DstartShort;}
346  // Add hit to hough plane
347  // 11 of 32 phi parcels: center = 5
348  short DstartComp = (letterShort - 5) % m_params.phigeo * m_nPhiOne;
349  if (DstartComp < 0) {DstartComp = m_nPhiFull + DstartComp;}
350 
351  m_vecDstart.push_back(DstartShort);
352  m_hitOrients.push_back(orient);
353 
354  if (orient == 1) {
355  addC3Comp(hitr, prio, *m_pcompAxial, DstartComp, m_compaxbins);
356  } else {
357  addC3Comp(hitr, prio, *m_pcompStereo, DstartComp, m_compstbins);
358  }
359 }
std::vector< unsigned short > m_prioPos
Priority positon within the TS in the current event elements basf2: [0,3] first, left,...
Definition: NDFinder.h:317
std::vector< short > m_vecDstart
Phi-start of 7/32 hit representation in full track parameter space.
Definition: NDFinder.h:326
std::vector< unsigned short > m_hitOrients
Orients TS-Ids of the hits in the current event elements: [0,2335] for 2336 TS in total.
Definition: NDFinder.h:322
void addC3Comp(ushort hitr, ushort prio, const c5array &hitsToTracks, short Dstart, ndbinning bins)
In place array addition to houghmap Comp: A = A + B.
Definition: NDFinder.cc:362
ndparameters m_params
Configuration parameters of the 3DFinder.
Definition: NDFinder.h:332
std::vector< unsigned short > m_hitIds
TS-Ids of the hits in the current event elements: [0,2335] for 2336 TS in total.
Definition: NDFinder.h:312
unsigned short m_nPhiFull
Default bins.
Definition: NDFinder.h:348
unsigned short c2elem
TS-Id to 1/32 phi-sector mapping is stored in a 2D array.
Definition: NDFinderDefs.h:34
unsigned short phigeo
CDC symmetry: repeat wire pattern 32 times in phi.
Definition: NDFinder.h:114

◆ findTracks()

void findTracks ( )

main function for track finding

Build the Houghplane by summing up all single hit contributions

Definition at line 388 of file NDFinder.cc.

◆ getCM()

void getCM ( )
protected

NDFinder internal functions for track finding.

Core track finding logic in the constructed houghmap

pt, phiRad, cotTheta, cluster

Definition at line 485 of file NDFinder.cc.

◆ getHighWeight()

vector< cellweight > getHighWeight ( std::vector< cell_index >  entries,
float  cutoff 
)
protected

Candidate cells as seed for the clustering.

Selects all cells with weight > minweight

Definition at line 624 of file NDFinder.cc.

◆ hitContrib()

ushort hitContrib ( cell_index  peak,
ushort  ihit 
)
protected

Determine weight contribution of a single hit to a single cell.

Used to create the hitsVsClusters confusion matrix.

Definition at line 641 of file NDFinder.cc.

◆ init()

void init ( int  minweight,
int  minpts,
bool  diagonal,
int  minhits,
int  minhits_axial,
double  thresh,
double  minassign,
int  mincells,
bool  verbose,
std::string &  axialFile,
std::string &  stereoFile 
)

initialization

Set parameters

Parameters
minweightminimum weight of cluster member cells
minptsminimum neighboring cells with minweight for core cells
diagonalconsider diagonal neighbor cells in the clustering
minhitsminimum number of hits per cluster
minhits_axialminimum number of axial hits per cluster
threshselection of cells for weighted mean track estimation
minassignhit to cluster assigment critical limit
mincellsminumum number of cells per cluster
verboseprint Hough planes and verbose output
axialFileaxial hit data
stereoFilestereo hit data

Load the axial and stereo track to hit relations from file.

Unpack zero suppresed track to hit relations.

Definition at line 25 of file NDFinder.cc.

◆ initBins()

void initBins ( )

Initialize the binnings and reserve the arrays.

Create the arrays of the track to hit relations for axial and stereo hits.

Since the CDC wire pattern is repeated 32 times, the hit ids are stored for 1/32 of the CDC only. The total number of 2336 TS corresponds to (41 axial + 32 stereo) * 32.

The number of track bins (full phi) is: (omega, phi, theta) = (40, 384, 9)

compressed phi: phi_start, phi_width, phi_0, ..., phi_12

use phi bins: 84 = 7 * (384/32)

expanded phi: 132 = 11 * (384/32)

Acceptance Ranges

Definition at line 72 of file NDFinder.cc.

◆ loadArray()

void loadArray ( const std::string &  filename,
ndbinning  bins,
c5array &  hitsToTracks 
)

Load an NDFinder array of hit representations in track phase space.

Used to load axial and stereo hit arrays. Represented in a 7/32 phi sector of the CDC.

Definition at line 159 of file NDFinder.cc.

◆ relateHitsToClusters()

vector< SimpleCluster > relateHitsToClusters ( std::vector< std::vector< unsigned short >> &  hitsVsClusters,
std::vector< SimpleCluster > &  clusters 
)
protected

Use confusion matrix to related hits to clusters.

Remove small clusters with less than minhits related hits.

hit assignment

Definition at line 422 of file NDFinder.cc.

◆ restoreZeros()

void restoreZeros ( ndbinning  zerobins,
ndbinning  compbins,
c5array &  expArray,
const c5array &  compArray 
)

Restore non-zero suppressed hit curves.

will make m_params.arrayAxialFile and m_params.arrayStereoFile obsolete

Definition at line 258 of file NDFinder.cc.

◆ squeezeOne()

void squeezeOne ( c5array &  writeArray,
c5array &  readArray,
int  outparcels,
int  inparcels,
c5index  ihit,
c5index  iprio,
c5index  itheta,
c5elem  nomega 
)

Squeeze phi-axis in a 2D (omega,phi) plane.

Parameters
inparcelsnumber of 1/32 sectors in input plane
outparcelsnumber of 1/32 sectors in output plane

Definition at line 223 of file NDFinder.cc.

Member Data Documentation

◆ m_pc5shapeax

boost::array<c5index, 5> m_pc5shapeax
private

NDFinder.

Shapes of the arrays holding the hit patterns

Definition at line 285 of file NDFinder.h.

◆ m_vecDstart

std::vector<short> m_vecDstart
private

Phi-start of 7/32 hit representation in full track parameter space.

Used to get the weight contribution of a hit to a cluster.

Definition at line 326 of file NDFinder.h.


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