15#include "FairRootManager.h"
16#include "TClonesArray.h"
18#include "TMatrixTSym.h"
36 FairRootManager*
rootMgr = FairRootManager::Instance();
38 cout <<
"-E- CbmStsKFTrackFitter::Init(): "
39 <<
"ROOT manager is not instantiated!" << endl;
44 cout <<
"-W- CbmStsKFTrackFitter::Init: "
45 <<
"no STS hits array" << endl;
50 cout <<
"-W- CbmStsKFTrackFitter::Init: "
51 <<
"no MVD hits array" << endl;
56 LOG(error) <<
"-E- CbmStsKFTrackFitter::Init(): CbmKF instance not found";
75 fHits.resize(NMvdHits + NStsHits);
77 for (Int_t i = 0; i < NMvdHits; i++) {
80 T.fHits.push_back(&(
fHits[i]));
84 for (Int_t i = 0; i < NStsHits; i++) {
87 T.fHits.push_back(&(
fHits[NMvdHits + i]));
99 for (Int_t i = 0; i < 6; i++) {
100 T.GetTrack()[i] = 0.;
106 Int_t err = T.Fit(1);
111 T.GetTrackParam(par);
116 T.GetStsTrack(*track, 1);
120 Double_t* t = T.GetTrack();
121 Double_t* c = T.GetCovMatrix();
122 for (
int i = 0; i < 6; i++) {
125 for (
int i = 0; i < 15; i++) {
128 c[0] = c[2] = c[5] = c[9] = c[14] = 100.;
129 T.GetRefChi2() = 100.;
131 T.GetStsTrack(*track, 0);
132 T.GetStsTrack(*track, 1);
151 T.GetTrackParam(*e_track);
165 if (z <= fpar->GetZ()) {
166 T.SetTrackParam(*fpar);
169 else if (z < fpar->GetZ() + 0.1) {
170 T.SetTrackParam(*fpar);
173 else if (lpar->GetZ() <= z) {
174 T.SetTrackParam(*lpar);
177 else if (lpar->GetZ() - 0.1 < z) {
178 T.SetTrackParam(*lpar);
183 T.SetTrackParam(*fpar);
187 T.GetTrackParam(*e_track);
195 FairRootManager* fManger = FairRootManager::Instance();
200 vtx =
reinterpret_cast<CbmVertex*
>(fManger->GetObject(
"PrimaryVertex."));
201 if (
nullptr == vtx) {
202 vtx =
reinterpret_cast<CbmVertex*
>(fManger->GetObject(
"PrimaryVertex"));
205 cout <<
"-W- CbmStsKFTrackFitter::GetChiToVertex: No Primary Vertex found!" << endl;
211 T.Extrapolate(vtx->
GetZ());
215 Double_t Cv[3] = {tmp(0, 0), tmp(0, 1), tmp(1, 1)};
224 if (!track || !vtx || !v_track) {
230 T.GetTrackParam(*v_track);
231 if (T.GetRefNDF() > 0 && T.GetRefChi2() >= 0) {
232 ret = T.GetRefChi2() / T.GetRefNDF();
233 if (std::isfinite(ret)) {
243 Double_t* t = T.GetTrack();
244 Double_t* c = T.GetCovMatrix();
245 for (
int i = 0; i < 6; i++) {
246 ok = ok && std::isfinite(t[i]) && TMath::Abs(t[i]) < 1.e5;
248 for (
int i = 0; i < 15; i++) {
249 ok = ok && std::isfinite(c[i]);
251 ok = ok && std::isfinite(T.GetMass()) && std::isfinite(T.GetRefChi2());
253 ok = ok && (c[0] > 0);
254 ok = ok && (c[2] > 0);
255 ok = ok && (c[5] > 0);
256 ok = ok && (c[9] > 0);
257 ok = ok && (c[14] > 0);
260 Double_t c00 = TMath::Sqrt(c[0]);
261 Double_t c11 = TMath::Sqrt(c[2]);
262 Double_t c22 = TMath::Sqrt(c[5]);
263 Double_t c33 = TMath::Sqrt(c[9]);
264 Double_t c44 = TMath::Sqrt(c[14]);
265 Double_t a = c11 * c00;
337 for (
int i = 0; i < 6; i++) {
340 for (
int i = 0; i < 15; i++) {
343 c[0] = c[2] = c[5] = c[9] = c[14] = 100.;
344 T.GetRefChi2() = 100.;
static FairRootManager * rootMgr
ClassImp(CbmStsKFTrackFitter)
Data class for STS tracks.
friend fvec sqrt(const fvec &a)
static Double_t getDeviation(Double_t x, Double_t y, Double_t C[], Double_t vx, Double_t vy, Double_t Cv[]=nullptr)
void SetStsTrack(CbmStsTrack &track, bool first=1)
void SetTrackParam(const FairTrackParam &track)
void SetPID(Int_t pidHypo)
static CbmKF * Instance()
data class for a reconstructed 3-d hit in the STS
TClonesArray * fStsHitsArray
void SetKFHits(CbmKFTrack &T, CbmStsTrack *track)
std::vector< CbmKFStsHit > fHits
void Extrapolate(CbmStsTrack *track, Double_t z, FairTrackParam *e_track)
Double_t FitToVertex(CbmStsTrack *track, CbmVertex *vtx, FairTrackParam *v_track)
Double_t GetChiToVertex(CbmStsTrack *track, CbmVertex *vtx=nullptr)
TClonesArray * fMvdHitsArray
Int_t DoFit(CbmStsTrack *track, Int_t pidHypo=211)
Bool_t CheckTrack(CbmKFTrack &T)
int32_t GetNofMvdHits() const
int32_t GetMvdHitIndex(int32_t iHit) const
int32_t GetStsHitIndex(int32_t iHit) const
int32_t GetNofStsHits() const
int32_t GetPidHypo() const
const FairTrackParam * GetParamLast() const
void SetPidHypo(int32_t pid)
void SetFlag(int32_t flag)
const FairTrackParam * GetParamFirst() const
void SetParamLast(const FairTrackParam *par)
void CovMatrix(TMatrixFSym &covMat) const