FairRoot/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:
21  PndCAHitV(): fIStation(-1), fId(Vc::Zero),
22  fX0(Vc::Zero), fX1(Vc::Zero), fX2(Vc::Zero),
23  fErr2X1(Vc::Zero), fErrX12(Vc::Zero), fErr2X2(Vc::Zero),
24  fR(Vc::Zero), fErr2R(Vc::Zero), fErr2A(Vc::Zero), fU(Vc::Zero), fDR(Vc::Zero), fIsLeft(true), fISec(Vc::Zero),
25  fAngle(Vc::Zero){}
26 
27 
28  PndCAHitV( const PndCAHit* hits, const float_m& valid );
29 
30  float_m IsValid() const { return fIStation >= 0; }
31 
32  char IStation() const {
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  PndCAParameters::CALocalToGlobal(float(X0()[iV]), float(X1()[iV]), float(X2()[iV]), float(Angle()[iV]), x, y, z);
63  }
64 
65  private:
66 
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  float_v x1 = fX1;
84  const float_v xCorr = fR - fR*rsqrt( 1 - p.SinPhi()*p.SinPhi() );
85  // xCorr /= cos(3.f/180.f*3.141592); // currently neglect stereo angle
86  x1(fIsLeft) += xCorr;
87  x1(!fIsLeft) -= xCorr;
88  return x1;
89 }
90 
91 
92 
93 inline PndCAHitV::PndCAHitV( const PndCAHit* hits, const float_m& valid )
94 {
95  int_v::Memory mIStation;
96  mIStation = int_v( -1 );
97 
98  uint_v::Memory mId;
99  float_v::Memory mX1, mX2, mX0;
100  float_v::Memory mErr2X1, mErrX12, mErr2X2;
101  float_v::Memory mR, mU, mDR, mErr2R, mErr2A, mIsLeft;
102  float_v::Memory mAlpha;
103  float_v::Memory mIsUsed;
104  int_v::Memory mISec;
105 
106  foreach_bit(unsigned short iV, valid) {
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); fX2 = float_v(mX2); fX0 = float_v(mX0);
131  fErr2X1 = float_v(mErr2X1); fErrX12 = float_v(mErrX12); fErr2X2 = float_v(mErr2X2);
132  fR = float_v(mR); fErr2R = float_v(mErr2R); fErr2A = float_v(mErr2A); fIsLeft = ( float_v(mIsLeft) == 1.f );
133  fU = float_v(mU);
134  fDR = float_v(mDR);
135  fISec = int_v(mISec);
136  fAngle = float_v(mAlpha);
137 }
138 
139 
140 
141 #endif
142 
uint_v Id() const
Definition: PndCAHitsV.h:39
float_v R() const
Definition: PndCAHitsV.h:52
float Angle() const
Definition: PndCAHits.h:51
float_v fX1
Definition: PndCAHitsV.h:70
float X0() const
Definition: PndCAHits.h:34
float_v Err2A() const
Definition: PndCAHitsV.h:56
float_v Err2R() const
Definition: PndCAHitsV.h:55
float X2() const
Definition: PndCAHits.h:36
float U() const
Definition: PndCAHits.h:44
float_v fErrX12
Definition: PndCAHitsV.h:71
uint_v fId
Definition: PndCAHitsV.h:68
float_v ErrX12() const
Definition: PndCAHitsV.h:48
float_v Err2X1() const
Definition: PndCAHitsV.h:47
void GetGlobalCoor(int iV, float &x, float &y, float &z) const
Definition: PndCAHitsV.h:61
float_v X1() const
Definition: PndCAHitsV.h:44
float DR() const
Definition: PndCAHits.h:43
static const fvec Zero
float Err2A() const
Definition: PndCAHits.h:46
int_v fISec
Definition: PndCAHitsV.h:78
float_v fErr2X1
Definition: PndCAHitsV.h:71
__m128 v
Definition: P4_F32vec4.h:4
float X1() const
Definition: PndCAHits.h:35
Double_t p
Definition: anasim.C:58
char IStation() const
Definition: PndCAHitsV.h:32
int Id() const
Definition: PndCAHits.h:30
float_v fAngle
Definition: PndCAHitsV.h:79
float_m IsValid() const
Definition: PndCAHitsV.h:30
float_v fErr2A
Definition: PndCAHitsV.h:75
float_v U() const
Definition: PndCAHitsV.h:51
int_v ISec() const
Definition: PndCAHitsV.h:54
float_v fX0
Definition: PndCAHitsV.h:70
float Err2X1() const
Definition: PndCAHits.h:38
float_m IsLeft() const
Definition: PndCAHitsV.h:57
int_v fIStation
Definition: PndCAHitsV.h:67
float_v Err2X2() const
Definition: PndCAHitsV.h:49
float Err2X2() const
Definition: PndCAHits.h:40
friend F32vec4 rsqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:32
float_v X2() const
Definition: PndCAHitsV.h:45
float_v fU
Definition: PndCAHitsV.h:76
int_v IStations() const
Definition: PndCAHitsV.h:37
Double_t z
float_v fErr2X2
Definition: PndCAHitsV.h:71
float_v fR
Definition: PndCAHitsV.h:73
int ISec() const
Definition: PndCAHits.h:49
bool IsUsed() const
Definition: PndCAHits.h:53
static void CALocalToGlobal(T x0, T x1, T angle, T &x, T &y)
float_v DR() const
Definition: PndCAHitsV.h:53
float_v fX2
Definition: PndCAHitsV.h:70
float_v Angle() const
Definition: PndCAHitsV.h:59
Double_t x
bool IsLeft() const
Definition: PndCAHits.h:48
float R() const
Definition: PndCAHits.h:42
float_v fDR
Definition: PndCAHitsV.h:76
CbmHit * hits[nHits]
Definition: RiemannTest.C:19
Double_t y
float_v X1Corrected(const PndCATrackParamVector &p) const
Definition: PndCAHitsV.h:82
float_v fErr2R
Definition: PndCAHitsV.h:74
float ErrX12() const
Definition: PndCAHits.h:39
char IStation() const
Definition: PndCAHits.h:28
float_m fIsLeft
Definition: PndCAHitsV.h:77
float_v X0() const
Definition: PndCAHitsV.h:43
float Err2R() const
Definition: PndCAHits.h:45