11#ifndef KF_CORE_KfTrackParam_h
12#define KF_CORE_KfTrackParam_h 1
19#include <boost/serialization/access.hpp>
23#if !defined(NO_ROOT) && !XPU_IS_HIP_CUDA
41 friend class boost::serialization::access;
89 T
Z()
const {
return fZ; }
92 T
X()
const {
return fX; }
95 T
Y()
const {
return fY; }
128 T
C(
int i,
int j)
const
130 int ind = (j <= i) ? i * (1 + i) / 2 + j : j * (1 + j) / 2 + i;
138 template<
int i,
int j>
141 constexpr int ind = (j <= i) ? i * (1 + i) / 2 + j : j * (1 + j) / 2 + i;
305 return GetP() *
sqrt(t2 / (T(1.) + t2));
357 int ind = (j <= i) ? i * (1 + i) / 2 + j : j * (1 + j) / 2 + i;
365 template<
int i,
int j>
368 constexpr int ind = (j <= i) ? i * (1 + i) / 2 + j : j * (1 + j) / 2 + i;
457 template<
int i,
int j>
533 void ResetErrors(T c00, T c11, T c22, T c33, T c44, T c55, T c66);
537 std::string
ToString(
int i = -1)
const;
544 bool IsFinite(
bool printWhenWrong)
const;
550 bool IsConsistent(
bool printWhenWrong,
int nFilled)
const;
559 template<
class Archive>
585 template<
typename T1,
bool TDoAllA,
bool TDoAllB>
604 0., 0., 0., 0., 0., 1.,
605 0., 0., 0., 0., 0., 0., 1.};
622#if !defined(NO_ROOT) && !XPU_IS_HIP_CUDA
642#if !defined(NO_ROOT) && !XPU_IS_HIP_CUDA
659#if !defined(NO_ROOT) && !XPU_IS_HIP_CUDA
669#if !defined(NO_ROOT) && !XPU_IS_HIP_CUDA
692 T phiDTx = -
GetTy() / phiDdenom;
693 T phiDTy = +
GetTx() / phiDdenom;
699 T varPhi = phiDTx * phiDTx * varTx + phiDTy * phiDTy * varTy + T(2.) * phiDTx * phiDTy * covTxTy;
712 T thetaDdenom =
sqrt(sumSqSlopes) * (T(1.) + sumSqSlopes);
713 T thetaDTx =
GetTx() / thetaDdenom;
714 T thetaDTy =
GetTy() / thetaDdenom;
720 T varTheta = thetaDTx * thetaDTx * varTx + thetaDTy * thetaDTy * varTy + T(2.) * thetaDTx * thetaDTy * covTxTy;
722 return sqrt(varTheta);
728 template<
typename TdataA>
729 template<
typename TdataB,
bool TDoAllA,
bool TDoAllB>
732 auto copy = [&](TdataA& a,
const TdataB& b) {
786 fscal maxVi =
sqrt(1. + (ProtonMass<double> / minP) * (ProtonMass<double> / minP)) * SpeedOfLightInv<double>;
787 fscal minVi = SpeedOfLightInv<fscal>;
788 fscal vmean = minVi + 0.4 * (maxVi - minVi);
789 fscal dvi = (maxVi - vmean) / 3.;
std::string ToString(CbmCutId id)
Convert CbmCutId to a string representation.
Common constant definitions for the Kalman Filter library.
Collection of generic mathematical methods.
friend fvec sqrt(const fvec &a)
friend fvec log(const fvec &a)
Implementation selection for the SIMD utilities (VS or pseudo)
Scalar version of TrackParamBase.
T GetEta() const
Gets pseudo-rapidity.
ClassDefNV(TrackParamBaseScalar, 1)
It is a technical base class of kf::TrackParam.
T GetPx() const
Gets x-component of the momentum [GeV/ec].
T C00() const
Individual getters for covariance matrix elements.
void SetOneEntry(const int ia, const TrackParamBase< fvec > &Tb, const int ib)
void SetChiSqTime(T v)
Sets Chi-square of time measurements.
T Ndf() const
Gets NDF of track fit model.
T Vi() const
Gets inverse velocity [ns/cm].
T fChiSq
chi^2 of track fit, spatial measurements
T GetPhiError() const
Gets azimuthal angle error [rad].
T GetTxError() const
Gets error of slope along x-axis.
T GetVi() const
Gets inverse velocity [ns/cm] in downstream direction.
void SetCovariance(int i, int j, T val)
Get covariance matrix element.
void SetTx(T v)
Sets slope along x-axis.
T & Ndf()
Reference to NDF of track fit model.
T fQp
charge over momentum [ec/GeV]
T GetXError() const
Gets x position error [cm].
T GetPy() const
Gets y-component of the momentum [GeV/ec].
void Set(const TrackParamBase< fvec > &Tb, const int ib)
T NdfTime() const
Gets NDF of time measurements.
T GetYError() const
Gets y position error [cm].
const CovMatrix_t & GetCovMatrix() const
Gets covariance matrix.
T GetTy() const
Gets slope along y-axis.
T C() const
Get covariance matrix element when indices are known at compile time.
T GetTimeError() const
Gets time error [ns].
T & Tx()
Reference to slope along x-axis.
T GetCharge() const
Gets charge.
void SetCovMatrix(const CovMatrix_t &val)
Sets covariance matrix.
void SetZ(T v)
Sets z position [cm].
T GetThetaError() const
Gets polar angle error [rad].
T & Time()
Reference to time [ns].
static constexpr int kNcovParam
N of covariance matrix parameters.
T GetPz() const
Gets z-component of the momentum [GeV/ec].
T GetZ() const
Gets z position [cm].
T & C(int i, int j)
Get a reference to the covariance matrix element.
T GetP() const
Gets momentum [GeV/ec]. For the straight tracks returns 1.e4 [GeV/ec].
void ResetErrors(T c00, T c11, T c22, T c33, T c44, T c55, T c66)
Resets variances of track parameters and chi2, ndf values.
T ChiSq() const
Gets Chi-square of track fit model.
static constexpr int kNtrackParam
N of variable track parameters: {x, y, tx, ty, q/p, t, vi}.
T & Qp()
Reference to charge over momentum [ec/GeV].
T fChiSqTime
chi^2 of track fit, time measurements
T GetPhi() const
Gets azimuthal angle [rad].
bool IsConsistent(bool printWhenWrong, int nFilled) const
T Tx() const
Gets slope along x-axis.
T GetTime() const
Gets time [ns].
void SetC00(T val)
Individual setters for covariance matrix elements.
std::string ToStringCorrelations(int i=-1) const
T GetTyError() const
Gets error of slope along y-axis.
void SetY(T v)
Sets y position [cm].
void CopyBase(const int ia, const TrackParamBase< T1 > &Tb, const int ib)
Copies all/one entries from the other class.
void SetChiSq(T v)
Sets Chi-square of track fit model.
T X() const
Gets x position [cm].
T & Z()
Reference to z position [cm].
T GetTheta() const
Gets polar angle [rad].
void serialize(Archive &ar, const unsigned int)
void SetVi(T v)
Sets inverse velocity [ns/cm].
T ChiSqTime() const
Gets Chi-square of time measurements.
T GetTx() const
Gets slope along x-axis.
T & ChiSq()
Reference to Chi-square of track fit model.
T & Ty()
Reference to slope along y-axis.
T & NdfTime()
Reference to NDF of time measurements.
T & C()
Get a reference to the covariance matrix element when indices are known at compile time.
std::array< T, kNcovParam > CovMatrix_t
covariance matrix type
T GetViError() const
Gets inverse velocity error [ns/cm].
void SetNdf(T v)
Sets NDF of track fit model.
CovMatrix_t fCovMatrix
covariance matrix
T & Y()
Reference to y position [cm].
T GetNdfTime() const
Gets NDF of time measurements.
T GetQp() const
Gets charge over momentum [ec/GeV].
T Y() const
Gets y position [cm].
void SetOneEntry(const int ia, const TrackParamBase< T1 > &Tb)
T GetChiSqTime() const
Gets Chi-square of time measurements.
T Qp() const
Gets charge over momentum [ec/GeV].
T Z() const
Gets z position [cm].
void InitVelocityRange(fscal minP)
Initializes inverse velocity range.
T GetPt() const
Gets transverse momentum.
T GetNdf() const
Gets NDF of track fit model.
T GetQpError() const
Gets error of charge over momentum [ec/GeV].
T Time() const
Gets time [ns].
T GetY() const
Gets y position [cm].
T & Vi()
Reference to inverse velocity [ns/cm].
T C(int i, int j) const
Get covariance matrix element.
void SetX(T v)
Sets x position [cm].
void SetNdfTime(T v)
Sets NDF of time measurements.
void SetTy(T v)
Sets slope along y-axis.
ClassDefNV(TrackParamBase, 1)
void SetCovariance(T val)
Get covariance matrix element when indices are known at compile time.
bool IsFinite(bool printWhenWrong) const
T & ChiSqTime()
Reference to Chi-square of time measurements.
CovMatrix_t & CovMatrix()
Reference to covariance matrix.
T fNdfTime
NDF of track fit, time measurements.
T fVi
inverse velocity in downstream direction [ns/cm]
T fNdf
NDF of track fit, spatial measurements.
T GetCovariance(int i, int j) const
Get covariance matrix element.
void Set(const TrackParamBase< T1 > &Tb)
TrackParamBase(const TrackParamBase< T1 > &tr)
T GetChiSq() const
Gets Chi-square of track fit model.
T & C00()
Individual references to covariance matrix elements.
T Ty() const
Gets slope along y-axis.
void SetQp(T v)
Sets charge over momentum [ec/GeV].
T & X()
Reference to x position [cm].
bool IsEntryConsistent(bool printWhenWrong, int i) const
void SetTime(T v)
Sets time [ns].
T GetX() const
Gets x position [cm].
TrackParam classes of different types.
ClassDefNV(TrackParam, 1)
static void CopyEntries(TdataA &a, int ia, const TdataB &b, int ib)
constexpr auto SpeedOfLightInv
Inverse speed of light [ns/cm].
constexpr auto ProtonMass
Proton mass [GeV/c2] (PDG 11.08.2022)
constexpr int SymIndex(int i, int j)
Get matrix element for a symmetrix matrix stored in a low-triangular array.
fvec iif(const fmask &m, const fvec &t, const fvec &f)
TrackParam< double > TrackParamD
TrackParam< fvec > TrackParamV
TrackParam< fscal > TrackParamS