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