PandaRoot
KFPTrack.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 #ifndef KFPTrack_H
14 #define KFPTrack_H
15 
16 #include <cmath>
17 
18 class KFPTrack {
19 
20  public:
21  KFPTrack() {}
22  ~KFPTrack() {}
23 
24  int GetID() const { return ID; }
25 
26  bool GetXYZPxPyPz(float *p) const
27  {
28  for (int i = 0; i < 6; i++)
29  p[i] = fP[i];
30  return 1;
31  }
32  bool GetCovarianceXYZPxPyPz(float cv[21]) const
33  {
34  for (int i = 0; i < 21; i++)
35  cv[i] = fC[i];
36  return 1;
37  }
38 
39  bool GetCovarianceXYZPxPyPz(double cv[21]) const
40  {
41  for (int i = 0; i < 21; i++)
42  cv[i] = fC[i];
43  return 1;
44  }
45 
46  // void GetXYZ(float *position) {position[0] = fP[0]; position[1] = fP[1]; position[1] = fP[1];}
47  void GetXYZ(float *position) const
48  {
49  position[0] = fP[0];
50  position[1] = fP[1];
51  position[2] = fP[2];
52  }
53  void GetPxPyPz(float *position) const
54  {
55  position[0] = fP[3];
56  position[1] = fP[4];
57  position[2] = fP[5];
58  }
59 
60  void XvYvZv(float *position) const
61  {
62  position[0] = fP[0];
63  position[1] = fP[1];
64  position[2] = fP[2];
65  }
66  void PxPyPz(float *position) const
67  {
68  position[0] = fP[3];
69  position[1] = fP[4];
70  position[2] = fP[5];
71  }
72  void XvYvZv(double *position) const
73  {
74  position[0] = fP[0];
75  position[1] = fP[1];
76  position[2] = fP[2];
77  }
78  void PxPyPz(double *position) const
79  {
80  position[0] = fP[3];
81  position[1] = fP[4];
82  position[2] = fP[5];
83  }
84 
85  float GetX() const { return fP[0]; }
86  float GetY() const { return fP[1]; }
87  float GetZ() const { return fP[2]; }
88  float GetPx() const { return fP[3]; }
89  float GetPy() const { return fP[4]; }
90  float GetPz() const { return fP[5]; }
91 
92  float GetPt() const { return sqrt(fP[3] * fP[3] + fP[4] * fP[4]); }
93  float GetP() const { return sqrt(fP[3] * fP[3] + fP[4] * fP[4] + fP[5] * fP[5]); }
94 
95  void GetCovarianceMatrix(float *covmatrix)
96  {
97  for (int i = 0; i < 21; i++)
98  covmatrix[i] = fC[i];
99  }
100  float GetParameter(int i) const { return fP[i]; }
101  float GetCovariance(int i) const { return fC[i]; }
102 
103  int Charge() const { return fQ; }
104  float GetChi2perNDF() const { return fChi2 / fNDF; }
105  float GetChi2() const { return fChi2; }
106  int GetNDF() const { return fNDF; }
107 
108  const float *GetTrack() const { return fP; }
109  const float *GetCovMatrix() const { return fC; }
110 
111  void SetParameters(float *position)
112  {
113  for (int i = 0; i < 6; i++)
114  fP[i] = position[i];
115  }
116  void SetParameters(float x, float y, float z, float px, float py, float pz)
117  {
118  fP[0] = x;
119  fP[1] = y;
120  fP[2] = z;
121  fP[3] = px;
122  fP[4] = py;
123  fP[5] = pz;
124  }
125  void SetXYZ(float x, float y, float z)
126  {
127  fP[0] = x;
128  fP[1] = y;
129  fP[2] = z;
130  }
131  void SetPxPyPz(float px, float py, float pz)
132  {
133  fP[3] = px;
134  fP[4] = py;
135  fP[5] = pz;
136  }
137  void SetID(int id) { ID = id; }
138 
139  void SetX(float x) { fP[0] = x; }
140  void SetY(float y) { fP[1] = y; }
141  void SetZ(float z) { fP[2] = z; }
142  void SetPx(float px) { fP[3] = px; }
143  void SetPy(float py) { fP[4] = py; }
144  void SetPz(float pz) { fP[5] = pz; }
145  void SetCharge(int q) { fQ = q; }
146  void SetChi2(float chi) { fChi2 = chi; }
147  void SetNDF(int ndf) { fNDF = ndf; }
148 
149  void SetCovarianceMatrix(const float *C)
150  {
151  for (int i = 0; i < 21; i++)
152  fC[i] = C[i];
153  }
154 
155  void RotateXY(float alpha); // rotate on alpha in XY plane. Should be usefull for CS change
156 
157  int Id() const { return fId; };
158  void SetId(int id) { fId = id; };
159 
160  private:
161  int ID;
162  float fP[6]; // coordinates of the vertex
163  float fC[21]; // Covariance matrix of the vertex parameters
164  float fChi2; // chi-square of the vertex fitting
165  int fQ; // charge
166  int fNDF; // degree of freedom number
167 
168  int fId;
169 };
170 
171 #endif
void SetCovarianceMatrix(const float *C)
Definition: KFPTrack.h:149
void SetXYZ(float x, float y, float z)
Definition: KFPTrack.h:125
int Charge() const
Definition: KFPTrack.h:103
void PxPyPz(float *position) const
Definition: KFPTrack.h:66
const float * GetCovMatrix() const
Definition: KFPTrack.h:109
bool GetCovarianceXYZPxPyPz(double cv[21]) const
Definition: KFPTrack.h:39
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:40
void SetZ(float z)
Definition: KFPTrack.h:141
float GetPt() const
Definition: KFPTrack.h:92
float GetY() const
Definition: KFPTrack.h:86
void SetNDF(int ndf)
Definition: KFPTrack.h:147
int Id() const
Definition: KFPTrack.h:157
void SetY(float y)
Definition: KFPTrack.h:140
void SetX(float x)
Definition: KFPTrack.h:139
float GetP() const
Definition: KFPTrack.h:93
float GetX() const
Definition: KFPTrack.h:85
float GetPy() const
Definition: KFPTrack.h:89
float GetPx() const
Definition: KFPTrack.h:88
float GetParameter(int i) const
Definition: KFPTrack.h:100
void SetPx(float px)
Definition: KFPTrack.h:142
void SetID(int id)
Definition: KFPTrack.h:137
unsigned int i
Definition: P4_F32vec4.h:33
const float * GetTrack() const
Definition: KFPTrack.h:108
void PxPyPz(double *position) const
Definition: KFPTrack.h:78
float GetZ() const
Definition: KFPTrack.h:87
void SetId(int id)
Definition: KFPTrack.h:158
void XvYvZv(double *position) const
Definition: KFPTrack.h:72
float GetPz() const
Definition: KFPTrack.h:90
bool GetXYZPxPyPz(float *p) const
Definition: KFPTrack.h:26
int GetNDF() const
Definition: KFPTrack.h:106
void GetXYZ(float *position) const
Definition: KFPTrack.h:47
void SetParameters(float *position)
Definition: KFPTrack.h:111
void XvYvZv(float *position) const
Definition: KFPTrack.h:60
bool GetCovarianceXYZPxPyPz(float cv[21]) const
Definition: KFPTrack.h:32
void SetPy(float py)
Definition: KFPTrack.h:143
void GetPxPyPz(float *position) const
Definition: KFPTrack.h:53
void SetPz(float pz)
Definition: KFPTrack.h:144
void SetPxPyPz(float px, float py, float pz)
Definition: KFPTrack.h:131
void GetCovarianceMatrix(float *covmatrix)
Definition: KFPTrack.h:95
~KFPTrack()
Definition: KFPTrack.h:22
KFPTrack()
Definition: KFPTrack.h:21
void SetParameters(float x, float y, float z, float px, float py, float pz)
Definition: KFPTrack.h:116
int GetID() const
Definition: KFPTrack.h:24
double alpha
Definition: f_Init.h:31
void RotateXY(float alpha)
float GetChi2perNDF() const
Definition: KFPTrack.h:104
void SetChi2(float chi)
Definition: KFPTrack.h:146
float GetChi2() const
Definition: KFPTrack.h:105
double pz[39]
Definition: pipisigmas.h:25
void SetCharge(int q)
Definition: KFPTrack.h:145
float GetCovariance(int i) const
Definition: KFPTrack.h:101