CbmRoot
CbmRichTrackExtrapolationIdeal.cxx
Go to the documentation of this file.
1 
9 
10 #include "CbmGlobalTrack.h"
11 #include "CbmMCTrack.h"
12 #include "CbmRichPoint.h"
13 #include "CbmStsTrack.h"
14 #include "CbmTrackMatchNew.h"
15 #include "FairRootManager.h"
16 #include "FairTrackParam.h"
17 
18 #include "TClonesArray.h"
19 #include "TMatrixFSym.h"
20 
21 #include <iostream>
22 
23 using std::cout;
24 using std::endl;
25 
27  : fRefPlanePoints(NULL)
28  , fMcTracks(NULL)
29  , fStsTracks(NULL)
30  , fStsTrackMatches(NULL) {}
31 
33 
35  FairRootManager* ioman = FairRootManager::Instance();
36  if (NULL == ioman) {
37  Fatal("CbmRichTrackExtrapolationIdeal::Init",
38  "RootManager not instantised!");
39  }
40 
41  fMcTracks = (TClonesArray*) ioman->GetObject("MCTrack");
42  if (NULL == fMcTracks) {
43  Fatal("CbmRichTrackExtrapolationIdeal::Init", "No MCTrack array!");
44  }
45 
46  fRefPlanePoints = (TClonesArray*) ioman->GetObject("RefPlanePoint");
47  if (NULL == fRefPlanePoints) {
48  Fatal("CbmRichTrackExtrapolationIdeal::Init", "No RefPlanePoint array!");
49  }
50 
51  fStsTracks = (TClonesArray*) ioman->GetObject("StsTrack");
52  if (NULL == fStsTracks) {
53  Fatal("CbmRichTrackExtrapolationIdeal::Init", "No StsTrack array!");
54  }
55 
56  fStsTrackMatches = (TClonesArray*) ioman->GetObject("StsTrackMatch");
57  if (NULL == fStsTrackMatches) {
58  Fatal("CbmRichTrackExtrapolationIdeal::Init", "No StsTrackMatch array!");
59  }
60 }
61 
63  TClonesArray* globalTracks,
64  TClonesArray* extrapolatedTrackParams,
65  double /*z*/) {
66  if (NULL == extrapolatedTrackParams) {
67  cout << "-E- CbmRichTrackExtrapolationIdeal::DoExtrapolate: TrackParam "
68  "Array missing!"
69  << endl;
70  return;
71  }
72 
73  if (NULL == globalTracks) {
74  cout << "-E- CbmRichTrackExtrapolationIdeal::DoExtrapolate: Global Track "
75  "Array missing! "
76  << endl;
77  return;
78  }
79 
80  // some default variables
81  Double_t tx, ty, qp;
82  Double_t charge = 1.;
83  TMatrixFSym covMat(5);
84  for (Int_t i = 0; i < 5; i++)
85  for (Int_t j = 0; j <= i; j++)
86  covMat(i, j) = 0;
87  covMat(0, 0) = covMat(1, 1) = covMat(2, 2) = covMat(3, 3) = covMat(4, 4) =
88  1.e-4;
89 
90  TVector3 pos, mom;
91  Int_t nTracks = globalTracks->GetEntriesFast();
92  for (Int_t iTrack = 0; iTrack < nTracks; iTrack++) {
93  CbmGlobalTrack* gTrack = (CbmGlobalTrack*) globalTracks->At(iTrack);
94  new ((*extrapolatedTrackParams)[iTrack])
95  FairTrackParam(0., 0., 0., 0., 0., 0., covMat);
96  Int_t idSTS = gTrack->GetStsTrackIndex();
97  if (idSTS < 0) continue;
98  CbmStsTrack* pSTStr = (CbmStsTrack*) fStsTracks->At(idSTS);
99  if (NULL == pSTStr) continue;
100  CbmTrackMatchNew* pTrackMatch =
101  (CbmTrackMatchNew*) fStsTrackMatches->At(idSTS);
102  if (NULL == pTrackMatch) continue;
103  Int_t iMCmatch = pTrackMatch->GetMatchedLink().GetIndex();
104  for (Int_t ii = 0; ii < fRefPlanePoints->GetEntriesFast(); ii++) {
105  CbmRichPoint* pRefPlane = (CbmRichPoint*) fRefPlanePoints->At(ii);
106  if (pRefPlane->GetTrackID() == iMCmatch) {
107  pRefPlane->Momentum(mom);
108  pRefPlane->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  } // select MCPoint to that track
115  } // loop MCPoints
116  } // loop tracks
117 }
CbmRichPoint.h
CbmMatch::GetMatchedLink
const CbmLink & GetMatchedLink() const
Definition: CbmMatch.h:37
CbmRichTrackExtrapolationIdeal.h
This is the implementation of the TrackExtrapolation from MC points. It reads the STS track array,...
CbmRichTrackExtrapolationIdeal::~CbmRichTrackExtrapolationIdeal
virtual ~CbmRichTrackExtrapolationIdeal()
Destructor.
Definition: CbmRichTrackExtrapolationIdeal.cxx:32
CbmRichTrackExtrapolationIdeal::Init
virtual void Init()
Inherited from CbmRichTrackExtrapolationBase.
Definition: CbmRichTrackExtrapolationIdeal.cxx:34
i
int i
Definition: L1/vectors/P4_F32vec4.h:25
CbmGlobalTrack.h
CbmRichTrackExtrapolationIdeal::fRefPlanePoints
TClonesArray * fRefPlanePoints
Definition: CbmRichTrackExtrapolationIdeal.h:54
CbmStsTrack.h
Data class for STS tracks.
CbmGlobalTrack::GetStsTrackIndex
Int_t GetStsTrackIndex() const
Definition: CbmGlobalTrack.h:38
CbmRichTrackExtrapolationIdeal::fMcTracks
TClonesArray * fMcTracks
Definition: CbmRichTrackExtrapolationIdeal.h:55
CbmTrackMatchNew.h
CbmRichTrackExtrapolationIdeal::DoExtrapolation
virtual void DoExtrapolation(TClonesArray *globalTracks, TClonesArray *extrapolatedTrackParams, double z)
Inherited from CbmRichTrackExtrapolationBase.
Definition: CbmRichTrackExtrapolationIdeal.cxx:62
CbmGlobalTrack
Definition: CbmGlobalTrack.h:26
CbmMCTrack.h
CbmRichTrackExtrapolationIdeal::fStsTrackMatches
TClonesArray * fStsTrackMatches
Definition: CbmRichTrackExtrapolationIdeal.h:57
pos
TVector3 pos
Definition: CbmMvdSensorDigiToHitTask.cxx:60
CbmRichTrackExtrapolationIdeal::fStsTracks
TClonesArray * fStsTracks
Definition: CbmRichTrackExtrapolationIdeal.h:56
CbmTrackMatchNew
Definition: CbmTrackMatchNew.h:19
CbmRichTrackExtrapolationIdeal::CbmRichTrackExtrapolationIdeal
CbmRichTrackExtrapolationIdeal()
Default constructor.
Definition: CbmRichTrackExtrapolationIdeal.cxx:26
CbmStsTrack
Definition: CbmStsTrack.h:37
CbmRichPoint
Definition: CbmRichPoint.h:24