Project
Loading...
Searching...
No Matches
TrackITS.h
Go to the documentation of this file.
1// Copyright 2019-2026 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.
11
15
16#ifndef ALICEO2_ITS_TRACKITS_H
17#define ALICEO2_ITS_TRACKITS_H
18
19#include <cstdint>
20
21#include "GPUCommonDef.h"
25
26namespace o2
27{
28namespace itsmft
29{
30class Cluster;
31}
32
33namespace its
34{
35
37{
38 enum UserBits {
39 kSharedClusters = 1 << 28
40 };
41
44
45 public:
46 using o2::track::TrackParCov::TrackParCov; // inherit base constructors
47 static constexpr int MaxClusters = 16;
48
49 GPUhdDefault() TrackITS() = default;
50 GPUhdDefault() TrackITS(const TrackITS& t) = default;
51 GPUhd() TrackITS(const o2::track::TrackParCov& parcov) : o2::track::TrackParCov{parcov} {}
52 GPUhd() TrackITS(const o2::track::TrackParCov& parCov, float chi2, const o2::track::TrackParCov& outer)
53 : o2::track::TrackParCov{parCov}, mParamOut{outer}, mChi2{chi2} {}
54 GPUhdDefault() TrackITS& operator=(const TrackITS& tr) = default;
55 GPUhdDefault() TrackITS& operator=(TrackITS&& tr) = default;
56 GPUhdDefault() ~TrackITS() = default;
57
58 // These functions must be provided
59 bool propagate(float alpha, float x, float bz);
60 bool update(const Cluster& c, float chi2);
61
62 // Other functions
63 GPUhdi() float getChi2() const { return mChi2; }
64 GPUhdi() int getNClusters() const { return mClusRef.getEntries(); }
65 GPUhdi() int getNumberOfClusters() const { return getNClusters(); }
66 int getFirstClusterEntry() const { return mClusRef.getFirstEntry(); }
67 int getClusterEntry(int i) const { return getFirstClusterEntry() + i; }
69 {
70 mClusRef.setFirstEntry(mClusRef.getFirstEntry() + bias);
71 }
72 void setFirstClusterEntry(int offs)
73 {
74 mClusRef.setFirstEntry(offs);
75 }
77 {
78 mClusRef.setEntries(n);
79 }
80 bool operator<(const TrackITS& o) const;
81 void getImpactParams(float x, float y, float z, float bz, float ip[2]) const;
82 // bool getPhiZat(float r,float &phi,float &z) const;
83
84 void setClusterRefs(int firstEntry, int n)
85 {
86 mClusRef.set(firstEntry, n);
87 }
88
89 const ClusRefs& getClusterRefs() const { return mClusRef; }
90 GPUhdi() ClusRefs& getClusterRefs() { return mClusRef; }
91
92 GPUhdi() void setChi2(float chi2) { mChi2 = chi2; }
93
94 bool isBetter(const TrackITS& best, float maxChi2) const;
95
96 GPUhdi() auto& getTimeStamp() { return mTime; }
97 GPUhdi() const auto& getTimeStamp() const { return mTime; }
98
99 GPUhdi() o2::track::TrackParCov& getParamIn() { return *this; }
100 GPUhdi() const o2::track::TrackParCov& getParamIn() const { return *this; }
101
102 GPUhdi() o2::track::TrackParCov& getParamOut() { return mParamOut; }
103 GPUhdi() const o2::track::TrackParCov& getParamOut() const { return mParamOut; }
104
105 GPUhdi() void setPattern(uint32_t p) { mPattern = p; }
106 GPUhdi() uint32_t getPattern() const { return mPattern; }
107 bool hasHitOnLayer(uint32_t i) const { return mPattern & (0x1 << i); }
108 bool isFakeOnLayer(uint32_t i) const { return !(mPattern & (0x1 << (16 + i))); }
109 bool isExtendedOnLayer(uint32_t i) const { return (mPattern & (0x1 << (24 + i))); } // only correct if getNClusters <= 8 on layers <= 8
110 uint32_t getLastClusterLayer() const
111 {
112 uint32_t r{0}, v{mPattern & ((1 << 16) - 1)};
113 while (v >>= 1) {
114 r++;
115 }
116 return r;
117 }
118 uint32_t getFirstClusterLayer() const
119 {
120 int s{0};
121 while (!(mPattern & (1 << s))) {
122 s++;
123 }
124 return s;
125 }
126 int getNFakeClusters() const;
127
128 void setSharedClusters(bool toggle = true) { mClusterSizes = toggle ? (mClusterSizes | kSharedClusters) : (mClusterSizes & ~kSharedClusters); }
129 bool hasSharedClusters() const { return mClusterSizes & kSharedClusters; }
130
131 void setClusterSize(int l, int size)
132 {
133 if (l >= 8) {
134 return;
135 }
136 if (size > 15) {
137 size = 15;
138 }
139 mClusterSizes &= ~(0xf << (l * 4));
140 mClusterSizes |= (size << (l * 4));
141 }
142
143 int getClusterSize(int l)
144 {
145 if (l >= 7) {
146 return 0;
147 }
148 return (mClusterSizes >> (l * 4)) & 0xf;
149 }
150
151 int getClusterSizes() const
152 {
153 return mClusterSizes;
154 }
155
156 private:
157 o2::track::TrackParCov mParamOut;
158 ClusRefs mClusRef;
159 float mChi2 = 0.;
160 uint32_t mPattern = 0;
161 uint32_t mClusterSizes = 0u;
162 TimeStamp mTime;
163
164 ClassDefNV(TrackITS, 7);
165};
166
167class TrackITSExt : public TrackITS
168{
170 public:
171 static constexpr int MaxClusters = 16;
172 using TrackITS::TrackITS; // inherit base constructors
173
174 GPUh() TrackITSExt(o2::track::TrackParCov&& parCov, short ncl, float chi2, o2::track::TrackParCov&& outer, std::array<int, MaxClusters> cls)
175 : TrackITS(parCov, chi2, outer), mIndex{cls}
176 {
178 }
179
180 GPUh() TrackITSExt(o2::track::TrackParCov& parCov, short ncl, float chi2, std::uint32_t rof, o2::track::TrackParCov& outer, std::array<int, MaxClusters> cls)
181 : TrackITS(parCov, chi2, outer), mIndex{cls}
182 {
184 }
185
186 GPUhdDefault() TrackITSExt(const TrackITSExt& t) = default;
187
188 void setClusterIndex(int l, int i)
189 {
190 int ncl = getNumberOfClusters();
191 mIndex[ncl++] = (l << 28) + i;
192 getClusterRefs().setEntries(ncl);
193 }
194
195 GPUhdi() const int& getClusterIndex(int lr) const { return mIndex[lr]; }
196
197 GPUhdi() void setExternalClusterIndex(int layer, int idx, bool newCluster = false)
198 {
199 if (newCluster) {
200 getClusterRefs().setEntries(getNumberOfClusters() + 1);
201 uint32_t pattern = getPattern();
202 pattern |= 0x1 << layer;
203 setPattern(pattern);
204 }
205 mIndex[layer] = idx;
206 }
207
209 {
210 return mIndex;
211 }
212
213 private:
214 std::array<int, MaxClusters> mIndex = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
215 ClassDefNV(TrackITSExt, 3);
216};
217} // namespace its
218} // namespace o2
219#endif /* ALICEO2_ITS_TRACKITS_H */
Base track model for the Barrel, params only, w/o covariance.
int32_t i
Class to refer to the 1st entry and N elements of some group in the continuous container.
uint32_t c
Definition RawData.h:2
o2::track::TrackParCov TrackParCov
Definition Recon.h:39
HMPID cluster implementation.
Definition Cluster.h:27
void setClusterIndex(int l, int i)
Definition TrackITS.h:188
GPUhdDefault() TrackITSExt(const TrackITSExt &t)=default
GPUhdi() const int &getClusterIndex(int lr) const
Definition TrackITS.h:195
GPUhdi() void setExternalClusterIndex(int layer
int bool MaxClusters & getClusterIndexes()
Definition TrackITS.h:208
static constexpr int MaxClusters
< heavy version of TrackITS, with clusters embedded
Definition TrackITS.h:171
GPUh() TrackITSExt(o2
Definition TrackITS.h:174
GPUhdi() auto &getTimeStamp()
Definition TrackITS.h:96
bool operator<(const TrackITS &o) const
Definition TrackITS.cxx:27
bool hasHitOnLayer(uint32_t i) const
Definition TrackITS.h:107
GPUhdi() const auto &getTimeStamp() const
Definition TrackITS.h:97
const ClusRefs & getClusterRefs() const
Definition TrackITS.h:89
uint32_t getFirstClusterLayer() const
Definition TrackITS.h:118
void setClusterRefs(int firstEntry, int n)
Definition TrackITS.h:84
GPUhdi() int getNClusters() const
Definition TrackITS.h:64
int getNFakeClusters() const
Definition TrackITS.cxx:110
static constexpr int MaxClusters
Definition TrackITS.h:47
GPUhdi() ClusRefs &getClusterRefs()
Definition TrackITS.h:90
void getImpactParams(float x, float y, float z, float bz, float ip[2]) const
Definition TrackITS.cxx:40
GPUhdDefault() TrackITS &operator
int getClusterEntry(int i) const
Definition TrackITS.h:67
void shiftFirstClusterEntry(int bias)
Definition TrackITS.h:68
uint32_t getLastClusterLayer() const
Definition TrackITS.h:110
void setNumberOfClusters(int n)
Definition TrackITS.h:76
GPUhdi() uint32_t getPattern() const
Definition TrackITS.h:106
int getClusterSize(int l)
Definition TrackITS.h:143
bool isFakeOnLayer(uint32_t i) const
Definition TrackITS.h:108
void setClusterSize(int l, int size)
Definition TrackITS.h:131
GPUhdi() int getNumberOfClusters() const
Definition TrackITS.h:65
GPUhdi() const o2
Definition TrackITS.h:100
int getFirstClusterEntry() const
Definition TrackITS.h:66
int getClusterSizes() const
Definition TrackITS.h:151
GPUhdi() float getChi2() const
Definition TrackITS.h:63
void setFirstClusterEntry(int offs)
Definition TrackITS.h:72
bool propagate(float alpha, float x, float bz)
Definition TrackITS.cxx:72
bool hasSharedClusters() const
Definition TrackITS.h:129
GPUhd() TrackITS(const o2
Definition TrackITS.h:51
void setSharedClusters(bool toggle=true)
Definition TrackITS.h:128
GPUhdDefault() TrackITS()=default
bool isBetter(const TrackITS &best, float maxChi2) const
Definition TrackITS.cxx:94
bool isExtendedOnLayer(uint32_t i) const
Definition TrackITS.h:109
bool update(const Cluster &c, float chi2)
Definition TrackITS.cxx:82
GPUhdi() void setChi2(float chi2)
Definition TrackITS.h:92
Cluster class for the ITSMFT.
Definition Cluster.h:34
GLdouble n
Definition glcorearb.h:1982
GLfloat GLfloat GLfloat alpha
Definition glcorearb.h:279
GLint GLenum GLint x
Definition glcorearb.h:403
GLsizeiptr size
Definition glcorearb.h:659
const GLdouble * v
Definition glcorearb.h:832
GLenum array
Definition glcorearb.h:4274
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
GLenum GLuint GLint GLint layer
Definition glcorearb.h:1310
GLboolean r
Definition glcorearb.h:1233
GLdouble GLdouble GLdouble z
Definition glcorearb.h:843
TrackParCovF TrackParCov
Definition Track.h:33
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::array< uint16_t, 5 > pattern