Skip to content

Commit 7e23409

Browse files
committed
Methods for Kalman filter linearized wrt reference track
1 parent f9f3798 commit 7e23409

File tree

6 files changed

+461
-26
lines changed

6 files changed

+461
-26
lines changed

DataFormats/Reconstruction/include/ReconstructionDataFormats/TrackParametrization.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ class TrackParametrization
229229
// parameters manipulation
230230
GPUd() bool correctForELoss(value_t xrho, bool anglecorr = false);
231231
GPUd() bool rotateParam(value_t alpha);
232+
GPUd() bool rotateParam(value_t& alpha, value_t& ca, value_t& sa);
232233
GPUd() bool propagateParamTo(value_t xk, value_t b);
233234
GPUd() bool propagateParamTo(value_t xk, const dim3_t& b);
234235
GPUd() void invertParam();

DataFormats/Reconstruction/include/ReconstructionDataFormats/TrackParametrizationWithError.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,11 @@ class TrackParametrizationWithError : public TrackParametrization<value_T>
8989
// parameters + covmat manipulation
9090
GPUd() bool testRotate(value_t alpha) const;
9191
GPUd() bool rotate(value_t alpha);
92-
GPUd() bool propagateTo(value_t xk, value_t b);
92+
GPUd() bool rotate(value_t alpha, TrackParametrization<value_T>& linRef, value_t bz);
93+
GPUd() bool propagateTo(value_t xk, value_t bz);
94+
GPUd() bool propagateTo(value_t xk, TrackParametrization<value_T>& linRef0, value_t bz);
9395
GPUd() bool propagateTo(value_t xk, const dim3_t& b);
94-
GPUd() bool propagateToDCA(const o2::dataformats::VertexBase& vtx, value_t b, o2::dataformats::DCA* dca = nullptr, value_t maxD = 999.f);
96+
GPUd() bool propagateToDCA(const o2::dataformats::VertexBase& vtx, value_t bz, o2::dataformats::DCA* dca = nullptr, value_t maxD = 999.f);
9597
GPUd() void invert();
9698
GPUd() value_t getPredictedChi2(const dim2_t& p, const dim3_t& cov) const;
9799
GPUd() value_t getPredictedChi2Quiet(const dim2_t& p, const dim3_t& cov) const;
@@ -118,7 +120,7 @@ class TrackParametrizationWithError : public TrackParametrization<value_T>
118120
GPUd() bool update(const BaseCluster<T>& p);
119121

120122
GPUd() bool correctForMaterial(value_t x2x0, value_t xrho, bool anglecorr = false);
121-
123+
GPUd() bool correctForMaterial(TrackParametrization<value_T>& linRef, value_t x2x0, value_t xrho, bool anglecorr = false);
122124
GPUd() void resetCovariance(value_t s2 = 0);
123125
GPUd() void checkCovariance();
124126
GPUd() void checkCorrelations();

DataFormats/Reconstruction/src/TrackParametrization.cxx

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,38 @@ GPUd() bool TrackParametrization<value_T>::rotateParam(value_t alpha)
188188
return true;
189189
}
190190

191+
//______________________________________________________________
192+
template <typename value_T>
193+
GPUd() bool TrackParametrization<value_T>::rotateParam(value_t& alpha, value_t& ca, value_t& sa)
194+
{
195+
// rotate to alpha frame
196+
if (gpu::CAMath::Abs(getSnp()) > constants::math::Almost1) {
197+
LOGP(debug, "Precondition is not satisfied: |sin(phi)|>1 ! {:f}", getSnp());
198+
return false;
199+
}
200+
//
201+
math_utils::detail::bringToPMPi<value_t>(alpha);
202+
math_utils::detail::sincos(alpha - getAlpha(), sa, ca);
203+
value_t snp = getSnp(), csp = gpu::CAMath::Sqrt((1.f - snp) * (1.f + snp)); // Improve precision
204+
// RS: check if rotation does no invalidate track model (cos(local_phi)>=0, i.e. particle direction in local frame is along the X axis
205+
if ((csp * ca + snp * sa) < 0) {
206+
// LOGF(warning,"Rotation failed: local cos(phi) would become {:.2f}", csp * ca + snp * sa);
207+
return false;
208+
}
209+
//
210+
value_t tmp = snp * ca - csp * sa;
211+
if (gpu::CAMath::Abs(tmp) > constants::math::Almost1) {
212+
LOGP(debug, "Rotation failed: new snp {:.2f}", tmp);
213+
return false;
214+
}
215+
value_t xold = getX(), yold = getY();
216+
mAlpha = alpha;
217+
mX = xold * ca + yold * sa;
218+
mP[kY] = -xold * sa + yold * ca;
219+
mP[kSnp] = tmp;
220+
return true;
221+
}
222+
191223
//____________________________________________________________
192224
template <typename value_T>
193225
GPUd() bool TrackParametrization<value_T>::propagateParamTo(value_t xk, const dim3_t& b)

0 commit comments

Comments
 (0)