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 TRACKINGITS_INCLUDE_TRACKLET_H_
17#define TRACKINGITS_INCLUDE_TRACKLET_H_
18
20#include "ITStracking/Cluster.h"
21#include "GPUCommonRtypes.h"
22#include "GPUCommonMath.h"
23#include "GPUCommonDef.h"
24#include "GPUCommonLogger.h"
25
26#ifndef GPUCA_GPUCODE_DEVICE
27#ifndef GPU_NO_FMT
28#include <string>
29#include <fmt/format.h>
30#endif
31#endif
32
33namespace o2::its
34{
35
36struct Tracklet final {
37 GPUhdDefault() Tracklet() = default;
38 GPUhdi() Tracklet(const int, const int, const Cluster&, const Cluster&, short rof0, short rof1);
39 GPUhdi() Tracklet(const int, const int, float tanL, float phi, short rof0, short rof1);
40 GPUhdDefault() bool operator==(const Tracklet&) const = default;
41 GPUhdi() unsigned char isEmpty() const
42 {
43 return firstClusterIndex < 0 || secondClusterIndex < 0;
44 }
45 GPUhdi() auto getMinRof() const noexcept { return o2::gpu::CAMath::Min(rof[0], rof[1]); }
46 GPUhdi() auto getMaxRof() const noexcept { return o2::gpu::CAMath::Max(rof[0], rof[1]); }
47 GPUhdi() auto getDeltaRof() const { return rof[1] - rof[0]; }
48 GPUhdi() auto getSpanRof(const Tracklet& o) const noexcept { return o2::gpu::CAMath::Max(getMaxRof(), o.getMaxRof()) - o2::gpu::CAMath::Min(getMinRof(), o.getMinRof()); }
49 GPUhdi() unsigned char operator<(const Tracklet&) const;
50 GPUhd() void print() const
51 {
52 printf("TRKLT: fClIdx:%d fROF:%d sClIdx:%d sROF:%d (DROF:%d) tgl=%f phi=%f\n", firstClusterIndex, rof[0], secondClusterIndex, rof[1], getDeltaRof(), tanLambda, phi);
53 }
54
57 float tanLambda{-999};
58 float phi{-999};
60
62};
63
64GPUhdi() Tracklet::Tracklet(const int firstClusterOrderingIndex, const int secondClusterOrderingIndex,
65 const Cluster& firstCluster, const Cluster& secondCluster, short rof0 = -1, short rof1 = -1)
66 : firstClusterIndex{firstClusterOrderingIndex},
67 secondClusterIndex{secondClusterOrderingIndex},
68 tanLambda{(firstCluster.zCoordinate - secondCluster.zCoordinate) /
69 (firstCluster.radius - secondCluster.radius)},
70 phi{o2::gpu::GPUCommonMath::ATan2(firstCluster.yCoordinate - secondCluster.yCoordinate,
71 firstCluster.xCoordinate - secondCluster.xCoordinate)},
72 rof{static_cast<short>(rof0), static_cast<short>(rof1)}
73{
74 // Nothing to do
75}
76
77GPUhdi() Tracklet::Tracklet(const int idx0, const int idx1, float tanL, float phi, short rof0, short rof1)
78 : firstClusterIndex{idx0},
79 secondClusterIndex{idx1},
80 tanLambda{tanL},
81 phi{phi},
82 rof{static_cast<short>(rof0), static_cast<short>(rof1)}
83{
84 // Nothing to do
85}
86
87GPUhdi() unsigned char Tracklet::operator<(const Tracklet& t) const
88{
89 if (isEmpty()) {
90 return false;
91 }
92 return true;
93}
94
95} // namespace o2::its
96
97#endif /* TRACKINGITS_INCLUDE_TRACKLET_H_ */
void print() const
bool o
constexpr int UnusedIndex
Definition Constants.h:30
GPUhdi() Line
GPUhdi() unsigned char operator<(const Tracklet &) const
GPUhdi() auto getMaxRof() const noexcept
Definition Tracklet.h:46
const const Cluster const Cluster short short rof1
Definition Tracklet.h:38
GPUhdi() auto getMinRof() const noexcept
Definition Tracklet.h:45
GPUhd() void print() const
Definition Tracklet.h:50
GPUhdi() auto getSpanRof(const Tracklet &o) const noexcept
Definition Tracklet.h:48
const const Cluster const Cluster short rof0
Definition Tracklet.h:38
const float tanL
Definition Tracklet.h:39
const float float phi
Definition Tracklet.h:39
GPUhdi() auto getDeltaRof() const
Definition Tracklet.h:47
ClassDefNV(Tracklet, 1)
GPUhdDefault() Tracklet()=default
GPUhdi() Tracklet(const int