CbmRoot
Loading...
Searching...
No Matches
CbmPVFinderKF.cxx
Go to the documentation of this file.
1/* Copyright (C) 2006-2021 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Volker Friese, Denis Bertini [committer] */
4
5#include "CbmPVFinderKF.h"
6
7#include "CbmEvent.h"
9#include "CbmKFTrack.h"
10#include "CbmKFVertex.h"
11#include "CbmStsTrack.h"
12#include "TClonesArray.h"
13
14#include <cmath>
15
16// ---------------------------------------------------------------------------------------------------------------------
17//
19{
20
21 Int_t NTracks = tracks->GetEntriesFast();
22
24 CbmKFTrack* CloneArray = new CbmKFTrack[NTracks];
25 for (Int_t i = 0; i < NTracks; i++) {
26 CbmStsTrack* st = (CbmStsTrack*) tracks->At(i);
27 Int_t NHits = st->GetTotalNofHits();
28 if (NHits < 4) {
29 continue;
30 }
31 if (st->GetFlag()) {
32 continue;
33 }
34 if (st->GetChiSq() < 0. || st->GetChiSq() > 3.5 * 3.5 * st->GetNDF()) {
35 continue;
36 }
37 CbmKFTrack& T = CloneArray[i];
38 T.SetStsTrack(*st);
39 if (!std::isfinite(T.GetTrack()[0]) || !std::isfinite(T.GetCovMatrix()[0])) {
40 continue;
41 }
42 Finder.AddTrack(&T);
43 }
45 Finder.Fit(v);
46 v.GetVertex(*vertex);
47 delete[] CloneArray;
48 return vertex->GetNTracks();
49}
50
51// ---------------------------------------------------------------------------------------------------------------------
52//
54{
55
56 assert(event);
58
59 // Get vertex object
60 CbmVertex* vertex = event->GetVertex();
61
62 // Copy input tracks to KF tracks
63 Int_t nTracks = event->GetNofData(ECbmDataType::kStsTrack);
64 if (nTracks <= 0) {
65 return 0;
66 }
67
68 CbmKFTrack* trackArray = new CbmKFTrack[nTracks];
69 for (Int_t iTrack = 0; iTrack < nTracks; iTrack++) {
70 Int_t trackIndex = event->GetIndex(ECbmDataType::kStsTrack, iTrack);
71 CbmStsTrack* track = (CbmStsTrack*) tracks->At(trackIndex);
72 Int_t nHits = track->GetTotalNofHits();
73 if (nHits < 4) { // use only tracks with at least 4 hits
74 continue;
75 }
76 if (track->GetFlag()) { // do not use suspicious tracks
77 continue;
78 }
79 if (track->GetChiSq() < 0. || track->GetChiSq() > 12.25 * track->GetNDF()) { // use only good-quality tracks
80 continue;
81 }
82 CbmKFTrack& kTrack = trackArray[iTrack];
83 kTrack.SetStsTrack(*track);
84 if (!std::isfinite(kTrack.GetTrack()[0]) || !std::isfinite(kTrack.GetCovMatrix()[0])) {
85 continue;
86 }
87 vFinder.AddTrack(&kTrack);
88 }
89
90 // Do the vertex finding
92 vFinder.Fit(v);
93
94 // Copy KFVertex into CbmVertex
95 v.GetVertex(*vertex);
96
97 delete[] trackArray;
98 return vertex->GetNTracks();
99}
100
TClonesArray * tracks
ClassImp(CbmPVFinderKF)
Data class for STS tracks.
fscal v[fmask::Size]
Definition KfSimdPseudo.h:4
Class characterising one event by a collection of links (indices) to data objects,...
Definition CbmEvent.h:34
void AddTrack(CbmKFTrackInterface *Track, int32_t idx=-1)
void Fit(CbmKFVertexInterface &vtx)
void SetStsTrack(CbmStsTrack &track, bool first=1)
Double_t * GetCovMatrix() override
array[6] of track parameters(x,y,tx,ty,qp,z)
Definition CbmKFTrack.h:78
Double_t * GetTrack() override
Is it electron.
Definition CbmKFTrack.h:77
Implementation of the primary vertex finder using KF utility.
virtual Int_t FindEventVertex(CbmEvent *event, TClonesArray *tracks)
Execution of PV finding.
virtual Int_t FindPrimaryVertex(TClonesArray *tracks, CbmVertex *vertex)
Execution of PV finding.
virtual int32_t GetTotalNofHits() const
Definition CbmStsTrack.h:81
int32_t GetFlag() const
Definition CbmTrack.h:62
int32_t GetNDF() const
Definition CbmTrack.h:64
double GetChiSq() const
Definition CbmTrack.h:63
int32_t GetNTracks() const
Definition CbmVertex.h:72