Skip to content

Commit 4b45691

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

File tree

1 file changed

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

1 file changed

+16
-5
lines changed

DataFormats/Reconstruction/include/ReconstructionDataFormats/Vertex.h

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,19 @@ 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.SetX(pos[0]);
51+
mPos.SetY(pos[1]);
52+
mPos.SetZ(pos[2]);
53+
mCov[kCovXX] = cov[kCovXX];
54+
mCov[kCovXY] = cov[kCovXY];
55+
mCov[kCovXZ] = cov[kCovXZ];
56+
mCov[kCovYY] = cov[kCovYY];
57+
mCov[kCovYZ] = cov[kCovYZ];
58+
mCov[kCovZZ] = cov[kCovZZ];
5059
}
60+
GPUhd() VertexBase(const math_utils::Point3D<float>& pos, const std::array<float, kNCov>& cov) : mPos(pos), mCov(cov) {}
5161

5262
#if !defined(GPUCA_NO_FMT) && !defined(GPUCA_GPUCODE_DEVICE)
5363
void print() const;
@@ -58,6 +68,7 @@ class VertexBase
5868
GPUhd() float getX() const { return mPos.X(); }
5969
GPUhd() float getY() const { return mPos.Y(); }
6070
GPUhd() float getZ() const { return mPos.Z(); }
71+
GPUhd() float getR() const { return gpu::CAMath::Hypot(mPos.X(), mPos.Y()); }
6172
GPUd() float getSigmaX2() const { return mCov[kCovXX]; }
6273
GPUd() float getSigmaY2() const { return mCov[kCovYY]; }
6374
GPUd() float getSigmaZ2() const { return mCov[kCovZZ]; }
@@ -69,6 +80,7 @@ class VertexBase
6980
GPUd() float getSigmaZ() const { return gpu::CAMath::Sqrt(getSigmaZ2()); }
7081

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

7385
GPUd() math_utils::Point3D<float> getXYZ() const { return mPos; }
7486
GPUd() math_utils::Point3D<float>& getXYZ() { return mPos; }
@@ -105,6 +117,7 @@ class VertexBase
105117
setSigmaYZ(syz);
106118
}
107119
GPUd() void setCov(const std::array<float, kNCov>& cov) { mCov = cov; }
120+
GPUd() void setCov(float c, int e) { mCov[e] = c; }
108121

109122
bool operator==(const VertexBase& other) const;
110123
bool operator!=(const VertexBase& other) const { return !(*this == other); }
@@ -133,10 +146,8 @@ class Vertex : public VertexBase
133146

134147
GPUhdDefault() Vertex() = default;
135148
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-
}
149+
GPUhd() Vertex(const float* pos, const float* cov, ushort nCont, float chi2) : VertexBase(pos, cov), mChi2(chi2), mNContributors(nCont) {}
150+
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) {}
140151

141152
#if !defined(GPUCA_NO_FMT) && !defined(GPUCA_GPUCODE_DEVICE)
142153
void print() const;

0 commit comments

Comments
 (0)