CbmRoot
CbmEcalTrackExtrapolationKF.cxx
Go to the documentation of this file.
1 
2 #include <iostream>
3 
4 #include "TClonesArray.h"
5 
6 #include "CbmEcalInf.h"
7 #include "CbmEcalStructure.h"
9 #include "CbmGlobalTrack.h"
10 #include "CbmKFTrack.h"
11 #include "CbmMCTrack.h"
12 #include "CbmStsKFTrackFitter.h"
13 #include "CbmStsTrack.h"
14 #include "FairRootManager.h"
15 #include "FairTrackParam.h"
16 
17 using namespace std;
18 
19 // ----- Default constructor -------------------------------------------
21  : CbmEcalTrackExtrapolation(1)
22  , fTrackParamArray(NULL)
23  , fSTSArray(NULL)
24  , iEx(-1) {
25  ;
26 }
27 // -------------------------------------------------------------------------
28 
29 
30 // ----- Standard constructor ------------------------------------------
32  : CbmEcalTrackExtrapolation(verbose)
33  , fTrackParamArray(NULL)
34  , fSTSArray(NULL)
35  , iEx(-1) {
36  ;
37 }
38 // -------------------------------------------------------------------------
39 
40 
41 // ----- Destructor ----------------------------------------------------
43 // -------------------------------------------------------------------------
44 
45 
46 // ----- Public method Init --------------------------------------------
48  CbmEcalTrackExtrapolation::Init();
49  //Get and check FairRootManager
50  FairRootManager* ioman = FairRootManager::Instance();
51  if (!ioman)
52  Fatal("CbmEcalTrackExtrapolationKF::Init()",
53  "Can't instantise Rootmanager");
54 
55  //Get STS track array
56  fSTSArray = (TClonesArray*) ioman->GetObject("StsTrack");
57  if (!fSTSArray)
58  cout << "-W- CbmEcalTrackExtrapolationKF::Init: No sts track array!"
59  << endl;
60 }
61 // -------------------------------------------------------------------------
62 
63 
64 // ----- Public method DoExtrapolate ------------------------------------------
66  TClonesArray* gTrackArray,
67  TClonesArray* fTrackParamArray_) {
68  if (!fTrackParamArray_) {
69  cout << "-E- CbmEcalTrackExtrapolationKF::DoExtrapolate: ";
70  cout << "TrackParamArray missing! " << endl;
71  return -1;
72  }
73 
74  if (!gTrackArray) {
75  cout << "-E- CbmEcalTrackExtrapolationKF::DoExtrapolate: ";
76  cout << "Track Array missing! " << endl;
77  return -1;
78  }
79  Int_t nTr = 0;
80  Int_t i = 0;
81  Int_t n = gTrackArray->GetEntriesFast();
82  CbmGlobalTrack* tr;
83  CbmKFTrack kfTr;
84  FairTrackParam trpar;
85  for (; i < n; i++) {
86  Map()[nTr] = -1111;
87  tr = (CbmGlobalTrack*) gTrackArray->At(i);
88  if (!tr) continue;
89  if (tr->GetStsTrackIndex() < 0 || tr->GetTrdTrackIndex() < 0) continue;
90  kfTr.SetTrackParam(*(const_cast<FairTrackParam*>(tr->GetParamLast())));
91  kfTr.Extrapolate(Str()->GetEcalInf()->GetZPos());
92  kfTr.GetTrackParam(trpar);
93  Map()[nTr] = i;
94  new ((*fTrackParamArray_)[nTr++]) FairTrackParam(trpar);
95  }
96 
97  return nTr;
98 }
99 // -------------------------------------------------------------------------
100 
101 
102 // ----- Public method Finish ------------------------------------------
104 //-----------------------------------------------------------------------------------
105 
CbmEcalTrackExtrapolationKF::DoExtrapolate
virtual Int_t DoExtrapolate(TClonesArray *gTrackArray, TClonesArray *fTrackParamArray)
Definition: CbmEcalTrackExtrapolationKF.cxx:65
CbmEcalTrackExtrapolationKF.h
CbmGlobalTrack::GetParamLast
const FairTrackParam * GetParamLast() const
Definition: CbmGlobalTrack.h:44
CbmEcalTrackExtrapolationKF::~CbmEcalTrackExtrapolationKF
virtual ~CbmEcalTrackExtrapolationKF()
Definition: CbmEcalTrackExtrapolationKF.cxx:42
CbmKFTrack::GetTrackParam
void GetTrackParam(FairTrackParam &track)
Definition: CbmKFTrack.cxx:45
i
int i
Definition: L1/vectors/P4_F32vec4.h:25
CbmGlobalTrack.h
CbmEcalTrackExtrapolationKF::Finish
virtual void Finish()
Definition: CbmEcalTrackExtrapolationKF.cxx:103
CbmStsTrack.h
Data class for STS tracks.
CbmGlobalTrack::GetStsTrackIndex
Int_t GetStsTrackIndex() const
Definition: CbmGlobalTrack.h:38
CbmGlobalTrack::GetTrdTrackIndex
Int_t GetTrdTrackIndex() const
Definition: CbmGlobalTrack.h:39
CbmEcalTrackExtrapolationKF::Init
virtual void Init()
Definition: CbmEcalTrackExtrapolationKF.cxx:47
ClassImp
ClassImp(CbmConverterManager) InitStatus CbmConverterManager
Definition: CbmConverterManager.cxx:12
CbmKFTrack.h
CbmEcalTrackExtrapolationKF::CbmEcalTrackExtrapolationKF
CbmEcalTrackExtrapolationKF()
Definition: CbmEcalTrackExtrapolationKF.cxx:20
CbmGlobalTrack
Definition: CbmGlobalTrack.h:26
CbmMCTrack.h
CbmEcalTrackExtrapolationKF
Definition: CbmEcalTrackExtrapolationKF.h:35
CbmEcalTrackExtrapolationKF::fSTSArray
TClonesArray * fSTSArray
Definition: CbmEcalTrackExtrapolationKF.h:61
CbmKFTrack
Definition: CbmKFTrack.h:21
CbmKFTrack::SetTrackParam
void SetTrackParam(const FairTrackParam &track)
Definition: CbmKFTrack.cxx:34
CbmStsKFTrackFitter.h
CbmKFTrackInterface::Extrapolate
Int_t Extrapolate(Double_t z, Double_t *QP0=0)
Access to i-th hit.
Definition: CbmKFTrackInterface.cxx:39