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