EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CbmRichTrackExtrapolationIdeal.cxx
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file CbmRichTrackExtrapolationIdeal.cxx
1 
8 #include <assert.h>
9 
11 
12 #include "CbmRichPoint.h"
13 #include "FairTrackParam.h"
14 #include "CbmMCTrack.h"
15 //#include "CbmStsTrack.h"
16 #include "CbmTrackMatch.h"
17 #include "CbmGlobalTrack.h"
18 #include "FairRootManager.h"
19 
20 #include "TClonesArray.h"
21 #include "TMatrixFSym.h"
22 
23 #include <iostream>
24 
25 using std::cout;
26 using std::endl;
27 
29  fRefPlanePoints(NULL),
30  fMcTracks(NULL)/*,
31  fStsTracks(NULL),
32  fStsTrackMatches(NULL)*/
33 {
34 
35 }
36 
38 {
39 }
40 
42 {
44  if (NULL == ioman) { Fatal("CbmRichTrackExtrapolationIdeal::Init", "RootManager not instantised!");}
45 
46  fMcTracks = (TClonesArray*) ioman->GetObject("MCTrack");
47  if ( NULL == fMcTracks) { Fatal("CbmRichTrackExtrapolationIdeal::Init", "No MCTrack array!");}
48 
49  fRefPlanePoints = (TClonesArray*) ioman->GetObject("RefPlanePoint");
50  if ( NULL == fRefPlanePoints) { Fatal("CbmRichTrackExtrapolationIdeal::Init", "No RefPlanePoint array!");}
51 
52  assert(0);
53 #if _OFF_
54  fStsTracks = (TClonesArray*) ioman->GetObject("StsTrack");
55  if ( NULL == fStsTracks) { Fatal("CbmRichTrackExtrapolationIdeal::Init", "No StsTrack array!");}
56 
57  fStsTrackMatches = (TClonesArray*) ioman->GetObject("StsTrackMatch");
58  if ( NULL == fStsTrackMatches) { Fatal("CbmRichTrackExtrapolationIdeal::Init", "No StsTrackMatch array!");}
59 #endif
60 }
61 
63  TClonesArray* globalTracks,
64  TClonesArray* extrapolatedTrackParams,
65  double z,
66  int minNofStsHits)
67 {
68  if ( NULL == extrapolatedTrackParams ) {
69  cout << "-E- CbmRichTrackExtrapolationIdeal::DoExtrapolate: TrackParam Array missing!" << endl;
70  return;
71  }
72 
73  if ( NULL == globalTracks ) {
74  cout << "-E- CbmRichTrackExtrapolationIdeal::DoExtrapolate: Global Track Array missing! " << endl;
75  return;
76  }
77 
78  // some default variables
79  Double_t tx,ty,qp;
80  Double_t charge = 1.;
81  TMatrixFSym covMat(5);
82  for(Int_t i=0;i<5;i++) for(Int_t j=0; j<=i; j++) covMat(i,j) = 0;
83  covMat(0,0) = covMat(1,1) = covMat(2,2) = covMat(3,3) = covMat(4,4) = 1.e-4;
84 
85  TVector3 pos, mom;
86  Int_t nTracks = globalTracks->GetEntriesFast();
87  for (Int_t iTrack=0; iTrack < nTracks; iTrack++){
88  CbmGlobalTrack* gTrack = (CbmGlobalTrack*) globalTracks->At(iTrack);
89  new((*extrapolatedTrackParams)[iTrack]) FairTrackParam(0.,0.,0.,0.,0.,0.,covMat);
90  Int_t idSTS = gTrack->GetStsTrackIndex();
91  if (idSTS < 0 ) continue;
92 
93  assert(0);
94 #if _OFF_
95  CbmStsTrack* pSTStr = (CbmStsTrack*) fStsTracks->At(idSTS);
96  if ( NULL == pSTStr ) continue;
97 
98  Int_t Nsts = pSTStr->GetNStsHits() + pSTStr->GetNMvdHits();
99  if ( Nsts >= minNofStsHits) {
100  CbmTrackMatch* pTrackMatch = (CbmTrackMatch*)fStsTrackMatches->At(idSTS);
101  if ( NULL == pTrackMatch) continue;
102  Int_t iMCmatch = pTrackMatch->GetMCTrackId();
103  for (Int_t ii=0; ii < fRefPlanePoints->GetEntriesFast(); ii++){
104  CbmRichPoint* pRefPlane = (CbmRichPoint*)fRefPlanePoints->At(ii);
105  if (pRefPlane->GetTrackID() == iMCmatch){
106  pRefPlane->Momentum(mom);
107  pRefPlane->Position(pos);
108  tx = mom.Px()/mom.Pz();
109  ty = mom.Py()/mom.Pz();
110  qp = charge/mom.Mag();
111  FairTrackParam richtrack(pos.X(),pos.Y(),pos.Z(),tx,ty,qp,covMat);
112  *(FairTrackParam*)(extrapolatedTrackParams->At(iTrack)) = richtrack;
113  } // select MCPoint to that track
114  } // loop MCPoints
115  } // require fMinNsts
116 #endif
117  } // loop tracks
118 }