2121namespace o2 ::gpu
2222{
2323
24+ struct Covariance {
25+ float m00, m01, m02, m03, m04, m05, m06, m07, m08, m09, m10, m11, m12, m13, m14;
26+ constexpr operator float *() { return &m00; }
27+ constexpr operator const float *() const { return &m00; }
28+ constexpr float & operator [](int32_t i) { return *((&m00) + i); }
29+ constexpr const float & operator [](int32_t i) const { return *((&m00) + i); }
30+ };
31+
32+ struct Parameters {
33+ float mY , mZ , mSinPhi , mDzDs , mQPt ;
34+ constexpr operator float *() { return &mY ; }
35+ constexpr operator const float *() const { return &mY ; }
36+ constexpr float & operator [](int32_t i) { return *((&mY ) + i); }
37+ constexpr const float & operator [](int32_t i) const { return *((&mY ) + i); }
38+ };
39+
2440/* *
2541 * @class GPUTPCBaseTrackParam
2642 *
@@ -32,31 +48,6 @@ template <template <class> class F>
3248struct GPUTPCBaseTrackParamSkeleton {
3349 MEMLAYOUT_MEMBERFUNCTIONS (GPUTPCBaseTrackParamSkeleton, F, mX , mC , mZOffset , mP )
3450
35- GPUhd () void ElementwiseAssignment (GPUTPCBaseTrackParamSkeleton<MemLayout::const_reference> v) {
36- mX = v.mX ;
37- mC [0 ] = v.mC [0 ];
38- mC [1 ] = v.mC [1 ];
39- mC [2 ] = v.mC [2 ];
40- mC [3 ] = v.mC [3 ];
41- mC [4 ] = v.mC [4 ];
42- mC [5 ] = v.mC [5 ];
43- mC [6 ] = v.mC [6 ];
44- mC [7 ] = v.mC [7 ];
45- mC [8 ] = v.mC [8 ];
46- mC [9 ] = v.mC [9 ];
47- mC [10 ] = v.mC [10 ];
48- mC [11 ] = v.mC [11 ];
49- mC [12 ] = v.mC [12 ];
50- mC [13 ] = v.mC [13 ];
51- mC [14 ] = v.mC [14 ];
52- mZOffset = v.mZOffset ;
53- mP [0 ] = v.mP [0 ];
54- mP [1 ] = v.mP [1 ];
55- mP [2 ] = v.mP [2 ];
56- mP [3 ] = v.mP [3 ];
57- mP [4 ] = v.mP [4 ];
58- }
59-
6051 GPUd () float X () const { return mX ; }
6152 GPUd () float Y () const { return mP [0 ]; }
6253 GPUd () float Z () const { return mP [1 ]; }
@@ -98,13 +89,39 @@ struct GPUTPCBaseTrackParamSkeleton {
9889 GPUd () void SetQPt (float v) { mP [4 ] = v; }
9990 GPUd () void SetZOffset (float v) { mZOffset = v; }
10091
92+ // Needed for iterators and std::sort
93+ template <template <class > class F_in >
94+ constexpr GPUTPCBaseTrackParamSkeleton& operator =(GPUTPCBaseTrackParamSkeleton<F_in> other) {
95+ mX = other.mX ;
96+ mC = other.mC ;
97+ mZOffset = other.mZOffset ;
98+ mP = other.mP ;
99+ return *this ;
100+ }
101+ // GPUTPCBaseTrackParamSkeleton() = default;
102+ // GPUTPCBaseTrackParamSkeleton(F<float> X, F<Covariance> C, F<float> ZOffset, F<Parameters> P) : mX(X), mC(C), mZOffset(ZOffset), mP(P) { }
103+ /* GPUTPCBaseTrackParamSkeleton(const GPUTPCBaseTrackParamSkeleton& other) = default;
104+ GPUTPCBaseTrackParamSkeleton& operator=(const GPUTPCBaseTrackParamSkeleton& other) {
105+ mX = other.mX;
106+ mC = other.mC;
107+ mZOffset = other.mZOffset;
108+ mP = other.mP;
109+ return *this;
110+ }
111+ friend void swap(GPUTPCBaseTrackParamSkeleton& a, GPUTPCBaseTrackParamSkeleton& b) {
112+ std::swap(a.mX, b.mX);
113+ std::swap(a.mC, b.mC);
114+ std::swap(a.mZOffset, b.mZOffset);
115+ std::swap(a.mP, b.mP);
116+ }*/
117+
101118 // WARNING, Track Param Data is copied in the GPU Tracklet Constructor element by element instead of using copy constructor!!!
102119 // This is neccessary for performance reasons!!!
103120 // Changes to Elements of this class therefore must also be applied to TrackletConstructor!!!
104121 F<float > mX ; // x position
105- F<float [ 15 ] > mC ; // the covariance matrix for Y,Z,SinPhi,..
122+ F<Covariance > mC ; // the covariance matrix for Y,Z,SinPhi,..
106123 F<float > mZOffset ; // z offset
107- F<float [ 5 ] > mP ; // 'active' track parameters: Y, Z, SinPhi, DzDs, q/Pt
124+ F<Parameters > mP ; // 'active' track parameters: Y, Z, SinPhi, DzDs, q/Pt
108125};
109126
110127using GPUTPCBaseTrackParam = GPUTPCBaseTrackParamSkeleton<MemLayout::value>;
0 commit comments