diff --git a/Detectors/ITSMFT/ITS/tracking/include/ITStracking/Cluster.h b/Detectors/ITSMFT/ITS/tracking/include/ITStracking/Cluster.h index 34014d858648b..fb5f1a13ef3d2 100644 --- a/Detectors/ITSMFT/ITS/tracking/include/ITStracking/Cluster.h +++ b/Detectors/ITSMFT/ITS/tracking/include/ITStracking/Cluster.h @@ -18,6 +18,7 @@ #include #include "ITStracking/Constants.h" +#include "ITStracking/MathUtils.h" #include "GPUCommonRtypes.h" #include "GPUCommonDef.h" @@ -29,26 +30,21 @@ class IndexTableUtils; struct Cluster final { GPUhdDefault() Cluster() = default; - GPUhd() Cluster(const float x, const float y, const float z, const int idx); - template - GPUhd() Cluster(const int, const IndexTableUtils& utils, const Cluster&); - template - GPUhd() Cluster(const int, const float3&, const IndexTableUtils& utils, const Cluster&); - GPUhdDefault() Cluster(const Cluster&) = default; - GPUhdDefault() Cluster(Cluster&&) noexcept = default; - GPUhdDefault() ~Cluster() = default; - - GPUhdDefault() Cluster& operator=(const Cluster&) = default; - GPUhdDefault() Cluster& operator=(Cluster&&) noexcept = default; - GPUhdDefault() bool operator==(const Cluster&) const = default; - + GPUhd() Cluster(const float x, const float y, const float z, const int idx) + : xCoordinate(x), + yCoordinate(y), + zCoordinate(z), + phi(math_utils::computeNormalizedPhi(x, y)), + radius(math_utils::hypot(x, y)), + clusterId(idx), + indexTableBinIndex(0) {} GPUhd() void print() const; - float xCoordinate{-999.f}; - float yCoordinate{-999.f}; - float zCoordinate{-999.f}; - float phi{-999.f}; - float radius{-999.f}; + float xCoordinate{constants::UnsetValue}; + float yCoordinate{constants::UnsetValue}; + float zCoordinate{constants::UnsetValue}; + float phi{constants::UnsetValue}; + float radius{constants::UnsetValue}; int clusterId{constants::UnusedIndex}; int indexTableBinIndex{constants::UnusedIndex}; @@ -57,23 +53,18 @@ struct Cluster final { struct TrackingFrameInfo final { GPUhdDefault() TrackingFrameInfo() = default; - GPUhd() TrackingFrameInfo(float x, float y, float z, float xTF, float alpha, std::array&& posTF, std::array&& covTF); - GPUhdDefault() TrackingFrameInfo(const TrackingFrameInfo&) = default; - GPUhdDefault() TrackingFrameInfo(TrackingFrameInfo&&) noexcept = default; - GPUhdDefault() ~TrackingFrameInfo() = default; - - GPUhdDefault() TrackingFrameInfo& operator=(const TrackingFrameInfo&) = default; - GPUhdDefault() TrackingFrameInfo& operator=(TrackingFrameInfo&&) = default; + GPUhd() TrackingFrameInfo(float x, float y, float z, float xTF, float alpha, const std::array& posTF, const std::array& covTF) + : xCoordinate(x), yCoordinate(y), zCoordinate(z), xTrackingFrame(xTF), alphaTrackingFrame(alpha), positionTrackingFrame(posTF), covarianceTrackingFrame(covTF) {} GPUhd() void print() const; - float xCoordinate{-999.f}; - float yCoordinate{-999.f}; - float zCoordinate{-999.f}; - float xTrackingFrame{-999.f}; - float alphaTrackingFrame{-999.f}; - std::array positionTrackingFrame = {-999.f, -999.f}; - std::array covarianceTrackingFrame = {-999.f, -999.f, -999.f}; + float xCoordinate{constants::UnsetValue}; + float yCoordinate{constants::UnsetValue}; + float zCoordinate{constants::UnsetValue}; + float xTrackingFrame{constants::UnsetValue}; + float alphaTrackingFrame{constants::UnsetValue}; + std::array positionTrackingFrame{constants::UnsetValue, constants::UnsetValue}; + std::array covarianceTrackingFrame{constants::UnsetValue, constants::UnsetValue, constants::UnsetValue}; ClassDefNV(TrackingFrameInfo, 1); }; diff --git a/Detectors/ITSMFT/ITS/tracking/include/ITStracking/MathUtils.h b/Detectors/ITSMFT/ITS/tracking/include/ITStracking/MathUtils.h index 950d8c0a9117f..2f69758de36c4 100644 --- a/Detectors/ITSMFT/ITS/tracking/include/ITStracking/MathUtils.h +++ b/Detectors/ITSMFT/ITS/tracking/include/ITStracking/MathUtils.h @@ -43,6 +43,11 @@ GPUhdi() constexpr float getNormalizedPhi(float phi) return phi; } +GPUhdi() constexpr float computeNormalizedPhi(float x, float y) +{ + return getNormalizedPhi(computePhi(x, y)); +} + GPUhdi() float computeCurvature(float x1, float y1, float x2, float y2, float x3, float y3) { // in case the triangle is degenerate we return infinite curvature. diff --git a/Detectors/ITSMFT/ITS/tracking/src/Cluster.cxx b/Detectors/ITSMFT/ITS/tracking/src/Cluster.cxx index 8c01fb25c545e..1ff327d115d89 100644 --- a/Detectors/ITSMFT/ITS/tracking/src/Cluster.cxx +++ b/Detectors/ITSMFT/ITS/tracking/src/Cluster.cxx @@ -8,77 +8,16 @@ // 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 Cluster.cxx -/// \brief -/// -#include "GPUCommonMath.h" -#include "GPUCommonArray.h" #include "ITStracking/Cluster.h" -#include "ITStracking/Definitions.h" -#include "ITStracking/MathUtils.h" -#include "ITStracking/IndexTableUtils.h" using namespace o2::its; -using math_utils::computePhi; -using math_utils::getNormalizedPhi; - -Cluster::Cluster(const float x, const float y, const float z, const int index) - : xCoordinate{x}, - yCoordinate{y}, - zCoordinate{z}, - phi{getNormalizedPhi(computePhi(x, y))}, - radius{o2::gpu::GPUCommonMath::Hypot(x, y)}, - clusterId{index}, - indexTableBinIndex{0} -{ - // Nothing to do -} - -template -Cluster::Cluster(const int layerIndex, const IndexTableUtils& utils, const Cluster& other) - : xCoordinate{other.xCoordinate}, - yCoordinate{other.yCoordinate}, - zCoordinate{other.zCoordinate}, - phi{getNormalizedPhi(computePhi(other.xCoordinate, other.yCoordinate))}, - radius{o2::gpu::GPUCommonMath::Hypot(other.xCoordinate, other.yCoordinate)}, - clusterId{other.clusterId}, - indexTableBinIndex{utils.getBinIndex(utils.getZBinIndex(layerIndex, zCoordinate), - utils.getPhiBinIndex(phi))} -//, montecarloId{ other.montecarloId } -{ - // Nothing to do -} - -template -Cluster::Cluster(const int layerIndex, const float3& primaryVertex, const IndexTableUtils& utils, const Cluster& other) - : xCoordinate{other.xCoordinate}, - yCoordinate{other.yCoordinate}, - zCoordinate{other.zCoordinate}, - phi{getNormalizedPhi( - computePhi(xCoordinate - primaryVertex.x, yCoordinate - primaryVertex.y))}, - radius{o2::gpu::GPUCommonMath::Hypot(xCoordinate - primaryVertex.x, yCoordinate - primaryVertex.y)}, - clusterId{other.clusterId}, - indexTableBinIndex{utils.getBinIndex(utils.getZBinIndex(layerIndex, zCoordinate), - utils.getPhiBinIndex(phi))} -{ - // Nothing to do -} - GPUhd() void Cluster::print() const { printf("Cluster: %f %f %f %f %f %d %d\n", xCoordinate, yCoordinate, zCoordinate, phi, radius, clusterId, indexTableBinIndex); } -TrackingFrameInfo::TrackingFrameInfo(float x, float y, float z, float xTF, float alpha, std::array&& posTF, - std::array&& covTF) - : xCoordinate{x}, yCoordinate{y}, zCoordinate{z}, xTrackingFrame{xTF}, alphaTrackingFrame{alpha}, positionTrackingFrame{posTF}, covarianceTrackingFrame{covTF} -{ - // Nothing to do -} - GPUhd() void TrackingFrameInfo::print() const { printf("x: %f y: %f z: %f xTF: %f alphaTF: %f posTF: %f %f covTF: %f %f %f\n",