CbmRoot
Loading...
Searching...
No Matches
CbmLitTrackFitterImp.cxx
Go to the documentation of this file.
1/* Copyright (C) 2007-2017 GSI/JINR-LIT, Darmstadt/Dubna
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Andrey Lebedev [committer] */
4
11
12#include "data/CbmLitFitNode.h"
13#include "data/CbmLitHit.h"
14#include "data/CbmLitStripHit.h"
15#include "data/CbmLitTrack.h"
19#include "utils/CbmLitMath.h"
20
21#include <iostream>
22
28
30
32{
33 track->SortHits(downstream);
34 track->SetChi2(0.0);
35 Int_t nofHits = track->GetNofHits();
36 FitNodeVector nodes(nofHits);
38 std::vector<litfloat> F(36);
39
40 if (downstream) {
41 track->SetParamLast(track->GetParamFirst());
42 par = *track->GetParamLast();
43 }
44 else {
45 track->SetParamFirst(track->GetParamLast());
46 par = *track->GetParamFirst();
47 }
48
49 litfloat totalLength = 0.;
50
51 for (Int_t iHit = 0; iHit < nofHits; iHit++) {
52 const CbmLitHit* hit = track->GetHit(iHit);
53 litfloat Ze = hit->GetZ();
54 litfloat length = 0;
55 if (fPropagator->Propagate(&par, Ze, track->GetPDG(), &F, &length) == kLITERROR) {
56 track->SetQuality(kLITBAD);
57 //std::cout << "PROP ERROR: Ze=" << Ze << " length=" << length << " par=" << par.ToString();
58 return kLITERROR;
59 }
60 totalLength += length;
61 nodes[iHit].SetPredictedParam(&par);
62 nodes[iHit].SetF(F);
63 litfloat chi2Hit = 0.;
64 if (fUpdate->Update(&par, hit, chi2Hit) == kLITERROR) {
65 track->SetQuality(kLITBAD);
66 //std::cout << "UPD ERROR: Ze=" << Ze << " length=" << length << " par=" << par.ToString();
67 return kLITERROR;
68 }
69 nodes[iHit].SetUpdatedParam(&par);
70 nodes[iHit].SetChiSqFiltered(chi2Hit);
71 track->SetChi2(track->GetChi2() + chi2Hit);
72 if (iHit == 0) {
73 if (downstream) {
74 track->SetParamFirst(&par);
75 }
76 else {
77 track->SetParamLast(&par);
78 }
79 }
80 }
81 if (downstream) {
82 track->SetParamLast(&par);
83 }
84 else {
85 track->SetParamFirst(&par);
86 }
87
88 track->SetFitNodes(nodes);
89 track->SetNDF(lit::NDF(track));
90 track->SetLength(totalLength);
91
92 return kLITSUCCESS;
93}
@ kLITBAD
Definition CbmLitEnums.h:40
LitStatus
Definition CbmLitEnums.h:29
@ kLITERROR
Definition CbmLitEnums.h:31
@ kLITSUCCESS
Definition CbmLitEnums.h:30
Data class for storage of fitted track parameters, transport matrix and chi-square on each detector s...
double litfloat
Definition CbmLitFloat.h:19
Base data class for hits.
Base data class for strip hits.
Implementation of Kalman Filter track fit.
Data class for track parameters.
Interface for track update algorithm.
Base data class for track.
vector< CbmLitFitNode > FitNodeVector
Definition CbmLitTypes.h:39
boost::shared_ptr< CbmLitTrackPropagator > TrackPropagatorPtr
boost::shared_ptr< CbmLitTrackUpdate > TrackUpdatePtr
Base data class for hits.
Definition CbmLitHit.h:29
litfloat GetZ() const
Definition CbmLitHit.h:44
TrackPropagatorPtr fPropagator
virtual LitStatus Fit(CbmLitTrack *track, bool downstream=true)
Inherited from CbmLitTrackFitter.
virtual ~CbmLitTrackFitterImp()
Destructor.
CbmLitTrackFitterImp(TrackPropagatorPtr propagator, TrackUpdatePtr update)
Constructor.
Data class for track parameters.
Base data class for track.
Definition CbmLitTrack.h:34
void SetParamLast(const CbmLitTrackParam *par)
Definition CbmLitTrack.h:86
void SetLength(litfloat length)
Definition CbmLitTrack.h:93
void SetParamFirst(const CbmLitTrackParam *par)
Definition CbmLitTrack.h:85
void SetNDF(Int_t ndf)
Definition CbmLitTrack.h:82
const CbmLitTrackParam * GetParamFirst() const
Definition CbmLitTrack.h:68
void SortHits(Bool_t downstream=true)
Sort hits by Z position.
const CbmLitHit * GetHit(Int_t index) const
Definition CbmLitTrack.h:71
const CbmLitTrackParam * GetParamLast() const
Definition CbmLitTrack.h:69
Int_t GetPDG() const
Definition CbmLitTrack.h:67
void SetChi2(litfloat chi2)
Definition CbmLitTrack.h:81
Int_t GetNofHits() const
Definition CbmLitTrack.h:62
void SetQuality(LitTrackQa quality)
Definition CbmLitTrack.h:80
void SetFitNodes(const vector< CbmLitFitNode > &nodes)
Definition CbmLitTrack.h:90
litfloat GetChi2() const
Definition CbmLitTrack.h:64
Int_t NDF(const CbmLitTrack *track)