@@ -27,7 +27,6 @@ template <typename value_T = float>
2727class TrackParametrizationWithError : public TrackParametrization <value_T>
2828{ // track+error parameterization
2929 public:
30-
3130 using typename TrackParametrization<value_T>::value_t ;
3231 using typename TrackParametrization<value_T>::dim3_t ;
3332 using typename TrackParametrization<value_T>::dim2_t ;
@@ -53,9 +52,11 @@ class TrackParametrizationWithError : public TrackParametrization<value_T>
5352 GPUdDefault () ~TrackParametrizationWithError () = default ;
5453 using TrackParametrization<value_T>::TrackParametrization;
5554
55+ using TrackParametrization<value_T>::set;
5656 GPUd () void set (value_t x, value_t alpha, const params_t & par, const covMat_t& cov, int charge = 1 , const PID pid = PID::Pion);
57+ GPUd () void set (value_t x, value_t alpha, const value_t * par, const value_t * cov, int charge = 1 , const PID pid = PID::Pion);
5758 GPUd () void set (const dim3_t & xyz, const dim3_t & pxpypz, const gpu::gpustd::array<value_t , kLabCovMatSize >& cv, int sign, bool sectorAlpha = true , const PID pid = PID::Pion);
58- GPUd () const value_t * getCov () const ;
59+ GPUd () const covMat_t& getCov () const ;
5960 GPUd () value_t getSigmaY2 () const ;
6061 GPUd () value_t getSigmaZY () const ;
6162 GPUd () value_t getSigmaZ2 () const ;
@@ -89,6 +90,7 @@ class TrackParametrizationWithError : public TrackParametrization<value_T>
8990 GPUd () void invert ();
9091
9192 GPUd () value_t getPredictedChi2 (const dim2_t & p, const dim3_t & cov) const ;
93+ GPUd () value_t getPredictedChi2 (const value_t * p, const value_t * cov) const ;
9294
9395 template <typename T>
9496 GPUd () value_t getPredictedChi2 (const BaseCluster<T>& p) const ;
@@ -100,6 +102,7 @@ class TrackParametrizationWithError : public TrackParametrization<value_T>
100102 bool update (const TrackParametrizationWithError& rhs);
101103
102104 GPUd () bool update (const dim2_t & p, const dim3_t & cov);
105+ GPUd () bool update (const value_t * p, const value_t * cov);
103106
104107 template <typename T>
105108 GPUd () bool update (const BaseCluster<T>& p);
@@ -108,13 +111,16 @@ class TrackParametrizationWithError : public TrackParametrization<value_T>
108111
109112 GPUd () void resetCovariance (value_t s2 = 0 );
110113 GPUd () void checkCovariance ();
114+ GPUd () void setCov (value_t v, size_t i, size_t j);
111115 GPUd () void setCov (value_t v, int i);
116+ GPUd () void setCov (const covMat_t& mat);
112117
113- GPUd () void updateCov (const value_t delta[kCovMatSize ]);
114- GPUd () void updateCov (value_t delta, int i);
118+ GPUd () void updateCov (const covMat_t& delta);
119+ GPUd () void updateCov (value_t delta, size_t i, size_t j);
120+ GPUd () void updateCov (value_t delta, size_t i);
115121
116122 protected:
117- value_t mC [ kCovMatSize ] = {0 .f }; // 15 covariance matrix elements
123+ covMat_t mC {0 .f }; // 15 covariance matrix elements
118124
119125 ClassDefNV (TrackParametrizationWithError, 2 );
120126};
@@ -140,6 +146,13 @@ GPUdi() TrackParametrizationWithError<value_T>::TrackParametrizationWithError(va
140146// __________________________________________________________________________
141147template <typename value_T>
142148GPUdi () void TrackParametrizationWithError<value_T>::set(value_t x, value_t alpha, const params_t & par, const covMat_t& cov, int charge, const PID pid)
149+ {
150+ set (x, alpha, par.data (), cov.data (), charge, pid);
151+ }
152+
153+ // __________________________________________________________________________
154+ template <typename value_T>
155+ GPUdi () void TrackParametrizationWithError<value_T>::set(value_t x, value_t alpha, const value_t * par, const value_t * cov, int charge, const PID pid)
143156{
144157 TrackParametrization<value_T>::set (x, alpha, par, charge, pid);
145158 for (int i = 0 ; i < kCovMatSize ; i++) {
@@ -149,7 +162,7 @@ GPUdi() void TrackParametrizationWithError<value_T>::set(value_t x, value_t alph
149162
150163// __________________________________________________________________________
151164template <typename value_T>
152- GPUdi () auto TrackParametrizationWithError<value_T>::getCov() const -> const value_t *
165+ GPUdi () auto TrackParametrizationWithError<value_T>::getCov() const -> const covMat_t&
153166{
154167 return mC ;
155168}
@@ -283,6 +296,20 @@ GPUdi() auto TrackParametrizationWithError<value_T>::getPredictedChi2(const Base
283296 return getPredictedChi2 (pyz, cov);
284297}
285298
299+ // ______________________________________________
300+ template <typename value_T>
301+ GPUdi () auto TrackParametrizationWithError<value_T>::getPredictedChi2(const dim2_t & p, const dim3_t & cov) const -> value_t
302+ {
303+ return getPredictedChi2 (p.data (), cov.data ());
304+ }
305+
306+ // ______________________________________________
307+ template <typename value_T>
308+ GPUdi () bool TrackParametrizationWithError<value_T>::update(const dim2_t & p, const dim3_t & cov)
309+ {
310+ return update (p.data (), cov.data ());
311+ }
312+
286313// __________________________________________________________________________
287314template <typename value_T>
288315template <typename T>
@@ -302,16 +329,36 @@ GPUdi() void TrackParametrizationWithError<value_T>::setCov(value_t v, int i)
302329
303330// __________________________________________________________________________
304331template <typename value_T>
305- GPUdi () void TrackParametrizationWithError<value_T>::updateCov(value_t delta, int i)
332+ GPUdi () void TrackParametrizationWithError<value_T>::setCov(value_t v, size_t i, size_t j)
333+ {
334+ mC [CovarMap[i][j]] = v;
335+ }
336+
337+ template <typename value_T>
338+ GPUdi () void TrackParametrizationWithError<value_T>::setCov(const covMat_t& cov)
339+ {
340+ mC = cov;
341+ }
342+
343+ // __________________________________________________________________________
344+ template <typename value_T>
345+ GPUdi () void TrackParametrizationWithError<value_T>::updateCov(value_t delta, size_t i, size_t j)
346+ {
347+ mC [CovarMap[i][j]] += delta;
348+ }
349+
350+ // __________________________________________________________________________
351+ template <typename value_T>
352+ GPUdi () void TrackParametrizationWithError<value_T>::updateCov(value_t delta, size_t i)
306353{
307354 mC [i] += delta;
308355}
309356
310357// __________________________________________________________________________
311358template <typename value_T>
312- GPUdi () void TrackParametrizationWithError<value_T>::updateCov(const value_t delta[ kCovMatSize ] )
359+ GPUdi () void TrackParametrizationWithError<value_T>::updateCov(const covMat_t& delta)
313360{
314- for (int i = kCovMatSize ; i--; ) {
361+ for (size_t i = 0 ; i < kCovMatSize ; ++i ) {
315362 mC [i] += delta[i];
316363 }
317364}
0 commit comments