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