12#include "trg/cdc/NDFinderDefs.h"
13#include "trg/cdc/Clusterizend.h"
14#include <Math/Vector3D.h>
31 std::vector<ROOT::Math::XYZVector> houghspace, std::vector<ROOT::Math::XYZVector> ndreadout):
37 m_houghspace = houghspace;
38 m_ndreadout = ndreadout;
57 return m_cluster.
getHits().size();
59 std::vector<unsigned short> getRelHits()
63 std::vector<unsigned short> getRelHitsWeights()
73 SimpleCluster getCluster()
77 std::vector<ROOT::Math::XYZVector> getHoughSpace()
81 std::vector<ROOT::Math::XYZVector> getNDReadout()
99 std::vector<ROOT::Math::XYZVector> m_houghspace;
100 std::vector<ROOT::Math::XYZVector> m_ndreadout;
113 std::string
axialFile =
"data/trg/cdc/ndFinderArrayAxialComp.txt.gz";
114 std::string stereoFile =
"data/trg/cdc/ndFinderArrayStereoComp.txt.gz";
159 std::vector<std::vector<float>> m_acceptRanges;
160 std::vector<float> m_slotSizes;
169 delete m_parrayStereo;
170 delete m_phoughPlane;
171 delete m_parrayHitMod;
173 delete m_pcompStereo;
174 delete m_parrayAxialExp;
175 delete m_parrayStereoExp;
200 void init(
unsigned short minWeight,
unsigned char minPts,
bool diagonal,
201 unsigned char minSuperAxial,
unsigned char minSuperStereo,
float thresh,
202 unsigned char minCells,
bool dbscanning,
unsigned short minTotalWeight,
unsigned short minPeakWeight,
unsigned char iterations,
203 unsigned char omegaTrim,
unsigned char phiTrim,
unsigned char thetaTrim,
204 bool verbose, std::string& axialFile, std::string& stereoFile);
220 void squeezeOne(c5array& writeArray, c5array& readArray,
int outparcels,
int inparcels, c5index ihit, c5index iprio, c5index itheta,
225 void squeezeAll(
ndbinning writebins, c5array& writeArray, c5array& readArray,
int outparcels,
int inparcels);
241 delete m_phoughPlane;
242 m_phoughPlane =
new c3array(m_pc3shape);
249 void addHit(
unsigned short hitId,
unsigned short hitSLId,
unsigned short hitPrioPos,
long hitPrioTime)
251 if (hitPrioPos > 0) {
285 void addC3Comp(ushort hitr, ushort prio,
const c5array& hitsToTracks,
290 std::vector<SimpleCluster>& clusters);
293 cell_index
getMax(
const std::vector<cell_index>&);
297 ushort
hitContrib(cell_index peak, ushort ihit);
302 std::vector<std::vector<unsigned short>>& hitsVsClusters,
303 std::vector<SimpleCluster>& clusters);
307 std::vector<cellweight>
getHighWeight(std::vector<cell_index> entries,
float cutoff);
313 std::vector<double>
getBinToVal(std::vector<double>);
318 return pt * 1e11 / (3e8 * 1.5);
323 std::vector<double> transform(std::vector<double> estimate);
330 boost::array<c5index, 5> m_pc5shapest;
331 boost::array<c3index, 3> m_pc3shape;
332 boost::array<c2index, 2> m_pc2shapeHitMod;
333 boost::array<c5index, 5> m_pc5shapeCompAx;
334 boost::array<c5index, 5> m_pc5shapeCompSt;
335 boost::array<c5index, 5> m_pc5shapeExpAx;
336 boost::array<c5index, 5> m_pc5shapeExpSt;
340 c5array* m_parrayStereo =
nullptr;
341 c3array* m_phoughPlane =
nullptr;
342 c2array* m_parrayHitMod =
nullptr;
343 c5array* m_pcompAxial =
nullptr;
344 c5array* m_pcompStereo =
nullptr;
345 c5array* m_parrayAxialExp =
nullptr;
346 c5array* m_parrayStereoExp =
nullptr;
396 std::vector<ushort> m_planeShape;
400 unsigned short m_nPhiOne{0};
401 unsigned short m_nPhiComp{0};
402 unsigned short m_nPhiExp{0};
403 unsigned short m_nPhiUse{0};
404 unsigned short m_nOmega{0};
405 unsigned short m_nTheta{0};
407 unsigned short m_nSL{0};
408 unsigned short m_nTS{0};
409 unsigned short m_nAx{0};
410 unsigned short m_nSt{0};
411 unsigned short m_nPrio{0};
Store track parameters of found tracks.
std::vector< unsigned short > m_relHits
vector of the indices of the related hits in the list of CDC hits (StoreArray<CDCHits>)
double m_phi
2D azimuthal angle
virtual ~NDFinderTrack()
Default destructor.
std::vector< double > m_hitWeights
vector of the weights for each related hit.
double m_omega
2D track curvature
double m_cotTheta
3D polar angle
Class to represent the CDC NDFinder.
double cdcTrackRadius(double pt)
Transverse momentum to radius.
std::vector< NDFinderTrack > * getFinderTracks()
retreive the results
virtual ~NDFinder()
Default destructor.
Belle2::Clusterizend m_clusterer
Clustering module.
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...
void initBins()
Initialize the binnings and reserve the arrays.
void initHitModAxSt(c2array &hitMod)
Initialize hit modulo mappings.
c5array * m_parrayAxial
Array pointers to the hit patterns.
void getCM()
NDFinder internal functions for track finding.
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.
std::vector< unsigned short > m_prioPos
Priority positon within the TS in the current event elements basf2: [0,3] first, left,...
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.
std::vector< short > m_vecDstart
Phi-start of 7/32 hit representation in full track parameter space.
std::vector< unsigned short > m_hitOrients
Orients TS-Ids of the hits in the current event elements: [0,2335] for 2336 TS in total.
ushort hitContrib(cell_index peak, ushort ihit)
Determine weight contribution of a single hit to a single cell.
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.
std::vector< cellweight > getHighWeight(std::vector< cell_index > entries, float cutoff)
Candidate cells as seed for the clustering.
void addHit(unsigned short hitId, unsigned short hitSLId, unsigned short hitPrioPos, long hitPrioTime)
fill hit info of the event
std::vector< double > getBinToVal(std::vector< double >)
Scale the weighted center to track parameter values.
unsigned short m_nHits
Counter for the number of hits in the current event.
boost::array< c5index, 5 > m_pc5shapeax
NDFinder.
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< int > m_nWires
Number of first priority wires in each super layer (TS per SL)
ndbinning m_axBins
Binnings in different hit pattern arrays.
clustererParams m_clustererParams
Configuration of the clustering module.
void printParams()
Debug: print configured parameters.
ndparameters m_params
Configuration parameters of the 3DFinder.
std::vector< NDFinderTrack > m_NDFinderTracks
Result: vector of the found tracks.
void addLookup(unsigned short ihit)
Add a single axial or stereo hit to the houghmap.
std::vector< unsigned short > m_hitIds
TS-Ids of the hits in the current event elements: [0,2335] for 2336 TS in total.
unsigned short m_nPhiFull
Default bins.
NDFinder()
Default constructor.
void reset()
NDFinder reset data structure to process next event.
void findTracks()
main function for track finding
std::vector< std::vector< unsigned short > > getHitsVsClusters(std::vector< SimpleCluster > &clusters)
Create hits to clusters confusion matrix.
std::vector< double > getWeightedMean(std::vector< cellweight >)
Calculate the weighted center of a cluster.
std::vector< long > m_prioTime
Drift time of the priority wire.
float transformVar(float estVal, int idx)
Calculate physical units.
void printArray3D(c3array &hitsToTracks, ndbinning bins, ushort, ushort, ushort, ushort)
Debug Tool: Print part of the houghmap.
cell_index getMax(const std::vector< cell_index > &)
Peak cell in cluster.
bool m_verbose
Print Hough planes and verbose output.
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 > getHits()
Get ids of related hits (indices of the TS StoreArray)
std::vector< unsigned short > getWeights()
Get weight contribution of each related hit to the cluster.
unsigned short c5elem
Store hit patterns in a 5D array (hitid, prio, omega, phi, theta)
Abstract base class for different kinds of events.
Struct of ndFinder parameters.
unsigned char iterations
Clustering: number of iterations for the cluster search in each Hough space.
std::string axialFile
Zero-Suppressed trained hit data.
unsigned short minTotalWeight
Clustering: minimum of the total weight in all cells of the 3d volume.
unsigned char minCells
Minimum number of cells in the track parameter space.
unsigned short phigeo
CDC symmetry: repeat wire pattern 32 times in phi.
unsigned char omegaTrim
Clustering: number of deleted cells in each omega direction from the maximum.
unsigned char minSuperAxial
Clustering options.
bool dbscanning
Clustering method: When true: dbscan, when false: fixed 3d volume.
float thresh
houghspace must have thresh x maxweight of cluster
unsigned short parcelsExp
CDC symmetry: phi range covered by expanded hit data [0 .
unsigned char thetaTrim
Clustering: number of deleted cells in each theta direction from the maximum.
unsigned char minSuperStereo
Required number of stereo super layers.
unsigned short minPeakWeight
Clustering: minimum peak cell weight.
unsigned short parcels
** CDC symmetry: phi range covered by hit data [0 .. phigeo] */
unsigned char phiTrim
Clustering: number of deleted cells in each phi direction from the maximum.
Default binning in a (7/32) phi-sector.