CbmRoot
LitCudaConverter.h
Go to the documentation of this file.
1 
9 #ifndef LITCUDACONVERTER_H_
10 #define LITCUDACONVERTER_H_
11 
12 #include "CbmLitPixelHit.h"
13 #include "CbmLitTrack.h"
14 #include "CbmLitTrackParam.h"
15 
16 #include "LitCudaHit.h"
17 #include "LitCudaTrack.h"
18 #include "LitCudaTrackParam.h"
19 
20 /* Converts CbmLitPixelHit to LitCudaPixelHit.
21  * @param hit Pointer to CbmLitPixelHit.
22  * @param lhit Pointer to LitScalPixelHit.
23  */
25  LitCudaPixelHit* lhit) {
26  lhit->X = hit->GetX();
27  lhit->Y = hit->GetY();
28  lhit->Dx = hit->GetDx();
29  lhit->Dy = hit->GetDy();
30  lhit->Dxy = hit->GetDxy();
31  lhit->planeId = hit->GetPlaneId();
32  lhit->refId = hit->GetRefId();
33  lhit->Z = hit->GetZ();
34 }
35 
36 /* Converts CbmLitTrackParam to LitCudaTrackParam.
37  * @param par Pointer to CbmLitTrackParam.
38  * @param lpar Pointer to LitCudaTrackParam.
39  */
41  LitCudaTrackParam* lpar) {
42  lpar->X = par->GetX();
43  lpar->Y = par->GetY();
44  lpar->Tx = par->GetTx();
45  lpar->Ty = par->GetTy();
46  lpar->Qp = par->GetQp();
47  lpar->Z = par->GetZ();
48  lpar->C0 = par->GetCovariance(0);
49  lpar->C1 = par->GetCovariance(1);
50  lpar->C2 = par->GetCovariance(2);
51  lpar->C3 = par->GetCovariance(3);
52  lpar->C4 = par->GetCovariance(4);
53  lpar->C5 = par->GetCovariance(5);
54  lpar->C6 = par->GetCovariance(6);
55  lpar->C7 = par->GetCovariance(7);
56  lpar->C8 = par->GetCovariance(8);
57  lpar->C9 = par->GetCovariance(9);
58  lpar->C10 = par->GetCovariance(10);
59  lpar->C11 = par->GetCovariance(11);
60  lpar->C12 = par->GetCovariance(12);
61  lpar->C13 = par->GetCovariance(13);
62  lpar->C14 = par->GetCovariance(14);
63 }
64 
65 /* Converts LitCudaTrackParam to CbmLitTrackParam.
66  * @param lpar Pointer to LitCudaTrackParam.
67  * @param par Pointer to CbmLitTrackParam.
68  */
70  CbmLitTrackParam* par) {
71  par->SetX(lpar->X);
72  par->SetY(lpar->Y);
73  par->SetTx(lpar->Tx);
74  par->SetTy(lpar->Ty);
75  par->SetQp(lpar->Qp);
76  par->SetZ(lpar->Z);
77  par->SetCovariance(0, lpar->C0);
78  par->SetCovariance(1, lpar->C1);
79  par->SetCovariance(2, lpar->C2);
80  par->SetCovariance(3, lpar->C3);
81  par->SetCovariance(4, lpar->C4);
82  par->SetCovariance(5, lpar->C5);
83  par->SetCovariance(6, lpar->C6);
84  par->SetCovariance(7, lpar->C7);
85  par->SetCovariance(8, lpar->C8);
86  par->SetCovariance(9, lpar->C9);
87  par->SetCovariance(10, lpar->C10);
88  par->SetCovariance(11, lpar->C11);
89  par->SetCovariance(12, lpar->C12);
90  par->SetCovariance(13, lpar->C13);
91  par->SetCovariance(14, lpar->C14);
92 }
93 
94 /* Concerts LitCudaTrack to CbmLitTrack.
95  * @param ltrack Pointer to LitCudaTrack.
96  * @param track Pointer to CbmLitTrack.
97  */
99  CbmLitTrack* track) {
100  // Convert track parameters
101  CbmLitTrackParam parFirst, parLast;
102  LitCudaTrackParamToCbmLitTrackParam(&(ltrack->paramFirst), &parFirst);
103  LitCudaTrackParamToCbmLitTrackParam(&(ltrack->paramLast), &parLast);
104  track->SetParamLast(&parLast);
105  track->SetParamFirst(&parFirst);
106 
107  // Copy other track parameters
108  track->SetChi2(ltrack->chiSq);
109  track->SetNDF(ltrack->NDF);
110  track->SetPreviousTrackId(ltrack->previouseTrackId);
111  track->SetQuality(kLITGOOD);
112  // track->SetRefId(std::distance(ltracks.begin(), it));
113 
114  // Convert hits
115  for (int i = 0; i < ltrack->nofHits; i++) {
116  CbmLitPixelHit* newHit = new CbmLitPixelHit;
117  newHit->SetX(ltrack->hits[i]->X);
118  newHit->SetY(ltrack->hits[i]->Y);
119  newHit->SetDx(ltrack->hits[i]->Dx);
120  newHit->SetDy(ltrack->hits[i]->Dy);
121  newHit->SetDxy(ltrack->hits[i]->Dxy);
122  newHit->SetPlaneId(ltrack->hits[i]->planeId);
123  newHit->SetHitType(kLITPIXELHIT);
124  newHit->SetDetectorId(kLITMUCH);
125  newHit->SetRefId(ltrack->hits[i]->refId);
126  newHit->SetZ(ltrack->hits[i]->Z);
127  // std::cout << ltrack->hits[i];
128  track->AddHit(newHit);
129  }
130 }
131 
132 /* Converts CbmLitTrack to LitCudaTrack.
133  * @param track Pointer to CbmLitTrack.
134  * @param ltrack Pointer to LitCudaTrack.
135  */
137  LitCudaTrack* ltrack) {
138  // Convert track parameters
139  // CbmLitTrackParamToLitTrackParamScal(track->GetParamFirst(), &(ltrack->paramFirst));
141  &(ltrack->paramLast));
142 
143  // Copy other track parameters
144  // ltrack->chiSq = track->GetChi2();
145  // ltrack->NDF = track->GetNDF();
146  // ltrack->previouseTrackId = track->GetPreviousTrackId();
147 
148  // Convert hits
149  for (int i = 0; i < track->GetNofHits(); i++) {
150  LitCudaPixelHit* newHit = new LitCudaPixelHit;
151  CbmLitPixelHit* hit = (CbmLitPixelHit*) track->GetHit(i);
152  newHit->X = hit->GetX();
153  newHit->Y = hit->GetY();
154  newHit->Dx = hit->GetDx();
155  newHit->Dy = hit->GetDy();
156  newHit->Dxy = hit->GetDxy();
157  // newHit->planeId = hit->GetPlaneId();
158  // newHit->refId = hit->GetRefId();
159  // newHit->Z = hit->GetZ();
160  ltrack->AddHit(newHit);
161  }
162 }
163 #endif /* LITCUDACONVERTER_H_ */
CbmLitTrackParam.h
Data class for track parameters.
CbmLitTrackParam::SetTy
void SetTy(litfloat ty)
Definition: CbmLitTrackParam.h:68
CbmLitHit::SetZ
void SetZ(litfloat z)
Definition: CbmLitHit.h:62
LitCudaTrack::previouseTrackId
unsigned short previouseTrackId
Definition: LitCudaTrack.h:26
LitCudaTrackParam::C2
float C2
Definition: LitCudaTrackParam.h:9
LitCudaTrackParam::C4
float C4
Definition: LitCudaTrackParam.h:9
kLITGOOD
@ kLITGOOD
Definition: CbmLitEnums.h:32
LitCudaPixelHit::Z
float Z
Definition: LitCudaHit.h:35
CbmLitPixelHit::GetDy
litfloat GetDy() const
Definition: CbmLitPixelHit.h:40
LitCudaTrackParam::Qp
float Qp
Definition: LitCudaTrackParam.h:7
LitCudaTrackParamToCbmLitTrackParam
void LitCudaTrackParamToCbmLitTrackParam(const LitCudaTrackParam *lpar, CbmLitTrackParam *par)
Definition: LitCudaConverter.h:69
LitCudaPixelHit
Definition: LitCudaHit.h:28
CbmLitPixelHitToLitCudaPixelHit
void CbmLitPixelHitToLitCudaPixelHit(const CbmLitPixelHit *hit, LitCudaPixelHit *lhit)
Definition: LitCudaConverter.h:24
CbmLitTrackParam::GetX
litfloat GetX() const
Definition: CbmLitTrackParam.h:53
LitCudaTrackParam::C11
float C11
Definition: LitCudaTrackParam.h:9
LitCudaTrack::paramFirst
LitCudaTrackParam paramFirst
Definition: LitCudaTrack.h:19
CbmLitPixelHit::SetY
void SetY(litfloat y)
Definition: CbmLitPixelHit.h:45
LitCudaTrackParam::C7
float C7
Definition: LitCudaTrackParam.h:9
CbmLitHit::GetZ
litfloat GetZ() const
Definition: CbmLitHit.h:48
CbmLitTrackParam
Data class for track parameters.
Definition: CbmLitTrackParam.h:29
LitCudaTrackParam::C1
float C1
Definition: LitCudaTrackParam.h:9
LitCudaTrack::chiSq
float chiSq
Definition: LitCudaTrack.h:21
i
int i
Definition: L1/vectors/P4_F32vec4.h:25
CbmLitTrackParam::GetY
litfloat GetY() const
Definition: CbmLitTrackParam.h:54
CbmLitTrack::SetParamFirst
void SetParamFirst(const CbmLitTrackParam *par)
Definition: CbmLitTrack.h:81
CbmLitTrackParam::GetQp
litfloat GetQp() const
Definition: CbmLitTrackParam.h:58
LitCudaTrack::NDF
unsigned short NDF
Definition: LitCudaTrack.h:22
CbmLitTrack::SetPreviousTrackId
void SetPreviousTrackId(Int_t id)
Definition: CbmLitTrack.h:79
CbmLitHit::GetRefId
Int_t GetRefId() const
Definition: CbmLitHit.h:46
CbmLitTrackParam::SetZ
void SetZ(litfloat z)
Definition: CbmLitTrackParam.h:66
CbmLitTrackParam::GetCovariance
litfloat GetCovariance(int index) const
Definition: CbmLitTrackParam.h:60
CbmLitTrackParam::SetQp
void SetQp(litfloat qp)
Definition: CbmLitTrackParam.h:69
CbmLitPixelHit.h
Base data class for pixel hits.
LitCudaHit.h
LitCudaTrackParam
Definition: LitCudaTrackParam.h:6
LitCudaTrackParam::C8
float C8
Definition: LitCudaTrackParam.h:9
CbmLitHit::SetDetectorId
void SetDetectorId(LitSystemId sysId, Int_t station)
Definition: CbmLitHit.h:66
CbmLitTrack::SetParamLast
void SetParamLast(const CbmLitTrackParam *par)
Definition: CbmLitTrack.h:82
LitCudaPixelHit::Y
float Y
Definition: LitCudaHit.h:30
LitCudaTrackParam::C10
float C10
Definition: LitCudaTrackParam.h:9
CbmLitTrack::SetNDF
void SetNDF(Int_t ndf)
Definition: CbmLitTrack.h:78
LitCudaTrack
Definition: LitCudaTrack.h:12
LitCudaTrack::paramLast
LitCudaTrackParam paramLast
Definition: LitCudaTrack.h:20
LitCudaTrack.h
LitCudaTrackParam::Tx
float Tx
Definition: LitCudaTrackParam.h:7
CbmLitPixelHit::GetY
litfloat GetY() const
Definition: CbmLitPixelHit.h:38
LitCudaTrack::nofHits
unsigned short nofHits
Definition: LitCudaTrack.h:24
CbmLitHit::SetRefId
void SetRefId(Int_t refId)
Definition: CbmLitHit.h:60
LitCudaTrackParam::Ty
float Ty
Definition: LitCudaTrackParam.h:7
LitCudaTrackParam::C6
float C6
Definition: LitCudaTrackParam.h:9
kLITMUCH
@ kLITMUCH
Definition: CbmLitEnums.h:41
LitCudaPixelHit::Dxy
float Dxy
Definition: LitCudaHit.h:32
LitCudaTrackParam::C3
float C3
Definition: LitCudaTrackParam.h:9
CbmLitTrackParam::GetZ
litfloat GetZ() const
Definition: CbmLitTrackParam.h:55
LitCudaTrackToCbmLitTrack
void LitCudaTrackToCbmLitTrack(LitCudaTrack *ltrack, CbmLitTrack *track)
Definition: LitCudaConverter.h:98
CbmLitTrackParam::SetY
void SetY(litfloat y)
Definition: CbmLitTrackParam.h:65
LitCudaTrackParam::C14
float C14
Definition: LitCudaTrackParam.h:9
CbmLitTrack
Base data class for track.
Definition: CbmLitTrack.h:30
CbmLitPixelHit
Base data class for pixel hits.
Definition: CbmLitPixelHit.h:22
LitCudaPixelHit::planeId
unsigned char planeId
Definition: LitCudaHit.h:33
kLITPIXELHIT
@ kLITPIXELHIT
Definition: CbmLitEnums.h:16
LitCudaPixelHit::Dy
float Dy
Definition: LitCudaHit.h:31
LitCudaTrackParam::C12
float C12
Definition: LitCudaTrackParam.h:9
CbmLitTrackParamToLitCudaTrackParam
void CbmLitTrackParamToLitCudaTrackParam(const CbmLitTrackParam *par, LitCudaTrackParam *lpar)
Definition: LitCudaConverter.h:40
CbmLitTrack::GetParamLast
const CbmLitTrackParam * GetParamLast() const
Definition: CbmLitTrack.h:63
CbmLitTrackToLitCudaTrack
void CbmLitTrackToLitCudaTrack(CbmLitTrack *track, LitCudaTrack *ltrack)
Definition: LitCudaConverter.h:136
CbmLitHit::SetHitType
void SetHitType(LitHitType hitType)
Definition: CbmLitHit.h:61
CbmLitPixelHit::GetDxy
litfloat GetDxy() const
Definition: CbmLitPixelHit.h:41
LitCudaPixelHit::refId
unsigned short refId
Definition: LitCudaHit.h:34
CbmLitTrack::SetQuality
void SetQuality(LitTrackQa quality)
Definition: CbmLitTrack.h:76
CbmLitPixelHit::SetDx
void SetDx(litfloat dx)
Definition: CbmLitPixelHit.h:46
CbmLitPixelHit::GetX
litfloat GetX() const
Definition: CbmLitPixelHit.h:37
LitCudaTrackParam::Y
float Y
Definition: LitCudaTrackParam.h:7
LitCudaTrackParam.h
CbmLitPixelHit::SetDy
void SetDy(litfloat dy)
Definition: CbmLitPixelHit.h:47
CbmLitPixelHit::SetDxy
void SetDxy(litfloat dxy)
Definition: CbmLitPixelHit.h:48
LitCudaTrackParam::X
float X
Definition: LitCudaTrackParam.h:7
LitCudaTrackParam::Z
float Z
Definition: LitCudaTrackParam.h:7
CbmLitTrack.h
Base data class for track.
LitCudaPixelHit::X
float X
Definition: LitCudaHit.h:30
LitCudaTrackParam::C13
float C13
Definition: LitCudaTrackParam.h:9
LitCudaTrackParam::C5
float C5
Definition: LitCudaTrackParam.h:9
CbmLitTrackParam::GetTy
litfloat GetTy() const
Definition: CbmLitTrackParam.h:57
LitCudaPixelHit::Dx
float Dx
Definition: LitCudaHit.h:31
CbmLitTrackParam::SetX
void SetX(litfloat x)
Definition: CbmLitTrackParam.h:64
CbmLitPixelHit::SetX
void SetX(litfloat x)
Definition: CbmLitPixelHit.h:44
LitCudaTrackParam::C9
float C9
Definition: LitCudaTrackParam.h:9
LitCudaTrackParam::C0
float C0
Definition: LitCudaTrackParam.h:9
LitCudaTrack::hits
LitCudaPixelHit * hits[LIT_CUDA_MAX_NOF_HITS_IN_TRACK]
Definition: LitCudaTrack.h:23
CbmLitTrackParam::SetCovariance
void SetCovariance(int index, litfloat cov)
Definition: CbmLitTrackParam.h:74
CbmLitTrack::GetHit
const CbmLitHit * GetHit(Int_t index) const
Definition: CbmLitTrack.h:65
CbmLitTrackParam::GetTx
litfloat GetTx() const
Definition: CbmLitTrackParam.h:56
LitCudaTrack::AddHit
void AddHit(LitCudaPixelHit *hit)
Definition: LitCudaTrack.h:17
CbmLitPixelHit::GetDx
litfloat GetDx() const
Definition: CbmLitPixelHit.h:39
CbmLitTrack::AddHit
void AddHit(const CbmLitHit *hit)
Add hit to track. No additional memory is allocated for hit.
Definition: CbmLitTrack.h:96
CbmLitTrack::SetChi2
void SetChi2(litfloat chi2)
Definition: CbmLitTrack.h:77
CbmLitTrack::GetNofHits
Int_t GetNofHits() const
Definition: CbmLitTrack.h:56
CbmLitTrackParam::SetTx
void SetTx(litfloat tx)
Definition: CbmLitTrackParam.h:67