CbmRoot
CbmEcalTrackingMuch.cxx
Go to the documentation of this file.
1 #include "CbmEcalTrackingMuch.h"
2 
3 #include "FairRootManager.h"
4 #include "FairTrackParam.h"
5 
6 #include "CbmStsKFTrackFitter.h"
7 #include "CbmStsTrack.h"
8 
9 #include "CbmEcalInf.h"
10 #include "CbmEcalStructure.h"
11 
12 #include "TClonesArray.h"
13 
14 #include <iostream>
15 
16 using std::cerr;
17 using std::cout;
18 using std::endl;
19 using std::list;
20 
22 void CbmEcalTrackingMuch::Exec(Option_t*) {
23  Int_t n = fStsTracks->GetEntriesFast();
24  Int_t i = 0;
25  CbmStsTrack* tr;
26  FairTrackParam tpar;
27 
28  fTrackPar->Clear();
29  for (; i < n; i++) {
30  tr = (CbmStsTrack*) fStsTracks->At(i);
31  if (!tr) continue;
32  fFitter->Extrapolate(tr, fCaloZ, &tpar);
33  new ((*fTrackPar)[i]) FairTrackParam(tpar);
34  }
35 }
36 
37 
38 CbmEcalTrackingMuch::CbmEcalTrackingMuch(const char* name, const Int_t iVerbose)
39  : FairTask(name, iVerbose)
40  , fStsTracks(NULL)
41  , fStr(NULL)
42  , fInf(NULL)
43  , fCaloZ(0.)
44  , fFitter(NULL)
45  , fTrackPar(NULL) {}
46 
49  FairRootManager* fManager = FairRootManager::Instance();
50  if (!fManager) {
51  Fatal("Init", "Can't find a Root Manager.");
52  return kFATAL;
53  }
54  fStsTracks = (TClonesArray*) fManager->GetObject("StsTrack");
55  if (!fStsTracks) {
56  Fatal("Init", "Can't find an array of STS tracks.");
57  return kFATAL;
58  }
59  fStr = (CbmEcalStructure*) fManager->GetObject("EcalStructure");
60  if (!fStr) {
61  Fatal("Init", "Can't find calorimeter structure in the system");
62  return kFATAL;
63  }
64  fTrackPar = new TClonesArray("FairTrackParam", 3000);
65  fManager->Register("EcalTrackParam",
66  "ECAL",
67  fTrackPar,
68  IsOutputBranchPersistent("EcalTrackParam"));
70  fInf = fStr->GetEcalInf();
71  fCaloZ = fInf->GetZPos();
72 
73  return kSUCCESS;
74 }
75 
78  fTrackPar->Delete();
79  delete fTrackPar;
80  delete fFitter;
81 }
82 
CbmStsKFTrackFitter::Extrapolate
void Extrapolate(CbmStsTrack *track, Double_t z, FairTrackParam *e_track)
Definition: CbmStsKFTrackFitter.cxx:134
CbmEcalTrackingMuch::Init
virtual InitStatus Init()
Definition: CbmEcalTrackingMuch.cxx:48
CbmEcalTrackingMuch::Exec
virtual void Exec(Option_t *option)
Definition: CbmEcalTrackingMuch.cxx:22
i
int i
Definition: L1/vectors/P4_F32vec4.h:25
CbmEcalTrackingMuch::fInf
CbmEcalInf * fInf
Definition: CbmEcalTrackingMuch.h:48
CbmEcalTrackingMuch
Definition: CbmEcalTrackingMuch.h:15
CbmEcalTrackingMuch::fStsTracks
TClonesArray * fStsTracks
Definition: CbmEcalTrackingMuch.h:40
CbmStsTrack.h
Data class for STS tracks.
CbmStsKFTrackFitter
Definition: CbmStsKFTrackFitter.h:14
ClassImp
ClassImp(CbmConverterManager) InitStatus CbmConverterManager
Definition: CbmConverterManager.cxx:12
CbmEcalTrackingMuch::fCaloZ
Float_t fCaloZ
Definition: CbmEcalTrackingMuch.h:50
CbmEcalTrackingMuch::CbmEcalTrackingMuch
CbmEcalTrackingMuch()
Definition: CbmEcalTrackingMuch.h:21
CbmEcalTrackingMuch::fStr
CbmEcalStructure * fStr
Definition: CbmEcalTrackingMuch.h:46
CbmEcalTrackingMuch::Finish
virtual void Finish()
Definition: CbmEcalTrackingMuch.cxx:77
CbmEcalTrackingMuch::fFitter
CbmStsKFTrackFitter * fFitter
Definition: CbmEcalTrackingMuch.h:52
CbmEcalTrackingMuch.h
CbmStsTrack
Definition: CbmStsTrack.h:37
CbmStsKFTrackFitter.h
CbmEcalTrackingMuch::fTrackPar
TClonesArray * fTrackPar
Definition: CbmEcalTrackingMuch.h:54