18#include "FairRootManager.h"
55 FairRootManager* rootMgr = FairRootManager::Instance();
56 if (NULL == rootMgr) {
58 cout <<
"-E- BmnStsKFTrackFitter::Init(): "
59 <<
"ROOT manager is not instantiated!" << endl;
65 cout <<
"-W- BmnStsKFTrackFitter::Init: "
66 <<
"no STS hits array" << endl;
94 fHits.resize(NMvdHits + NStsHits);
96 for (
Int_t i = 0;
i < NMvdHits;
i++) {
99 T.fHits.push_back(&(
fHits[
i]));
103 for (
Int_t i = 0;
i < NStsHits;
i++) {
106 T.fHits.push_back(&(
fHits[NMvdHits +
i]));
122 T.GetTrack()[
i] = 0.;
127 Int_t err = T.Fit(1);
134 T.GetStsTrack(*track, 1);
139 for (
int i = 0;
i < 6;
i++)
141 for (
int i = 0;
i < 15;
i++)
143 c[0] = c[2] = c[5] = c[9] = c[14] = 100.;
144 T.GetRefChi2() = 100.;
146 T.GetStsTrack(*track, 0);
147 T.GetStsTrack(*track, 1);
163 cout <<
"-Info- BmnStsKFTrackFitter::ReadMatBudget: "
164 <<
"reading mat. budget histograms from file " << fileName << endl;
173 while ((obj = next())) {
181 int pos = title.
Last(
'_');
204 T.GetTrack()[
i] = 0.;
220 T.GetStsTrack(*track, 1);
227 for (
int i = 0;
i < 6;
i++)
229 for (
int i = 0;
i < 15;
i++)
231 c[0] = c[2] = c[5] = c[9] = c[14] = 100.;
232 T.GetRefChi2() = 100.;
234 T.GetStsTrack(*track, 0);
235 T.GetStsTrack(*track, 1);
296 err = h->
Filter(track, downstream, qp0);
303 for (
Int_t j = istold + 0; j < ist; j++) {
312 err = err || mat->
Pass(track, downstream, qp0);
316 err = err || h->
Filter(track, downstream, qp0);
321 err = h->
Filter(track, downstream, qp0);
323 for (
Int_t i = NHits - 2;
i >= 0;
i--) {
328 for (
Int_t j = istold - 0; j > ist; j--) {
335 err = err || mat->
Pass(track, downstream, qp0);
337 err = err || h->
Filter(track, downstream, qp0);
363 T[0] = T[1] = T[2] = T[3] = T[4] = T[5] = 0;
384 T[0] = T[1] = T[2] = T[3] = T[4] = T[5] = 0;
395 if ((ihit == 0 && downstream) || (ihit == track.
GetNOfHits() - 1 && !downstream)) {
396 cout <<
"!!! BmnStsKFTrackFitter::EvalMaterial - this should not happen " << ihit <<
" " << downstream <<
" "
404 int iprev = (downstream) ? ihit - 1 : ihit + 1;
415 TAxis* axis[2] = {histo->GetXaxis(), histo->GetYaxis()};
418 Double_t thick = histo->GetBinContent(ixyprev[0], ixyprev[1]);
420 if ((ixy[0] != ixyprev[0]) || (ixy[1] != ixyprev[1])) {
421 int idxy[2], ilong = 0, ishor = 1;
423 for (
int j = 0; j < 2; ++j)
424 idxy[j] = ixy[j] - ixyprev[j];
425 for (
int j = 0; j < 2; ++j)
426 dxy[j] = idxy[j] * axis[j]->GetBinWidth(1);
432 int istep =
TMath::Sign(1, idxy[ilong]),
i = ixyprev[ilong];
437 int j = axis[ishor]->
FindBin(xyshort);
439 thick += histo->GetBinContent(
i, j);
441 thick += histo->GetBinContent(j,
i);
448 thick /= (nbins * 100);
474 T.GetTrackParam(*e_track);
488 if (z <= fpar->GetZ()) {
489 T.SetTrackParam(*fpar);
491 }
else if (z < fpar->GetZ() + 0.1) {
492 T.SetTrackParam(*fpar);
494 }
else if (lpar->GetZ() <= z) {
495 T.SetTrackParam(*lpar);
497 }
else if (lpar->GetZ() - 0.1 < z) {
498 T.SetTrackParam(*lpar);
502 T.SetTrackParam(*fpar);
506 T.GetTrackParam(*e_track);
515 FairRootManager* fManger = FairRootManager::Instance();
516 vtx =
reinterpret_cast<CbmVertex*
>(fManger->GetObject(
"PrimaryVertex"));
518 cout <<
"-W- CbmStsKFTrackFitter::GetChiToVertex: No Primary Vertex found!" << endl;
524 T.Extrapolate(vtx->
GetZ());
528 Double_t Cv[3] = {tmp(0, 0), tmp(0, 1), tmp(1, 1)};
539 if (!track || !vtx || !v_track)
544 T.GetTrackParam(*v_track);
545 if (T.GetRefNDF() > 0 && T.GetRefChi2() >= 0) {
546 ret = T.GetRefChi2() / T.GetRefNDF();
561 for (
int i = 0;
i < 6;
i++)
563 for (
int i = 0;
i < 15;
i++)
564 ok = ok && finite(c[
i]);
565 ok = ok && finite(T.GetMass()) && finite(T.GetRefChi2());
567 ok = ok && (c[0] > 0);
568 ok = ok && (c[2] > 0);
569 ok = ok && (c[5] > 0);
570 ok = ok && (c[9] > 0);
571 ok = ok && (c[14] > 0);
631 for (
int i = 0;
i < 6;
i++)
633 for (
int i = 0;
i < 15;
i++)
635 c[0] = c[2] = c[5] = c[9] = c[14] = 100.;
636 T.GetRefChi2() = 100.;
TMatrixTSym< Float_t > TMatrixFSym
CbmKFUMeasurement FitPoint[2]
TClonesArray * fStsHitsArray
void Extrapolate(CbmStsTrack *track, Double_t z, FairTrackParam *e_track)
Extrapolate track to any Z position.
std::map< Double_t, TProfile2D * > fMatHistos
void Init()
Initialisation.
Int_t FitWithMat(CbmKFTrack &track, Int_t downstream)
void EvalMaterial(CbmKFTrack &track, int ihit, Int_t downstream, CbmKFMaterial &mat)
void ReadMatBudget(TString &matBudgetFileName)
BmnStsKFTrackFitter()
Default constructor.
Double_t GetChiToVertex(CbmStsTrack *track, CbmVertex *vtx=0)
Get normalized (in sigma's) impact parameter form vertex vtx if no vtx given, return deviation from p...
void SetKFHits(CbmKFTrack &T, CbmStsTrack *track)
Bool_t CheckTrack(CbmKFTrack &T)
Int_t DoFit(CbmStsTrack *track, Int_t pidHypo=211)
Fit given track using Kalman Filter algorithm.
TClonesArray * fMvdHitsArray
Int_t Fit(CbmStsTrack *track, Int_t pidHypo=211)
Double_t FitToVertex(CbmStsTrack *track, CbmVertex *vtx, FairTrackParam *v_track)
Fit track to a vertex.
std::vector< BmnKFStsHit > fHits
~BmnStsKFTrackFitter()
Destructor.
Abstract base class for hit is being used by the CbmKF Kalman Filter.
virtual Int_t Filter(CbmKFTrackInterface &track, Bool_t downstream, Double_t &QP0)=0
virtual Int_t Pass(Double_t ZCross, Double_t ZThick, CbmKFTrackInterface &track, Bool_t downstream, Double_t &QP0)
static Double_t getDeviation(Double_t x, Double_t y, Double_t C[], Double_t vx, Double_t vy, Double_t Cv[]=0)
void SetStsTrack(CbmStsTrack &track, bool first=1)
CbmKFHit * GetHit(Int_t i)
Number of hits.
void SetTrackParam(FairTrackParam &track)
Double_t * GetTrack()
Is it electron.
Double_t & GetRefChi2()
array[15] of covariance matrix
Int_t GetNOfHits()
Number of Degrees of Freedom after fit.
Int_t & GetRefNDF()
Chi^2 after fit.
Double_t * GetCovMatrix()
array[6] of track parameters(x,y,tx,ty,qp,z)
void SetPID(Int_t pidHypo)
The CbmKF Kalman Filter algorithm.
std::vector< CbmKFMaterial * > vMaterial
static CbmKF * Instance()
FairTrackParam * GetParamLast()
Int_t GetNMvdHits() const
Int_t GetMvdHitIndex(Int_t iHit) const
Int_t GetNStsHits() const
Accessors.
Int_t GetStsHitIndex(Int_t iHit) const
FairTrackParam * GetParamFirst()
void SetPidHypo(Int_t pid)
Modifiers.
void CovMatrix(TMatrixFSym &covMat) const
Double_t GetX() const
Accessors.
virtual Int_t FindBin(const char *label)
virtual Double_t GetBinCenter(Int_t bin) const
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
virtual TObject * ReadObj()
const char * GetName() const override
const char * GetTitle() const override
friend friend class TClonesArray
Ssiz_t Last(char c) const
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
RVec< PromoteType< T > > sqrt(const RVec< T > &v)
Double_t Sign(Double_t a, Double_t b)
Double_t Sqrt(Double_t x)