Project
Loading...
Searching...
No Matches
Cell.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_CACELL_H_
17#define TRACKINGITSU_INCLUDE_CACELL_H_
18
19#include <cstdint>
20
25#include "GPUCommonDef.h"
26
27namespace o2::its
28{
29
31 int cellTopology{-1};
32 int cell{-1};
34 int nextCell{-1};
35 int level{-1};
36};
37
38template <int NClusters>
40{
41 public:
42 GPUhd() LayerMask getHitLayerMask() const { return LayerMask{static_cast<uint16_t>(getUserField())}; }
43 GPUhd() void setHitLayerMask(LayerMask mask) { setUserField(mask.value()); }
44 GPUhd() int getInnerLayer() const { return getHitLayerMask().first(); }
45 GPUhd() int getFirstTrackletIndex() const { return mTracklets[0]; };
46 GPUhd() void setFirstTrackletIndex(int trkl) { mTracklets[0] = trkl; };
47 GPUhd() int getSecondTrackletIndex() const { return mTracklets[1]; };
48 GPUhd() void setSecondTrackletIndex(int trkl) { mTracklets[1] = trkl; };
49 GPUhd() float getChi2() const { return mChi2; };
50 GPUhd() void setChi2(float chi2) { mChi2 = chi2; };
51 GPUhd() int getLevel() const { return mLevel; };
52 GPUhd() void setLevel(int level) { mLevel = level; };
53 GPUhd() int* getLevelPtr() { return &mLevel; }
54 GPUhd() auto& getTimeStamp() noexcept { return mTime; }
55 GPUhd() const auto& getTimeStamp() const noexcept { return mTime; }
56
57 protected:
58 GPUhdDefault() SeedBase() = default;
59 GPUhdDefault() SeedBase(const SeedBase&) = default;
60 GPUhdDefault() ~SeedBase() = default;
62 GPUhdDefault() SeedBase& operator=(const SeedBase&) = default;
63 GPUhdDefault() SeedBase& operator=(SeedBase&&) = default;
64 GPUhd() SeedBase(const o2::track::TrackParCovF& tpc, float chi2, int level, const TimeEstBC& time)
65 : o2::track::TrackParCovF(tpc), mChi2(chi2), mLevel(level), mTime(time)
66 {
67 }
68 GPUhd() auto& clustersRaw() { return mClusters; }
69 GPUhd() const auto& clustersRaw() const { return mClusters; }
70
71 private:
72 float mChi2{constants::UnsetValue};
73 int mLevel{constants::UnusedIndex};
74 std::array<int, 2> mTracklets = constants::helpers::initArray<int, 2, constants::UnusedIndex>();
75 std::array<int, NClusters> mClusters = constants::helpers::initArray<int, NClusters, constants::UnusedIndex>();
76 TimeEstBC mTime;
77};
78
80class CellSeed final : public SeedBase<constants::ClustersPerCell>
81{
83
84 public:
85 GPUhdDefault() CellSeed() = default;
86 GPUhd() CellSeed(int innerL, int cl0, int cl1, int cl2, int trkl0, int trkl1, const o2::track::TrackParCovF& tpc, float chi2, const TimeEstBC& time)
88 {
89 }
90 GPUhd() CellSeed(LayerMask hitLayerMask, int cl0, int cl1, int cl2, int trkl0, int trkl1, const o2::track::TrackParCovF& tpc, float chi2, const TimeEstBC& time)
91 : Base(tpc, chi2, 1, time)
92 {
93 setHitLayerMask(hitLayerMask);
94 auto& clusters = this->clustersRaw();
95 clusters[0] = cl0;
96 clusters[1] = cl1;
97 clusters[2] = cl2;
98 setFirstTrackletIndex(trkl0);
99 setSecondTrackletIndex(trkl1);
100 }
101 GPUhdDefault() CellSeed(const CellSeed&) = default;
102 GPUhdDefault() ~CellSeed() = default;
104 GPUhdDefault() CellSeed& operator=(const CellSeed&) = default;
105 GPUhdDefault() CellSeed& operator=(CellSeed&&) = default;
106
107 GPUhd() int getFirstClusterIndex() const { return this->clustersRaw()[0]; };
108 GPUhd() int getSecondClusterIndex() const { return this->clustersRaw()[1]; };
109 GPUhd() int getThirdClusterIndex() const { return this->clustersRaw()[2]; };
110 GPUhd() auto& getClusters() { return this->clustersRaw(); }
111 GPUhd() const auto& getClusters() const { return this->clustersRaw(); }
114 GPUhd() int getCluster(int layer) const
115 {
116 const int slot = getHitLayerMask().slot(layer);
117 return (slot >= 0 && slot < constants::ClustersPerCell) ? this->clustersRaw()[slot] : constants::UnusedIndex;
118 }
119};
120
124template <int NLayers>
125class TrackSeed final : public SeedBase<NLayers>
126{
127 using Base = SeedBase<NLayers>;
128
129 public:
130 GPUhdDefault() TrackSeed() = default;
132 : Base(static_cast<const o2::track::TrackParCovF&>(cs), cs.getChi2(), cs.getLevel(), cs.getTimeStamp())
133 {
134 this->setHitLayerMask(cs.getHitLayerMask());
135 this->setFirstTrackletIndex(cs.getFirstTrackletIndex());
136 this->setSecondTrackletIndex(cs.getSecondTrackletIndex());
137 auto& clusters = this->clustersRaw();
138 int slot = 0;
139 const auto hitMask = cs.getHitLayerMask();
140 for (int layer = 0; layer < NLayers; ++layer) {
141 if (hitMask.has(layer)) {
142 clusters[layer] = cs.getClusters()[slot++];
143 }
144 }
145 }
146 GPUhdDefault() TrackSeed(const TrackSeed&) = default;
147 GPUhdDefault() ~TrackSeed() = default;
149 GPUhdDefault() TrackSeed& operator=(const TrackSeed&) = default;
150 GPUhdDefault() TrackSeed& operator=(TrackSeed&&) = default;
151
152 GPUhd() int getFirstClusterIndex() const { return getClusterBySlot(0); }
153 GPUhd() int getSecondClusterIndex() const { return getClusterBySlot(1); }
154 GPUhd() int getThirdClusterIndex() const { return getClusterBySlot(2); }
155 GPUhd() auto& getClusters() { return this->clustersRaw(); }
156 GPUhd() const auto& getClusters() const { return this->clustersRaw(); }
157 GPUhd() int getCluster(int layer) const { return this->clustersRaw()[layer]; }
158
159 private:
160 GPUhd() int getClusterBySlot(int requestedSlot) const
161 {
162 int slot = 0;
163 const auto hitMask = this->getHitLayerMask();
164 for (int layer = 0; layer < NLayers; ++layer) {
165 if (hitMask.has(layer)) {
166 if (slot++ == requestedSlot) {
167 return this->clustersRaw()[layer];
168 }
169 }
170 }
172 }
173};
174
175} // namespace o2::its
176
177#endif /* TRACKINGITSU_INCLUDE_CACELL_H_ */
Base track model for the Barrel, params only, w/o covariance.
int16_t time
Definition RawEventData.h:4
CellSeed: connections of three clusters.
Definition Cell.h:81
int int int int int trkl1
Definition Cell.h:86
GPUhd() int getCluster(int layer) const
Definition Cell.h:114
int int int int int const o2::track::TrackParCovF float chi2
Definition Cell.h:86
GPUhdDefault() CellSeed()=default
int int int int int const o2::track::TrackParCovF float const TimeEstBC innerL
Definition Cell.h:87
int int int int int const o2::track::TrackParCovF float const TimeEstBC & time
Definition Cell.h:87
GPUhd() auto &getClusters()
Definition Cell.h:110
GPUhd() CellSeed(int innerL
int int int cl2
Definition Cell.h:86
GPUhd() int getSecondClusterIndex() const
Definition Cell.h:108
GPUhd() int getThirdClusterIndex() const
Definition Cell.h:109
int int int int trkl0
Definition Cell.h:86
int int cl1
Definition Cell.h:86
GPUhd() const auto &getClusters() const
Definition Cell.h:111
int int int int int const o2::track::TrackParCovF & tpc
Definition Cell.h:86
GPUhd() void setLevel(int level)
Definition Cell.h:52
GPUhd() void setChi2(float chi2)
Definition Cell.h:50
GPUhd() LayerMask getHitLayerMask() const
Definition Cell.h:42
GPUhd() void setHitLayerMask(LayerMask mask)
Definition Cell.h:43
GPUhd() int getLevel() const
Definition Cell.h:51
GPUhd() const auto &getTimeStamp() const noexcept
Definition Cell.h:55
GPUhd() void setSecondTrackletIndex(int trkl)
Definition Cell.h:48
GPUhdDefault() SeedBase()=default
GPUhd() int *getLevelPtr()
Definition Cell.h:53
GPUhd() float getChi2() const
Definition Cell.h:49
GPUhd() auto &clustersRaw()
Definition Cell.h:68
GPUhd() auto &getTimeStamp() noexcept
Definition Cell.h:54
GPUhd() void setFirstTrackletIndex(int trkl)
Definition Cell.h:46
GPUhd() int getFirstTrackletIndex() const
Definition Cell.h:45
GPUhd() int getSecondTrackletIndex() const
Definition Cell.h:47
GPUhd() const auto &clustersRaw() const
Definition Cell.h:69
GPUhd() int getInnerLayer() const
Definition Cell.h:44
GPUhdDefault() TrackSeed()=default
GPUhd() auto &getClusters()
Definition Cell.h:155
GPUhd() int getThirdClusterIndex() const
Definition Cell.h:154
GPUhd() const auto &getClusters() const
Definition Cell.h:156
GPUhd() int getSecondClusterIndex() const
Definition Cell.h:153
GPUhd() int getFirstClusterIndex() const
Definition Cell.h:152
GPUhdDefault() TrackSeed(const TrackSeed &)=default
GPUhd() int getCluster(int layer) const
Definition Cell.h:157
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
GLenum GLuint GLint GLint layer
Definition glcorearb.h:1310
GLint level
Definition glcorearb.h:275
GLint GLuint mask
Definition glcorearb.h:291
constexpr int UnusedIndex
Definition Constants.h:32
constexpr int ClustersPerCell
Definition Constants.h:31
constexpr float UnsetValue
Definition Constants.h:33
TrackParametrizationWithError< float > TrackParCovF
Definition Track.h:31
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::vector< Cluster > clusters