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