1313#define MEAN_VERTEX_OBJECT_H_
1414
1515#include < array>
16- #include " Rtypes.h"
17-
1816#include " Framework/Logger.h"
1917#include " ReconstructionDataFormats/Vertex.h"
2018
@@ -28,71 +26,65 @@ class MeanVertexObject : public VertexBase
2826 public:
2927 MeanVertexObject (float x, float y, float z, float sigmax, float sigmay, float sigmaz, float slopeX, float slopeY)
3028 {
31- gpu::gpustd::array<float , kNCov > cov;
32- cov[CovElems::kCovXX ] = sigmax;
33- cov[CovElems::kCovYY ] = sigmay;
34- cov[CovElems::kCovZZ ] = sigmaz;
3529 setXYZ (x, y, z);
36- setCov (cov );
30+ setSigma ({sigmax, sigmay, sigmaz} );
3731 mSlopeX = slopeX;
3832 mSlopeY = slopeY;
3933 }
4034 MeanVertexObject (std::array<float , 3 > pos, std::array<float , 3 > sigma, float slopeX, float slopeY)
4135 {
4236 math_utils::Point3D<float > p (pos[0 ], pos[1 ], pos[2 ]);
43- gpu::gpustd::array<float , kNCov > cov;
44- cov[CovElems::kCovXX ] = sigma[0 ];
45- cov[CovElems::kCovYY ] = sigma[1 ];
46- cov[CovElems::kCovZZ ] = sigma[2 ];
4737 setPos (p);
48- setCov (cov );
38+ setSigma (sigma );
4939 mSlopeX = slopeX;
5040 mSlopeY = slopeY;
5141 }
5242 MeanVertexObject () = default ;
5343 ~MeanVertexObject () = default ;
5444 MeanVertexObject (const MeanVertexObject& other) = default ;
5545 MeanVertexObject (MeanVertexObject&& other) = default ;
56- MeanVertexObject& operator =(MeanVertexObject& other) = default ;
46+ MeanVertexObject& operator =(const MeanVertexObject& other) = default ;
5747 MeanVertexObject& operator =(MeanVertexObject&& other) = default ;
5848
5949 void set (int icoord, float val);
6050 void setSigma (int icoord, float val);
61- void setSigmaX (float val) { setSigmaX2 (val); }
62- void setSigmaY (float val) { setSigmaY2 (val); }
63- void setSigmaZ (float val) { setSigmaZ2 (val); }
6451 void setSigma (std::array<float , 3 > val)
6552 {
66- setSigmaX2 (val[0 ]);
67- setSigmaY2 (val[1 ]);
68- setSigmaZ2 (val[2 ]);
53+ setSigmaX (val[0 ]);
54+ setSigmaY (val[1 ]);
55+ setSigmaZ (val[2 ]);
6956 }
7057 void setSlopeX (float val) { mSlopeX = val; }
7158 void setSlopeY (float val) { mSlopeY = val; }
7259
7360 math_utils::Point3D<float >& getPos () { return getXYZ (); }
7461 math_utils::Point3D<float > getPos () const { return getXYZ (); }
75- float getSigmaX () const { return getSigmaX2 (); }
76- float getSigmaY () const { return getSigmaY2 (); }
77- float getSigmaZ () const { return getSigmaZ2 (); }
78- const gpu::gpustd::array<float , kNCov >& getSigma () const { return getCov (); }
7962
8063 float getSlopeX () const { return mSlopeX ; }
8164 float getSlopeY () const { return mSlopeY ; }
8265
83- float getXAtZ (float z) { return getX () + mSlopeX * (z - getZ ()); }
84- float getYAtZ (float z) { return getY () + mSlopeY * (z - getZ ()); }
66+ float getXAtZ (float z) const { return getX () + mSlopeX * (z - getZ ()); }
67+ float getYAtZ (float z) const { return getY () + mSlopeY * (z - getZ ()); }
8568
8669 void print () const ;
8770 std::string asString () const ;
8871
89- VertexBase getMeanVertex (float z)
72+ VertexBase getMeanVertex (float z) const
9073 {
74+ // set z-dependent x,z, assuming that the cov.matrix is already set
9175 VertexBase v = *this ;
9276 v.setXYZ (getXAtZ (z), getYAtZ (z), z);
9377 return v;
9478 }
9579
80+ void setMeanXYVertexAtZ (VertexBase& v, float z) const
81+ {
82+ float dz = z - getZ ();
83+ v.setX (getX () + mSlopeX * dz);
84+ v.setY (getY () + mSlopeY * dz);
85+ v.setZ (z);
86+ }
87+
9688 const VertexBase& getMeanVertex () const
9789 {
9890 return (const VertexBase&)(*this );
0 commit comments