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 <array>
20#include <chrono>
21#include <cmath>
22#include <fstream>
23#include <iomanip>
24#include <iosfwd>
25#include <memory>
26#include <utility>
27#include <functional>
28
35#include "ITStracking/Road.h"
36
37// #define OPTIMISATION_OUTPUT
38
39namespace o2
40{
41namespace gpu
42{
43class GPUChainITS;
44}
45namespace its
46{
47class TrackITSExt;
48
50{
51 public:
52 virtual ~TrackerTraits() = default;
53 virtual void adoptTimeFrame(TimeFrame* tf);
54 virtual void initialiseTimeFrame(const int iteration);
55 virtual void computeLayerTracklets(const int iteration, int iROFslice, int iVertex);
56 virtual void computeLayerCells(const int iteration);
57 virtual void findCellsNeighbours(const int iteration);
58 virtual void findRoads(const int iteration);
59 virtual void initialiseTimeFrameHybrid(const int iteration) { LOGP(error, "initialiseTimeFrameHybrid: this method should never be called with CPU traits"); }
60 virtual void computeTrackletsHybrid(const int iteration, int, int) { LOGP(error, "computeTrackletsHybrid: this method should never be called with CPU traits"); }
61 virtual void computeCellsHybrid(const int iteration) { LOGP(error, "computeCellsHybrid: this method should never be called with CPU traits"); }
62 virtual void findCellsNeighboursHybrid(const int iteration) { LOGP(error, "findCellsNeighboursHybrid: this method should never be called with CPU traits"); }
63 virtual void findRoadsHybrid(const int iteration) { LOGP(error, "findRoadsHybrid: this method should never be called with CPU traits"); }
64 virtual void findTracksHybrid(const int iteration) { LOGP(error, "findTracksHybrid: this method should never be called with CPU traits"); }
65 virtual void findTracks() { LOGP(error, "findTracks: this method is deprecated."); }
66 virtual void extendTracks(const int iteration);
67 virtual void findShortPrimaries();
68 virtual void setBz(float bz);
69 virtual bool trackFollowing(TrackITSExt* track, int rof, bool outward, const int iteration);
70 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);
71
72 void UpdateTrackingParameters(const std::vector<TrackingParameters>& trkPars);
74
75 void setIsGPU(const unsigned char isgpu) { mIsGPU = isgpu; };
76 float getBz() const;
78 bool isMatLUT() const;
79
80 // Others
81 GPUhd() static consteval int4 getEmptyBinsRect() { return int4{0, 0, 0, 0}; }
82 const int4 getBinsRect(const Cluster&, int layer, float z1, float z2, float maxdeltaz, float maxdeltaphi) const noexcept;
83 const int4 getBinsRect(int layer, float phi, float maxdeltaphi, float z, float maxdeltaz) const noexcept;
84 const int4 getBinsRect(int layer, float phi, float maxdeltaphi, float z1, float z2, float maxdeltaz) const noexcept;
86 void setSmoothing(bool v) { mApplySmoothing = v; }
87 bool getSmoothing() const { return mApplySmoothing; }
88 void setNThreads(int n);
89 int getNThreads() const { return mNThreads; }
90
92
93 // TimeFrame information forwarding
94 virtual int getTFNumberOfClusters() const;
95 virtual int getTFNumberOfTracklets() const;
96 virtual int getTFNumberOfCells() const;
97
98 float mBz = 5.f;
99
100 private:
101 track::TrackParCov buildTrackSeed(const Cluster& cluster1, const Cluster& cluster2, const TrackingFrameInfo& tf3);
102 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);
103
104 int mNThreads = 1;
105 bool mApplySmoothing = false;
106
107 protected:
111 std::vector<TrackingParameters> mTrkParams;
112 bool mIsGPU = false;
113};
114
115inline void TrackerTraits::initialiseTimeFrame(const int iteration)
116{
117 mTimeFrame->initialise(iteration, mTrkParams[iteration], mTrkParams[iteration].NLayers);
118 setIsGPU(false);
119}
120
121inline float TrackerTraits::getBz() const
122{
123 return mBz;
124}
125
126inline void TrackerTraits::UpdateTrackingParameters(const std::vector<TrackingParameters>& trkPars)
127{
128 mTrkParams = trkPars;
129}
130
131inline const int4 TrackerTraits::getBinsRect(const int layerIndex, float phi, float maxdeltaphi, float z, float maxdeltaz) const noexcept
132{
133 return getBinsRect(layerIndex, phi, maxdeltaphi, z, z, maxdeltaz);
134}
135
136inline const int4 TrackerTraits::getBinsRect(const Cluster& currentCluster, int layerIndex, float z1, float z2, float maxdeltaz, float maxdeltaphi) const noexcept
137{
138 return getBinsRect(layerIndex, currentCluster.phi, maxdeltaphi, z1, z2, maxdeltaz);
139}
140
141inline const int4 TrackerTraits::getBinsRect(const int layerIndex, float phi, float maxdeltaphi, float z1, float z2, float maxdeltaz) const noexcept
142{
143 const float zRangeMin = o2::gpu::GPUCommonMath::Min(z1, z2) - maxdeltaz;
144 const float phiRangeMin = (maxdeltaphi > constants::math::Pi) ? 0.f : phi - maxdeltaphi;
145 const float zRangeMax = o2::gpu::GPUCommonMath::Max(z1, z2) + maxdeltaz;
146 const float phiRangeMax = (maxdeltaphi > constants::math::Pi) ? constants::math::TwoPi : phi + maxdeltaphi;
147
148 if (zRangeMax < -mTrkParams[0].LayerZ[layerIndex] ||
149 zRangeMin > mTrkParams[0].LayerZ[layerIndex] || zRangeMin > zRangeMax) {
150 return getEmptyBinsRect();
151 }
152
153 const IndexTableUtils& utils{mTimeFrame->mIndexTableUtils};
154 return int4{o2::gpu::GPUCommonMath::Max(0, utils.getZBinIndex(layerIndex, zRangeMin)),
155 utils.getPhiBinIndex(math_utils::getNormalizedPhi(phiRangeMin)),
156 o2::gpu::GPUCommonMath::Min(mTrkParams[0].ZBins - 1, utils.getZBinIndex(layerIndex, zRangeMax)), // /!\ trkParams can potentially change across iterations
157 utils.getPhiBinIndex(math_utils::getNormalizedPhi(phiRangeMax))};
158}
159} // namespace its
160} // namespace o2
161
162#endif /* TRACKINGITSU_INCLUDE_TRACKERTRAITS_H_ */
GPUChain * chain
Declarations for the wrapper for the set of cylindrical material layers.
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 void computeCellsHybrid(const int iteration)
o2::gpu::GPUChainITS * mChain
virtual int getTFNumberOfTracklets() const
void SetRecoChain(o2::gpu::GPUChainITS *chain)
virtual void findRoadsHybrid(const int iteration)
virtual void computeTrackletsHybrid(const int iteration, int, int)
virtual void findCellsNeighbours(const int iteration)
virtual void findTracksHybrid(const int iteration)
virtual int getTFNumberOfClusters() const
virtual void findShortPrimaries()
virtual void initialiseTimeFrame(const int iteration)
virtual void initialiseTimeFrameHybrid(const int iteration)
virtual ~TrackerTraits()=default
void UpdateTrackingParameters(const std::vector< TrackingParameters > &trkPars)
TimeFrame * getTimeFrame()
virtual void findCellsNeighboursHybrid(const int iteration)
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 setIsGPU(const unsigned char isgpu)
void setCorrType(const o2::base::PropagatorImpl< float >::MatCorrType type)
GPUhd() static const eval int4 getEmptyBinsRect()
virtual void findTracks()
virtual bool trackFollowing(TrackITSExt *track, int rof, bool outward, const int iteration)
virtual void computeLayerCells(const int iteration)
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:43
constexpr float TwoPi
Definition Constants.h:44
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