Project
Loading...
Searching...
No Matches
TrackITS.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.
11
15
16#ifndef ALICEO2_ITS_TRACKITS_H
17#define ALICEO2_ITS_TRACKITS_H
18
19#include <vector>
20
21#include "GPUCommonDef.h"
24
25namespace o2
26{
27namespace itsmft
28{
29class Cluster;
30}
31
32namespace its
33{
34
36{
37 enum UserBits {
38 kNextROF = 1 << 28,
39 kSharedClusters = 1 << 29
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() o2::track::TrackParCov& getParamIn() { return *this; }
97 GPUhdi() const o2::track::TrackParCov& getParamIn() const { return *this; }
98
99 GPUhdi() o2::track::TrackParCov& getParamOut() { return mParamOut; }
100 GPUhdi() const o2::track::TrackParCov& getParamOut() const { return mParamOut; }
101
102 GPUhdi() void setPattern(uint32_t p) { mPattern = p; }
103 GPUhdi() uint32_t getPattern() const { return mPattern; }
104 bool hasHitOnLayer(uint32_t i) const { return mPattern & (0x1 << i); }
105 bool isFakeOnLayer(uint32_t i) const { return !(mPattern & (0x1 << (16 + i))); }
106 bool isExtendedOnLayer(uint32_t i) const { return (mPattern & (0x1 << (24 + i))); } // only correct if getNClusters <= 8 on layers <= 8
107 uint32_t getLastClusterLayer() const
108 {
109 uint32_t r{0}, v{mPattern & ((1 << 16) - 1)};
110 while (v >>= 1) {
111 r++;
112 }
113 return r;
114 }
115 uint32_t getFirstClusterLayer() const
116 {
117 int s{0};
118 while (!(mPattern & (1 << s))) {
119 s++;
120 }
121 return s;
122 }
123 int getNFakeClusters() const;
124
125 void setNextROFbit(bool toggle = true) { mClusterSizes = toggle ? (mClusterSizes | kNextROF) : (mClusterSizes & ~kNextROF); }
126 bool hasHitInNextROF() const { return mClusterSizes & kNextROF; }
127 void setSharedClusters(bool toggle = true) { mClusterSizes = toggle ? (mClusterSizes | kSharedClusters) : (mClusterSizes & ~kSharedClusters); }
128 bool hasSharedClusters() const { return mClusterSizes & kSharedClusters; }
129
130 void setClusterSize(int l, int size)
131 {
132 if (l >= 8) {
133 return;
134 }
135 if (size > 15) {
136 size = 15;
137 }
138 mClusterSizes &= ~(0xf << (l * 4));
139 mClusterSizes |= (size << (l * 4));
140 }
141
142 int getClusterSize(int l)
143 {
144 if (l >= 7) {
145 return 0;
146 }
147 return (mClusterSizes >> (l * 4)) & 0xf;
148 }
149
150 int getClusterSizes() const
151 {
152 return mClusterSizes;
153 }
154
155 private:
156 o2::track::TrackParCov mParamOut;
157 ClusRefs mClusRef;
158 float mChi2 = 0.;
159 uint32_t mPattern = 0;
160 unsigned int mClusterSizes = 0u;
161
162 ClassDefNV(TrackITS, 6);
163};
164
165class TrackITSExt : public TrackITS
166{
168 public:
169 static constexpr int MaxClusters = 16;
170 using TrackITS::TrackITS; // inherit base constructors
171
172 GPUh() TrackITSExt(o2::track::TrackParCov&& parCov, short ncl, float chi2,
173 o2::track::TrackParCov&& outer, o2::gpu::gpustd::array<int, MaxClusters> cls)
174 : TrackITS(parCov, chi2, outer), mIndex{cls}
175 {
177 }
178
179 GPUh() TrackITSExt(o2::track::TrackParCov& parCov, short ncl, float chi2, std::uint32_t rof,
180 o2::track::TrackParCov& outer, o2::gpu::gpustd::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
208 GPUh() o2::gpu::gpustd::array<int, MaxClusters>& getClusterIndexes()
209 {
210 return mIndex;
211 }
212
213 private:
214 o2::gpu::gpustd::array<int, MaxClusters> mIndex = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
215 ClassDefNV(TrackITSExt, 2);
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
bool o
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:169
GPUh() TrackITSExt(o2
Definition TrackITS.h:172
bool operator<(const TrackITS &o) const
Definition TrackITS.cxx:27
bool hasHitOnLayer(uint32_t i) const
Definition TrackITS.h:104
const ClusRefs & getClusterRefs() const
Definition TrackITS.h:89
uint32_t getFirstClusterLayer() const
Definition TrackITS.h:115
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
void setNextROFbit(bool toggle=true)
Definition TrackITS.h:125
uint32_t getLastClusterLayer() const
Definition TrackITS.h:107
void setNumberOfClusters(int n)
Definition TrackITS.h:76
GPUhdi() uint32_t getPattern() const
Definition TrackITS.h:103
int getClusterSize(int l)
Definition TrackITS.h:142
bool isFakeOnLayer(uint32_t i) const
Definition TrackITS.h:105
bool hasHitInNextROF() const
Definition TrackITS.h:126
void setClusterSize(int l, int size)
Definition TrackITS.h:130
GPUhdi() int getNumberOfClusters() const
Definition TrackITS.h:65
GPUhdi() const o2
Definition TrackITS.h:97
int getFirstClusterEntry() const
Definition TrackITS.h:66
int getClusterSizes() const
Definition TrackITS.h:150
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:128
GPUhd() TrackITS(const o2
Definition TrackITS.h:51
void setSharedClusters(bool toggle=true)
Definition TrackITS.h:127
GPUhdDefault() TrackITS()=default
bool isBetter(const TrackITS &best, float maxChi2) const
Definition TrackITS.cxx:94
bool isExtendedOnLayer(uint32_t i) const
Definition TrackITS.h:106
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
std::array< T, N > array
TrackParCovF TrackParCov
Definition Track.h:33
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
Defining DataPointCompositeObject explicitly as copiable.
std::array< uint16_t, 5 > pattern