forked from AliceO2Group/AliceO2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTracklet.h
More file actions
100 lines (88 loc) · 3.55 KB
/
Tracklet.h
File metadata and controls
100 lines (88 loc) · 3.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
///
/// \file Tracklet.h
/// \brief
///
#ifndef TRACKINGITS_INCLUDE_TRACKLET_H_
#define TRACKINGITS_INCLUDE_TRACKLET_H_
#include "ITStracking/Constants.h"
#include "ITStracking/Cluster.h"
#include "GPUCommonRtypes.h"
#include "GPUCommonMath.h"
#include "GPUCommonDef.h"
#include "GPUCommonLogger.h"
#ifndef GPUCA_GPUCODE_DEVICE
#ifndef GPU_NO_FMT
#include <string>
#include <fmt/format.h>
#endif
#endif
namespace o2::its
{
struct Tracklet final {
GPUhdDefault() Tracklet() = default;
GPUhdi() Tracklet(const int, const int, const Cluster&, const Cluster&, short rof0, short rof1);
GPUhdi() Tracklet(const int, const int, float tanL, float phi, short rof0, short rof1);
GPUhdDefault() bool operator==(const Tracklet&) const = default;
GPUhdi() unsigned char isEmpty() const
{
return firstClusterIndex < 0 || secondClusterIndex < 0;
}
GPUhdi() auto getMinRof() const noexcept { return o2::gpu::CAMath::Min(rof[0], rof[1]); }
GPUhdi() auto getMaxRof() const noexcept { return o2::gpu::CAMath::Max(rof[0], rof[1]); }
GPUhdi() auto getDeltaRof() const { return rof[1] - rof[0]; }
GPUhdi() auto getSpanRof(const Tracklet& o) const noexcept { return o2::gpu::CAMath::Max(getMaxRof(), o.getMaxRof()) - o2::gpu::CAMath::Min(getMinRof(), o.getMinRof()); }
GPUhdi() unsigned char operator<(const Tracklet&) const;
#if !defined(GPUCA_NO_FMT) && !defined(GPUCA_GPUCODE_DEVICE)
std::string asString() const
{
return fmt::format("fClIdx:{} fROF:{} sClIdx:{} sROF:{} (DROF:{})", firstClusterIndex, rof[0], secondClusterIndex, rof[1], getDeltaRof());
}
void print() const { LOG(info) << asString(); }
#endif
int firstClusterIndex{constants::UnusedIndex};
int secondClusterIndex{constants::UnusedIndex};
float tanLambda{-999};
float phi{-999};
short rof[2] = {constants::UnusedIndex, constants::UnusedIndex};
ClassDefNV(Tracklet, 1);
};
GPUhdi() Tracklet::Tracklet(const int firstClusterOrderingIndex, const int secondClusterOrderingIndex,
const Cluster& firstCluster, const Cluster& secondCluster, short rof0 = -1, short rof1 = -1)
: firstClusterIndex{firstClusterOrderingIndex},
secondClusterIndex{secondClusterOrderingIndex},
tanLambda{(firstCluster.zCoordinate - secondCluster.zCoordinate) /
(firstCluster.radius - secondCluster.radius)},
phi{o2::gpu::GPUCommonMath::ATan2(firstCluster.yCoordinate - secondCluster.yCoordinate,
firstCluster.xCoordinate - secondCluster.xCoordinate)},
rof{static_cast<short>(rof0), static_cast<short>(rof1)}
{
// Nothing to do
}
GPUhdi() Tracklet::Tracklet(const int idx0, const int idx1, float tanL, float phi, short rof0, short rof1)
: firstClusterIndex{idx0},
secondClusterIndex{idx1},
tanLambda{tanL},
phi{phi},
rof{static_cast<short>(rof0), static_cast<short>(rof1)}
{
// Nothing to do
}
GPUhdi() unsigned char Tracklet::operator<(const Tracklet& t) const
{
if (isEmpty()) {
return false;
}
return true;
}
} // namespace o2::its
#endif /* TRACKINGITS_INCLUDE_TRACKLET_H_ */