PandaRoot
PndCAHitsV.h
Go to the documentation of this file.
1 //-*- Mode: C++ -*-
2 // *****************************************************************************
3 // *
4 // @Autors: I.Kulakov; M.Zyzak; I.Kisel *
5 // @e-mail: I.Kulakov@gsi.de; M.Zyzak@gsi.de; I.Kisel@compeng.uni-frankfurt.de *
6 // *
7 // *****************************************************************************
8 
9 #ifndef PNDCAHITSV_H
10 #define PNDCAHITSV_H
11 
12 #include <vector>
13 using std::vector;
14 
15 #include "PndCAHits.h"
16 #include "PndCAParameters.h"
17 #include "PndCATrackParamVector.h"
18 
19 class PndCAHitV {
20  public:
22  : fIStation(-1), fId(Vc::Zero), fX0(Vc::Zero), fX1(Vc::Zero), fX2(Vc::Zero), fErr2X1(Vc::Zero), fErrX12(Vc::Zero), fErr2X2(Vc::Zero), fR(Vc::Zero), fErr2R(Vc::Zero),
23  fErr2A(Vc::Zero), fU(Vc::Zero), fDR(Vc::Zero), fIsLeft(true), fISec(Vc::Zero), fAngle(Vc::Zero)
24  {
25  }
26 
27  PndCAHitV(const PndCAHit *hits, const float_m &valid);
28 
29  float_m IsValid() const { return fIStation >= 0; }
30 
31  char IStation() const
32  {
33  const float_m v = IsValid();
34  assert(!v.isEmpty());
35  return fIStation[v.firstOne()];
36  }
37  int_v IStations() const { return fIStation; } // is not needed by tracker
38 
39  uint_v Id() const { return fId; };
40 
41  float_v X1Corrected(const PndCATrackParamVector &p) const;
42 
43  float_v X0() const { return fX0; }
44  float_v X1() const { return fX1; }
45  float_v X2() const { return fX2; }
46 
47  float_v Err2X1() const { return fErr2X1; }
48  float_v ErrX12() const { return fErrX12; }
49  float_v Err2X2() const { return fErr2X2; }
50 
51  float_v U() const { return fU; }
52  float_v R() const { return fR; }
53  float_v DR() const { return fDR; }
54  int_v ISec() const { return fISec; }
55  float_v Err2R() const { return fErr2R; }
56  float_v Err2A() const { return fErr2A; }
57  float_m IsLeft() const { return fIsLeft; }
58 
59  float_v Angle() const { return fAngle; }
60 
61  void GetGlobalCoor(int iV, float &x, float &y, float &z) const
62  {
63  PndCAParameters::CALocalToGlobal(float(X0()[iV]), float(X1()[iV]), float(X2()[iV]), float(Angle()[iV]), x, y, z);
64  }
65 
66  private:
67  int_v fIStation;
68  uint_v fId; // index of hits in an input array
69 
70  float_v fX0, fX1, fX2; // local coordinates. X0 is normal to module, X2 is paralel to magnetic field
71  float_v fErr2X1, fErrX12, fErr2X2; // cov matrix
72 
73  float_v fR;
74  float_v fErr2R;
75  float_v fErr2A;
76  float_v fU, fDR;
77  float_m fIsLeft;
78  int_v fISec;
79  float_v fAngle; // direction of hit station. Angle between normal and vertical axis. This angle defines local CS of the hit
80 };
81 
82 inline float_v PndCAHitV::X1Corrected(const PndCATrackParamVector &p) const
83 {
84  float_v x1 = fX1;
85  const float_v xCorr = fR - fR * rsqrt(1 - p.SinPhi() * p.SinPhi());
86  // xCorr /= cos(3.f/180.f*3.141592); // currently neglect stereo angle
87  x1(fIsLeft) += xCorr;
88  x1(!fIsLeft) -= xCorr;
89  return x1;
90 }
91 
92 inline PndCAHitV::PndCAHitV(const PndCAHit *hits, const float_m &valid)
93 {
94  int_v::Memory mIStation;
95  mIStation = int_v(-1);
96 
97  uint_v::Memory mId;
98  float_v::Memory mX1, mX2, mX0;
99  float_v::Memory mErr2X1, mErrX12, mErr2X2;
100  float_v::Memory mR, mU, mDR, mErr2R, mErr2A, mIsLeft;
101  float_v::Memory mAlpha;
102  float_v::Memory mIsUsed;
103  int_v::Memory mISec;
104 
105  foreach_bit(unsigned short iV, valid)
106  {
107  const PndCAHit &h = hits[iV];
108 
109  mId[iV] = h.Id();
110  mIStation[iV] = h.IStation();
111  mX1[iV] = h.X1();
112  mX2[iV] = h.X2();
113  mX0[iV] = h.X0();
114 
115  mErr2X1[iV] = h.Err2X1();
116  mErrX12[iV] = h.ErrX12();
117  mErr2X2[iV] = h.Err2X2();
118  mR[iV] = h.R();
119  mU[iV] = h.U();
120  mDR[iV] = h.DR();
121  mErr2R[iV] = h.Err2R();
122  mErr2A[iV] = h.Err2A();
123  mIsLeft[iV] = h.IsLeft() ? 1.f : 0.f;
124  mISec[iV] = h.ISec();
125  mAlpha[iV] = h.Angle();
126  mIsUsed[iV] = h.IsUsed() ? 1.f : 0.f;
127  }
128  fId = uint_v(mId);
129  fIStation = int_v(mIStation);
130  fX1 = float_v(mX1);
131  fX2 = float_v(mX2);
132  fX0 = float_v(mX0);
133  fErr2X1 = float_v(mErr2X1);
134  fErrX12 = float_v(mErrX12);
135  fErr2X2 = float_v(mErr2X2);
136  fR = float_v(mR);
137  fErr2R = float_v(mErr2R);
138  fErr2A = float_v(mErr2A);
139  fIsLeft = (float_v(mIsLeft) == 1.f);
140  fU = float_v(mU);
141  fDR = float_v(mDR);
142  fISec = int_v(mISec);
143  fAngle = float_v(mAlpha);
144 }
145 
146 #endif
float_v Angle() const
Definition: PndCAHitsV.h:59
float R() const
Definition: PndCAHits.h:43
float Angle() const
Definition: PndCAHits.h:52
float_v Err2R() const
Definition: PndCAHitsV.h:55
float DR() const
Definition: PndCAHits.h:44
float U() const
Definition: PndCAHits.h:45
bool IsLeft() const
Definition: PndCAHits.h:49
float Err2X1() const
Definition: PndCAHits.h:39
float_v Err2A() const
Definition: PndCAHitsV.h:56
bool IsUsed() const
Definition: PndCAHits.h:54
__m128 v
Definition: P4_F32vec4.h:3
float_m IsLeft() const
Definition: PndCAHitsV.h:57
float_v X0() const
Definition: PndCAHitsV.h:43
float_v X1Corrected(const PndCATrackParamVector &p) const
Definition: PndCAHitsV.h:82
float_v ErrX12() const
Definition: PndCAHitsV.h:48
float_m IsValid() const
Definition: PndCAHitsV.h:29
float_v Err2X2() const
Definition: PndCAHitsV.h:49
float_v U() const
Definition: PndCAHitsV.h:51
uint_v Id() const
Definition: PndCAHitsV.h:39
float_v DR() const
Definition: PndCAHitsV.h:53
friend F32vec4 rsqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:31
float Err2A() const
Definition: PndCAHits.h:47
float Err2R() const
Definition: PndCAHits.h:46
int Id() const
Definition: PndCAHits.h:31
int_v ISec() const
Definition: PndCAHitsV.h:54
void GetGlobalCoor(int iV, float &x, float &y, float &z) const
Definition: PndCAHitsV.h:61
float_v R() const
Definition: PndCAHitsV.h:52
float Err2X2() const
Definition: PndCAHits.h:41
static void CALocalToGlobal(T x0, T x1, T angle, T &x, T &y)
float_v X1() const
Definition: PndCAHitsV.h:44
float X1() const
Definition: PndCAHits.h:36
int_v IStations() const
Definition: PndCAHitsV.h:37
float_v Err2X1() const
Definition: PndCAHitsV.h:47
int ISec() const
Definition: PndCAHits.h:50
float X2() const
Definition: PndCAHits.h:37
float_v X2() const
Definition: PndCAHitsV.h:45
char IStation() const
Definition: PndCAHits.h:29
float ErrX12() const
Definition: PndCAHits.h:40
char IStation() const
Definition: PndCAHitsV.h:31
float X0() const
Definition: PndCAHits.h:35