CbmRoot
Loading...
Searching...
No Matches
CbmTofTracklet.h
Go to the documentation of this file.
1/* Copyright (C) 2015-2020 PI-UHd, GSI
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Norbert Herrmann [committer], Florian Uhlig */
4
10#ifndef CBMTOFTRACKLET_H
11#define CBMTOFTRACKLET_H 1
12
13#include "CbmTofHit.h" // for CbmTofHit
14#include "CbmTofTrackletParam.h" // for CbmTofTrackletParam
15
16#include <FairTrackParam.h> // for FairTrackParam
17
18#include <Rtypes.h> // for THashConsistencyHolder, ClassDef
19#include <TObject.h> // for TObject
20
21#include <cstdint>
22#include <vector> // for vector, __vector_base<>::value_type
23
24#include <cmath>
25
30class CbmTofTracklet : public TObject {
31
32public:
35
45 virtual ~CbmTofTracklet();
46
47 virtual void PrintInfo();
48
50 int32_t GetPidHypo() const { return fPidHypo; }
51
53 int32_t GetNofHits() const { return fTofHit.size(); }
54
56 int32_t GetHitIndex(int32_t ind) const { return fTofHit[ind]; }
57
58 double GetT0() const { return fT0; }
59 double GetTt() const { return fTt; }
60 double GetT0Err() const { return fT0Err; }
61 double GetTtErr() const { return fTtErr; }
62 double GetT0TtCov() const { return fT0TtCov; }
63 double GetTheta() const { return atan(sqrt(pow(fTrackPar.GetTy(), 2) + pow(fTrackPar.GetTx(), 2))); }
64 double GetPhi() const { return atan(fTrackPar.GetTy() / fTrackPar.GetTx()); }
65 int32_t GetStationHitIndex(int32_t iSm) const
66 {
67 for (int32_t i = 0; i < (int32_t) fTofHit.size(); i++)
68 if (fTofDet[i] == iSm) return fTofHit[i];
69 return -1;
70 }
71
72 int32_t GetTofHitIndex(int32_t ind) const { return fTofHit[ind]; }
73 inline void SetTofHitIndex(int32_t ind, int32_t i) { fTofHit[ind] = i; }
74 CbmTofHit* GetTofHitPointer(int32_t ind) { return &fhit[ind]; }
75 int32_t GetTofDetIndex(int32_t ind) const { return fTofDet[ind]; }
76
77 const std::vector<int32_t>& GetTofHitInd() const { return fTofHit; }
78
79 const double* GetPoint(int32_t n); // interface to event display: CbmEvDisTracks
80 const double* GetFitPoint(int32_t n); // interface to event display: CbmEvDisTracks
81
83 double GetTrackDx() const { return sqrt(fTrackPar.GetCovariance(0)); }
84
86 double GetTrackDy() const { return sqrt(fTrackPar.GetCovariance(5)); }
87
89 double GetTrackLength() const { return fTrackLength; }
90
93
95 double GetTrackX() const { return fTrackPar.GetX(); }
96
98 double GetTrackY() const { return fTrackPar.GetY(); }
99
101 double GetTrackTx() const { return fTrackPar.GetTx(); }
102
104 double GetTrackTy() const { return fTrackPar.GetTy(); }
105
107 double GetDistance() const { return fDistance; }
108 double GetTime() const { return fTime; }
109 double UpdateTt();
110 double UpdateT0();
111 double GetTex(CbmTofHit* pHit);
112
113 int32_t GetFirstInd(int32_t iSmType); // return closest Hit to target except in iSmType
114 double GetZ0x(); // return intercept with z-axis
115 double GetZ0y(); // return intercept with z-axis
116 double GetR0(); // return transverse distance at z=0
117 double GetFitX(double Z); // get x value of fit function at position z
118 double GetFitY(double Z); // get y value of fit function at position z
119 double GetFitT(double R); // get time of fit function at distance R
120 double GetRefVel(uint32_t N); // get reference velocity from first N hits
121
122 double GetChiSq() const { return fChiSq; }
123 int32_t GetNDF() const { return fNDF; }
124
125 const FairTrackParam* GetParamFirst() const { return &fParamFirst; }
126 const FairTrackParam* GetParamLast() const { return &fParamLast; }
127
128 virtual void GetFairTrackParamLast();
129
130 virtual double GetMatChi2(int32_t iSm);
131
133 inline void SetTofHitIndex(int32_t tofHitIndex, int32_t iDet, CbmTofHit* pHit)
134 {
135 fTofHit.resize(1);
136 fTofHit[0] = tofHitIndex;
137 fTofDet.resize(1);
138 fTofDet[0] = iDet;
139 fhit.resize(1);
140 fhit[0] = CbmTofHit(*pHit);
141 fMatChi.resize(1);
142 }
143
144 inline void SetTofHitIndex(int32_t tofHitIndex, int32_t iDet, CbmTofHit* pHit, double chi2)
145 {
146 fTofHit.resize(1);
147 fTofHit[0] = tofHitIndex;
148 fTofDet.resize(1);
149 fTofDet[0] = iDet;
150 fhit.resize(1);
151 fhit[0] = CbmTofHit(*pHit);
152 fMatChi.resize(1);
153 fMatChi[0] = chi2;
154 }
155
156 inline void SetTofHitInd(const std::vector<int32_t>& tofHitInd) { fTofHit = tofHitInd; }
157
158
159 inline void AddTofHitIndex(int32_t tofHitIndex, int32_t iDet, CbmTofHit* pHit)
160 {
161 fTofHit.resize(fTofHit.size() + 1);
162 fTofHit[fTofHit.size() - 1] = tofHitIndex;
163 fTofDet.resize(fTofHit.size());
164 fTofDet[fTofHit.size() - 1] = iDet;
165 fhit.resize(fTofHit.size());
166 fhit[fTofHit.size() - 1] = CbmTofHit(*pHit);
167 fMatChi.resize(fTofHit.size());
168 }
169
170 inline void AddTofHitIndex(int32_t tofHitIndex, int32_t iDet, CbmTofHit* pHit, double chi2)
171 {
172 fTofHit.resize(fTofHit.size() + 1);
173 fTofHit[fTofHit.size() - 1] = tofHitIndex;
174 fTofDet.resize(fTofHit.size());
175 fTofDet[fTofHit.size() - 1] = iDet;
176 fhit.resize(fTofHit.size());
177 fhit[fTofHit.size() - 1] = CbmTofHit(*pHit);
178 fMatChi.resize(fTofHit.size());
179 fMatChi[fTofHit.size() - 1] = chi2;
180 }
181
182 inline void ReplaceTofHitIndex(int32_t tofHitIndex, int32_t iDet, CbmTofHit* pHit, double chi2)
183 {
184 for (int32_t iHit = 0; iHit < (int32_t) fTofHit.size(); iHit++) {
185 if (iDet == fTofDet[iHit]) {
186 fTofHit[iHit] = tofHitIndex;
187 fhit[iHit] = CbmTofHit(*pHit);
188 fMatChi[iHit] = chi2;
189 break;
190 }
191 }
192 }
193
194 inline void RemoveTofHitIndex(int32_t /*tofHitIndex*/, int32_t iDet, CbmTofHit* /*pHit*/, double /*chi2*/)
195 {
196 for (int32_t iHit = 0; iHit < (int32_t) fTofHit.size(); iHit++) {
197 if (iDet == fTofDet[iHit]) {
198 fTofHit.erase(fTofHit.begin() + iHit);
199 fhit.erase(fhit.begin() + iHit);
200 fMatChi.erase(fMatChi.begin() + iHit);
201 break;
202 }
203 }
204 }
205
206 virtual double GetXdif(int32_t iSmType, CbmTofHit* pHit);
207 virtual double GetYdif(int32_t iSmType, CbmTofHit* pHit);
208 virtual double GetTdif(int32_t iSmType, CbmTofHit* pHit);
209 virtual double Dist3D(CbmTofHit* pHit0, CbmTofHit* pHit1);
210 virtual bool ContainsAddr(int32_t iAddr);
211 virtual int32_t HitIndexOfAddr(int32_t iAddr);
212 virtual CbmTofHit* HitPointerOfAddr(int32_t iAddr);
213
215 inline void SetTrackParameter(CbmTofTrackletParam* par) { fTrackPar = *par; }
216
218 inline void SetTrackLength(double trackLength) { fTrackLength = trackLength; }
219
221 inline void SetPidHypo(int32_t pid) { fPidHypo = pid; }
222
224 inline void SetDistance(double distance) { fDistance = distance; }
225 inline void SetTime(double val) { fTime = val; }
226 inline void SetTt(double val) { fTt = val; }
227 inline void SetT0(double val) { fT0 = val; }
228 inline void SetT0Err(double val) { fT0Err = val; }
229 inline void SetTtErr(double val) { fTtErr = val; }
230 inline void SetT0TtCov(double val) { fT0TtCov = val; }
231
232 inline void SetChiSq(double chiSq) { fChiSq = chiSq; }
233 inline void SetNDF(int32_t ndf) { fNDF = ndf; }
234 inline void SetParamFirst(const FairTrackParam* par) { fParamFirst = *par; }
235 inline void SetParamLast(const FairTrackParam* par) { fParamLast = *par; }
236
237 void SetParamLast(const CbmTofTrackletParam* par);
238 // void LoadParamLast();
239
240 void Clear(Option_t* option = "");
243private:
244 double fTrackLength; // Track length from primary vertex to TOF [cm]
245 int32_t fPidHypo; // PID hypothesis used for track extrapolation
246 double fDistance; // Normalized distance from hit to track
247 double fTime; // Reference time of reference hit
248 double fTt; // slope dT/dr
249 double fT0; // Time at origin
250 double fT0Err; // Error on Time at origin
251 double fTtErr; // Error on slope dT/dr
252 double fT0TtCov; // Covariance od fT0 and fTt
253 double fChiSq; // Chi2 of fit
254 int32_t fNDF; // # of degrees of freedom
255 CbmTofTrackletParam fTrackPar; // Track parameters at z of TofHit
256 FairTrackParam fParamFirst; // Track parameters at first and last fitted hit
257 FairTrackParam fParamLast; //
258 std::vector<int32_t> fTofHit; // Index of TofHit
259 std::vector<int32_t> fTofDet; // DetLayer of TofHit
260 std::vector<double> fMatChi; // Matching Chi2 of TofHit
261 std::vector<CbmTofHit> fhit; // vector of TofHit objects
262 double fP[4]; // transient (transfer) space point to Eve
263
267};
268
269#endif /* CBMTOFTRACKLET_H */
Data class for track parameters.
friend fvec sqrt(const fvec &a)
double GetCovariance(int index) const
Provides information on attaching a TofHit to a TofTrack.
void SetTofHitIndex(int32_t ind, int32_t i)
int32_t GetNDF() const
double GetFitY(double Z)
int32_t GetTofHitIndex(int32_t ind) const
ClassDef(CbmTofTracklet, 3)
double GetTrackLength() const
CbmTofTracklet & operator=(const CbmTofTracklet &)
double GetTrackX() const
virtual double GetTdif(int32_t iSmType, CbmTofHit *pHit)
void SetChiSq(double chiSq)
void SetPidHypo(int32_t pid)
int32_t GetHitIndex(int32_t ind) const
void AddTofHitIndex(int32_t tofHitIndex, int32_t iDet, CbmTofHit *pHit)
int32_t GetStationHitIndex(int32_t iSm) const
double GetRefVel(uint32_t N)
virtual bool ContainsAddr(int32_t iAddr)
void SetTime(double val)
const FairTrackParam * GetParamLast() const
virtual CbmTofHit * HitPointerOfAddr(int32_t iAddr)
virtual int32_t HitIndexOfAddr(int32_t iAddr)
void ReplaceTofHitIndex(int32_t tofHitIndex, int32_t iDet, CbmTofHit *pHit, double chi2)
virtual void PrintInfo()
double GetPhi() const
void SetTrackParameter(CbmTofTrackletParam *par)
void RemoveTofHitIndex(int32_t, int32_t iDet, CbmTofHit *, double)
void SetTofHitInd(const std::vector< int32_t > &tofHitInd)
double GetTt() const
double GetTrackTx() const
virtual double GetXdif(int32_t iSmType, CbmTofHit *pHit)
int32_t GetNofHits() const
const FairTrackParam * GetParamFirst() const
void SetT0TtCov(double val)
CbmTofHit * GetTofHitPointer(int32_t ind)
void SetT0Err(double val)
virtual double GetMatChi2(int32_t iSm)
const double * GetPoint(int32_t n)
const std::vector< int32_t > & GetTofHitInd() const
void SetTrackLength(double trackLength)
void SetDistance(double distance)
double GetTrackY() const
void Clear(Option_t *option="")
void SetTofHitIndex(int32_t tofHitIndex, int32_t iDet, CbmTofHit *pHit)
double GetFitT(double R)
const double * GetFitPoint(int32_t n)
virtual ~CbmTofTracklet()
std::vector< double > fMatChi
std::vector< int32_t > fTofDet
void SetParamFirst(const FairTrackParam *par)
std::vector< CbmTofHit > fhit
int32_t GetTofDetIndex(int32_t ind) const
double GetTime() const
void SetParamLast(const FairTrackParam *par)
virtual double GetYdif(int32_t iSmType, CbmTofHit *pHit)
double GetTrackDy() const
void SetT0(double val)
virtual void GetFairTrackParamLast()
double GetTrackTy() const
CbmTofTrackletParam fTrackPar
double GetT0Err() const
double GetTtErr() const
double GetTex(CbmTofHit *pHit)
int32_t GetPidHypo() const
std::vector< int32_t > fTofHit
FairTrackParam fParamFirst
void SetTt(double val)
void SetNDF(int32_t ndf)
double GetT0() const
void SetTtErr(double val)
void AddTofHitIndex(int32_t tofHitIndex, int32_t iDet, CbmTofHit *pHit, double chi2)
double GetChiSq() const
double GetT0TtCov() const
CbmTofTrackletParam * GetTrackParameter()
void SetTofHitIndex(int32_t tofHitIndex, int32_t iDet, CbmTofHit *pHit, double chi2)
FairTrackParam fParamLast
double GetFitX(double Z)
double GetDistance() const
double GetTheta() const
int32_t GetFirstInd(int32_t iSmType)
virtual double Dist3D(CbmTofHit *pHit0, CbmTofHit *pHit1)
double GetTrackDx() const