Project
Loading...
Searching...
No Matches
TrackerTraits.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
15
16#ifndef TRACKINGITSU_INCLUDE_TRACKERTRAITS_H_
17#define TRACKINGITSU_INCLUDE_TRACKERTRAITS_H_
18
19#include <cmath>
20
25
26// #define OPTIMISATION_OUTPUT
27
28namespace o2
29{
30namespace gpu
31{
32class GPUChainITS;
33}
34namespace its
35{
36class TrackITSExt;
37
39{
40 public:
41 virtual ~TrackerTraits() = default;
42 virtual void adoptTimeFrame(TimeFrame* tf);
43 virtual void initialiseTimeFrame(const int iteration);
44
45 virtual void computeLayerTracklets(const int iteration, int iROFslice, int iVertex);
46 virtual void computeLayerCells(const int iteration);
47 virtual void findCellsNeighbours(const int iteration);
48 virtual void findRoads(const int iteration);
49
50 virtual bool supportsExtendTracks() const noexcept { return true; }
51 virtual void extendTracks(const int iteration);
52 virtual bool supportsFindShortPrimaries() const noexcept { return true; }
53 virtual void findShortPrimaries();
54
55 virtual bool trackFollowing(TrackITSExt* track, int rof, bool outward, const int iteration);
56 virtual void processNeighbours(int iLayer, int iLevel, const std::vector<CellSeed>& currentCellSeed, const std::vector<int>& currentCellId, std::vector<CellSeed>& updatedCellSeed, std::vector<int>& updatedCellId);
57
58 void UpdateTrackingParameters(const std::vector<TrackingParameters>& trkPars);
60
61 virtual void setBz(float bz);
62 float getBz() const;
64 bool isMatLUT() const;
65 virtual const char* getName() const noexcept { return "CPU"; }
66 virtual bool isGPU() const noexcept { return false; }
67
68 // Others
69 GPUhd() static consteval int4 getEmptyBinsRect() { return int4{0, 0, 0, 0}; }
70 const int4 getBinsRect(const Cluster&, int layer, float z1, float z2, float maxdeltaz, float maxdeltaphi) const noexcept;
71 const int4 getBinsRect(int layer, float phi, float maxdeltaphi, float z, float maxdeltaz) const noexcept;
72 const int4 getBinsRect(int layer, float phi, float maxdeltaphi, float z1, float z2, float maxdeltaz) const noexcept;
74 void setSmoothing(bool v) { mApplySmoothing = v; }
75 bool getSmoothing() const { return mApplySmoothing; }
76 void setNThreads(int n);
77 int getNThreads() const { return mNThreads; }
78
80
81 // TimeFrame information forwarding
82 virtual int getTFNumberOfClusters() const;
83 virtual int getTFNumberOfTracklets() const;
84 virtual int getTFNumberOfCells() const;
85
86 float mBz = 5.f;
87
88 private:
89 track::TrackParCov buildTrackSeed(const Cluster& cluster1, const Cluster& cluster2, const TrackingFrameInfo& tf3);
90 bool fitTrack(TrackITSExt& track, int start, int end, int step, float chi2clcut = o2::constants::math::VeryBig, float chi2ndfcut = o2::constants::math::VeryBig, float maxQoverPt = o2::constants::math::VeryBig, int nCl = 0);
91
92 int mNThreads = 1;
93 bool mApplySmoothing = false;
94
95 protected:
99 std::vector<TrackingParameters> mTrkParams;
100};
101
102inline void TrackerTraits::initialiseTimeFrame(const int iteration)
103{
104 mTimeFrame->initialise(iteration, mTrkParams[iteration], mTrkParams[iteration].NLayers);
105}
106
107inline float TrackerTraits::getBz() const
108{
109 return mBz;
110}
111
112inline void TrackerTraits::UpdateTrackingParameters(const std::vector<TrackingParameters>& trkPars)
113{
114 mTrkParams = trkPars;
115}
116
117inline const int4 TrackerTraits::getBinsRect(const int layerIndex, float phi, float maxdeltaphi, float z, float maxdeltaz) const noexcept
118{
119 return getBinsRect(layerIndex, phi, maxdeltaphi, z, z, maxdeltaz);
120}
121
122inline const int4 TrackerTraits::getBinsRect(const Cluster& currentCluster, int layerIndex, float z1, float z2, float maxdeltaz, float maxdeltaphi) const noexcept
123{
124 return getBinsRect(layerIndex, currentCluster.phi, maxdeltaphi, z1, z2, maxdeltaz);
125}
126
127inline const int4 TrackerTraits::getBinsRect(const int layerIndex, float phi, float maxdeltaphi, float z1, float z2, float maxdeltaz) const noexcept
128{
129 const float zRangeMin = o2::gpu::GPUCommonMath::Min(z1, z2) - maxdeltaz;
130 const float phiRangeMin = (maxdeltaphi > constants::math::Pi) ? 0.f : phi - maxdeltaphi;
131 const float zRangeMax = o2::gpu::GPUCommonMath::Max(z1, z2) + maxdeltaz;
132 const float phiRangeMax = (maxdeltaphi > constants::math::Pi) ? constants::math::TwoPi : phi + maxdeltaphi;
133
134 if (zRangeMax < -mTrkParams[0].LayerZ[layerIndex] ||
135 zRangeMin > mTrkParams[0].LayerZ[layerIndex] || zRangeMin > zRangeMax) {
136 return getEmptyBinsRect();
137 }
138
139 const IndexTableUtils& utils{mTimeFrame->mIndexTableUtils};
140 return int4{o2::gpu::GPUCommonMath::Max(0, utils.getZBinIndex(layerIndex, zRangeMin)),
141 utils.getPhiBinIndex(math_utils::getNormalizedPhi(phiRangeMin)),
142 o2::gpu::GPUCommonMath::Min(mTrkParams[0].ZBins - 1, utils.getZBinIndex(layerIndex, zRangeMax)), // /!\ trkParams can potentially change across iterations
143 utils.getPhiBinIndex(math_utils::getNormalizedPhi(phiRangeMax))};
144}
145} // namespace its
146} // namespace o2
147
148#endif /* TRACKINGITSU_INCLUDE_TRACKERTRAITS_H_ */
GPUChain * chain
void initialise(const int iteration, const TrackingParameters &trkParam, const int maxLayers=7, bool resetVertices=true)
virtual void findRoads(const int iteration)
virtual void processNeighbours(int iLayer, int iLevel, const std::vector< CellSeed > &currentCellSeed, const std::vector< int > &currentCellId, std::vector< CellSeed > &updatedCellSeed, std::vector< int > &updatedCellId)
virtual void extendTracks(const int iteration)
void setSmoothing(bool v)
virtual int getTFNumberOfCells() const
o2::gpu::GPUChainITS * getChain() const
virtual void adoptTimeFrame(TimeFrame *tf)
virtual void computeLayerTracklets(const int iteration, int iROFslice, int iVertex)
virtual void setBz(float bz)
virtual bool supportsFindShortPrimaries() const noexcept
o2::gpu::GPUChainITS * mChain
virtual int getTFNumberOfTracklets() const
virtual bool isGPU() const noexcept
void SetRecoChain(o2::gpu::GPUChainITS *chain)
virtual void findCellsNeighbours(const int iteration)
virtual int getTFNumberOfClusters() const
virtual void findShortPrimaries()
virtual void initialiseTimeFrame(const int iteration)
virtual ~TrackerTraits()=default
void UpdateTrackingParameters(const std::vector< TrackingParameters > &trkPars)
TimeFrame * getTimeFrame()
const int4 getBinsRect(const Cluster &, int layer, float z1, float z2, float maxdeltaz, float maxdeltaphi) const noexcept
std::vector< TrackingParameters > mTrkParams
o2::base::PropagatorImpl< float >::MatCorrType mCorrType
bool getSmoothing() const
void setCorrType(const o2::base::PropagatorImpl< float >::MatCorrType type)
GPUhd() static const eval int4 getEmptyBinsRect()
virtual bool trackFollowing(TrackITSExt *track, int rof, bool outward, const int iteration)
virtual void computeLayerCells(const int iteration)
virtual bool supportsExtendTracks() const noexcept
virtual const char * getName() const noexcept
GLdouble n
Definition glcorearb.h:1982
GLuint GLuint end
Definition glcorearb.h:469
const GLdouble * v
Definition glcorearb.h:832
GLint GLint GLsizei GLint GLenum GLenum type
Definition glcorearb.h:275
GLenum GLuint GLint GLint layer
Definition glcorearb.h:1310
GLuint start
Definition glcorearb.h:469
GLdouble GLdouble GLdouble z
Definition glcorearb.h:843
constexpr float VeryBig
constexpr float Pi
Definition Constants.h:45
constexpr float TwoPi
Definition Constants.h:46
TrackParCovF TrackParCov
Definition Track.h:33
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
Common utility functions.
std::unique_ptr< GPUReconstructionTimeframe > tf