15#include <Math/Vector3D.h>
16#include "trg/cdc/NDFinderDefs.h"
17#include "trg/cdc/Clusterizend.h"
41 std::string stereoFile;
47 unsigned short hitSLID;
48 unsigned short hitPrioPos;
58 std::vector<ROOT::Math::XYZVector>&& readoutHoughSpace,
59 std::vector<ROOT::Math::XYZVector>&& readoutCluster)
64 m_omega = estimatedParameters[0];
65 m_phi = estimatedParameters[1];
66 m_cot = estimatedParameters[2];
103 unsigned short omega;
106 unsigned short nHitIDs;
107 unsigned short nPriorityWires;
112 unsigned short relativeWireID;
113 unsigned short phiSectorStart;
114 unsigned short priorityWire;
119 unsigned short hitIndex;
120 unsigned short contribution;
121 unsigned short superLayer;
126 NDFinder() =
default;
133 delete m_compStereoHitReps;
135 delete m_expStereoHitReps;
169 std::vector<std::vector<unsigned short>>
getHitsVsClustersTable(
const std::vector<SimpleCluster>& clusters);
185 static inline double getTrackRadius(
double transverseMomentum) {
return transverseMomentum * 1e11 / (3e8 * 1.5); }
214 static constexpr unsigned short m_nTS = 2336;
215 static constexpr unsigned short m_nSL = 9;
222 static constexpr unsigned short m_nPhi = 384;
223 static constexpr unsigned short m_nCot = 9;
238 static constexpr std::array<double, 2>
m_phiRange = {0., 11.25};
240 static constexpr std::array<double, 2>
m_cotRange = {2.3849627654510415, -1.0061730449796316};
268 c5array* m_compStereoHitReps =
nullptr;
281 c5array* m_expStereoHitReps =
nullptr;
std::vector< ROOT::Math::XYZVector > getClusterReadout() const
Cluster readout (if storeAdditionalReadout true)
double m_cot
3D polar angle
SimpleCluster m_cluster
The found cluster of the track, including the track segment hits.
double getCot() const
Get the track parameter cot (z always 0)
double getOmega() const
Get the track parameter omega (z always 0)
double m_phi
2D azimuthal angle
NDFinderTrack(std::array< double, 3 > estimatedParameters, SimpleCluster &&cluster, std::vector< ROOT::Math::XYZVector > &&readoutHoughSpace, std::vector< ROOT::Math::XYZVector > &&readoutCluster)
Constructor.
std::vector< unsigned short > getRelatedHits() const
Get the number of related Hits.
std::vector< ROOT::Math::XYZVector > m_houghSpace
Vector storing the complete Hough space for analysis.
std::vector< ROOT::Math::XYZVector > getHoughSpace() const
Hough space readout (if storeAdditionalReadout true)
double m_omega
2D track curvature (This is the "real" omega (curvature), i.e., sign(q)/(r_2d[cm]))
std::vector< ROOT::Math::XYZVector > m_readoutCluster
Vector storing cluster informations for analysis.
double getPhi0() const
Get the track parameter phi0 (z always 0)
static constexpr unsigned short m_nPhi
Bins in the omega dimension.
static constexpr double m_binSizeOmega
0.2
std::vector< short > m_priorityWireTime
Drift time of the priority wire.
std::vector< NDFinderTrack > * getFinderTracks()
Retreive the results.
static constexpr unsigned short m_nPhiComp
Bins of compressed phi: phi_start, phi_width, phi_0, ..., phi_12.
c5array * m_compAxialHitReps
m_compAxialHitReps/m_compStereoHitReps (~ Compressed in phi (width, start, values)) 5D array mapping:
std::vector< std::vector< unsigned short > > getHitsVsClustersTable(const std::vector< SimpleCluster > &clusters)
Create hits to clusters confusion matrix.
static constexpr unsigned short m_nSL
Number of super layers.
std::vector< unsigned short > m_hitIDs
TS-IDs of the hits in the current event: Elements = [0,2335] for 2336 TS in total.
std::array< double, 3 > transformTrackParameters(const std::array< double, 3 > &estimatedParameters)
Transform to physical units.
void initLookUpArrays()
Initialize the arrays LUT arrays.
std::vector< unsigned short > m_priorityWirePos
Priority positon within the TS. Elements basf2: [0,3] first, left, right, no hit.
void loadCompressedHitReps(const std::string &fileName, const SectorBinning &compBins, c5array &compHitsToWeights)
Fills the m_compAxialHitReps/m_compStereoHitReps (see below) arrays with the hit representations (hit...
static constexpr std::array< double, 2 > m_cotRange
=> theta in [22.75, 135.18]
static constexpr std::array< double, 2 > m_omegaRange
1/4 = 0.25 GeV (minimum transverse momentum)
static constexpr std::array< double, 2 > m_phiRange
One phi sector (360/32)
std::vector< NDFinderTrack > m_ndFinderTracks
Result: Vector of the found tracks.
static constexpr double m_binSizePhi
0.9375
static constexpr unsigned short m_nOmega
Bins in the phi dimension.
Clusterizend m_clusterer
Clustering module.
int getMaximumHitInSuperLayer(const std::vector< ContributionInfo > &contributionInfos, unsigned short superLayer)
Find the hit with the maximum contribution in a given super layer.
void init(const NDFinderParameters &ndFinderParameters)
Initialization of the NDFinder (parameters and lookup tables)
void initHitToSectorMap()
Fills the m_hitToSectorIDs (see below) array with the hit to orientation/sectorWire/sectorID relation...
bool checkHitSuperLayers(const SimpleCluster &cluster)
Cut on the number of hit axial/stereo super layers.
static constexpr unsigned short m_nTS
Number of track segments.
unsigned short m_nHits
Counter for the number of hits in the current event.
c3array * m_houghSpace
The complete Hough space with the size [m_nOmega, m_nPhi, m_nCot].
static constexpr unsigned short m_phiGeo
Repetition of the wire pattern.
void fillExpandedHitReps(const SectorBinning &compBins, const c5array &compHitsToWeights, c5array &expHitsToWeights)
Fills the m_expAxialHitReps/m_expStereoHitReps (see below) arrays with the expanded hit representatio...
static double getTrackRadius(double transverseMomentum)
Transverse momentum (which is 1/omega, in GeV/c) to radius (in cm)
static constexpr unsigned short m_nStereo
Number of unique stereo track segments.
NDFinderParameters m_ndFinderParams
Configuration parameters of the 3DFinder.
static constexpr unsigned short m_nPrio
Number of priority wires.
static constexpr unsigned short m_nAxial
Number of unique axial track segments.
c2array * m_hitToSectorIDs
m_hitToSectorIDs: 2D array mapping TS-ID ([0, 2335]) to:
void processHitForHoughSpace(const unsigned short hitIdx)
Process a single axial or stereo hit for the Hough space.
static constexpr unsigned short m_nPhiSector
Bins of one phi sector (12)
std::array< double, 3 > calculateCenterOfGravity(const SimpleCluster &cluster)
Calculate the center of gravity (weighted mean) for the track parameters.
static constexpr double m_binSizeCot
-0.377
std::vector< SimpleCluster > relateHitsToClusters(std::vector< SimpleCluster > &clusters)
Relate the hits in the peak of the cluster to the cluster. Applies a cut on the clusters.
std::vector< unsigned short > m_hitSLIDs
SL-IDs of the hits in the current event: Elements = Super layer number in [0,1,......
static constexpr SectorBinning m_compAxialBins
40, 15, 1, 41, 3
void reset()
Reset the NDFinder data structure to process next event.
void findTracks()
Main function for track finding.
void addHit(const HitInfo &hitInfo)
Add the hit info of a single track segment to the NDFinder.
static constexpr SectorBinning m_compStereoBins
40, 15, 9, 32, 3
static constexpr unsigned short m_nCot
Bins in the cot dimension.
c5array * m_expAxialHitReps
m_expAxialHitReps/m_expStereoHitReps (~ expansion of the compressed representations) 5D array mapping...
unsigned short getHitContribution(const cell_index &peakCell, const unsigned short hitIdx)
Returns the hit contribution of a TS at a certain cluster cell (= peak/maximum cell)
std::vector< ContributionInfo > extractContributionInfos(const std::vector< unsigned short > &clusterHits)
Extract relevant hit information (hitIdx, contribution, super layer, drift time)
std::array< double, 3 > getTrackParameterEstimate(const std::array< double, 3 > ¢erOfGravity)
Transform the center of gravity (cells) into the estimated track parameters.
void writeHitToHoughSpace(const WireInfo &hitInfo, const c5array &expHitsToWeights)
Write (add) a single hit (Hough curve) to the Hough space.
void runTrackFinding()
Core track finding logic in the constructed Hough space.
boost::multi_array< unsigned short, 2 > c2array
TS-ID to 1/32 phi-sector mapping is stored in a 2D array.
boost::multi_array< unsigned short, 5 > c5array
Store hit patterns in a 5D array (hitid, prio, omega, phi, cot)
boost::multi_array< unsigned short, 3 > c3array
The Hough space is a 3D array (omega, phi, cot)
std::array< c3index, 3 > cell_index
The cell index of one Hough space bin.
Abstract base class for different kinds of events.
Struct containing the track segment (hit) information from the Track Segment Finder (TSF)
Struct of NDFinder parameters.
std::string axialFile
Axial and stereo hit representations that should be used.
unsigned short minSuperStereo
Required number of stereo super layers.
bool storeAdditionalReadout
Switch for writing the full Hough space and the cluster information to the 3DFinderInfo class.
unsigned short phiTrim
Clustering: Number of deleted cells in each phi direction from the maximum.
unsigned short minSuperAxial
Required number of axial super layers.
unsigned short omegaTrim
Clustering: Number of deleted cells in each omega direction from the maximum.
unsigned short iterations
Clustering: Number of iterations for the cluster search in each Hough space quadrant.
Collection of the hit contribution information needed for the hit to cluster relations.
Data type to collect a binning.
Collection of the hit information needed for the hit representations.