CbmRoot
Loading...
Searching...
No Matches
CbmTofTrackletParam.h
Go to the documentation of this file.
1/* Copyright (C) 2015-2021 PI-UHd, GSI
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Norbert Herrmann [committer], Florian Uhlig */
4
11
12#ifndef CBMTOFTRACKLETPARAM_H_
13#define CBMTOFTRACKLETPARAM_H_
14
15#include <Rtypes.h> // for ClassDef
16#include <TObject.h> // for TObject
17#include <TVector3.h> // for TVector3
18
19#include <cmath> // for abs, sqrt
20#include <cstdint>
21#include <sstream> // for operator<<, basic_ostream, stringstream, cha...
22#include <vector> // for vector
23
31class CbmTofTrackletParam : public TObject {
32 public:
37 : fX(0.)
38 , fY(0.)
39 , fZ(0.)
40 , fT(0.)
41 , fTx(0.)
42 , fTy(0.)
43 , fTt(0.)
44 , fQp(0.)
45 , fLz(0.)
46 , fChiSq(0.)
47 , fCovMatrix(15, 0.)
48 {
49 }
50
55
56 /* Getters */
57 double GetX() const { return fX; }
58 double GetY() const { return fY; }
59 double GetZ() const { return fZ; }
60 double GetT() const { return fT; }
61 double GetLz() const { return fLz; }
62 double GetTx() const { return fTx; }
63 double GetTy() const { return fTy; }
64 double GetTt() const { return fTt; }
65 double GetQp() const { return fQp; }
66 double GetChiSq() const { return fChiSq; }
67 double GetCovariance(int index) const { return fCovMatrix[index]; }
68 const std::vector<double>& GetCovMatrix() const { return fCovMatrix; }
69
70 /* Setters */
71 void SetX(double x) { fX = x; }
72 void SetY(double y) { fY = y; }
73 void SetZ(double z) { fZ = z; }
74 void SetT(double t) { fT = t; }
75 void SetLz(double lz) { fLz = lz; }
76 void SetTx(double tx) { fTx = tx; }
77 void SetTy(double ty) { fTy = ty; }
78 void SetTt(double tt) { fTt = tt; }
79 void SetQp(double qp) { fQp = qp; }
80 void SetChiSq(double v) { fChiSq = v; }
81 void SetCovMatrix(const std::vector<double>& C) { fCovMatrix.assign(C.begin(), C.end()); }
82 void SetCovariance(int index, double cov) { fCovMatrix[index] = cov; }
83
90 void GetDirCos(double& nx, double& ny, double& nz) const
91 {
92 double p = (std::abs(fQp) != 0.) ? 1. / std::abs(fQp) : 1.e20;
93 double pz = std::sqrt(p * p / (fTx * fTx + fTy * fTy + 1));
94 double px = fTx * pz;
95 double py = fTy * pz;
96 TVector3 unit = TVector3(px, py, pz).Unit();
97 nx = unit.X();
98 ny = unit.Y();
99 nz = unit.Z();
100 }
101
106 std::vector<double> GetStateVector() const
107 {
108 std::vector<double> state(5, 0.);
109 state[0] = GetX();
110 state[1] = GetY();
111 state[2] = GetTx();
112 state[3] = GetTy();
113 state[4] = GetQp();
114 return state;
115 }
116
121 void SetStateVector(const std::vector<double>& x)
122 {
123 SetX(x[0]);
124 SetY(x[1]);
125 SetTx(x[2]);
126 SetTy(x[3]);
127 SetQp(x[4]);
128 }
129
134 std::string ToString() const
135 {
136 std::stringstream ss;
137 ss << "TofTrackletParam: pos=(" << fX << "," << fY << "," << fZ << ") tx=" << fTx << " ty=" << fTy
138 << " qp=" << fQp; // << std::endl;
139 // ss << "cov: ";
140 // for (int32_t i = 0; i < 15; i++) ss << fCovMatrix[i] << " ";
141 // ss << endl;
142 ss.precision(3);
143 ss << " cov: x=" << fCovMatrix[0] << " y=" << fCovMatrix[5] << " tx=" << fCovMatrix[9] << " ty=" << fCovMatrix[12]
144 << " q/p=" << fCovMatrix[14];
145 return ss.str();
146 }
147
148 double GetZr(double R) const;
149
150 double GetZy(double Y) const
151 {
152 if (fTy != 0.) {
153 return (Y - fY) / fTy + fZ;
154 }
155 return 0.;
156 }
157
158
159 private:
160 double fX, fY, fZ, fT; // X, Y, Z coordinates in [cm]
161 double fTx, fTy, fTt; // Slopes: tx=dx/dz, ty=dy/dz
162 double fQp; // Q/p: Q is a charge (+/-1), p is momentum in [GeV/c]
163 double fLz; // tracklength in z - direction
164 double fChiSq;
165 /* Covariance matrix.
166 * Upper triangle symmetric matrix.
167 * a[0,0..4], a[1,1..4], a[2,2..4], a[3,3..4], a[4,4] */
168 std::vector<double> fCovMatrix;
169
171};
172
173#endif /*CBMTOFTRACKLETPARAM_H_*/
fscal v[fmask::Size]
Definition KfSimdPseudo.h:4
Some class C.
void SetCovMatrix(const std::vector< double > &C)
std::vector< double > fCovMatrix
void GetDirCos(double &nx, double &ny, double &nz) const
Return direction cosines.
double GetZy(double Y) const
void SetStateVector(const std::vector< double > &x)
Set parameters from vector.
CbmTofTrackletParam()
Constructor.
const std::vector< double > & GetCovMatrix() const
double GetCovariance(int index) const
std::vector< double > GetStateVector() const
Return state vector as vector.
ClassDef(CbmTofTrackletParam, 1)
void SetCovariance(int index, double cov)
std::string ToString() const
Return string representation of class.
virtual ~CbmTofTrackletParam()
Destructor.
double GetZr(double R) const