CbmRoot
LitVecPack.h
Go to the documentation of this file.
1 
11 #ifndef LITVECPACK_H_
12 #define LITVECPACK_H_
13 
14 #include "LitHit.h"
15 #include "LitTrackParam.h"
16 #include "LitTypes.h"
17 
18 namespace lit {
19  namespace parallel {
20 
27  inline void PackFieldValue(const LitFieldValue<fscal> value[],
28  LitFieldValue<fvec>& lvalue) {
29  for (unsigned char i = 0; i < fvecLen; i++) {
30  lvalue.Bx[i] = value[i].Bx;
31  lvalue.By[i] = value[i].By;
32  lvalue.Bz[i] = value[i].Bz;
33  }
34  }
35 
36 
43  inline void PackTrackParam(const LitTrackParam<fscal> par[],
44  LitTrackParam<fvec>& lpar) {
45  for (unsigned char i = 0; i < fvecLen; i++) {
46  lpar.X[i] = par[i].X;
47  lpar.Y[i] = par[i].Y;
48  lpar.Tx[i] = par[i].Tx;
49  lpar.Ty[i] = par[i].Ty;
50  lpar.Qp[i] = par[i].Qp;
51  lpar.Z[i] = par[i].Z;
52  lpar.C0[i] = par[i].C0;
53  lpar.C1[i] = par[i].C1;
54  lpar.C2[i] = par[i].C2;
55  lpar.C3[i] = par[i].C3;
56  lpar.C4[i] = par[i].C4;
57  lpar.C5[i] = par[i].C5;
58  lpar.C6[i] = par[i].C6;
59  lpar.C7[i] = par[i].C7;
60  lpar.C8[i] = par[i].C8;
61  lpar.C9[i] = par[i].C9;
62  lpar.C10[i] = par[i].C10;
63  lpar.C11[i] = par[i].C11;
64  lpar.C12[i] = par[i].C12;
65  lpar.C13[i] = par[i].C13;
66  lpar.C14[i] = par[i].C14;
67  }
68  }
69 
70 
77  inline void UnpackTrackParam(const LitTrackParam<fvec>& lpar,
78  LitTrackParam<fscal> par[]) {
79  for (unsigned char i = 0; i < fvecLen; i++) {
80  par[i].X = lpar.X[i];
81  par[i].Y = lpar.Y[i];
82  par[i].Tx = lpar.Tx[i];
83  par[i].Ty = lpar.Ty[i];
84  par[i].Qp = lpar.Qp[i];
85  par[i].Z = lpar.Z[i];
86  par[i].C0 = lpar.C0[i];
87  par[i].C1 = lpar.C1[i];
88  par[i].C2 = lpar.C2[i];
89  par[i].C3 = lpar.C3[i];
90  par[i].C4 = lpar.C4[i];
91  par[i].C5 = lpar.C5[i];
92  par[i].C6 = lpar.C6[i];
93  par[i].C7 = lpar.C7[i];
94  par[i].C8 = lpar.C8[i];
95  par[i].C9 = lpar.C9[i];
96  par[i].C10 = lpar.C10[i];
97  par[i].C11 = lpar.C11[i];
98  par[i].C12 = lpar.C12[i];
99  par[i].C13 = lpar.C13[i];
100  par[i].C14 = lpar.C14[i];
101  }
102  }
103 
104 
112  inline void UnpackTrackParam(unsigned int i,
113  const LitTrackParam<fvec>& lpar,
114  LitTrackParam<fscal>& par) {
115  par.X = lpar.X[i];
116  par.Y = lpar.Y[i];
117  par.Tx = lpar.Tx[i];
118  par.Ty = lpar.Ty[i];
119  par.Qp = lpar.Qp[i];
120  par.Z = lpar.Z[i];
121  par.C0 = lpar.C0[i];
122  par.C1 = lpar.C1[i];
123  par.C2 = lpar.C2[i];
124  par.C3 = lpar.C3[i];
125  par.C4 = lpar.C4[i];
126  par.C5 = lpar.C5[i];
127  par.C6 = lpar.C6[i];
128  par.C7 = lpar.C7[i];
129  par.C8 = lpar.C8[i];
130  par.C9 = lpar.C9[i];
131  par.C10 = lpar.C10[i];
132  par.C11 = lpar.C11[i];
133  par.C12 = lpar.C12[i];
134  par.C13 = lpar.C13[i];
135  par.C14 = lpar.C14[i];
136  }
137 
138 
146  inline void PackPixelHit(const LitScalPixelHit hit[],
147  LitPixelHit<fvec>& lhit) {
148  for (unsigned char i = 0; i < fvecLen; i++) {
149  lhit.X[i] = hit[i].X;
150  lhit.Y[i] = hit[i].Y;
151  lhit.Dx[i] = hit[i].Dx;
152  lhit.Dy[i] = hit[i].Dy;
153  lhit.Dxy[i] = hit[i].Dxy;
154  }
155  }
156 
157 
165  inline void UnpackPixelHit(const LitPixelHit<fvec>& lhit,
166  LitScalPixelHit hit[]) {
167  for (unsigned char i = 0; i < fvecLen; i++) {
168  hit[i].X = lhit.X[i];
169  hit[i].Y = lhit.Y[i];
170  hit[i].Dx = lhit.Dx[i];
171  hit[i].Dy = lhit.Dy[i];
172  hit[i].Dxy = lhit.Dxy[i];
173  }
174  }
175 
176 
184  inline void PackTrack(const LitTrack<fscal>* track[],
185  LitTrack<fvec>& ltrack) {
186  // LitTrackParam<fvec>& lparFirst = ltrack.paramFirst;
187  LitTrackParam<fvec>& lparLast = ltrack.paramLast;
188  //std::cout << "pack track parameters" << std::endl;
189  for (unsigned char i = 0; i < fvecLen; i++) {
190  // const LitTrackParam<fscal>* par = &track[i]->paramFirst;
191 
192  // lparFirst.X[i] = par->X;
193  // lparFirst.Y[i] = par->Y;
194  // lparFirst.Tx[i] = par->Tx;
195  // lparFirst.Ty[i] = par->Ty;
196  // lparFirst.Qp[i] = par->Qp;
197  // lparFirst.Z[i] = par->Z;
198  // lparFirst.C0[i] = par->C0;
199  // lparFirst.C1[i] = par->C1;
200  // lparFirst.C2[i] = par->C2;
201  // lparFirst.C3[i] = par->C3;
202  // lparFirst.C4[i] = par->C4;
203  // lparFirst.C5[i] = par->C5;
204  // lparFirst.C6[i] = par->C6;
205  // lparFirst.C7[i] = par->C7;
206  // lparFirst.C8[i] = par->C8;
207  // lparFirst.C9[i] = par->C9;
208  // lparFirst.C10[i] = par->C10;
209  // lparFirst.C11[i] = par->C11;
210  // lparFirst.C12[i] = par->C12;
211  // lparFirst.C13[i] = par->C13;
212  // lparFirst.C14[i] = par->C14;
213 
214  const LitTrackParam<fscal>* par = &track[i]->paramLast;
215  lparLast.X[i] = par->X;
216  lparLast.Y[i] = par->Y;
217  lparLast.Tx[i] = par->Tx;
218  lparLast.Ty[i] = par->Ty;
219  lparLast.Qp[i] = par->Qp;
220  lparLast.Z[i] = par->Z;
221  lparLast.C0[i] = par->C0;
222  lparLast.C1[i] = par->C1;
223  lparLast.C2[i] = par->C2;
224  lparLast.C3[i] = par->C3;
225  lparLast.C4[i] = par->C4;
226  lparLast.C5[i] = par->C5;
227  lparLast.C6[i] = par->C6;
228  lparLast.C7[i] = par->C7;
229  lparLast.C8[i] = par->C8;
230  lparLast.C9[i] = par->C9;
231  lparLast.C10[i] = par->C10;
232  lparLast.C11[i] = par->C11;
233  lparLast.C12[i] = par->C12;
234  lparLast.C13[i] = par->C13;
235  lparLast.C14[i] = par->C14;
236  }
237  // std::cout << "pack hits" << std::endl;
238  unsigned short nofHits = track[0]->GetNofHits();
239  for (unsigned short iHit = 0; iHit < nofHits; iHit++) {
240  LitPixelHit<fvec>* const lhit = ltrack.hits[iHit];
241  for (unsigned char i = 0; i < fvecLen; i++) {
242  LitPixelHit<fscal>* const hit = track[i]->hits[iHit];
243  lhit->X[i] = hit->X;
244  lhit->Y[i] = hit->Y;
245  lhit->Dx[i] = hit->Dx;
246  lhit->Dy[i] = hit->Dy;
247  lhit->Dxy[i] = hit->Dxy;
248  }
249  }
250  // std::cout << "pack hits finished" << std::endl;
251  // FIXME: check if we need to set nofHits
252  // ltrack.nofHits = nofHits;
253  }
254 
255 
265  inline void UnpackTrack(const LitTrack<fvec>& ltrack,
266  LitTrack<fscal> track[]) {
267  std::cout << "UnpackTrack: not implemented!" << std::endl;
268  }
269 
270  } // namespace parallel
271 } // namespace lit
272 #endif /* LITVECPACK_H_ */
lit::parallel::LitTrackParam::C2
T C2
Definition: LitTrackParam.h:100
lit::parallel::LitTrackParam::Z
T Z
Definition: LitTrackParam.h:94
lit::parallel::LitScalPixelHit
Base class for scalar pixel hits.
Definition: LitScalPixelHit.h:31
lit::parallel::LitTrackParam::C10
T C10
Definition: LitTrackParam.h:100
lit::parallel::LitTrackParam::C13
T C13
Definition: LitTrackParam.h:100
lit::parallel::LitPixelHit::X
T X
Definition: LitPixelHit.h:62
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
lit::parallel::PackFieldValue
void PackFieldValue(const LitFieldValue< fscal > value[], LitFieldValue< fvec > &lvalue)
Packs LitFieldValue.
Definition: LitVecPack.h:27
i
int i
Definition: L1/vectors/P4_F32vec4.h:25
lit::parallel::LitScalPixelHit::Dxy
fscal Dxy
Definition: LitScalPixelHit.h:75
lit::parallel::LitFieldValue::Bx
T Bx
Definition: LitFieldValue.h:57
lit::parallel::LitTrackParam::C0
T C0
Definition: LitTrackParam.h:100
LitTrackParam.h
Track parameters data class.
lit::parallel::LitTrackParam::C9
T C9
Definition: LitTrackParam.h:100
lit::parallel::LitPixelHit::Dx
T Dx
Definition: LitPixelHit.h:63
lit::parallel::UnpackTrackParam
void UnpackTrackParam(const LitTrackParam< fvec > &lpar, LitTrackParam< fscal > par[])
Unpacks LitTrackParam.
Definition: LitVecPack.h:77
lit::parallel::LitTrackParam::C3
T C3
Definition: LitTrackParam.h:100
lit::parallel::LitTrackParam::C14
T C14
Definition: LitTrackParam.h:100
lit::parallel::LitTrackParam::C4
T C4
Definition: LitTrackParam.h:100
LitTypes.h
Header files for SSE operations.
lit::parallel::LitTrackParam< fscal >
lit::parallel::PackTrackParam
void PackTrackParam(const LitTrackParam< fscal > par[], LitTrackParam< fvec > &lpar)
Packs LitTrackParam.
Definition: LitVecPack.h:43
lit::parallel::LitTrackParam::C12
T C12
Definition: LitTrackParam.h:100
lit::parallel::UnpackPixelHit
void UnpackPixelHit(const LitPixelHit< fvec > &lhit, LitScalPixelHit hit[])
Unpacks LitPixelHit.
Definition: LitVecPack.h:165
fvecLen
const int fvecLen
Definition: L1/vectors/P4_F32vec4.h:251
lit::parallel::LitFieldValue
Magnetic field value at a certain point in the space.
Definition: LitFieldValue.h:29
lit::parallel::LitTrack::paramLast
LitTrackParam< T > paramLast
Definition: LitTrack.h:76
lit::parallel::LitTrackParam::Ty
T Ty
Definition: LitTrackParam.h:96
lit::parallel::LitTrack
Base track data class.
Definition: LitTrack.h:31
lit::parallel::LitScalPixelHit::Dx
fscal Dx
Definition: LitScalPixelHit.h:74
lit::parallel::LitTrackParam::Tx
T Tx
Definition: LitTrackParam.h:95
lit::parallel::LitScalPixelHit::Y
fscal Y
Definition: LitScalPixelHit.h:73
lit::parallel::LitScalPixelHit::Dy
fscal Dy
Definition: LitScalPixelHit.h:74
lit::parallel::LitScalPixelHit::X
fscal X
Definition: LitScalPixelHit.h:73
lit::parallel::LitTrack::GetNofHits
unsigned short GetNofHits() const
Return number of hits in track.
Definition: LitTrack.h:53
lit::parallel::LitPixelHit::Dy
T Dy
Definition: LitPixelHit.h:63
lit::parallel::LitPixelHit::Y
T Y
Definition: LitPixelHit.h:62
lit::parallel::LitPixelHit::Dxy
T Dxy
Definition: LitPixelHit.h:64
lit::parallel::LitTrackParam::C5
T C5
Definition: LitTrackParam.h:100
lit::parallel::UnpackTrack
void UnpackTrack(const LitTrack< fvec > &ltrack, LitTrack< fscal > track[])
Unpacks LitTrack.
Definition: LitVecPack.h:265
lit::parallel::LitTrackParam::C1
T C1
Definition: LitTrackParam.h:100
lit::parallel::LitFieldValue::By
T By
Definition: LitFieldValue.h:57
lit::parallel::LitTrack::hits
vector< LitPixelHit< T > * > hits
Definition: LitTrack.h:77
lit::parallel::LitTrackParam::C11
T C11
Definition: LitTrackParam.h:100
lit::parallel::LitTrackParam::C7
T C7
Definition: LitTrackParam.h:100
lit::parallel::PackPixelHit
void PackPixelHit(const LitScalPixelHit hit[], LitPixelHit< fvec > &lhit)
Packs LitPixelHit.
Definition: LitVecPack.h:146
lit::parallel::PackTrack
void PackTrack(const LitTrack< fscal > *track[], LitTrack< fvec > &ltrack)
Packs LitTrack.
Definition: LitVecPack.h:184
lit::parallel::LitTrackParam::C6
T C6
Definition: LitTrackParam.h:100
lit::parallel::LitTrackParam::Qp
T Qp
Definition: LitTrackParam.h:97
lit::parallel::LitPixelHit
Base class for pixel hits.
Definition: LitPixelHit.h:29
lit::parallel::LitFieldValue::Bz
T Bz
Definition: LitFieldValue.h:57
lit
Definition: LitTrackFinderNNVecElectron.h:19