Project
Loading...
Searching...
No Matches
Tracklet.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_TRACKLET_H_
17#define TRACKINGITSU_INCLUDE_TRACKLET_H_
18
19#include "ITStracking/Cluster.h"
20#include <iostream>
21#include "GPUCommonMath.h"
22#include "GPUCommonDef.h"
23
24#ifndef GPUCA_GPUCODE_DEVICE
25#include <string>
26#endif
27
28namespace o2
29{
30namespace its
31{
32
33struct Tracklet final {
35 GPUhdi() Tracklet(const int, const int, const Cluster&, const Cluster&, short rof0, short rof1);
36 GPUhdi() Tracklet(const int, const int, float tanL, float phi, short rof0, short rof1);
37 GPUhdi() bool operator==(const Tracklet&) const;
38 GPUhdi() bool operator!=(const Tracklet&) const;
39 GPUhdi() unsigned char isEmpty() const
40 {
41 return firstClusterIndex < 0 || secondClusterIndex < 0;
42 }
43 GPUhdi() auto getDeltaRof() const { return rof[1] - rof[0]; }
45 GPUhdi() void dump() const;
46 GPUhdi() void dump(const int, const int);
47 GPUhdi() void dump(const int, const int) const;
48 GPUhdi() unsigned char operator<(const Tracklet&) const;
49#ifndef GPUCA_GPUCODE_DEVICE
50 std::string asString() const
51 {
52 return "fClIdx: " + std::to_string(firstClusterIndex) + " sClIdx: " + std::to_string(secondClusterIndex) +
53 " rof1: " + std::to_string(rof[0]) + " rof2: " + std::to_string(rof[1]) + " delta: " + std::to_string(getDeltaRof());
54 }
55#endif
56
59 float tanLambda;
60 float phi;
61 short rof[2];
62};
63
64GPUhdi() Tracklet::Tracklet() : firstClusterIndex{-1}, secondClusterIndex{-1}, tanLambda{0.0f}, phi{0.0f}
65{
66 rof[0] = -1;
67 rof[1] = -1;
68}
69
70GPUhdi() Tracklet::Tracklet(const int firstClusterOrderingIndex, const int secondClusterOrderingIndex,
71 const Cluster& firstCluster, const Cluster& secondCluster, short rof0 = -1, short rof1 = -1)
72 : firstClusterIndex{firstClusterOrderingIndex},
73 secondClusterIndex{secondClusterOrderingIndex},
74 tanLambda{(firstCluster.zCoordinate - secondCluster.zCoordinate) /
75 (firstCluster.radius - secondCluster.radius)},
76 phi{o2::gpu::GPUCommonMath::ATan2(firstCluster.yCoordinate - secondCluster.yCoordinate,
77 firstCluster.xCoordinate - secondCluster.xCoordinate)},
78 rof{static_cast<short>(rof0), static_cast<short>(rof1)}
79{
80 // Nothing to do
81}
82
83GPUhdi() Tracklet::Tracklet(const int idx0, const int idx1, float tanL, float phi, short rof0, short rof1)
84 : firstClusterIndex{idx0},
85 secondClusterIndex{idx1},
86 tanLambda{tanL},
87 phi{phi},
88 rof{static_cast<short>(rof0), static_cast<short>(rof1)}
89{
90 // Nothing to do
91}
92
93GPUhdi() bool Tracklet::operator==(const Tracklet& rhs) const
94{
95 return this->firstClusterIndex == rhs.firstClusterIndex &&
96 this->secondClusterIndex == rhs.secondClusterIndex &&
97 this->tanLambda == rhs.tanLambda &&
98 this->phi == rhs.phi &&
99 this->rof[0] == rhs.rof[0] &&
100 this->rof[1] == rhs.rof[1];
101}
102
103GPUhdi() bool Tracklet::operator!=(const Tracklet& rhs) const
104{
105 return this->firstClusterIndex != rhs.firstClusterIndex ||
106 this->secondClusterIndex != rhs.secondClusterIndex ||
107 this->tanLambda != rhs.tanLambda ||
108 this->phi != rhs.phi;
109}
110
111GPUhdi() unsigned char Tracklet::operator<(const Tracklet& t) const
112{
113 if (isEmpty()) {
114 return false;
115 }
116 return true;
117}
118
119GPUhdi() void Tracklet::dump(const int offsetFirst, const int offsetSecond)
120{
121 printf("fClIdx: %d sClIdx: %d rof1: %hu rof2: %hu\n", firstClusterIndex + offsetFirst, secondClusterIndex + offsetSecond, rof[0], rof[1]);
122}
123
124GPUhdi() void Tracklet::dump(const int offsetFirst, const int offsetSecond) const
125{
126 printf("fClIdx: %d sClIdx: %d rof1: %hu rof2: %hu\n", firstClusterIndex + offsetFirst, secondClusterIndex + offsetSecond, rof[0], rof[1]);
127}
128
129GPUhdi() void Tracklet::dump()
130{
131 printf("fClIdx: %d sClIdx: %d rof1: %hu rof2: %hu\n", firstClusterIndex, secondClusterIndex, rof[0], rof[1]);
132}
133
134GPUhdi() void Tracklet::dump() const
135{
136 printf("fClIdx: %d sClIdx: %d rof1: %hu rof2: %hu\n", firstClusterIndex, secondClusterIndex, rof[0], rof[1]);
137}
138
139} // namespace its
140} // namespace o2
141
142#endif /* TRACKINGITSU_INCLUDE_TRACKLET_H_ */
HMPID cluster implementation.
Definition Cluster.h:27
void dump(const std::string what, DPMAP m, int verbose)
Definition dcs-ccdb.cxx:79
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
GPUhdi() Cell
Definition Cell.h:55
D const SVectorGPU< T, D > & rhs
Definition SMatrixGPU.h:191
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::string to_string(gsl::span< T, Size > span)
Definition common.h:52
GPUhdi() void dump()
const int const
Definition Tracklet.h:47
const const Cluster const Cluster short short rof1
Definition Tracklet.h:35
const const Cluster const Cluster short rof0
Definition Tracklet.h:35
const float tanL
Definition Tracklet.h:36
const float float phi
Definition Tracklet.h:36
GPUhdi() auto getDeltaRof() const
Definition Tracklet.h:43
GPUhdi() Tracklet()
std::string asString() const
Definition Tracklet.h:50