Belle II Software light-2406-ragdoll
KFitTrack Class Reference

KFitTrack is a container of the track information (Lorentz vector, position, and error matrix), and a set of macro functions to set/get the contents. More...

#include <KFitTrack.h>

Collaboration diagram for KFitTrack:

Classes

struct  KFitPXE
 KFitPXE is a container of the track information (Lorentz vector, position, and error matrix). More...
 

Public Member Functions

 KFitTrack (void)
 Construct an object with no argument.
 
 KFitTrack (const KFitTrack &kp)
 Construct the object as a copy constructor.
 
 KFitTrack (const CLHEP::HepLorentzVector &p, const HepPoint3D &x, const CLHEP::HepSymMatrix &e, const double q, const int flag=KFitConst::kBeforeFit)
 Construct the object with track properties.
 
 ~KFitTrack (void)
 Destruct the object.
 
KFitTrackoperator= (const KFitTrack &)
 Operator: assignment operator.
 
void setMomentum (const CLHEP::HepLorentzVector &p, const int flag=KFitConst::kBeforeFit)
 Set a Lorentz vector of the track.
 
void setPosition (const HepPoint3D &x, const int flag=KFitConst::kBeforeFit)
 Set a position of the track.
 
void setError (const CLHEP::HepSymMatrix &e, const int flag=KFitConst::kBeforeFit)
 Set an error matrix of the track.
 
void setCharge (const double q)
 Set a charge of the track.
 
void setVertex (const HepPoint3D &v)
 Set a vertex position associated to the track.
 
void setVertexError (const CLHEP::HepSymMatrix &ve)
 Set a vertex error matrix associated to the track.
 
const CLHEP::HepLorentzVector getMomentum (const int flag=KFitConst::kAfterFit) const
 Get a Lorentz vector of the track.
 
const HepPoint3D getPosition (const int flag=KFitConst::kAfterFit) const
 Get a position of the track.
 
const CLHEP::HepSymMatrix getError (const int flag=KFitConst::kAfterFit) const
 Get an error matrix of the track.
 
double getCharge (void) const
 Get a charge of the track.
 
double getMass (void) const
 Get a mass of the track.
 
const HepPoint3D getVertex (void) const
 Get a vertex position associated to the track.
 
const CLHEP::HepSymMatrix getVertexError (void) const
 Get a vertex error matrix associated to the track.
 
double getFitParameter (const int which, const int flag) const
 Get a parameter of the track.
 
const CLHEP::HepMatrix getFitParameter (const int flag) const
 Get a parameter set of the track.
 
const CLHEP::HepSymMatrix getFitError (const int flag) const
 Get an error matrix of the track.
 
const CLHEP::HepMatrix getMomPos (const int flag) const
 Get a combination of Lorentz vector and position of the track.
 

Private Member Functions

void checkFlag (const int flag) const
 Check if the flag is one of KFitConst::kBeforeFit or KFitConst::kAfterFit.
 
void checkMatrixDimension (const CLHEP::HepSymMatrix &m, const int dim) const
 Check if the matrix size is intended one.
 

Private Attributes

struct KFitPXE m_PXEBefore
 Lorentz vector, position, and error matrix of the track before the fit.
 
struct KFitPXE m_PXEAfter
 Lorentz vector, position, and error matrix of the track after the fit.
 
double m_Charge
 Charge of the track.
 
double m_Mass
 Mass of the track.
 
HepPoint3D m_Vertex
 Vertex position associated to the track.
 
CLHEP::HepSymMatrix m_VertexError
 Vertex error matrix associated to the track.
 

Detailed Description

KFitTrack is a container of the track information (Lorentz vector, position, and error matrix), and a set of macro functions to set/get the contents.

Definition at line 38 of file KFitTrack.h.

Constructor & Destructor Documentation

◆ KFitTrack() [1/2]

KFitTrack ( void  )

Construct an object with no argument.

Definition at line 21 of file KFitTrack.cc.

22{
23 this->m_PXEBefore.m_P = HepLorentzVector();
24 this->m_PXEBefore.m_X = HepPoint3D();
25 this->m_PXEBefore.m_E = HepSymMatrix(KFitConst::kNumber7, 0);
26 this->m_PXEAfter. m_P = HepLorentzVector();
27 this->m_PXEAfter. m_X = HepPoint3D();
28 this->m_PXEAfter. m_E = HepSymMatrix(KFitConst::kNumber7, 0);
29 this->m_Charge = 0.;
30 this->m_Mass = 0.;
31 this->m_Vertex = HepPoint3D();
32 this->m_VertexError = HepSymMatrix(3, 0);
33}
double m_Charge
Charge of the track.
Definition: KFitTrack.h:187
double m_Mass
Mass of the track.
Definition: KFitTrack.h:189
HepPoint3D m_Vertex
Vertex position associated to the track.
Definition: KFitTrack.h:192
CLHEP::HepSymMatrix m_VertexError
Vertex error matrix associated to the track.
Definition: KFitTrack.h:194
struct KFitPXE m_PXEBefore
Lorentz vector, position, and error matrix of the track before the fit.
Definition: KFitTrack.h:181
struct KFitPXE m_PXEAfter
Lorentz vector, position, and error matrix of the track after the fit.
Definition: KFitTrack.h:184
static const int kNumber7
Constant 7 to check matrix size (internal use)
Definition: KFitConst.h:32
HepPoint3D m_X
Position of the track.
Definition: KFitTrack.h:47
CLHEP::HepSymMatrix m_E
(7x7) error matrix of the track
Definition: KFitTrack.h:49
CLHEP::HepLorentzVector m_P
Lorentz vector of the track.
Definition: KFitTrack.h:45

◆ KFitTrack() [2/2]

KFitTrack ( const CLHEP::HepLorentzVector &  p,
const HepPoint3D &  x,
const CLHEP::HepSymMatrix &  e,
const double  q,
const int  flag = KFitConst::kBeforeFit 
)

Construct the object with track properties.

Parameters
pLorentz vector of the track
xposition of the track
e(7x7) error matrix of the track
qcharge of the track
flagKFitConst::kBeforeFit or KFitConst::kAfterFit

Definition at line 39 of file KFitTrack.cc.

44{
45 checkFlag(flag);
47
48 switch (flag) {
50 m_PXEBefore.m_P = p;
51 m_PXEBefore.m_X = x;
52 m_PXEBefore.m_E = e;
53 m_PXEAfter.m_P = HepLorentzVector();
54 m_PXEAfter.m_X = HepPoint3D();
55 m_PXEAfter.m_E = HepSymMatrix(KFitConst::kNumber7, 0);
56 break;
57
59 m_PXEBefore.m_P = HepLorentzVector();
60 m_PXEBefore.m_X = HepPoint3D();
61 m_PXEBefore.m_E = HepSymMatrix(KFitConst::kNumber7, 0);
62 m_PXEAfter.m_P = p;
63 m_PXEAfter.m_X = x;
64 m_PXEAfter.m_E = e;
65 break;
66 }
67
69 m_Mass = p.mag();
70 m_Vertex = HepPoint3D();
71 m_VertexError = HepSymMatrix(3, 0);
72}
void checkMatrixDimension(const CLHEP::HepSymMatrix &m, const int dim) const
Check if the matrix size is intended one.
Definition: KFitTrack.h:173
void checkFlag(const int flag) const
Check if the flag is one of KFitConst::kBeforeFit or KFitConst::kAfterFit.
Definition: KFitTrack.h:164
double charge(int pdgCode)
Returns electric charge of a particle with given pdg code.
Definition: EvtPDLUtil.cc:44
static const int kAfterFit
Input parameter to specify after-fit when setting/getting a track attribute.
Definition: KFitConst.h:37
static const int kBeforeFit
Input parameter to specify before-fit when setting/getting a track attribute.
Definition: KFitConst.h:35

Member Function Documentation

◆ checkFlag()

void checkFlag ( const int  flag) const
inlineprivate

Check if the flag is one of KFitConst::kBeforeFit or KFitConst::kAfterFit.

If check fails, abort the program.

Parameters
flag

Definition at line 164 of file KFitTrack.h.

165 {
166 if (flag != KFitConst::kBeforeFit && flag != KFitConst::kAfterFit) B2FATAL("checkFlag");
167 }

◆ checkMatrixDimension()

void checkMatrixDimension ( const CLHEP::HepSymMatrix &  m,
const int  dim 
) const
inlineprivate

Check if the matrix size is intended one.

If check fails, abort the program.

Parameters
mmatrix to be tested
dimsize of the matrix

Definition at line 173 of file KFitTrack.h.

174 {
175 if (m.num_row() != dim) B2FATAL("checkMatrixDimension");
176 }

◆ getCharge()

double getCharge ( void  ) const

Get a charge of the track.

Definition at line 180 of file KFitTrack.cc.

181{
182 return m_Charge;
183}

◆ getError()

const HepSymMatrix getError ( const int  flag = KFitConst::kAfterFit) const

Get an error matrix of the track.

Parameters
flagKFitConst::kBeforeFit or KFitConst::kAfterFit
Returns
error matrix of the track

Definition at line 172 of file KFitTrack.cc.

173{
174 checkFlag(flag);
176}

◆ getFitError()

const HepSymMatrix getFitError ( const int  flag) const

Get an error matrix of the track.

Not intended for end user's use.

Parameters
flagKFitConst::kBeforeFit or KFitConst::kAfterFit
Returns
fitted error matrix

Definition at line 246 of file KFitTrack.cc.

247{
248 checkFlag(flag);
249 HepSymMatrix err(KFitConst::kNumber6, 0);
250
251 const HepSymMatrix& e = flag == KFitConst::kBeforeFit ? m_PXEBefore.m_E : m_PXEAfter.m_E;
252
253
254 for (int i = 0; i < 3; i++) {
255 for (int j = i; j < 3; j++) {
256 err[i][j] = e[i][j];
257 err[3 + i][3 + j] = e[4 + i][4 + j];
258 }
259 }
260
261 for (int i = 0; i < 3; i++) {
262 for (int j = 0; j < 3; j++) {
263 err[i][3 + j] = e[i][4 + j];
264 }
265 }
266
267 return err;
268}
static const int kNumber6
Constant 6 to check matrix size (internal use)
Definition: KFitConst.h:30

◆ getFitParameter() [1/2]

const HepMatrix getFitParameter ( const int  flag) const

Get a parameter set of the track.

Not intended for end user's use.

Parameters
flagKFitConst::kBeforeFit or KFitConst::kAfterFit
Returns
array of getFitParameter(0,flag) ... getFitParameter(5,flag)

Definition at line 234 of file KFitTrack.cc.

235{
236 HepMatrix a(KFitConst::kNumber6, 1, 0);
237
238 for (int i = 0; i <= 5; i++)
239 a[i][0] = getFitParameter(i, flag);
240
241 return a;
242}
double getFitParameter(const int which, const int flag) const
Get a parameter of the track.
Definition: KFitTrack.cc:208

◆ getFitParameter() [2/2]

double getFitParameter ( const int  which,
const int  flag 
) const

Get a parameter of the track.

Not intended for end user's use.

Parameters
which(0,1,2,3,4,5) = (Px,Py,Pz,Xx,Xy,Xz)
flagKFitConst::kBeforeFit or KFitConst::kAfterFit
Returns
corresponding parameter

Definition at line 208 of file KFitTrack.cc.

209{
210 checkFlag(flag);
211
212 const struct KFitPXE& pxe = flag == KFitConst::kBeforeFit ? m_PXEBefore : m_PXEAfter;
213
214 switch (which) {
215 case 0: return pxe.m_P.x();
216 case 1: return pxe.m_P.y();
217 case 2: return pxe.m_P.z();
218 case 3: return pxe.m_X.x();
219 case 4: return pxe.m_X.y();
220 case 5: return pxe.m_X.z();
221 default: {
222 char buf[1024];
223 sprintf(buf, "%s:%s(): which=%d out of range", __FILE__, __func__, which);
224 B2FATAL(buf);
225 }
226 }
227
228 /* NEVER REACHED */
229 return -999.;
230}

◆ getMass()

double getMass ( void  ) const

Get a mass of the track.

Definition at line 187 of file KFitTrack.cc.

188{
189 return m_Mass;
190}

◆ getMomentum()

const HepLorentzVector getMomentum ( const int  flag = KFitConst::kAfterFit) const

Get a Lorentz vector of the track.

Parameters
flagKFitConst::kBeforeFit or KFitConst::kAfterFit
Returns
Lorentz vector of the track

Definition at line 156 of file KFitTrack.cc.

157{
158 checkFlag(flag);
160}

◆ getMomPos()

const HepMatrix getMomPos ( const int  flag) const

Get a combination of Lorentz vector and position of the track.

Not intended for end user's use.

Parameters
flagKFitConst::kBeforeFit or KFitConst::kAfterFit
Returns
combination of Lorentz vector and position

Definition at line 272 of file KFitTrack.cc.

273{
274 HepMatrix a(KFitConst::kNumber7, 1, 0);
275
276 switch (flag) {
278 a[0][0] = m_PXEBefore.m_P.x();
279 a[1][0] = m_PXEBefore.m_P.y();
280 a[2][0] = m_PXEBefore.m_P.z();
281 a[3][0] = m_PXEBefore.m_P.t();
282 a[4][0] = m_PXEBefore.m_X.x();
283 a[5][0] = m_PXEBefore.m_X.y();
284 a[6][0] = m_PXEBefore.m_X.z();
285 break;
286
288 a[0][0] = m_PXEAfter.m_P.x();
289 a[1][0] = m_PXEAfter.m_P.y();
290 a[2][0] = m_PXEAfter.m_P.z();
291 a[3][0] = m_PXEAfter.m_P.t();
292 a[4][0] = m_PXEAfter.m_X.x();
293 a[5][0] = m_PXEAfter.m_X.y();
294 a[6][0] = m_PXEAfter.m_X.z();
295 }
296
297 return a;
298}

◆ getPosition()

const HepPoint3D getPosition ( const int  flag = KFitConst::kAfterFit) const

Get a position of the track.

Parameters
flagKFitConst::kBeforeFit or KFitConst::kAfterFit
Returns
position of the track

Definition at line 164 of file KFitTrack.cc.

165{
166 checkFlag(flag);
168}

◆ getVertex()

const HepPoint3D getVertex ( void  ) const

Get a vertex position associated to the track.

Definition at line 194 of file KFitTrack.cc.

195{
196 return m_Vertex;
197}

◆ getVertexError()

const HepSymMatrix getVertexError ( void  ) const

Get a vertex error matrix associated to the track.

Definition at line 201 of file KFitTrack.cc.

202{
203 return m_VertexError;
204}

◆ operator=()

KFitTrack & operator= ( const KFitTrack a)

Operator: assignment operator.

Definition at line 79 of file KFitTrack.cc.

80{
81 if (this != &a) {
82 this->m_PXEBefore = a.m_PXEBefore;
83 this->m_PXEAfter = a.m_PXEAfter;
84 this->m_Charge = a.m_Charge;
85 this->m_Mass = a.m_Mass;
86 this->m_Vertex = a.m_Vertex;
88 }
89
90 return *this;
91}

◆ setCharge()

void setCharge ( const double  q)

Set a charge of the track.

Parameters
qcharge of the track

Definition at line 134 of file KFitTrack.cc.

135{
137}

◆ setError()

void setError ( const CLHEP::HepSymMatrix &  e,
const int  flag = KFitConst::kBeforeFit 
)

Set an error matrix of the track.

Parameters
eerror matrix of the track
flagKFitConst::kBeforeFit or KFitConst::kAfterFit

Definition at line 121 of file KFitTrack.cc.

122{
123 checkFlag(flag);
125
126 if (flag == KFitConst::kBeforeFit)
127 m_PXEBefore.m_E = e;
128 else
129 m_PXEAfter.m_E = e;
130}

◆ setMomentum()

void setMomentum ( const CLHEP::HepLorentzVector &  p,
const int  flag = KFitConst::kBeforeFit 
)

Set a Lorentz vector of the track.

Parameters
pLorentz vector of the track
flagKFitConst::kBeforeFit or KFitConst::kAfterFit

Definition at line 95 of file KFitTrack.cc.

96{
97 checkFlag(flag);
98
99 if (flag == KFitConst::kBeforeFit)
100 m_PXEBefore.m_P = p;
101 else
102 m_PXEAfter.m_P = p;
103
104 m_Mass = p.mag();
105}

◆ setPosition()

void setPosition ( const HepPoint3D &  x,
const int  flag = KFitConst::kBeforeFit 
)

Set a position of the track.

Parameters
xposition of the track
flagKFitConst::kBeforeFit or KFitConst::kAfterFit

Definition at line 109 of file KFitTrack.cc.

110{
111 checkFlag(flag);
112
113 if (flag == KFitConst::kBeforeFit)
114 m_PXEBefore.m_X = x;
115 else
116 m_PXEAfter.m_X = x;
117}

◆ setVertex()

void setVertex ( const HepPoint3D &  v)

Set a vertex position associated to the track.

Parameters
vvertex position associated to the track

Definition at line 141 of file KFitTrack.cc.

142{
143 m_Vertex = v;
144}

◆ setVertexError()

void setVertexError ( const CLHEP::HepSymMatrix &  ve)

Set a vertex error matrix associated to the track.

Parameters
vevertex error matrix associated to the track

Definition at line 148 of file KFitTrack.cc.

149{
151 m_VertexError = ve;
152}

Member Data Documentation

◆ m_Charge

double m_Charge
private

Charge of the track.

Definition at line 187 of file KFitTrack.h.

◆ m_Mass

double m_Mass
private

Mass of the track.

Definition at line 189 of file KFitTrack.h.

◆ m_PXEAfter

struct KFitPXE m_PXEAfter
private

Lorentz vector, position, and error matrix of the track after the fit.

Definition at line 184 of file KFitTrack.h.

◆ m_PXEBefore

struct KFitPXE m_PXEBefore
private

Lorentz vector, position, and error matrix of the track before the fit.

Definition at line 181 of file KFitTrack.h.

◆ m_Vertex

HepPoint3D m_Vertex
private

Vertex position associated to the track.

Definition at line 192 of file KFitTrack.h.

◆ m_VertexError

CLHEP::HepSymMatrix m_VertexError
private

Vertex error matrix associated to the track.

Definition at line 194 of file KFitTrack.h.


The documentation for this class was generated from the following files: