Belle II Software development
NDFinder Class Reference

Class to represent the CDC NDFinder. More...

#include <NDFinder.h>

Classes

struct  ndparameters
 Struct of ndFinder parameters. More...
 

Public Member Functions

 NDFinder ()
 Default constructor.
 
virtual ~NDFinder ()
 Default destructor.
 
void init (unsigned short minWeight, unsigned char minPts, bool diagonal, unsigned char minSuperAxial, unsigned char minSuperStereo, float thresh, unsigned char minCells, bool dbscanning, unsigned short minTotalWeight, unsigned short minPeakWeight, unsigned char iterations, unsigned char omegaTrim, unsigned char phiTrim, unsigned char thetaTrim, bool verbose, std::string &axialFile, std::string &stereoFile)
 initialization
 
void initBins ()
 Initialize the binnings and reserve the arrays.
 
void loadArray (const std::string &filename, ndbinning bins, c5array &hitsToTracks)
 Load an NDFinder array of hit representations in track phase space.
 
void restoreZeros (ndbinning zerobins, ndbinning compbins, c5array &expArray, const c5array &compArray)
 Restore non-zero suppressed hit curves.
 
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.
 
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 hitSLId, unsigned short hitPrioPos, long hitPrioTime)
 fill hit info of the event
 
void findTracks ()
 main function for track finding
 
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.
 
void addLookup (unsigned short ihit)
 Add a single axial or stereo hit to the houghmap.
 
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.
 
std::vector< SimpleClusterallHitsToClusters (std::vector< std::vector< unsigned short > > &hitsVsClusters, std::vector< SimpleCluster > &clusters)
 Relate all hits in a cluster to the cluster Remove small clusters with less than minsuper related hits.
 
std::vector< cellweightgetHighWeight (std::vector< cell_index > entries, float cutoff)
 Candidate cells as seed for the clustering.
 
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 cdcTrackRadius (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.
 
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_hitSLIds
 SL-Ids of the hits in the current event elements: super layer number in [0,1,...,8].
 
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< long > m_prioTime
 Drift time of the priority wire.
 
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.
 
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
 
clustererParams m_clustererParams
 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.
 
Belle2::Clusterizend m_clusterer2
 
bool m_verbose {false}
 Print Hough planes and verbose output.
 

Detailed Description

Class to represent the CDC NDFinder.

Definition at line 107 of file NDFinder.h.

Constructor & Destructor Documentation

◆ NDFinder()

NDFinder ( )
inline

Default constructor.

Definition at line 163 of file NDFinder.h.

163{}

◆ ~NDFinder()

virtual ~NDFinder ( )
inlinevirtual

Default destructor.

Definition at line 166 of file NDFinder.h.

167 {
168 delete m_parrayAxial;
169 delete m_parrayStereo;
170 delete m_phoughPlane;
171 delete m_parrayHitMod;
172 delete m_pcompAxial;
173 delete m_pcompStereo;
174 delete m_parrayAxialExp;
175 delete m_parrayStereoExp;
176 }
c5array * m_parrayAxial
Array pointers to the hit patterns.
Definition: NDFinder.h:339

Member Function Documentation

◆ addC3Comp()

void addC3Comp ( ushort  hitr,
ushort  prio,
const c5array &  hitsToTracks,
short  Dstart,
ndbinning  bins 
)
protected

In place array addition to houghmap Comp: A = A + B.

Definition at line 368 of file NDFinder.cc.

371{
372 ushort ntheta = 0;
373 c3array& houghPlane = *m_phoughPlane;
374 for (ushort itheta = 0; itheta < m_nTheta; itheta++) { //9
375 if (bins.theta > 1) { //stereo
376 ntheta = itheta;
377 }
378 for (ushort iomega = 0; iomega < m_nOmega; iomega++) { //40
379 ushort startfield = 0;
380 ushort lenfield = 1;
381 ushort xstart = hitsToTracks[hitr][prio][iomega][startfield][ntheta];
382 ushort xlen = hitsToTracks[hitr][prio][iomega][lenfield][ntheta];
383 for (ushort iphiz = 0; iphiz < xlen; iphiz++) {
384 ushort iphix = iphiz + 2;
385 ushort iphi = iphiz + xstart;
386 ushort iHoughPhi = (iphi + Dstart) % m_nPhiFull;
387 houghPlane[iomega][iHoughPhi][itheta] += hitsToTracks[hitr][prio][iomega][iphix][ntheta];
388 }
389 }
390 }
391}
unsigned short m_nPhiFull
Default bins.
Definition: NDFinder.h:399

◆ addHit()

void addHit ( unsigned short  hitId,
unsigned short  hitSLId,
unsigned short  hitPrioPos,
long  hitPrioTime 
)
inline

fill hit info of the event

Definition at line 249 of file NDFinder.h.

250 {
251 if (hitPrioPos > 0) { // skip "no hit"
252 m_hitIds.push_back(hitId);
253 m_hitSLIds.push_back(hitSLId);
254 m_prioPos.push_back(3 - hitPrioPos);
255 m_prioTime.push_back(hitPrioTime);
256 m_nHits++;
257 }
258 }
std::vector< unsigned short > m_prioPos
Priority positon within the TS in the current event elements basf2: [0,3] first, left,...
Definition: NDFinder.h:365
unsigned short m_nHits
Counter for the number of hits in the current event.
Definition: NDFinder.h:380
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:356
std::vector< long > m_prioTime
Drift time of the priority wire.
Definition: NDFinder.h:368
std::vector< unsigned short > m_hitSLIds
SL-Ids of the hits in the current event elements: super layer number in [0,1,...,8].
Definition: NDFinder.h:360

◆ 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 337 of file NDFinder.cc.

338{
339 c2array& arrayHitMod = *m_parrayHitMod;
340
341 c2elem orient = arrayHitMod[m_hitIds[ihit]][0];
342 c2elem hitr = arrayHitMod[m_hitIds[ihit]][1];
343 c2elem letter = arrayHitMod[m_hitIds[ihit]][2];
344
345 unsigned short prio = m_prioPos[ ihit ];
346 short letterShort = (short) letter;
347
348 // Get hit contribution to cluster:
349 // 7 of 32 phi parcels: center = 3
350 short DstartShort = (letterShort - 3) % m_params.phigeo * m_nPhiOne;
351 if (DstartShort < 0) {DstartShort = m_nPhiFull + DstartShort;}
352 // Add hit to hough plane
353 // 11 of 32 phi parcels: center = 5
354 short DstartComp = (letterShort - 5) % m_params.phigeo * m_nPhiOne;
355 if (DstartComp < 0) {DstartComp = m_nPhiFull + DstartComp;}
356
357 m_vecDstart.push_back(DstartShort);
358 m_hitOrients.push_back(orient);
359
360 if (orient == 1) {
361 addC3Comp(hitr, prio, *m_pcompAxial, DstartComp, m_compAxBins);
362 } else {
363 addC3Comp(hitr, prio, *m_pcompStereo, DstartComp, m_compStBins);
364 }
365}
std::vector< short > m_vecDstart
Phi-start of 7/32 hit representation in full track parameter space.
Definition: NDFinder.h:377
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:373
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:368
ndparameters m_params
Configuration parameters of the 3DFinder.
Definition: NDFinder.h:383
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:151

◆ allHitsToClusters()

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

Relate all hits in a cluster to the cluster Remove small clusters with less than minsuper related hits.

Definition at line 429 of file NDFinder.cc.

430{
431 std::vector<SimpleCluster> useClusters;
432 if (hitsVsClusters.size() > 0) {
433 // Iteration over the number of clusters
434 for (unsigned long iclus = 0; iclus < hitsVsClusters.size(); iclus++) {
435 std::vector<std::vector<long>> superLayerNumbers;
436 // Iteration over all track segment hits
437 for (unsigned long ihit = 0; ihit < m_hitIds.size(); ihit++) {
438 unsigned short contribution = hitsVsClusters[iclus][ihit];
439 if (contribution > 0) {
440 superLayerNumbers.push_back({static_cast<long>(ihit), contribution, m_hitSLIds[ihit], m_prioTime[ihit]});
441 }
442 }
443 // Iteration over all super layers
444 for (unsigned short sl = 0; sl < 9; sl++) {
445 std::vector<std::vector<long>> oneSuperLayerContributions;
446 for (unsigned long nTS = 0; nTS < superLayerNumbers.size(); nTS++) {
447 if (superLayerNumbers[nTS][2] == sl) {
448 oneSuperLayerContributions.push_back({superLayerNumbers[nTS][0], superLayerNumbers[nTS][1], superLayerNumbers[nTS][3]});
449 }
450 }
451 // Continue if there are no hits in the current super layer
452 if (oneSuperLayerContributions.size() == 0) {
453 continue;
454 }
455 // Sorting after the drift times
456 struct sortingClass {
457 bool operator()(std::vector<long> i, std::vector<long> j) {return (i[2] < j[2]);}
458 } sortingTimes;
459 sort(oneSuperLayerContributions.begin(), oneSuperLayerContributions.end(), sortingTimes);
460 long maxHit = oneSuperLayerContributions[0][0];
461 long maxContribution = oneSuperLayerContributions[0][1];
462 // Iteration over all track segments in this super layer
463 for (size_t index = 0; index < oneSuperLayerContributions.size(); index++) {
464 // The maximum weight contribution gets identified
465 if (oneSuperLayerContributions[index][1] > maxContribution) {
466 maxContribution = oneSuperLayerContributions[index][1];
467 maxHit = oneSuperLayerContributions[index][0];
468 }
469 }
470 clusters[iclus].addHit(maxHit, maxContribution, m_hitOrients[maxHit]);
471 }
472 SimpleCluster& clu = clusters[iclus];
473 // The hits of the current cluster get extracted
474 std::vector<unsigned short> clusterHits = clu.getHits();
475 std::vector<unsigned short> clusterSLNumbers;
476 for (const auto& element : clusterHits) {
477 clusterSLNumbers.push_back(m_hitSLIds[element]);
478 }
479 // A cut on the super layer numbers is applied
480 std::set<unsigned short> uniqueSLNumbers(clusterSLNumbers.begin(), clusterSLNumbers.end());
481 size_t nSL = uniqueSLNumbers.size();
482 uniqueSLNumbers.insert({0, 2, 4, 6, 8});
483 size_t withAxialSLs = uniqueSLNumbers.size();
484 size_t axialNumber = 5 - (withAxialSLs - nSL);
485 size_t stereoNumber = nSL - axialNumber;
486 if (axialNumber >= m_params.minSuperAxial && stereoNumber >= m_params.minSuperStereo) {
487 useClusters.push_back(clusters[iclus]);
488 }
489 }
490 }
491 return useClusters;
492}
Type for found clusters.
Definition: Clusterizend.h:45
std::vector< unsigned short > getHits()
Get ids of related hits (indices of the TS StoreArray)
Definition: Clusterizend.h:100
unsigned char minSuperAxial
Clustering options.
Definition: NDFinder.h:118
unsigned char minSuperStereo
Required number of stereo super layers.
Definition: NDFinder.h:121

◆ cdcTrackRadius()

double cdcTrackRadius ( double  pt)
inlineprotected

Transverse momentum to radius.

Definition at line 316 of file NDFinder.h.

317 {
318 return pt * 1e11 / (3e8 * 1.5); // div (c * B)
319 }

◆ findTracks()

void findTracks ( )

main function for track finding

Build the Houghplane by summing up all single hit contributions

Definition at line 394 of file NDFinder.cc.

395{
397 for (unsigned short ihit = 0; ihit < m_nHits; ihit++) {
398 addLookup(ihit);
399 }
400 if (m_verbose) {
401 B2DEBUG(25, "m_houghPlane, 2");
402 printArray3D(*m_phoughPlane, m_fullBins);
403 }
404 getCM();
405}
void getCM()
NDFinder internal functions for track finding.
Definition: NDFinder.cc:494
void addLookup(unsigned short ihit)
Add a single axial or stereo hit to the houghmap.
Definition: NDFinder.cc:337
void printArray3D(c3array &hitsToTracks, ndbinning bins, ushort, ushort, ushort, ushort)
Debug Tool: Print part of the houghmap.
Definition: NDFinder.cc:289
bool m_verbose
Print Hough planes and verbose output.
Definition: NDFinder.h:418

◆ getBinToVal()

std::vector< double > getBinToVal ( std::vector< double >  thisAv)
protected

Scale the weighted center to track parameter values.

Definition at line 608 of file NDFinder.cc.

609{
610 std::vector<double> estimate;
611 for (ushort idim = 0; idim < 3; idim++) {
612 double trafd = m_acceptRanges[idim][0] + (thisAv[idim] + 0.5) * m_slotSizes[idim];
613 estimate.push_back(trafd);
614 }
615 return estimate;
616}

◆ getCM()

void getCM ( )
protected

NDFinder internal functions for track finding.

Core track finding logic in the constructed houghmap

Definition at line 494 of file NDFinder.cc.

495{
496 c3array& houghPlane = *m_phoughPlane;
497 std::vector<SimpleCluster> allClusters;
498 std::vector<ROOT::Math::XYZVector> houghspace;
499 if (m_params.dbscanning) {
500 m_clusterer.setNewPlane(houghPlane);
501 allClusters = m_clusterer.dbscan();
502 } else {
503 c3array copiedPlane = houghPlane;
504 m_clusterer.setNewPlane(copiedPlane);
505 std::vector<SimpleCluster> fixedClusters = m_clusterer.makeClusters();
506 allClusters = fixedClusters;
507 }
508 std::vector<SimpleCluster> clusters;
509 for (SimpleCluster& clu : allClusters) {
510 if (clu.getEntries().size() > m_params.minCells) {
511 clusters.push_back(clu);
512 }
513 }
514 std::vector<std::vector<unsigned short>> hitsVsClusters = getHitsVsClusters(clusters);
515 // New hit to cluster relation
516 std::vector<SimpleCluster> useClusters = allHitsToClusters(hitsVsClusters, clusters);
517
518 for (unsigned long iclus = 0; iclus < useClusters.size(); iclus++) {
519 SimpleCluster cli = useClusters[iclus];
520 std::vector<cell_index> entries = cli.getEntries();
521 cell_index maxid = getMax(entries);
522 ushort maxval = houghPlane[maxid[0]][maxid[1]][maxid[2]];
523 float cutoff = m_params.thresh * maxval;
524 std::vector<cellweight> highWeight = getHighWeight(entries, cutoff);
525 std::vector<std::vector<long int>> flatHW;
526 for (auto cx : highWeight) {
527 flatHW.push_back({cx.index[0], cx.index[1], cx.index[2], (unsigned short int)cx.weight});
528 }
529 std::vector<double> result = getWeightedMean(highWeight);
530 std::vector<double> estimate = getBinToVal(result);
531 std::vector<double> transformed = transform(estimate);
532
533 // READOUTS, uncomment what needed:
534 std::vector<ROOT::Math::XYZVector> ndreadout;
535
536 // Readout of the peak weight
537 /* ndreadout.push_back(ROOT::Math::XYZVector(maxval, 0, 0)); */
538
539 // Readout of the total weight
540 /* unsigned long totalWeight = 0; */
541 /* for (const cell_index& cellIndex : entries) { */
542 /* totalWeight += houghPlane[cellIndex[0]][cellIndex[1]][cellIndex[2]]; */
543 /* } */
544 /* ndreadout.push_back(ROOT::Math::XYZVector(totalWeight, 0, 0)); */
545
546 // Readout of the number of cluster cells
547 /* int ncells = entries.size(); */
548 /* ndreadout.push_back(ROOT::Math::XYZVector(ncells, 0, 0)); */
549
550 // Readout of the cluster center of gravity
551 /* ndreadout.push_back(ROOT::Math::XYZVector(result[0], result[1], result[2])); */
552
553 // Readout of the cluster weights
554 /* for (const cell_index& cellIndex : entries) { */
555 /* c3elem element = houghPlane[cellIndex[0]][cellIndex[1]][cellIndex[2]]; */
556 /* ndreadout.push_back(ROOT::Math::XYZVector(element, 0, 0)); */
557 /* } */
558
559 // Readout of the cluster cell indices
560 /* for (const cell_index& cellIndex : entries) { */
561 /* ndreadout.push_back(ROOT::Math::XYZVector(cellIndex[0], cellIndex[1], cellIndex[2])); */
562 /* } */
563
564 // Readout of the complete Hough space:
565 /* for (c3index i = 0; i < static_cast<c3index>(houghPlane.shape()[0]); ++i) { */
566 /* for (c3index j = 0; j < static_cast<c3index>(houghPlane.shape()[1]); ++j) { */
567 /* for (c3index k = 0; k < static_cast<c3index>(houghPlane.shape()[2]); ++k) { */
568 /* c3elem element = houghPlane[i][j][k]; */
569 /* houghspace.push_back(ROOT::Math::XYZVector(element, 0, 0)); */
570 /* } */
571 /* } */
572 /* } */
573
574 m_NDFinderTracks.push_back(NDFinderTrack(transformed, cli, houghspace, ndreadout));
575 }
576}
void setNewPlane(c3array &houghmapPlain)
Next event initialization: set a new hough space for clustering and track finding.
Definition: Clusterizend.h:153
Store track parameters of found tracks.
Definition: NDFinder.h:28
Belle2::Clusterizend m_clusterer
Clustering module.
Definition: NDFinder.h:414
std::vector< SimpleCluster > allHitsToClusters(std::vector< std::vector< unsigned short > > &hitsVsClusters, std::vector< SimpleCluster > &clusters)
Relate all hits in a cluster to the cluster Remove small clusters with less than minsuper related hit...
Definition: NDFinder.cc:429
std::vector< cellweight > getHighWeight(std::vector< cell_index > entries, float cutoff)
Candidate cells as seed for the clustering.
Definition: NDFinder.cc:655
std::vector< double > getBinToVal(std::vector< double >)
Scale the weighted center to track parameter values.
Definition: NDFinder.cc:608
std::vector< NDFinderTrack > m_NDFinderTracks
Result: vector of the found tracks.
Definition: NDFinder.h:352
std::vector< std::vector< unsigned short > > getHitsVsClusters(std::vector< SimpleCluster > &clusters)
Create hits to clusters confusion matrix.
Definition: NDFinder.cc:408
std::vector< double > getWeightedMean(std::vector< cellweight >)
Calculate the weighted center of a cluster.
Definition: NDFinder.cc:619
cell_index getMax(const std::vector< cell_index > &)
Peak cell in cluster.
Definition: NDFinder.cc:639
std::vector< cell_index > getEntries()
Get member cells in the cluster.
Definition: Clusterizend.h:73
unsigned char minCells
Minimum number of cells in the track parameter space.
Definition: NDFinder.h:127
bool dbscanning
Clustering method: When true: dbscan, when false: fixed 3d volume.
Definition: NDFinder.h:130
float thresh
houghspace must have thresh x maxweight of cluster
Definition: NDFinder.h:124

◆ getFinderTracks()

std::vector< NDFinderTrack > * getFinderTracks ( )
inline

retreive the results

Definition at line 264 of file NDFinder.h.

265 {
266 return &m_NDFinderTracks;
267 }

◆ getHighWeight()

std::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 655 of file NDFinder.cc.

656{
657 std::vector<cellweight> cellsAndWeight;
658 const c3array& houghPlane = *m_phoughPlane;
659 for (cell_index& entry : entries) {
660 ushort cellWeight = houghPlane[entry[0]][entry[1]][entry[2]];
661 if (cellWeight > cutoff) {
662 cellweight curElem;
663 curElem.index = entry;
664 curElem.weight = cellWeight;
665 cellsAndWeight.push_back(curElem);
666 }
667 }
668 return cellsAndWeight;
669}

◆ getHitsVsClusters()

std::vector< std::vector< unsigned short > > getHitsVsClusters ( std::vector< SimpleCluster > &  clusters)
protected

Create hits to clusters confusion matrix.

Definition at line 408 of file NDFinder.cc.

409{
410 unsigned short nClusters = clusters.size();
411 unsigned short defaultValue = 0;
412 std::vector<unsigned short> hitElem(m_nHits, defaultValue);
413 std::vector<std::vector<unsigned short>> hitsVsClusters(nClusters, hitElem);
414
415 for (unsigned long iclus = 0; iclus < clusters.size(); iclus++) {
416 SimpleCluster cli = clusters[iclus];
417 std::vector<cell_index> entries = cli.getEntries();
418 cell_index maxid = getMax(entries);
419 for (unsigned long ihit = 0; ihit < m_hitIds.size(); ihit++) {
420 ushort contrib = hitContrib(maxid, ihit);
421 hitsVsClusters[iclus][ihit] = contrib;
422 }
423 }
424 return hitsVsClusters;
425}
ushort hitContrib(cell_index peak, ushort ihit)
Determine weight contribution of a single hit to a single cell.
Definition: NDFinder.cc:672

◆ getMax()

cell_index getMax ( const std::vector< cell_index > &  entries)
protected

Peak cell in cluster.

Definition at line 639 of file NDFinder.cc.

640{
641 ushort curWeight = 0;
642 cell_index curMaxIndex = {0, 0, 0};
643 const c3array& houghPlane = *m_phoughPlane;
644
645 for (const cell_index& entry : entries) {
646 if (houghPlane[entry[0]][entry[1]][entry[2]] > curWeight) {
647 curWeight = houghPlane[entry[0]][entry[1]][entry[2]];
648 curMaxIndex = entry;
649 }
650 }
651 return curMaxIndex;
652}

◆ getWeightedMean()

std::vector< double > getWeightedMean ( std::vector< cellweight highWeight)
protected

Calculate the weighted center of a cluster.

Definition at line 619 of file NDFinder.cc.

620{
621 double axomega = 0.;
622 double axphi = 0.;
623 double axtheta = 0.;
624 long weightSum = 0;
625 for (cellweight& elem : highWeight) {
626 axomega += elem.index[0] * elem.weight;
627 axphi += elem.index[1] * elem.weight;
628 axtheta += elem.index[2] * elem.weight;
629 weightSum += elem.weight;
630 }
631 axomega /= weightSum;
632 axphi /= weightSum;
633 axtheta /= weightSum;
634 std::vector<double> result = {axomega, axphi, axtheta};
635 return result;
636}

◆ 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 672 of file NDFinder.cc.

673{
674 ushort contrib = 0;
675 ushort iHoughPhi = peak[1];
676 short Dstart = m_vecDstart[ihit];
677 ushort iphi = iHoughPhi - Dstart;
678 if (Dstart > iHoughPhi && Dstart > 300) {
679 iphi = m_nPhiFull - Dstart + iHoughPhi;
680 }
681 ushort iomega = peak[0];
682 ushort itheta = peak[2];
683 ushort orient = m_hitOrients[ihit];
684
685 const c2array& arrayHitMod = *m_parrayHitMod;
686 c2elem hitr = arrayHitMod[m_hitIds[ihit]][1];
687 unsigned short prio = m_prioPos[ ihit ];
688 if (Dstart > m_nPhiFull) {
689 B2ERROR("phi overflow: iHoughPhi = " << iHoughPhi << ", Dstart = " << Dstart << ", iphi=" << iphi);
690 }
691 if (iphi < m_nPhiUse) { // hit covers current phi area, get contribution
692 if (orient == 1) { // axial
693 contrib = (*m_parrayAxial)[hitr][prio][iomega][iphi][itheta];
694 } else { // stereo
695 contrib = (*m_parrayStereo)[hitr][prio][iomega][iphi][itheta];
696 }
697 }
698 return contrib;
699}

◆ init()

void init ( unsigned short  minWeight,
unsigned char  minPts,
bool  diagonal,
unsigned char  minSuperAxial,
unsigned char  minSuperStereo,
float  thresh,
unsigned char  minCells,
bool  dbscanning,
unsigned short  minTotalWeight,
unsigned short  minPeakWeight,
unsigned char  iterations,
unsigned char  omegaTrim,
unsigned char  phiTrim,
unsigned char  thetaTrim,
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
minSuperAxialminimum number of axial super layers per cluster
minSuperStereominimum number of stereo super layers per cluster
threshselection of cells for weighted mean track estimation
minCellsminumum number of cells per cluster
dbscanningwhen true: dbscan, when false: fixed three dim volume
minTotalWeightminimum total weight of all cells in the 3d volume
minPeakWeightminimum peak cell weight
iterationsnumber of cluster searches in each Hough space
omegaTrimnumber deleted cells in each omega direction from the maximum
phiTrimnumber deleted cells in each phi direction from the maximum
thetaTrimnumber deleted cells in each theta direction from the maximum
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 24 of file NDFinder.cc.

31{
32 m_params.minSuperAxial = (unsigned char) minSuperAxial;
33 m_params.minSuperStereo = (unsigned char) minSuperStereo;
34 m_params.thresh = (float) thresh;
35 m_params.minCells = (unsigned char) minCells;
36 m_params.dbscanning = (bool) dbscanning;
37 m_params.axialFile = axialFile;
38 m_params.stereoFile = stereoFile;
39 m_clustererParams.minWeight = (unsigned short) minWeight;
40 m_clustererParams.minPts = (unsigned char) minPts;
41 m_clustererParams.diagonal = diagonal;
42 m_clustererParams.minTotalWeight = (unsigned short) minTotalWeight;
43 m_clustererParams.minPeakWeight = (unsigned short) minPeakWeight;
44 m_clustererParams.iterations = (unsigned char) iterations;
45 m_clustererParams.omegaTrim = (unsigned char) omegaTrim;
46 m_clustererParams.phiTrim = (unsigned char) phiTrim;
47 m_clustererParams.thetaTrim = (unsigned char) thetaTrim;
48 m_verbose = verbose;
49
50
51 initBins();
52 B2DEBUG(25, "initialized binnings");
53
54 initHitModAxSt(*m_parrayHitMod);
55 B2DEBUG(25, "initialized HitMod, a map of tsid to (orient, relid, letter).");
56
58 loadArray(m_params.axialFile, m_compAxBins, *m_pcompAxial);
59 B2DEBUG(25, "loaded zero suppressed axial array ");
60 loadArray(m_params.stereoFile, m_compStBins, *m_pcompStereo);
61 B2DEBUG(25, "loaded zero suppressed stereo array ");
62
64 restoreZeros(m_expAxBins, m_compAxBins, *m_parrayAxialExp, *m_pcompAxial);
65 B2DEBUG(25, "restored expanded axial array (11/32 phi) ");
66 restoreZeros(m_expStBins, m_compStBins, *m_parrayStereoExp, *m_pcompStereo);
67 B2DEBUG(25, "restored expanded stereo array (11/32 phi) ");
69 B2DEBUG(25, "squeezed axial array (11/32 phi) --> (7/32 phi): ");
70 squeezeAll(m_stBins, *m_parrayStereo, *m_parrayStereoExp, m_params.parcels, m_params.parcelsExp);
71 B2DEBUG(25, "squeezed stereo array (11/32 phi) --> (7/32 phi)");
72
73 reset();
75 m_clusterer.setPlaneShape(m_planeShape);
76}
Clustering module.
Definition: Clusterizend.h:125
void initBins()
Initialize the binnings and reserve the arrays.
Definition: NDFinder.cc:78
void initHitModAxSt(c2array &hitMod)
Initialize hit modulo mappings.
Definition: NDFinder.cc:198
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.
Definition: NDFinder.cc:252
void loadArray(const std::string &filename, ndbinning bins, c5array &hitsToTracks)
Load an NDFinder array of hit representations in track phase space.
Definition: NDFinder.cc:165
void restoreZeros(ndbinning zerobins, ndbinning compbins, c5array &expArray, const c5array &compArray)
Restore non-zero suppressed hit curves.
Definition: NDFinder.cc:264
ndbinning m_axBins
Binnings in different hit pattern arrays.
Definition: NDFinder.h:386
clustererParams m_clustererParams
Configuration of the clustering module.
Definition: NDFinder.h:395
void reset()
NDFinder reset data structure to process next event.
Definition: NDFinder.h:231
std::string axialFile
Zero-Suppressed trained hit data.
Definition: NDFinder.h:113
unsigned short parcelsExp
CDC symmetry: phi range covered by expanded hit data [0 .
Definition: NDFinder.h:157
unsigned short parcels
‍** CDC symmetry: phi range covered by hit data [0 .. phigeo] *‍/
Definition: NDFinder.h:154
unsigned char iterations
Number of iterations of the cluster searching for each Hough space.
Definition: Clusterizend.h:31
unsigned char minPts
minimum number of neighbours for a cluster core cell
Definition: Clusterizend.h:23
bool diagonal
Consider diagonal adjacent cells as neighbors.
Definition: Clusterizend.h:25
unsigned short minTotalWeight
Cut on the total weight of all cells in the 3d volume.
Definition: Clusterizend.h:27
unsigned short minWeight
minimum weight for a cluster cell
Definition: Clusterizend.h:21
unsigned char omegaTrim
Number of deleted cells in omega in each direction of the maximum.
Definition: Clusterizend.h:33
unsigned char thetaTrim
Number of deleted cells in theta in each direction of the maximum.
Definition: Clusterizend.h:37
unsigned short minPeakWeight
Cut on the peak cell weight.
Definition: Clusterizend.h:29
unsigned char phiTrim
Number of deleted cells in phi in each direction of the maximum.
Definition: Clusterizend.h:35

◆ 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 78 of file NDFinder.cc.

79{
90 m_nTS = 2336;
91 m_nSL = 9;
92 m_params.phigeo = 32;
93
94 m_nAx = 41;
95 m_nSt = 32;
96 m_nPrio = 3;
97
98 m_nOmega = 40;
99 m_nPhiFull = 384;
100 m_nTheta = 9;
101 m_nPhiOne = m_nPhiFull / m_params.phigeo; // 384/32 = 12
103 m_nPhiComp = 15;
105 m_nPhiUse = m_params.parcels * m_nPhiOne;
107 m_nPhiExp = m_params.parcelsExp * m_nPhiOne;
108
109 m_axBins.hitid = m_nAx;
110 m_stBins.hitid = m_nSt;
111 m_axBins.phi = m_nPhiUse; //84
112 m_stBins.phi = m_nPhiUse; //84
113 m_compAxBins.hitid = m_nAx;
114 m_compStBins.hitid = m_nSt;
115 m_compAxBins.phi = m_nPhiComp;
116 m_compStBins.phi = m_nPhiComp;
117 m_compAxBins.theta = 1;
118 m_expAxBins.hitid = m_nAx;
119 m_expStBins.hitid = m_nSt;
120 m_expAxBins.phi = m_nPhiExp; //132
121 m_expStBins.phi = m_nPhiExp; //132
122
123 m_fullBins.hitid = m_nTS;
124 m_fullBins.phi = m_nPhiFull;
125
126 m_pc5shapeax = {{ m_nAx, m_nPrio, m_nOmega, m_nPhiUse, m_nTheta }};
127 m_pc5shapest = {{ m_nSt, m_nPrio, m_nOmega, m_nPhiUse, m_nTheta }};
128 m_pc3shape = {{ m_nOmega, m_nPhiFull, m_nTheta }};
129 m_pc2shapeHitMod = {{ m_nTS, m_nPrio}};
130 m_pc5shapeCompAx = {{ m_nAx, m_nPrio, m_nOmega, m_nPhiComp, 1 }};
131 m_pc5shapeCompSt = {{ m_nSt, m_nPrio, m_nOmega, m_nPhiComp, m_nTheta }};
132 m_pc5shapeExpAx = {{ m_nAx, m_nPrio, m_nOmega, m_nPhiExp, m_nTheta }};
133 m_pc5shapeExpSt = {{ m_nSt, m_nPrio, m_nOmega, m_nPhiExp, m_nTheta }};
134
135 m_parrayAxial = new c5array(m_pc5shapeax);
136 m_parrayStereo = new c5array(m_pc5shapest);
137 m_phoughPlane = new c3array(m_pc3shape);
138 m_parrayHitMod = new c2array(m_pc2shapeHitMod);
139 m_pcompAxial = new c5array(m_pc5shapeCompAx);
140 m_pcompStereo = new c5array(m_pc5shapeCompSt);
141 m_parrayAxialExp = new c5array(m_pc5shapeExpAx);
142 m_parrayStereoExp = new c5array(m_pc5shapeExpSt);
143
144 m_nWires = {160, 160, 192, 224, 256, 288, 320, 352, 384};
145
146 m_planeShape = {m_nOmega, m_nPhiFull, m_nTheta}; //{40, 384, 9};
147
149 std::vector<float> omegaRange = { -5., 5.};
150 std::vector<float> phiRange = {0., 11.25};
151 std::vector<float> thetaRange = {19., 140.};
152 float ssOmega = (omegaRange[1] - omegaRange[0]) / m_nOmega; //40;
153 float ssPhi = (phiRange[1] - phiRange[0]) / m_nPhiOne; //12;
154 float ssTheta = (thetaRange[1] - thetaRange[0]) / m_nTheta; //9;
155 m_acceptRanges.push_back(omegaRange);
156 m_acceptRanges.push_back(phiRange);
157 m_acceptRanges.push_back(thetaRange);
158 m_slotSizes.push_back(ssOmega);
159 m_slotSizes.push_back(ssPhi);
160 m_slotSizes.push_back(ssTheta);
161}
boost::array< c5index, 5 > m_pc5shapeax
NDFinder.
Definition: NDFinder.h:329
std::vector< int > m_nWires
Number of first priority wires in each super layer (TS per SL)
Definition: NDFinder.h:349

◆ initHitModAxSt()

void initHitModAxSt ( c2array &  hitMod)

Initialize hit modulo mappings.

Definition at line 198 of file NDFinder.cc.

199{
200 unsigned short phigeo = m_params.phigeo; // 32
201 std::vector<int> modSLs; //nWires per SL in 1/32 sector (9)
202 std::vector<int> toslid; //tsid to sl map (2336)
203 std::vector<int> sloffsets = {0}; // integrated number of wires in inner SLs (9);
204 std::vector<int> modoffsetsAxSt = {0, 0}; // integrated number of wires in inner SLs in 1/32 sector, separate for axial and stereo SLs (9);
205 for (int isl = 0; isl < m_nSL; isl++) {
206 modSLs.push_back(m_nWires[isl] / phigeo);
207 for (int itsrel = 0; itsrel < m_nWires[isl]; itsrel++) {
208 toslid.push_back(isl);
209 }
210 sloffsets.push_back(sloffsets[isl] + m_nWires[isl]);
211 int last = modoffsetsAxSt[isl];
212 modoffsetsAxSt.push_back(last + m_nWires[isl] / phigeo);
213 }
214 for (int its = 0; its < m_nTS; its++) { // 2336
215 int sl = toslid[its];
216 bool isAxial = (sl % 2 == 0);
217 int idInSL = its - sloffsets[sl];
218 int modSL = modSLs[sl];
219 int modId = idInSL % modSL;
220 int letter = (int) floor(idInSL / modSL);
221 int relId = (int)(modoffsetsAxSt[sl] + modId);
222 hitMod[its][0] = (int)(isAxial);
223 hitMod[its][1] = relId;
224 hitMod[its][2] = letter;
225 }
226}

◆ 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 165 of file NDFinder.cc.

166{
167 std::vector<c5elem> flatArray;
168 std::ifstream arrayFileGZ(filename, std::ios_base::in | std::ios_base::binary);
169 boost::iostreams::filtering_istream arrayStream;
170 arrayStream.push(boost::iostreams::gzip_decompressor());
171 arrayStream.push(arrayFileGZ);
172 c5elem uline;
173 if (arrayFileGZ.is_open()) {
174 while (arrayStream >> uline) {
175 flatArray.push_back(uline);
176 }
177 arrayFileGZ.close();
178 } else {
179 B2ERROR("could not open array file: " << filename);
180 }
181 B2DEBUG(25, "loaded array from file " << filename);
182 unsigned long icount = 0;
183 for (c5index ihit = 0; ihit < bins.hitid; ihit++) {
184 for (c5index iprio = 0; iprio < bins.prio; iprio++) {
185 for (c5index iomega = 0; iomega < bins.omega; iomega++) {
186 for (c5index iphi = 0; iphi < bins.phi; iphi++) {
187 for (c5index itheta = 0; itheta < bins.theta; itheta++) {
188 hitsToTracks[ihit][iprio][iomega][iphi][itheta] = flatArray[icount];
189 icount++;
190 }
191 }
192 }
193 }
194 }
195}
unsigned short c5elem
Store hit patterns in a 5D array (hitid, prio, omega, phi, theta)
Definition: NDFinderDefs.h:23

◆ printArray3D()

void printArray3D ( c3array &  hitsToTracks,
ndbinning  bins,
ushort  phiInc = 1,
ushort  omInc = 1,
ushort  divide = 4,
ushort  minWeightShow = 1 
)

Debug Tool: Print part of the houghmap.

Definition at line 289 of file NDFinder.cc.

291{
292 ushort phistart = 0;
293 ushort phiend = bins.phi;
294 bool started = false;
295 unsigned long phiSlice = 0;
296 for (c3index iphi = 0; iphi < bins.phi; iphi++) {
297 for (c3index itheta = 0; itheta < bins.theta; itheta++) {
298 for (c3index iomega = 0; iomega < bins.omega; iomega++) {
299 phiSlice += hitsToTracks[iomega][iphi][itheta];
300 }
301 }
302 if (phiSlice == 0 and not started) {
303 phistart = iphi + 1;
304 } else if (phiSlice != 0 and not started) {
305 started = true;
306 } else if (phiSlice != 0 and started) {
307 phiend = iphi;
308 } else if (phiSlice == 0 and started) {
309 phiend = iphi;
310 break;
311 }
312 }
313
314 B2DEBUG(25, "printArray3D, phistart = " << phistart << ", phiend = " << phiend);
315 auto d3shp = hitsToTracks.shape();
316 B2DEBUG(25, "printArray shape: " << d3shp[0] << ", " << d3shp[1] << ", " << d3shp[2]);
317
318 if (phiend == phistart) {
319 return;
320 }
321 c3index itheta = 4; // only print itheta = 4
322 for (c3index iomega = 0; iomega < bins.omega; iomega += omInc) {
323 for (c3index iphi = phistart; iphi < phiend; iphi += phiInc) {
324 // reduce printed weight
325 ushort valRed = (ushort)((hitsToTracks[iomega][iphi][itheta]) / divide);
326 if (valRed <= minWeightShow) // skip small weights
327 std::cout << " ";
328 else
329 std::cout << valRed;
330 }
331 std::cout << "|" << std::endl;
332 }
333}

◆ printParams()

void printParams ( )

Debug: print configured parameters.

Definition at line 703 of file NDFinder.cc.

704{
705 clustererParams cpa = m_clusterer.getParams();
706 B2DEBUG(25, "clustererParams minWeight=" << cpa.minWeight << ", minPts=" << cpa.minPts << ", diagonal=" << cpa.diagonal);
707 B2DEBUG(25, "ndFinderParams minSuperAxial=" << m_params.minSuperAxial <<
708 ", minSuperStereo=" << m_params.minSuperStereo << ", thresh=" << m_params.thresh <<
709 ", minCells=" << m_params.minCells << ", dbscanning=" << m_params.dbscanning << ", minTotalWeight=" << m_params.minTotalWeight <<
710 ", minPeakWeight=" << m_params.minPeakWeight <<
711 ", iterations=" << m_params.iterations << ", omegaTrim=" << m_params.omegaTrim << ", phiTrim=" << m_params.phiTrim << ", thetaTrim="
713}
unsigned char iterations
Clustering: number of iterations for the cluster search in each Hough space.
Definition: NDFinder.h:139
unsigned short minTotalWeight
Clustering: minimum of the total weight in all cells of the 3d volume.
Definition: NDFinder.h:133
unsigned char omegaTrim
Clustering: number of deleted cells in each omega direction from the maximum.
Definition: NDFinder.h:142
unsigned char thetaTrim
Clustering: number of deleted cells in each theta direction from the maximum.
Definition: NDFinder.h:148
unsigned short minPeakWeight
Clustering: minimum peak cell weight.
Definition: NDFinder.h:136
unsigned char phiTrim
Clustering: number of deleted cells in each phi direction from the maximum.
Definition: NDFinder.h:145

◆ reset()

void reset ( )
inline

NDFinder reset data structure to process next event.

Definition at line 231 of file NDFinder.h.

232 {
233 m_NDFinderTracks.clear();
234 m_hitIds.clear();
235 m_hitSLIds.clear();
236 m_prioPos.clear();
237 m_prioTime.clear();
238 m_nHits = 0;
239 m_vecDstart.clear();
240 m_hitOrients.clear();
241 delete m_phoughPlane;
242 m_phoughPlane = new c3array(m_pc3shape);
243 }

◆ 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 264 of file NDFinder.cc.

265{
266 B2DEBUG(25, "restoreZeros: zerobins.theta " << zerobins.theta << ", combins.theta " << compbins.theta);
267 for (c5index ihit = 0; ihit < compbins.hitid; ihit++) {
268 for (c5index iprio = 0; iprio < compbins.prio; iprio++) {
269 for (c5index iomega = 0; iomega < compbins.omega; iomega++) {
270 for (c5index itheta = 0; itheta < compbins.theta; itheta++) {
271 c5elem phiStart = compArray[ihit][iprio][iomega][0][itheta];
272 c5elem phiWidth = compArray[ihit][iprio][iomega][1][itheta];
273 for (c5index iphi = 0; iphi < phiWidth; iphi++) {
274 c5elem phiCur = phiStart + iphi;
275 expArray[ihit][iprio][iomega][phiCur][itheta] = compArray[ihit][iprio][iomega][iphi + 2][itheta];
276 if (compbins.theta == 1) { // case axial, expand in theta
277 for (c5index jtheta = 1; jtheta < zerobins.theta; jtheta++) {
278 expArray[ihit][iprio][iomega][phiCur][jtheta] = compArray[ihit][iprio][iomega][iphi + 2][itheta];
279 }
280 }
281 }
282 }
283 }
284 }
285 }
286}

◆ squeezeAll()

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.

Definition at line 252 of file NDFinder.cc.

253{
254 for (c5index ihit = 0; ihit < writebins.hitid; ihit++) {
255 for (c5index iprio = 0; iprio < writebins.prio; iprio++) {
256 for (c5index itheta = 0; itheta < writebins.theta; itheta++) {
257 squeezeOne(writeArray, readArray, outparcels, inparcels, ihit, iprio, itheta, writebins.omega);
258 }
259 }
260 }
261}
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.
Definition: NDFinder.cc:229

◆ 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 229 of file NDFinder.cc.

231{
232 int outnphi = (int)(12 * outparcels);
233 c5index trafstart = (c5index)((inparcels - outparcels) / 2 * 12);
234 c5index trafend = (c5index)(trafstart + outnphi);
235 for (c5index iomega = 0; iomega < nomega; iomega++) {
236 for (c5index iphi = 0; iphi < outnphi; iphi++) {
237 c5index readPhi = trafstart + iphi;
238 writeArray[ihit][iprio][iomega][iphi][itheta] = readArray[ihit][iprio][iomega][readPhi][itheta];
239 }
240 for (c5index iphi = 0; iphi < trafstart; iphi++) {
241 c5index writePhi = (c5index)(outnphi - trafstart + iphi);
242 writeArray[ihit][iprio][iomega][writePhi][itheta] += readArray[ihit][iprio][iomega][iphi][itheta];
243 }
244 for (c5index iphi = 0; iphi < trafstart; iphi++) {
245 c5index readPhi = trafend + iphi;
246 writeArray[ihit][iprio][iomega][iphi][itheta] += readArray[ihit][iprio][iomega][readPhi][itheta];
247 }
248 }
249}

◆ transform()

std::vector< double > transform ( std::vector< double >  estimate)
protected

Definition at line 598 of file NDFinder.cc.

599{
600 std::vector<double> transformed;
601 for (int idx = 0; idx < 3; idx++) {
602 transformed.push_back(transformVar(estimate[idx], idx));
603 }
604 return transformed;
605}
float transformVar(float estVal, int idx)
Calculate physical units.
Definition: NDFinder.cc:579

◆ transformVar()

float transformVar ( float  estVal,
int  idx 
)
protected

Calculate physical units.

Definition at line 579 of file NDFinder.cc.

580{
581 if (idx == 0) { //omega
582 if (estVal == 0.) {
583 return estVal;
584 } else {
585 return - 1 / cdcTrackRadius(1. / estVal);
586 }
587 } else if (idx == 1) { // phi
588 float phiMod = estVal;
589 if (estVal > 180) {
590 phiMod -= 360.;
591 }
592 return phiMod * TMath::DegToRad();
593 } else { // theta
594 float thetRad = estVal * TMath::DegToRad();
595 return cos(thetRad) / sin(thetRad);
596 }
597}
double cdcTrackRadius(double pt)
Transverse momentum to radius.
Definition: NDFinder.h:316

Member Data Documentation

◆ m_acceptRanges

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

Definition at line 159 of file NDFinder.h.

◆ m_axBins

ndbinning m_axBins
private

Binnings in different hit pattern arrays.

Definition at line 386 of file NDFinder.h.

◆ m_clusterer

Belle2::Clusterizend m_clusterer
private

Clustering module.

Definition at line 414 of file NDFinder.h.

◆ m_clusterer2

Belle2::Clusterizend m_clusterer2
private

Definition at line 415 of file NDFinder.h.

◆ m_clustererParams

clustererParams m_clustererParams
private

Configuration of the clustering module.

Definition at line 395 of file NDFinder.h.

◆ m_compAxBins

ndbinning m_compAxBins
private

Definition at line 389 of file NDFinder.h.

◆ m_compStBins

ndbinning m_compStBins
private

Definition at line 390 of file NDFinder.h.

◆ m_expAxBins

ndbinning m_expAxBins
private

Definition at line 391 of file NDFinder.h.

◆ m_expStBins

ndbinning m_expStBins
private

Definition at line 392 of file NDFinder.h.

◆ m_fullBins

ndbinning m_fullBins
private

Definition at line 388 of file NDFinder.h.

◆ m_hitIds

std::vector<unsigned short> m_hitIds
private

TS-Ids of the hits in the current event elements: [0,2335] for 2336 TS in total.

Definition at line 356 of file NDFinder.h.

◆ m_hitOrients

std::vector<unsigned short> m_hitOrients
private

Orients TS-Ids of the hits in the current event elements: [0,2335] for 2336 TS in total.

Definition at line 373 of file NDFinder.h.

◆ m_hitSLIds

std::vector<unsigned short> m_hitSLIds
private

SL-Ids of the hits in the current event elements: super layer number in [0,1,...,8].

Definition at line 360 of file NDFinder.h.

◆ m_nAx

unsigned short m_nAx {0}
private

Definition at line 409 of file NDFinder.h.

◆ m_NDFinderTracks

std::vector<NDFinderTrack> m_NDFinderTracks
private

Result: vector of the found tracks.

Definition at line 352 of file NDFinder.h.

◆ m_nHits

unsigned short m_nHits {0}
private

Counter for the number of hits in the current event.

Definition at line 380 of file NDFinder.h.

◆ m_nOmega

unsigned short m_nOmega {0}
private

Definition at line 404 of file NDFinder.h.

◆ m_nPhiComp

unsigned short m_nPhiComp {0}
private

Definition at line 401 of file NDFinder.h.

◆ m_nPhiExp

unsigned short m_nPhiExp {0}
private

Definition at line 402 of file NDFinder.h.

◆ m_nPhiFull

unsigned short m_nPhiFull {0}
private

Default bins.

Definition at line 399 of file NDFinder.h.

◆ m_nPhiOne

unsigned short m_nPhiOne {0}
private

Definition at line 400 of file NDFinder.h.

◆ m_nPhiUse

unsigned short m_nPhiUse {0}
private

Definition at line 403 of file NDFinder.h.

◆ m_nPrio

unsigned short m_nPrio {0}
private

Definition at line 411 of file NDFinder.h.

◆ m_nSL

unsigned short m_nSL {0}
private

Definition at line 407 of file NDFinder.h.

◆ m_nSt

unsigned short m_nSt {0}
private

Definition at line 410 of file NDFinder.h.

◆ m_nTheta

unsigned short m_nTheta {0}
private

Definition at line 405 of file NDFinder.h.

◆ m_nTS

unsigned short m_nTS {0}
private

Definition at line 408 of file NDFinder.h.

◆ m_nWires

std::vector<int> m_nWires
private

Number of first priority wires in each super layer (TS per SL)

Definition at line 349 of file NDFinder.h.

◆ m_params

ndparameters m_params
private

Configuration parameters of the 3DFinder.

Definition at line 383 of file NDFinder.h.

◆ m_parrayAxial

c5array* m_parrayAxial = nullptr
private

Array pointers to the hit patterns.

Definition at line 339 of file NDFinder.h.

◆ m_parrayAxialExp

c5array* m_parrayAxialExp = nullptr
private

Definition at line 345 of file NDFinder.h.

◆ m_parrayHitMod

c2array* m_parrayHitMod = nullptr
private

Definition at line 342 of file NDFinder.h.

◆ m_parrayStereo

c5array* m_parrayStereo = nullptr
private

Definition at line 340 of file NDFinder.h.

◆ m_parrayStereoExp

c5array* m_parrayStereoExp = nullptr
private

Definition at line 346 of file NDFinder.h.

◆ m_pc2shapeHitMod

boost::array<c2index, 2> m_pc2shapeHitMod
private

Definition at line 332 of file NDFinder.h.

◆ m_pc3shape

boost::array<c3index, 3> m_pc3shape
private

Definition at line 331 of file NDFinder.h.

◆ m_pc5shapeax

boost::array<c5index, 5> m_pc5shapeax
private

NDFinder.

Shapes of the arrays holding the hit patterns

Definition at line 329 of file NDFinder.h.

◆ m_pc5shapeCompAx

boost::array<c5index, 5> m_pc5shapeCompAx
private

Definition at line 333 of file NDFinder.h.

◆ m_pc5shapeCompSt

boost::array<c5index, 5> m_pc5shapeCompSt
private

Definition at line 334 of file NDFinder.h.

◆ m_pc5shapeExpAx

boost::array<c5index, 5> m_pc5shapeExpAx
private

Definition at line 335 of file NDFinder.h.

◆ m_pc5shapeExpSt

boost::array<c5index, 5> m_pc5shapeExpSt
private

Definition at line 336 of file NDFinder.h.

◆ m_pc5shapest

boost::array<c5index, 5> m_pc5shapest
private

Definition at line 330 of file NDFinder.h.

◆ m_pcompAxial

c5array* m_pcompAxial = nullptr
private

Definition at line 343 of file NDFinder.h.

◆ m_pcompStereo

c5array* m_pcompStereo = nullptr
private

Definition at line 344 of file NDFinder.h.

◆ m_phoughPlane

c3array* m_phoughPlane = nullptr
private

Definition at line 341 of file NDFinder.h.

◆ m_planeShape

std::vector<ushort> m_planeShape
private

Definition at line 396 of file NDFinder.h.

◆ m_prioPos

std::vector<unsigned short> m_prioPos
private

Priority positon within the TS in the current event elements basf2: [0,3] first, left, right, no hit elements stored: 3 - basf2prio.

Definition at line 365 of file NDFinder.h.

◆ m_prioTime

std::vector<long> m_prioTime
private

Drift time of the priority wire.

Definition at line 368 of file NDFinder.h.

◆ m_slotSizes

std::vector<float> m_slotSizes

Definition at line 160 of file NDFinder.h.

◆ m_stBins

ndbinning m_stBins
private

Definition at line 387 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 377 of file NDFinder.h.

◆ m_verbose

bool m_verbose {false}
private

Print Hough planes and verbose output.

Definition at line 418 of file NDFinder.h.


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