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