CbmRoot
Loading...
Searching...
No Matches
LitVecPack.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
15#ifndef LITVECPACK_H_
16#define LITVECPACK_H_
17
18#include "LitHit.h"
19#include "LitTrackParam.h"
20#include "LitTypes.h"
21
22namespace lit
23{
24 namespace parallel
25 {
26
33 inline void PackFieldValue(const LitFieldValue<fscal> value[], LitFieldValue<fvec>& lvalue)
34 {
35 for (unsigned char i = 0; i < fvecLen; i++) {
36 lvalue.Bx[i] = value[i].Bx;
37 lvalue.By[i] = value[i].By;
38 lvalue.Bz[i] = value[i].Bz;
39 }
40 }
41
42
50 {
51 for (unsigned char i = 0; i < fvecLen; i++) {
52 lpar.X[i] = par[i].X;
53 lpar.Y[i] = par[i].Y;
54 lpar.Tx[i] = par[i].Tx;
55 lpar.Ty[i] = par[i].Ty;
56 lpar.Qp[i] = par[i].Qp;
57 lpar.Z[i] = par[i].Z;
58 lpar.C0[i] = par[i].C0;
59 lpar.C1[i] = par[i].C1;
60 lpar.C2[i] = par[i].C2;
61 lpar.C3[i] = par[i].C3;
62 lpar.C4[i] = par[i].C4;
63 lpar.C5[i] = par[i].C5;
64 lpar.C6[i] = par[i].C6;
65 lpar.C7[i] = par[i].C7;
66 lpar.C8[i] = par[i].C8;
67 lpar.C9[i] = par[i].C9;
68 lpar.C10[i] = par[i].C10;
69 lpar.C11[i] = par[i].C11;
70 lpar.C12[i] = par[i].C12;
71 lpar.C13[i] = par[i].C13;
72 lpar.C14[i] = par[i].C14;
73 }
74 }
75
76
84 {
85 for (unsigned char i = 0; i < fvecLen; i++) {
86 par[i].X = lpar.X[i];
87 par[i].Y = lpar.Y[i];
88 par[i].Tx = lpar.Tx[i];
89 par[i].Ty = lpar.Ty[i];
90 par[i].Qp = lpar.Qp[i];
91 par[i].Z = lpar.Z[i];
92 par[i].C0 = lpar.C0[i];
93 par[i].C1 = lpar.C1[i];
94 par[i].C2 = lpar.C2[i];
95 par[i].C3 = lpar.C3[i];
96 par[i].C4 = lpar.C4[i];
97 par[i].C5 = lpar.C5[i];
98 par[i].C6 = lpar.C6[i];
99 par[i].C7 = lpar.C7[i];
100 par[i].C8 = lpar.C8[i];
101 par[i].C9 = lpar.C9[i];
102 par[i].C10 = lpar.C10[i];
103 par[i].C11 = lpar.C11[i];
104 par[i].C12 = lpar.C12[i];
105 par[i].C13 = lpar.C13[i];
106 par[i].C14 = lpar.C14[i];
107 }
108 }
109
110
118 inline void UnpackTrackParam(unsigned int i, const LitTrackParam<fvec>& lpar, LitTrackParam<fscal>& par)
119 {
120 par.X = lpar.X[i];
121 par.Y = lpar.Y[i];
122 par.Tx = lpar.Tx[i];
123 par.Ty = lpar.Ty[i];
124 par.Qp = lpar.Qp[i];
125 par.Z = lpar.Z[i];
126 par.C0 = lpar.C0[i];
127 par.C1 = lpar.C1[i];
128 par.C2 = lpar.C2[i];
129 par.C3 = lpar.C3[i];
130 par.C4 = lpar.C4[i];
131 par.C5 = lpar.C5[i];
132 par.C6 = lpar.C6[i];
133 par.C7 = lpar.C7[i];
134 par.C8 = lpar.C8[i];
135 par.C9 = lpar.C9[i];
136 par.C10 = lpar.C10[i];
137 par.C11 = lpar.C11[i];
138 par.C12 = lpar.C12[i];
139 par.C13 = lpar.C13[i];
140 par.C14 = lpar.C14[i];
141 }
142
143
151 inline void PackPixelHit(const LitScalPixelHit hit[], LitPixelHit<fvec>& lhit)
152 {
153 for (unsigned char i = 0; i < fvecLen; i++) {
154 lhit.X[i] = hit[i].X;
155 lhit.Y[i] = hit[i].Y;
156 lhit.Dx[i] = hit[i].Dx;
157 lhit.Dy[i] = hit[i].Dy;
158 lhit.Dxy[i] = hit[i].Dxy;
159 }
160 }
161
162
170 inline void UnpackPixelHit(const LitPixelHit<fvec>& lhit, LitScalPixelHit hit[])
171 {
172 for (unsigned char i = 0; i < fvecLen; i++) {
173 hit[i].X = lhit.X[i];
174 hit[i].Y = lhit.Y[i];
175 hit[i].Dx = lhit.Dx[i];
176 hit[i].Dy = lhit.Dy[i];
177 hit[i].Dxy = lhit.Dxy[i];
178 }
179 }
180
181
189 inline void PackTrack(const LitTrack<fscal>* track[], LitTrack<fvec>& ltrack)
190 {
191 // LitTrackParam<fvec>& lparFirst = ltrack.paramFirst;
192 LitTrackParam<fvec>& lparLast = ltrack.paramLast;
193 //std::cout << "pack track parameters" << std::endl;
194 for (unsigned char i = 0; i < fvecLen; i++) {
195 // const LitTrackParam<fscal>* par = &track[i]->paramFirst;
196
197 // lparFirst.X[i] = par->X;
198 // lparFirst.Y[i] = par->Y;
199 // lparFirst.Tx[i] = par->Tx;
200 // lparFirst.Ty[i] = par->Ty;
201 // lparFirst.Qp[i] = par->Qp;
202 // lparFirst.Z[i] = par->Z;
203 // lparFirst.C0[i] = par->C0;
204 // lparFirst.C1[i] = par->C1;
205 // lparFirst.C2[i] = par->C2;
206 // lparFirst.C3[i] = par->C3;
207 // lparFirst.C4[i] = par->C4;
208 // lparFirst.C5[i] = par->C5;
209 // lparFirst.C6[i] = par->C6;
210 // lparFirst.C7[i] = par->C7;
211 // lparFirst.C8[i] = par->C8;
212 // lparFirst.C9[i] = par->C9;
213 // lparFirst.C10[i] = par->C10;
214 // lparFirst.C11[i] = par->C11;
215 // lparFirst.C12[i] = par->C12;
216 // lparFirst.C13[i] = par->C13;
217 // lparFirst.C14[i] = par->C14;
218
219 const LitTrackParam<fscal>* par = &track[i]->paramLast;
220 lparLast.X[i] = par->X;
221 lparLast.Y[i] = par->Y;
222 lparLast.Tx[i] = par->Tx;
223 lparLast.Ty[i] = par->Ty;
224 lparLast.Qp[i] = par->Qp;
225 lparLast.Z[i] = par->Z;
226 lparLast.C0[i] = par->C0;
227 lparLast.C1[i] = par->C1;
228 lparLast.C2[i] = par->C2;
229 lparLast.C3[i] = par->C3;
230 lparLast.C4[i] = par->C4;
231 lparLast.C5[i] = par->C5;
232 lparLast.C6[i] = par->C6;
233 lparLast.C7[i] = par->C7;
234 lparLast.C8[i] = par->C8;
235 lparLast.C9[i] = par->C9;
236 lparLast.C10[i] = par->C10;
237 lparLast.C11[i] = par->C11;
238 lparLast.C12[i] = par->C12;
239 lparLast.C13[i] = par->C13;
240 lparLast.C14[i] = par->C14;
241 }
242 // std::cout << "pack hits" << std::endl;
243 unsigned short nofHits = track[0]->GetNofHits();
244 for (unsigned short iHit = 0; iHit < nofHits; iHit++) {
245 LitPixelHit<fvec>* const lhit = ltrack.hits[iHit];
246 for (unsigned char i = 0; i < fvecLen; i++) {
247 LitPixelHit<fscal>* const hit = track[i]->hits[iHit];
248 lhit->X[i] = hit->X;
249 lhit->Y[i] = hit->Y;
250 lhit->Dx[i] = hit->Dx;
251 lhit->Dy[i] = hit->Dy;
252 lhit->Dxy[i] = hit->Dxy;
253 }
254 }
255 // std::cout << "pack hits finished" << std::endl;
256 // FIXME: check if we need to set nofHits
257 // ltrack.nofHits = nofHits;
258 }
259
260
270 inline void UnpackTrack(const LitTrack<fvec>& ltrack, LitTrack<fscal> track[])
271 {
272 std::cout << "UnpackTrack: not implemented!" << std::endl;
273 }
274
275 } // namespace parallel
276} // namespace lit
277#endif /* LITVECPACK_H_ */
Track parameters data class.
Header files for SSE operations.
Magnetic field value at a certain point in the space.
Base class for pixel hits.
Definition LitPixelHit.h:35
Base class for scalar pixel hits.
Track parameters data class.
Base track data class.
Definition LitTrack.h:37
unsigned short GetNofHits() const
Return number of hits in track.
Definition LitTrack.h:59
vector< LitPixelHit< T > * > hits
Definition LitTrack.h:85
LitTrackParam< T > paramLast
Definition LitTrack.h:84
void PackPixelHit(const LitScalPixelHit hit[], LitPixelHit< fvec > &lhit)
Packs LitPixelHit.
Definition LitVecPack.h:151
void UnpackTrackParam(const LitTrackParam< fvec > &lpar, LitTrackParam< fscal > par[])
Unpacks LitTrackParam.
Definition LitVecPack.h:83
void UnpackTrack(const LitTrack< fvec > &ltrack, LitTrack< fscal > track[])
Unpacks LitTrack.
Definition LitVecPack.h:270
void UnpackPixelHit(const LitPixelHit< fvec > &lhit, LitScalPixelHit hit[])
Unpacks LitPixelHit.
Definition LitVecPack.h:170
void PackFieldValue(const LitFieldValue< fscal > value[], LitFieldValue< fvec > &lvalue)
Packs LitFieldValue.
Definition LitVecPack.h:33
void PackTrackParam(const LitTrackParam< fscal > par[], LitTrackParam< fvec > &lpar)
Packs LitTrackParam.
Definition LitVecPack.h:49
void PackTrack(const LitTrack< fscal > *track[], LitTrack< fvec > &ltrack)
Packs LitTrack.
Definition LitVecPack.h:189