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 <oneapi/tbb.h>
20
26#include "ITStracking/Cell.h"
28
29// #define OPTIMISATION_OUTPUT
30
31namespace o2
32{
33namespace gpu
34{
35class GPUChainITS;
36}
37namespace its
38{
39class TrackITSExt;
40
41template <int nLayers = 7>
43{
44 public:
47
48 virtual ~TrackerTraits() = default;
50 virtual void initialiseTimeFrame(const int iteration) { mTimeFrame->initialise(iteration, mTrkParams[iteration], mTrkParams[iteration].NLayers); }
51
52 virtual void computeLayerTracklets(const int iteration, int iROFslice, int iVertex);
53 virtual void computeLayerCells(const int iteration);
54 virtual void findCellsNeighbours(const int iteration);
55 virtual void findRoads(const int iteration);
56
57 virtual bool supportsExtendTracks() const noexcept { return true; }
58 virtual void extendTracks(const int iteration);
59 virtual bool supportsFindShortPrimaries() const noexcept { return true; }
60 virtual void findShortPrimaries();
61
62 virtual bool trackFollowing(TrackITSExt* track, int rof, bool outward, const int iteration);
63 virtual void processNeighbours(int iLayer, int iLevel, const bounded_vector<CellSeedN>& currentCellSeed, const bounded_vector<int>& currentCellId, bounded_vector<CellSeedN>& updatedCellSeed, bounded_vector<int>& updatedCellId);
64
65 void updateTrackingParameters(const std::vector<TrackingParameters>& trkPars) { mTrkParams = trkPars; }
67
68 virtual void setBz(float bz);
69 float getBz() const { return mBz; }
70 bool isMatLUT() const;
71 virtual const char* getName() const noexcept { return "CPU"; }
72 virtual bool isGPU() const noexcept { return false; }
73 void setMemoryPool(std::shared_ptr<BoundedMemoryResource>& pool) noexcept { mMemoryPool = pool; }
74 auto getMemoryPool() const noexcept { return mMemoryPool; }
75
76 // Others
77 GPUhd() static consteval int4 getEmptyBinsRect() { return int4{0, 0, 0, 0}; }
78 const int4 getBinsRect(int layer, float phi, float maxdeltaphi, float z, float maxdeltaz) const noexcept { return getBinsRect(layer, phi, maxdeltaphi, z, z, maxdeltaz); }
79 const int4 getBinsRect(const Cluster& cls, int layer, float z1, float z2, float maxdeltaz, float maxdeltaphi) const noexcept { return getBinsRect(layer, cls.phi, maxdeltaphi, z1, z2, maxdeltaz); }
80 const int4 getBinsRect(int layer, float phi, float maxdeltaphi, float z1, float z2, float maxdeltaz) const noexcept;
82 void setSmoothing(bool v) { mApplySmoothing = v; }
83 bool getSmoothing() const { return mApplySmoothing; }
84 void setNThreads(int n, std::shared_ptr<tbb::task_arena>& arena);
85 int getNThreads() { return mTaskArena->max_concurrency(); }
86
88
89 // TimeFrame information forwarding
90 virtual int getTFNumberOfClusters() const { return mTimeFrame->getNumberOfClusters(); }
91 virtual int getTFNumberOfTracklets() const { return mTimeFrame->getNumberOfTracklets(); }
92 virtual int getTFNumberOfCells() const { return mTimeFrame->getNumberOfCells(); }
93
94 private:
95 track::TrackParCov buildTrackSeed(const Cluster& cluster1, const Cluster& cluster2, const TrackingFrameInfo& tf3);
96 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);
97
98 bool mApplySmoothing = false;
99 std::shared_ptr<BoundedMemoryResource> mMemoryPool;
100 std::shared_ptr<tbb::task_arena> mTaskArena;
101
102 protected:
105 std::vector<TrackingParameters> mTrkParams;
106
107 float mBz{-999.f};
108 bool mIsZeroField{false};
109};
110
111template <int nLayers>
112inline const int4 TrackerTraits<nLayers>::getBinsRect(const int layerIndex, float phi, float maxdeltaphi, float z1, float z2, float maxdeltaz) const noexcept
113{
114 const float zRangeMin = o2::gpu::GPUCommonMath::Min(z1, z2) - maxdeltaz;
115 const float phiRangeMin = (maxdeltaphi > o2::constants::math::PI) ? 0.f : phi - maxdeltaphi;
116 const float zRangeMax = o2::gpu::GPUCommonMath::Max(z1, z2) + maxdeltaz;
117 const float phiRangeMax = (maxdeltaphi > o2::constants::math::PI) ? o2::constants::math::TwoPI : phi + maxdeltaphi;
118
119 if (zRangeMax < -mTrkParams[0].LayerZ[layerIndex] ||
120 zRangeMin > mTrkParams[0].LayerZ[layerIndex] || zRangeMin > zRangeMax) {
121 return getEmptyBinsRect();
122 }
123
124 const IndexTableUtilsN& utils{mTimeFrame->mIndexTableUtils};
125 return int4{o2::gpu::GPUCommonMath::Max(0, utils.getZBinIndex(layerIndex, zRangeMin)),
126 utils.getPhiBinIndex(math_utils::getNormalizedPhi(phiRangeMin)),
127 o2::gpu::GPUCommonMath::Min(mTrkParams[0].ZBins - 1, utils.getZBinIndex(layerIndex, zRangeMax)), // /!\ trkParams can potentially change across iterations
128 utils.getPhiBinIndex(math_utils::getNormalizedPhi(phiRangeMax))};
129}
130
131} // namespace its
132} // namespace o2
133
134#endif /* TRACKINGITSU_INCLUDE_TRACKERTRAITS_H_ */
GPUChain * chain
virtual void initialiseTimeFrame(const int iteration)
virtual int getTFNumberOfTracklets() const
GPUhd() static const eval int4 getEmptyBinsRect()
virtual void processNeighbours(int iLayer, int iLevel, const bounded_vector< CellSeedN > &currentCellSeed, const bounded_vector< int > &currentCellId, bounded_vector< CellSeedN > &updatedCellSeed, bounded_vector< int > &updatedCellId)
TimeFrame< nLayers > * getTimeFrame()
virtual ~TrackerTraits()=default
virtual void findRoads(const int iteration)
void setNThreads(int n, std::shared_ptr< tbb::task_arena > &arena)
auto getMemoryPool() const noexcept
void setMemoryPool(std::shared_ptr< BoundedMemoryResource > &pool) noexcept
virtual bool isGPU() const noexcept
virtual int getTFNumberOfClusters() const
void updateTrackingParameters(const std::vector< TrackingParameters > &trkPars)
virtual bool trackFollowing(TrackITSExt *track, int rof, bool outward, const int iteration)
virtual void computeLayerTracklets(const int iteration, int iROFslice, int iVertex)
IndexTableUtils< nLayers > IndexTableUtilsN
virtual void adoptTimeFrame(TimeFrame< nLayers > *tf)
std::vector< TrackingParameters > mTrkParams
virtual void computeLayerCells(const int iteration)
void setSmoothing(bool v)
virtual bool supportsFindShortPrimaries() const noexcept
virtual void findShortPrimaries()
const int4 getBinsRect(int layer, float phi, float maxdeltaphi, float z1, float z2, float maxdeltaz) const noexcept
const int4 getBinsRect(const Cluster &cls, int layer, float z1, float z2, float maxdeltaz, float maxdeltaphi) const noexcept
virtual bool supportsExtendTracks() const noexcept
virtual void setBz(float bz)
virtual void findCellsNeighbours(const int iteration)
virtual void extendTracks(const int iteration)
const int4 getBinsRect(int layer, float phi, float maxdeltaphi, float z, float maxdeltaz) const noexcept
virtual const char * getName() const noexcept
TimeFrame< nLayers > * mTimeFrame
void SetRecoChain(o2::gpu::GPUChainITS *chain)
bool getSmoothing() const
virtual int getTFNumberOfCells() const
o2::gpu::GPUChainITS * getChain() const
o2::gpu::GPUChainITS * mChain
GLdouble n
Definition glcorearb.h:1982
GLuint GLuint end
Definition glcorearb.h:469
const GLdouble * v
Definition glcorearb.h:832
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 TwoPI
constexpr float PI
constexpr float VeryBig
std::pmr::vector< T > bounded_vector
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
void initialise(const int iteration, const TrackingParameters &trkParam, const int maxLayers=7, bool resetVertices=true)
virtual int getNumberOfTracklets() const
Definition TimeFrame.h:657
virtual int getNumberOfCells() const
Definition TimeFrame.h:647
int getNumberOfClusters() const
Definition TimeFrame.h:637