2424#include " GPUCommonDef.h"
2525#include " GPUCommonLogger.h"
2626
27- #ifndef GPUCA_GPUCODE_DEVICE
28- #ifndef GPU_NO_FMT
29- #include < string>
30- #include < fmt/format.h>
31- #endif
32- #endif
33-
3427namespace o2 ::its
3528{
3629
30+ // tracklets are entirely determined by their two cluster idx
3731struct Tracklet final {
3832 GPUhdDefault () Tracklet() = default ;
39- GPUhdi () Tracklet(const int , const int , const Cluster&, const Cluster&, const TimeEstBC& t);
40- GPUhdi () Tracklet(const int , const int , float tanL, float phi, const TimeEstBC& t);
41- GPUhdDefault () bool operator ==(const Tracklet&) const = default ;
42- GPUhdi () unsigned char isEmpty () const
33+ GPUhdi () Tracklet(const int firstClusterOrderingIndex, const int secondClusterOrderingIndex,
34+ const Cluster& firstCluster, const Cluster& secondCluster, const TimeEstBC& t)
35+ : firstClusterIndex(firstClusterOrderingIndex),
36+ secondClusterIndex (secondClusterOrderingIndex),
37+ tanLambda((firstCluster.zCoordinate - secondCluster.zCoordinate) / (firstCluster.radius - secondCluster.radius)),
38+ phi(o2::gpu::GPUCommonMath::ATan2(firstCluster.yCoordinate - secondCluster.yCoordinate, firstCluster.xCoordinate - secondCluster.xCoordinate)),
39+ mTime(t) {}
40+
41+ GPUhdi () Tracklet(const int idx0, const int idx1, float tanL, float phi, const TimeEstBC& t)
42+ : firstClusterIndex(idx0),
43+ secondClusterIndex(idx1),
44+ tanLambda(tanL),
45+ phi(phi),
46+ mTime(t) {}
47+ GPUhdi () bool operator<(const Tracklet& o) const noexcept
48+ {
49+ return (firstClusterIndex != o.firstClusterIndex ) ? firstClusterIndex < o.firstClusterIndex : secondClusterIndex < o.secondClusterIndex ;
50+ }
51+ GPUhdi () bool operator==(const Tracklet& o) const noexcept
4352 {
44- return firstClusterIndex < 0 || secondClusterIndex < 0 ;
53+ return firstClusterIndex == o. firstClusterIndex && secondClusterIndex == o. secondClusterIndex ;
4554 }
4655 GPUhdi () bool isCompatible(const Tracklet& o) const { return mTime .isCompatible (o.mTime ); }
47- GPUhdi () unsigned char operator <(const Tracklet&) const ;
4856 GPUhd () void print() const
4957 {
5058 LOGP (info, " TRKLT: fClIdx:{} sClIdx:{} ts:{}+/-{} TgL={} Phi={}" , firstClusterIndex, secondClusterIndex, mTime .getTimeStamp (), mTime .getTimeStampError (), tanLambda, phi);
@@ -54,44 +62,13 @@ struct Tracklet final {
5462
5563 int firstClusterIndex{constants::UnusedIndex};
5664 int secondClusterIndex{constants::UnusedIndex};
57- float tanLambda{- 999 };
58- float phi{- 999 };
65+ float tanLambda{constants::UnsetValue };
66+ float phi{constants::UnsetValue };
5967 TimeEstBC mTime ;
6068
6169 ClassDefNV (Tracklet, 1 );
6270};
6371
64- GPUhdi () Tracklet::Tracklet(const int firstClusterOrderingIndex, const int secondClusterOrderingIndex,
65- const Cluster& firstCluster, const Cluster& secondCluster, const TimeEstBC& t)
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- mTime(t)
73- {
74- // Nothing to do
75- }
76-
77- GPUhdi () Tracklet::Tracklet(const int idx0, const int idx1, float tanL, float phi, const TimeEstBC& t)
78- : firstClusterIndex(idx0),
79- secondClusterIndex(idx1),
80- tanLambda(tanL),
81- phi(phi),
82- mTime(t)
83- {
84- // Nothing to do
85- }
86-
87- GPUhdi () unsigned char Tracklet::operator<(const Tracklet& t) const
88- {
89- if (isEmpty ()) {
90- return false ;
91- }
92- return true ;
93- }
94-
9572} // namespace o2::its
9673
9774#endif /* TRACKINGITS_INCLUDE_TRACKLET_H_ */
0 commit comments