EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CbmRichTrackExtrapolationKF.cxx
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file CbmRichTrackExtrapolationKF.cxx
1 
8 
9 //@@#include "CbmStsKFTrackFitter.h"
10 
11 #include "FairTrackParam.h"
12 //#include "CbmStsTrack.h"
13 #include "CbmGlobalTrack.h"
14 #include "FairTrackParam.h"
15 #include "FairRootManager.h"
16 
17 #include "TClonesArray.h"
18 #include "TMatrixFSym.h"
19 
20 #include <iostream>
21 
22 #include <PndTrack.h>
23 #include <FairGeanePro.h>
24 
25 using std::cout;
26 using std::endl;
27 
29  //fStsTracks(0)
30  fEicTracks(0)
31 {
32 }
33 
35 {
36 }
37 
39 {
41  if ( NULL == ioman) { Fatal("CbmRichTrackExtrapolationKF::Init", "RootManager not instantised!");}
42 
43  //fStsTracks = (TClonesArray*) ioman->GetObject("StsTrack");
44  //if ( NULL == fStsTracks) {Fatal("CbmRichTrackExtrapolationKF::Init", "No StsTrack array!");}
45  fEicTracks = (TClonesArray*) ioman->GetObject("EicIdealGenTrack");
46  if ( NULL == fEicTracks) {Fatal("CbmRichTrackExtrapolationKF::Init", "No reconstructed Track array!");}
47 }
48 
50  TClonesArray* globalTracks,
51  TClonesArray* extrapolatedTrackParams,
52  double z,
53  int minNofStsHits)
54 {
55  if ( NULL == extrapolatedTrackParams ) {
56  cout << "-E- CbmRichTrackExtrapolationKF::DoExtrapolate: TrackParamArray missing!" << endl;
57  return;
58  }
59 
60 #if _OLD_
61  if ( NULL == globalTracks ) {
62  cout << "-E- CbmRichTrackExtrapolationKF::DoExtrapolate: Track Array missing!" << endl;
63  return;
64  }
65 #endif
66 
67  TMatrixFSym covMat(5);
68  for(Int_t i=0;i<5;i++) for(Int_t j=0; j<=i; j++) covMat(i,j) = 0;
69  covMat(0,0) = covMat(1,1) = covMat(2,2) = covMat(3,3) = covMat(4,4) = 1.e-4;
70 
71  TVector3 pos, mom;
72 
73 #if _ORIG_
74  Int_t nTracks = globalTracks->GetEntriesFast();
75  for (Int_t iTrack=0; iTrack < nTracks; iTrack++){
76  CbmGlobalTrack* gTrack = (CbmGlobalTrack*)globalTracks->At(iTrack);
77  new((*extrapolatedTrackParams)[iTrack]) FairTrackParam(0.,0.,0.,0.,0.,0.,covMat);
78  Int_t idSTS = gTrack->GetStsTrackIndex();
79  if (idSTS < 0 ) continue;
80  CbmStsTrack* pSTStr = (CbmStsTrack*) fStsTracks->At(idSTS);
81  if ( NULL == pSTStr ) continue;
82 
83  CbmStsKFTrackFitter KF;
84  FairTrackParam ExTrack;
85 
86  KF.Extrapolate(pSTStr, z, &ExTrack);
87 
88  Int_t Nsts = pSTStr->GetNStsHits();
89 
90  if ( Nsts >= minNofStsHits) {
91  *(FairTrackParam*)(extrapolatedTrackParams->At(iTrack)) = ExTrack;
92  }
93  }
94 #else
95  Int_t nTracks = fEicTracks->GetEntriesFast();
96  for (Int_t iTrack=0; iTrack < nTracks; iTrack++) {
97  PndTrack *track = (PndTrack*) fEicTracks->At(iTrack);
98  //CbmGlobalTrack* gTrack = (CbmGlobalTrack*)globalTracks->At(iTrack);
99 
100 
101  //Int_t idSTS = gTrack->GetStsTrackIndex();
102  //if (idSTS < 0 ) continue;
103  //CbmStsTrack* pSTStr = (CbmStsTrack*) fStsTracks->At(idSTS);
104  //if ( NULL == pSTStr ) continue;
105 
106  //CbmStsKFTrackFitter KF;
107  FairGeanePro *fPro0 = new FairGeanePro();
108  FairTrackParP *fRes= new FairTrackParP();
109  FairTrackParam ExTrack;
110  FairTrackParP par = track->GetParamLast();
111  TVector3 x0(0,0,z), u0(1,0,0), v0(0,1,0);
112  fPro0->PropagateToPlane(x0, u0, v0);
113  //KF.Extrapolate(track, z, &ExTrack);
114  Bool_t rc = fPro0->Propagate(&par, fRes, -211); // FIXME: PID correctly, please!;
115 
116  new((*extrapolatedTrackParams)[iTrack])
117  FairTrackParam(fRes->GetX(), fRes->GetY(), fRes->GetZ(),
118  fRes->GetPx()/fRes->GetPz(), fRes->GetPy()/fRes->GetPz(),
119  fRes->GetQp(), covMat);
120  //printf("%f %f %f, %f %f %f\n", fRes->GetX(), fRes->GetY(), fRes->GetZ(),
121  // fRes->GetPx()/fRes->GetPz(), fRes->GetPy()/fRes->GetPz(),
122  // fRes->GetQp());
123 
124 #if 0
125  //Int_t Nsts = pSTStr->GetNStsHits();
126  //if ( Nsts >= minNofStsHits) {
127  //*(FairTrackParam*)(extrapolatedTrackParams->At(iTrack)) = ExTrack;
128  *(FairTrackParP*)(extrapolatedTrackParams->At(iTrack)) = *fRes;
129  // }
130 #endif
131  } //for iTrack
132 #endif
133 }