CbmRoot
Loading...
Searching...
No Matches
CbmFitGlobalTracks.cxx
Go to the documentation of this file.
1/* Copyright (C) 2006-2015 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Dmytro Kresan, Denis Bertini [committer], Florian Uhlig */
4
5// ------------------------------------------------------------------
6// ----- CbmFitGlobalTracks -----
7// ----- Created 06/03/2006 by D.Kresan -----
8// ------------------------------------------------------------------
10
11#include "CbmGlobalTrack.h"
13#include "FairRootManager.h"
14#include "TClonesArray.h"
15
16#include <iostream>
17
18using std::cout;
19using std::endl;
20
21//___________________________________________________________________
22//
23// CbmFitGlobalTracks
24//
25// Task for global track fitting. Uses algorithm, provided by concre-
26// te implementation of CbmGlobalTrackFitter class. This concrete en-
27// gine is to be set in standard constructor or by UseFitter method.
28//
29
30
31// ------------------------------------------------------------------
32CbmFitGlobalTracks::CbmFitGlobalTracks() : FairTask(), fVerbose(0), fFitter(NULL), fArrayGlbTrack(NULL) {}
33// ------------------------------------------------------------------
34
35
36// ------------------------------------------------------------------
37CbmFitGlobalTracks::CbmFitGlobalTracks(const char* name, Int_t verbose, CbmGlobalTrackFitter* fitter)
38 : FairTask(name, verbose)
39 , fVerbose(verbose)
40 , fFitter(fitter)
41 , fArrayGlbTrack(NULL)
42{
43}
44// ------------------------------------------------------------------
45
46
47// ------------------------------------------------------------------
49{
50 // Destructor
51}
52// ------------------------------------------------------------------
53
54
55// ------------------------------------------------------------------
57{
58 // Initialisation of the task. Initialise fitter
59 if (NULL == fFitter) {
60 cout << "-E- CbmFitGlobalTracks::Init : "
61 << "no track fitter selected!" << endl;
62 return kERROR;
63 }
64 fFitter->Init();
65 // Get pointer to the ROOT manager
66 FairRootManager* rootMgr = FairRootManager::Instance();
67 if (NULL == rootMgr) {
68 cout << "-E- CbmFitGlobalTracks::Init : "
69 << "CBM ROOT manager is not instantiated!" << endl;
70 return kERROR;
71 }
72 fArrayGlbTrack = (TClonesArray*) rootMgr->GetObject("GlobalTrack");
73 if (NULL == fArrayGlbTrack) {
74 cout << "-W- CbmFitGlobalTracks::Init : "
75 << "no global track array!" << endl;
76 }
77 return kSUCCESS;
78}
79// ------------------------------------------------------------------
80
81
82// ------------------------------------------------------------------
84{
85 // Task execution. Call DoFit of the fitter for each global track
86 if (NULL != fArrayGlbTrack) {
87 CbmGlobalTrack* glbTrack;
88 for (Int_t iGlbTrack = 0; iGlbTrack < fArrayGlbTrack->GetEntriesFast(); iGlbTrack++) {
89 // Get pointer to the global track
90 glbTrack = (CbmGlobalTrack*) fArrayGlbTrack->At(iGlbTrack);
91 if (NULL == glbTrack) continue;
92 // Fit the global track
93 fFitter->DoFit(glbTrack);
94 }
95 }
96}
97// ------------------------------------------------------------------
98
99
100// ------------------------------------------------------------------
102{
103 // Finish of the task execution
104}
105// ------------------------------------------------------------------
106
107
static FairRootManager * rootMgr
ClassImp(CbmFitGlobalTracks)
CbmGlobalTrackFitter * fFitter
virtual InitStatus Init()
virtual void Exec(Option_t *option="")
TClonesArray * fArrayGlbTrack
virtual void DoFit(CbmGlobalTrack *glbTrack)=0