Project
Loading...
Searching...
No Matches
ClusterLines.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.
11
12#ifndef O2_ITS_CLUSTERLINES_H
13#define O2_ITS_CLUSTERLINES_H
14
15#include <gsl/span>
16#include <vector>
17#include <array>
18#include <Math/SMatrix.h>
19#include <Math/SVector.h>
20#include "ITStracking/Cluster.h"
23#include "GPUCommonRtypes.h"
24
25namespace o2::its
26{
27
28struct Line final {
29#if !defined(__HIPCC__) && !defined(__CUDACC__) // hide the class completely for gpu-cc
32
33 Line() = default;
34 Line(const Tracklet&, const Cluster*, const Cluster*);
35 bool operator==(const Line&) const = default;
36
37 static float getDistance2FromPoint(const Line& line, const std::array<float, 3>& point);
38 static float getDistanceFromPoint(const Line& line, const std::array<float, 3>& point);
39 static SMatrix3f getDCAComponents(const Line& line, const std::array<float, 3>& point);
40 static float getDCA2(const Line&, const Line&, const float precision = constants::Tolerance);
41 static float getDCA(const Line&, const Line&, const float precision = constants::Tolerance);
42 bool isEmpty() const noexcept;
43 void print() const;
44
48
50#endif
51};
52
53class ClusterLines final
54{
55#if !defined(__HIPCC__) && !defined(__CUDACC__) // hide the class completely for gpu-cc
59
60 public:
61 ClusterLines() = default;
62 ClusterLines(const int firstLabel, const Line& firstLine, const int secondLabel, const Line& secondLine);
63 ClusterLines(gsl::span<const int> lineLabels, gsl::span<const Line> lines);
64 void add(const int lineLabel, const Line& line);
66 void accumulate(const Line& line);
67 bool isValid() const noexcept { return mIsValid; }
68 auto const& getVertex() const { return mVertex; }
69 const float* getRMS2() const { return mRMS2.Array(); }
70 float getAvgDistance2() const { return mAvgDistance2; }
71 auto getSize() const noexcept { return mLabels.size(); }
72 auto& getLabels() const noexcept { return mLabels; }
73 const auto& getTimeStamp() const noexcept { return mTime; }
74 bool operator==(const ClusterLines& rhs) const noexcept;
75 float getR2() const noexcept { return (mVertex[0] * mVertex[0]) + (mVertex[1] * mVertex[1]); }
76 float getR() const noexcept { return std::sqrt(getR2()); }
77
78 protected:
79 SMatrix3 mAMatrix; // AX=B, symmetric normal matrix
80 SVector3 mBMatrix; // AX=B, right-hand side
81 std::array<float, 3> mVertex = {}; // cluster centroid position
82 SMatrix3f mRMS2; // symmetric matrix: diagonal is RMS2
83 float mAvgDistance2 = 0.f; // substitute for chi2
84 bool mIsValid = false; // true if linear system was solved successfully
85 TimeEstBC mTime; // time stamp
86 std::vector<int> mLabels; // contributing labels
87
89#endif
90};
91
92} // namespace o2::its
93#endif /* O2_ITS_CLUSTERLINES_H */
void accumulate(const Line &line)
float getR2() const noexcept
const auto & getTimeStamp() const noexcept
bool operator==(const ClusterLines &rhs) const noexcept
auto & getLabels() const noexcept
bool isValid() const noexcept
auto getSize() const noexcept
float getAvgDistance2() const
void add(const int lineLabel, const Line &line)
std::vector< int > mLabels
ClassDefNV(ClusterLines, 1)
std::array< float, 3 > mVertex
float getR() const noexcept
auto const & getVertex() const
const float * getRMS2() const
GLenum GLint GLint * precision
Definition glcorearb.h:1899
constexpr float Tolerance
Definition Constants.h:33
SVector3f cosinesDirector
void print() const
bool operator==(const Line &) const =default
ClassDefNV(Line, 1)
static float getDistance2FromPoint(const Line &line, const std::array< float, 3 > &point)
bool isEmpty() const noexcept
static float getDCA2(const Line &, const Line &, const float precision=constants::Tolerance)
static float getDCA(const Line &, const Line &, const float precision=constants::Tolerance)
TimeEstBC mTime
static float getDistanceFromPoint(const Line &line, const std::array< float, 3 > &point)
SVector3f originPoint
static SMatrix3f getDCAComponents(const Line &line, const std::array< float, 3 > &point)
Line()=default