Skip to content

Commit 9ccfeb0

Browse files
committed
Reco: Add cov setters for ind. elements
1 parent a5c604d commit 9ccfeb0

File tree

1 file changed

+14
-5
lines changed
  • DataFormats/Reconstruction/include/ReconstructionDataFormats

1 file changed

+14
-5
lines changed

DataFormats/Reconstruction/include/ReconstructionDataFormats/Vertex.h

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,17 @@ class VertexBase
4545
static constexpr int kNCov = 6;
4646
GPUhdDefault() VertexBase() = default;
4747
GPUhdDefault() ~VertexBase() = default;
48-
GPUhd() VertexBase(const math_utils::Point3D<float>& pos, const std::array<float, kNCov>& cov) : mPos(pos), mCov(cov)
48+
GPUhd() VertexBase(const float* pos, const float* cov)
4949
{
50+
mPos = math_utils::Point3D<float>(pos[0], pos[1], pos[2]);
51+
mCov[kCovXX] = cov[kCovXX];
52+
mCov[kCovXY] = cov[kCovXY];
53+
mCov[kCovXZ] = cov[kCovXZ];
54+
mCov[kCovYY] = cov[kCovYY];
55+
mCov[kCovYZ] = cov[kCovYZ];
56+
mCov[kCovZZ] = cov[kCovZZ];
5057
}
58+
GPUhd() VertexBase(const math_utils::Point3D<float>& pos, const std::array<float, kNCov>& cov) : mPos(pos), mCov(cov) {}
5159

5260
#if !defined(GPUCA_NO_FMT) && !defined(GPUCA_GPUCODE_DEVICE)
5361
void print() const;
@@ -58,6 +66,7 @@ class VertexBase
5866
GPUhd() float getX() const { return mPos.X(); }
5967
GPUhd() float getY() const { return mPos.Y(); }
6068
GPUhd() float getZ() const { return mPos.Z(); }
69+
GPUhd() float getR() const { return gpu::CAMath::Hypot(mPos.X(), mPos.Y()); }
6170
GPUd() float getSigmaX2() const { return mCov[kCovXX]; }
6271
GPUd() float getSigmaY2() const { return mCov[kCovYY]; }
6372
GPUd() float getSigmaZ2() const { return mCov[kCovZZ]; }
@@ -69,6 +78,7 @@ class VertexBase
6978
GPUd() float getSigmaZ() const { return gpu::CAMath::Sqrt(getSigmaZ2()); }
7079

7180
GPUd() const std::array<float, kNCov>& getCov() const { return mCov; }
81+
GPUd() float getCov(int e) const { return mCov[e]; }
7282

7383
GPUd() math_utils::Point3D<float> getXYZ() const { return mPos; }
7484
GPUd() math_utils::Point3D<float>& getXYZ() { return mPos; }
@@ -105,6 +115,7 @@ class VertexBase
105115
setSigmaYZ(syz);
106116
}
107117
GPUd() void setCov(const std::array<float, kNCov>& cov) { mCov = cov; }
118+
GPUd() void setCov(float c, int e) { mCov[e] = c; }
108119

109120
bool operator==(const VertexBase& other) const;
110121
bool operator!=(const VertexBase& other) const { return !(*this == other); }
@@ -133,10 +144,8 @@ class Vertex : public VertexBase
133144

134145
GPUhdDefault() Vertex() = default;
135146
GPUhdDefault() ~Vertex() = default;
136-
GPUhd() Vertex(const math_utils::Point3D<float>& pos, const std::array<float, kNCov>& cov, ushort nCont, float chi2)
137-
: VertexBase(pos, cov), mChi2(chi2), mNContributors(nCont)
138-
{
139-
}
147+
GPUhd() Vertex(const float* pos, const float* cov, ushort nCont, float chi2) : VertexBase(pos, cov), mChi2(chi2), mNContributors(nCont) {}
148+
GPUhd() Vertex(const math_utils::Point3D<float>& pos, const std::array<float, kNCov>& cov, ushort nCont, float chi2) : VertexBase(pos, cov), mChi2(chi2), mNContributors(nCont) {}
140149

141150
#if !defined(GPUCA_NO_FMT) && !defined(GPUCA_GPUCODE_DEVICE)
142151
void print() const;

0 commit comments

Comments
 (0)