CbmRoot
CbmLitConverterParallel.cxx
Go to the documentation of this file.
1 
8 #include "CbmMuchTrack.h"
9 #include "CbmPixelHit.h"
10 #include "CbmTrack.h"
11 #include "CbmTrdTrack.h"
12 #include "FairTrackParam.h"
13 #include "TClonesArray.h"
15 #include "parallel/LitScalTrack.h"
16 #include "parallel/LitTrackParam.h"
17 
18 #include "TClonesArray.h"
19 
20 #include <cassert>
21 
22 
24 
26 
28  const FairTrackParam* par,
30  lpar->X = par->GetX();
31  lpar->Y = par->GetY();
32  lpar->Tx = par->GetTx();
33  lpar->Ty = par->GetTy();
34  lpar->Qp = par->GetQp();
35  lpar->Z = par->GetZ();
36  Double_t cov[15];
37  par->CovMatrix(cov);
38  lpar->C0 = cov[0];
39  lpar->C1 = cov[1];
40  lpar->C2 = cov[2];
41  lpar->C3 = cov[3];
42  lpar->C4 = cov[4];
43  lpar->C5 = cov[5];
44  lpar->C6 = cov[6];
45  lpar->C7 = cov[7];
46  lpar->C8 = cov[8];
47  lpar->C9 = cov[9];
48  lpar->C10 = cov[10];
49  lpar->C11 = cov[11];
50  lpar->C12 = cov[12];
51  lpar->C13 = cov[13];
52  lpar->C14 = cov[14];
53 }
54 
57  FairTrackParam* par) {
58  par->SetX(lpar->X);
59  par->SetY(lpar->Y);
60  par->SetTx(lpar->Tx);
61  par->SetTy(lpar->Ty);
62  par->SetQp(lpar->Qp);
63  par->SetZ(lpar->Z);
64  Double_t cov[15];
65  cov[0] = lpar->C0;
66  cov[1] = lpar->C1;
67  cov[2] = lpar->C2;
68  cov[3] = lpar->C3;
69  cov[4] = lpar->C4;
70  cov[5] = lpar->C5;
71  cov[6] = lpar->C6;
72  cov[7] = lpar->C7;
73  cov[8] = lpar->C8;
74  cov[9] = lpar->C9;
75  cov[10] = lpar->C10;
76  cov[11] = lpar->C11;
77  cov[12] = lpar->C12;
78  cov[13] = lpar->C13;
79  cov[14] = lpar->C14;
80  par->SetCovMatrix(cov);
81 }
82 
84  const CbmPixelHit* hit,
86  assert(hit->GetType() == kTRDHIT || hit->GetType() == kMUCHPIXELHIT
87  || hit->GetType() == kTOFHIT);
88 
89  lhit->X = hit->GetX();
90  lhit->Y = hit->GetY();
91  lhit->Z = hit->GetZ();
92  lhit->Dx = hit->GetDx();
93  lhit->Dy = hit->GetDy();
94  lhit->Dxy = hit->GetDxy();
95  lhit->refId = hit->GetRefId();
96 
97  if (hit->GetType() == kTRDHIT) {
98  lhit->stationId = hit->GetPlaneId();
99  } else if (hit->GetType() == kMUCHPIXELHIT) {
100  lhit->stationId = (hit->GetPlaneId() - 1) / 2;
101  } else if (hit->GetType() == kTOFHIT) {
102  lhit->stationId = 0;
103  }
104 }
105 
107  const TClonesArray* hits,
108  vector<lit::parallel::LitScalPixelHit*>& lhits) {
109  Int_t nofHits = hits->GetEntriesFast();
110  for (Int_t iHit = 0; iHit < nofHits; iHit++) {
111  const CbmPixelHit* hit = static_cast<const CbmPixelHit*>(hits->At(iHit));
113  CbmPixelHitToLitScalPixelHit(hit, lhit);
114  lhits.push_back(lhit);
115  }
116 }
117 
119  const CbmTrack* track,
120  const vector<lit::parallel::LitScalPixelHit*>& lhits,
121  lit::parallel::LitScalTrack* ltrack) {
122  // Convert hits
123  Int_t nofHits = track->GetNofHits();
124  for (Int_t iHit = 0; iHit < nofHits; iHit++) {
125  // Now we convert only pixel hits
126  if (track->GetHitType(iHit) != kPIXELHIT
127  && track->GetHitType(iHit) != kTRDHIT
128  && track->GetHitType(iHit) != kMUCHPIXELHIT)
129  continue;
130  Int_t hitId = track->GetHitIndex(iHit);
131  ltrack->AddHit(lhits[hitId]);
132  }
133  // Convert first and last track parameter
136  ltrack->SetParamFirst(lpar);
138  ltrack->SetParamFirst(lpar);
139  // Convert other parameters
140  ltrack->SetChiSq(track->GetChiSq());
141  ltrack->SetNDF(track->GetNDF());
142  ltrack->SetPreviousTrackId(track->GetPreviousTrackId());
143  ltrack->SetNofMissingHits(0);
144  ltrack->IsGood(true);
145 }
146 
148  const TClonesArray* tracks,
149  const vector<lit::parallel::LitScalPixelHit*>& lhits,
150  vector<lit::parallel::LitScalTrack*>& ltracks) {
151  Int_t nofTracks = tracks->GetEntriesFast();
152  for (Int_t iTrack = 0; iTrack < nofTracks; iTrack++) {
153  const CbmTrack* track = static_cast<const CbmTrack*>(tracks->At(iTrack));
155  CbmTrackToLitScalTrack(track, lhits, ltrack);
156  ltracks.push_back(ltrack);
157  }
158 }
159 
161  const lit::parallel::LitScalTrack* ltrack,
162  CbmTrack* track) {
163  // Convert hits
164  Int_t nofHits = ltrack->GetNofHits();
165  for (Int_t iHit = 0; iHit < nofHits; iHit++) {
166  Int_t hitId = ltrack->GetHit(iHit)->refId;
167  track->AddHit(hitId, kTRDHIT);
168  }
169  // Convert first and last track parameter
170  FairTrackParam par;
172  track->SetParamFirst(&par);
174  track->SetParamLast(&par);
175  // Convert other parameters
176  track->SetChiSq(ltrack->GetChiSq());
177  track->SetNDF(ltrack->GetNDF());
178  track->SetPreviousTrackId(ltrack->GetPreviousTrackId());
179 }
180 
182  const vector<lit::parallel::LitScalTrack*>& ltracks,
183  TClonesArray* tracks) {
184  Int_t nofTracks = ltracks.size();
185  for (Int_t iTrack = 0; iTrack < nofTracks; iTrack++) {
186  lit::parallel::LitScalTrack* ltrack = ltracks[iTrack];
187  CbmTrdTrack* track = new ((*tracks)[iTrack]) CbmTrdTrack();
188  LitScalTrackToCbmTrack(ltrack, track);
189  }
190 }
191 
193  const vector<lit::parallel::LitScalTrack*>& ltracks,
194  TClonesArray* tracks) {
195  Int_t nofTracks = ltracks.size();
196  for (Int_t iTrack = 0; iTrack < nofTracks; iTrack++) {
197  lit::parallel::LitScalTrack* ltrack = ltracks[iTrack];
198  CbmMuchTrack* track = new ((*tracks)[iTrack]) CbmMuchTrack();
199  LitScalTrackToCbmTrack(ltrack, track);
200  }
201 }
lit::parallel::LitTrackParam::C2
T C2
Definition: LitTrackParam.h:100
CbmHit::GetZ
Double_t GetZ() const
Definition: CbmHit.h:70
lit::parallel::LitTrackParam::Z
T Z
Definition: LitTrackParam.h:94
CbmTrack::GetChiSq
Double_t GetChiSq() const
Definition: CbmTrack.h:58
lit::parallel::LitScalPixelHit
Base class for scalar pixel hits.
Definition: LitScalPixelHit.h:31
lit::parallel::LitTrackParam::C10
T C10
Definition: LitTrackParam.h:100
CbmTrack::GetParamLast
const FairTrackParam * GetParamLast() const
Definition: CbmTrack.h:62
CbmPixelHit::GetDxy
Double_t GetDxy() const
Definition: CbmPixelHit.h:87
lit::parallel::LitScalTrack::GetNDF
unsigned short GetNDF() const
Returns number of degrees of freedom.
Definition: LitScalTrack.h:134
CbmPixelHit::GetX
Double_t GetX() const
Definition: CbmPixelHit.h:83
lit::parallel::LitTrackParam::C13
T C13
Definition: LitTrackParam.h:100
CbmTrack::GetNofHits
virtual Int_t GetNofHits() const
Definition: CbmTrack.h:53
lit::parallel::LitTrackParam::X
T X
Definition: LitTrackParam.h:92
lit::parallel::LitTrackParam::C8
T C8
Definition: LitTrackParam.h:100
lit::parallel::LitTrackParam::Y
T Y
Definition: LitTrackParam.h:93
CbmPixelHit::GetY
Double_t GetY() const
Definition: CbmPixelHit.h:84
lit::parallel::LitScalTrack::GetChiSq
fscal GetChiSq() const
Returns chi square of the track.
Definition: LitScalTrack.h:116
CbmPixelHit::GetDx
Double_t GetDx() const
Definition: CbmPixelHit.h:85
lit::parallel::LitScalTrack::GetHit
const LitScalPixelHit * GetHit(unsigned short index) const
Returns pointer to the hit.
Definition: LitScalTrack.h:82
CbmLitConverterParallel::~CbmLitConverterParallel
virtual ~CbmLitConverterParallel()
Destructor.
Definition: CbmLitConverterParallel.cxx:25
kTOFHIT
@ kTOFHIT
Definition: CbmHit.h:26
lit::parallel::LitScalPixelHit::Dxy
fscal Dxy
Definition: LitScalPixelHit.h:75
lit::parallel::LitTrackParam::C0
T C0
Definition: LitTrackParam.h:100
CbmTrack::SetPreviousTrackId
void SetPreviousTrackId(Int_t previousTrackId)
Definition: CbmTrack.h:72
CbmLitConverterParallel::LitScalTrackToCbmTrack
static void LitScalTrackToCbmTrack(const lit::parallel::LitScalTrack *ltrack, CbmTrack *track)
Convert LitScalTrack to CbmTrack.
Definition: CbmLitConverterParallel.cxx:160
CbmLitConverterParallel::CbmLitConverterParallel
CbmLitConverterParallel()
Constructor.
Definition: CbmLitConverterParallel.cxx:23
LitTrackParam.h
Track parameters data class.
CbmHit::GetRefId
Int_t GetRefId() const
Definition: CbmHit.h:72
lit::parallel::LitScalPixelHit::Z
fscal Z
Definition: LitScalPixelHit.h:78
CbmTrack::SetParamLast
void SetParamLast(const FairTrackParam *par)
Definition: CbmTrack.h:76
CbmTrack::SetNDF
void SetNDF(Int_t ndf)
Definition: CbmTrack.h:71
lit::parallel::LitTrackParam::C9
T C9
Definition: LitTrackParam.h:100
lit::parallel::LitScalTrack
Scalar track data class.
Definition: LitScalTrack.h:33
lit::parallel::LitScalTrack::GetNofHits
unsigned short GetNofHits() const
Returns number of hits in track.
Definition: LitScalTrack.h:66
CbmPixelHit::GetDy
Double_t GetDy() const
Definition: CbmPixelHit.h:86
lit::parallel::LitTrackParam::C3
T C3
Definition: LitTrackParam.h:100
CbmMuchTrack
Definition: CbmMuchTrack.h:16
lit::parallel::LitScalTrack::SetPreviousTrackId
void SetPreviousTrackId(unsigned short previousTrackId)
Sets previous trackId.
Definition: LitScalTrack.h:188
CbmHit::GetPlaneId
virtual Int_t GetPlaneId() const
Definition: CbmHit.h:97
lit::parallel::LitTrackParam::C14
T C14
Definition: LitTrackParam.h:100
lit::parallel::LitTrackParam::C4
T C4
Definition: LitTrackParam.h:100
lit::parallel::LitScalTrack::AddHit
void AddHit(const LitScalPixelHit *hit)
Adds hit to track.
Definition: LitScalTrack.h:60
lit::parallel::LitTrackParam< fscal >
lit::parallel::LitTrackParam::C12
T C12
Definition: LitTrackParam.h:100
CbmTrack
Definition: CbmTrack.h:32
CbmLitConverterParallel::CbmTrackToLitScalTrack
static void CbmTrackToLitScalTrack(const CbmTrack *track, const vector< lit::parallel::LitScalPixelHit * > &lhits, lit::parallel::LitScalTrack *ltrack)
Convert CbmTrack to LitScalTrack.
Definition: CbmLitConverterParallel.cxx:118
CbmLitConverterParallel::FairTrackParamToLitTrackParamScal
static void FairTrackParamToLitTrackParamScal(const FairTrackParam *par, lit::parallel::LitTrackParamScal *lpar)
Convert FairTrackParam to LitTrackParamScal.
Definition: CbmLitConverterParallel.cxx:27
CbmMuchTrack.h
lit::parallel::LitScalTrack::IsGood
bool IsGood() const
Returns true if track is good.
Definition: LitScalTrack.h:196
lit::parallel::LitTrackParam::Ty
T Ty
Definition: LitTrackParam.h:96
lit::parallel::LitScalTrack::SetParamFirst
void SetParamFirst(const LitTrackParamScal &param)
Sets first track parameter.
Definition: LitScalTrack.h:96
tracks
TClonesArray * tracks
Definition: Analyze_matching.h:17
CbmTrack.h
CbmLitConverterParallel::LitScalTrackArrayToCbmMuchTrackArray
static void LitScalTrackArrayToCbmMuchTrackArray(const vector< lit::parallel::LitScalTrack * > &ltracks, TClonesArray *tracks)
Convert array of LitScalTrack to array of CbmTrack.
Definition: CbmLitConverterParallel.cxx:192
lit::parallel::LitScalPixelHit::Dx
fscal Dx
Definition: LitScalPixelHit.h:74
lit::parallel::LitTrackParam::Tx
T Tx
Definition: LitTrackParam.h:95
LitScalTrack.h
Scalar track data class.
lit::parallel::LitScalPixelHit::Y
fscal Y
Definition: LitScalPixelHit.h:73
CbmTrack::GetHitIndex
Int_t GetHitIndex(Int_t iHit) const
Definition: CbmTrack.h:54
lit::parallel::LitScalPixelHit::Dy
fscal Dy
Definition: LitScalPixelHit.h:74
lit::parallel::LitScalTrack::SetNofMissingHits
void SetNofMissingHits(unsigned short nofMissingHits)
Sets number of missing hits.
Definition: LitScalTrack.h:152
lit::parallel::LitScalPixelHit::X
fscal X
Definition: LitScalPixelHit.h:73
CbmLitConverterParallel::LitScalTrackArrayToCbmTrdTrackArray
static void LitScalTrackArrayToCbmTrdTrackArray(const vector< lit::parallel::LitScalTrack * > &ltracks, TClonesArray *tracks)
Convert array of LitScalTrack to array of CbmTrack.
Definition: CbmLitConverterParallel.cxx:181
LitScalPixelHit.h
Base class for scalar pixel hits.
CbmTrack::SetChiSq
void SetChiSq(Double_t chiSq)
Definition: CbmTrack.h:70
lit::parallel::LitScalTrack::GetPreviousTrackId
unsigned short GetPreviousTrackId() const
Return Previous track index.
Definition: LitScalTrack.h:182
CbmTrack::GetNDF
Int_t GetNDF() const
Definition: CbmTrack.h:59
CbmTrack::GetPreviousTrackId
Int_t GetPreviousTrackId() const
Definition: CbmTrack.h:60
CbmPixelHit.h
lit::parallel::LitScalPixelHit::stationId
unsigned char stationId
Definition: LitScalPixelHit.h:76
kPIXELHIT
@ kPIXELHIT
Definition: CbmHit.h:18
CbmTrack::GetHitType
HitType GetHitType(Int_t iHit) const
Definition: CbmTrack.h:55
CbmLitConverterParallel::CbmPixelHitArrayToLitScalPixelHitArray
static void CbmPixelHitArrayToLitScalPixelHitArray(const TClonesArray *hits, vector< lit::parallel::LitScalPixelHit * > &lhits)
Convert CbmPixelHit array to LitScalPixelHit arra.
Definition: CbmLitConverterParallel.cxx:106
CbmTrack::GetParamFirst
const FairTrackParam * GetParamFirst() const
Definition: CbmTrack.h:61
CbmLitConverterParallel::CbmPixelHitToLitScalPixelHit
static void CbmPixelHitToLitScalPixelHit(const CbmPixelHit *hit, lit::parallel::LitScalPixelHit *lhit)
Convert CbmPixelHit to LitScalPixelHit.
Definition: CbmLitConverterParallel.cxx:83
kTRDHIT
@ kTRDHIT
Definition: CbmHit.h:25
CbmLitConverterParallel.h
Class for conversion between CBMROOT data classes and littrack parallel data classes.
CbmTrdTrack
Definition: CbmTrdTrack.h:22
lit::parallel::LitTrackParam::C5
T C5
Definition: LitTrackParam.h:100
lit::parallel::LitTrackParam::C1
T C1
Definition: LitTrackParam.h:100
lit::parallel::LitScalTrack::GetParamFirst
const LitTrackParamScal & GetParamFirst() const
Returns first parameter of the track.
Definition: LitScalTrack.h:90
lit::parallel::LitScalPixelHit::refId
unsigned short refId
Definition: LitScalPixelHit.h:77
CbmLitConverterParallel::CbmTrackArrayToLitScalTrackArray
static void CbmTrackArrayToLitScalTrackArray(const TClonesArray *tracks, const vector< lit::parallel::LitScalPixelHit * > &lhits, vector< lit::parallel::LitScalTrack * > &ltracks)
Convert array of CbmTrack to array of LitScalTrack.
Definition: CbmLitConverterParallel.cxx:147
lit::parallel::LitTrackParam::C11
T C11
Definition: LitTrackParam.h:100
lit::parallel::LitTrackParam::C7
T C7
Definition: LitTrackParam.h:100
CbmLitConverterParallel::LitTrackParamScalToFairTrackParam
static void LitTrackParamScalToFairTrackParam(const lit::parallel::LitTrackParamScal *lpar, FairTrackParam *par)
Convert LitTrackParamScal to FairTrackParam.
Definition: CbmLitConverterParallel.cxx:55
lit::parallel::LitScalTrack::SetChiSq
void SetChiSq(fscal chiSq)
Sets chi square.
Definition: LitScalTrack.h:122
lit::parallel::LitScalTrack::GetParamLast
const LitTrackParamScal & GetParamLast() const
Returns last parameter of the track.
Definition: LitScalTrack.h:104
lit::parallel::LitTrackParam::C6
T C6
Definition: LitTrackParam.h:100
CbmTrack::SetParamFirst
void SetParamFirst(const FairTrackParam *par)
Definition: CbmTrack.h:75
hits
static vector< vector< QAHit > > hits
Definition: CbmTofHitFinderTBQA.cxx:114
lit::parallel::LitTrackParam::Qp
T Qp
Definition: LitTrackParam.h:97
CbmPixelHit
Definition: CbmPixelHit.h:21
kMUCHPIXELHIT
@ kMUCHPIXELHIT
Definition: CbmHit.h:23
CbmTrdTrack.h
CbmTrack::AddHit
void AddHit(Int_t index, HitType type)
Definition: CbmTrack.cxx:75
CbmHit::GetType
HitType GetType() const
Definition: CbmHit.h:69
lit::parallel::LitScalTrack::SetNDF
void SetNDF(unsigned short NDF)
Sets number of degrees of freedom.
Definition: LitScalTrack.h:140