Project
Loading...
Searching...
No Matches
Triplet.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 ALICEO2_ITSMFT_TRACKING_TRIPLET_H_
17#define ALICEO2_ITSMFT_TRACKING_TRIPLET_H_
18
19#include <array>
20#include <cstdint>
21
26#include "GPUCommonDef.h"
27
29{
30
32 int cellTopology{-1};
33 int cell{-1};
35 int nextCell{-1};
36 int level{-1};
37};
38
43
47class Triplet final
48{
49 public:
50 GPUhdDefault() Triplet() = default;
51 GPUhd() Triplet(int innerL, int cl0, int cl1, int cl2, int trkl0, int trkl1, const o2::its::TimeEstBC& time)
53 {
54 }
55 GPUhd() Triplet(LayerMask hitLayerMask, int cl0, int cl1, int cl2, int trkl0, int trkl1, const o2::its::TimeEstBC& time)
56 : mLevel(1), mTime(time)
57 {
58 setHitLayerMask(hitLayerMask);
59 auto& clusters = mClusters;
60 clusters[0] = cl0;
61 clusters[1] = cl1;
62 clusters[2] = cl2;
63 setFirstTrackletIndex(trkl0);
64 setSecondTrackletIndex(trkl1);
65 }
66 GPUhdDefault() Triplet(const Triplet&) = default;
67 GPUhdDefault() ~Triplet() = default;
69 GPUhdDefault() Triplet& operator=(const Triplet&) = default;
70 GPUhdDefault() Triplet& operator=(Triplet&&) = default;
71
72 GPUhd() LayerMask getHitLayerMask() const { return LayerMask{mHitLayerMask}; }
73 GPUhd() void setHitLayerMask(LayerMask mask) { mHitLayerMask = mask.value(); }
74 GPUhd() int getInnerLayer() const { return getHitLayerMask().first(); }
75 GPUhd() int getFirstTrackletIndex() const { return mTracklets[0]; }
76 GPUhd() void setFirstTrackletIndex(int trkl) { mTracklets[0] = trkl; }
77 GPUhd() int getSecondTrackletIndex() const { return mTracklets[1]; }
78 GPUhd() void setSecondTrackletIndex(int trkl) { mTracklets[1] = trkl; }
79 GPUhd() int getLevel() const { return mLevel; }
80 GPUhd() void setLevel(int level) { mLevel = level; }
81 GPUhd() int* getLevelPtr() { return &mLevel; }
82 GPUhd() auto& getTimeStamp() noexcept { return mTime; }
83 GPUhd() const auto& getTimeStamp() const noexcept { return mTime; }
84 GPUhd() int getFirstClusterIndex() const { return mClusters[0]; }
85 GPUhd() int getSecondClusterIndex() const { return mClusters[1]; }
86 GPUhd() int getThirdClusterIndex() const { return mClusters[2]; }
87 GPUhd() auto& getClusters() { return mClusters; }
88 GPUhd() const auto& getClusters() const { return mClusters; }
89 GPUhd() TripletFitFactor& tripletFactor() noexcept { return mTripletFactor; }
90 GPUhd() const TripletFitFactor& tripletFactor() const noexcept { return mTripletFactor; }
91 GPUhd() TripleClusterReference getClusterReference(int requestedSlot) const noexcept
92 {
93 if (requestedSlot < 0 || requestedSlot >= o2::its::constants::ClustersPerCell) {
94 return {};
95 }
96 const auto mask = getHitLayerMask();
97 int slot = 0;
98 for (int position = 0; position < 32; ++position) {
99 if (mask.has(position) && slot++ == requestedSlot) {
100 return {position, mClusters[requestedSlot]};
101 }
102 }
103 return {};
104 }
105 GPUhd() int getCluster(int layer) const
106 {
107 const int slot = getHitLayerMask().slot(layer);
108 return (slot >= 0 && slot < o2::its::constants::ClustersPerCell) ? mClusters[slot] : o2::its::constants::UnusedIndex;
109 }
110
111 private:
112 uint32_t mHitLayerMask{0};
114 std::array<int, 2> mTracklets = o2::its::constants::helpers::initArray<int, 2, o2::its::constants::UnusedIndex>();
115 std::array<int, o2::its::constants::ClustersPerCell> mClusters =
116 o2::its::constants::helpers::initArray<int, o2::its::constants::ClustersPerCell, o2::its::constants::UnusedIndex>();
117 o2::its::TimeEstBC mTime;
118 TripletFitFactor mTripletFactor{};
119};
120
121} // namespace o2::itsmft::tracking
122
123#endif /* ALICEO2_ITSMFT_TRACKING_TRIPLET_H_ */
GPUhdDefault() Triplet()=default
GPUhdDefault() Triplet(const Triplet &)=default
GPUhd() const TripletFitFactor &tripletFactor() const noexcept
Definition Triplet.h:90
GPUhd() TripletFitFactor &tripletFactor() noexcept
Definition Triplet.h:89
GPUhd() const auto &getClusters() const
Definition Triplet.h:88
GPUhd() void setHitLayerMask(LayerMask mask)
Definition Triplet.h:73
GPUhd() void setFirstTrackletIndex(int trkl)
Definition Triplet.h:76
int int int int int const o2::its::TimeEstBC & time
Definition Triplet.h:52
int int int int int trkl1
Definition Triplet.h:51
int int int int int const o2::its::TimeEstBC innerL
Definition Triplet.h:52
GPUhd() void setSecondTrackletIndex(int trkl)
Definition Triplet.h:78
GPUhd() int getLevel() const
Definition Triplet.h:79
GPUhd() void setLevel(int level)
Definition Triplet.h:80
int int int int trkl0
Definition Triplet.h:51
GPUhd() int getInnerLayer() const
Definition Triplet.h:74
GPUhd() int *getLevelPtr()
Definition Triplet.h:81
GPUhd() int getFirstClusterIndex() const
Definition Triplet.h:84
GPUhd() auto &getTimeStamp() noexcept
Definition Triplet.h:82
GPUhd() auto &getClusters()
Definition Triplet.h:87
GPUhd() int getFirstTrackletIndex() const
Definition Triplet.h:75
GPUhd() Triplet(int innerL
GPUhd() TripleClusterReference getClusterReference(int requestedSlot) const noexcept
Definition Triplet.h:91
GPUhd() const auto &getTimeStamp() const noexcept
Definition Triplet.h:83
GPUhd() int getSecondClusterIndex() const
Definition Triplet.h:85
GPUhd() int getThirdClusterIndex() const
Definition Triplet.h:86
GPUhd() int getCluster(int layer) const
Definition Triplet.h:105
GPUhd() int getSecondTrackletIndex() const
Definition Triplet.h:77
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
uint32_t trackClusterIndicesSize noexcept
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::vector< Cluster > clusters