13 #include <analysis/VertexFitting/KFit/KFitTrack.h>
15 using namespace CLHEP;
18 using namespace Belle2::analysis;
21 KFitTrack::KFitTrack()
23 this->m_PXEBefore.m_P = HepLorentzVector();
25 this->m_PXEBefore.m_E = HepSymMatrix(KFitConst::kNumber7, 0);
26 this->m_PXEAfter. m_P = HepLorentzVector();
28 this->m_PXEAfter. m_E = HepSymMatrix(KFitConst::kNumber7, 0);
32 this->m_VertexError = HepSymMatrix(3, 0);
36 KFitTrack::KFitTrack(
const KFitTrack& a) =
default;
41 const HepLorentzVector& p,
const HepPoint3D& x,
const HepSymMatrix& e,
const double charge,
46 checkMatrixDimension(e, KFitConst::kNumber7);
49 case KFitConst::kBeforeFit:
53 m_PXEAfter.m_P = HepLorentzVector();
55 m_PXEAfter.m_E = HepSymMatrix(KFitConst::kNumber7, 0);
58 case KFitConst::kAfterFit:
59 m_PXEBefore.m_P = HepLorentzVector();
61 m_PXEBefore.m_E = HepSymMatrix(KFitConst::kNumber7, 0);
71 m_VertexError = HepSymMatrix(3, 0);
75 KFitTrack::~KFitTrack() =
default;
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;
87 this->m_VertexError = a.m_VertexError;
95 KFitTrack::setMomentum(
const HepLorentzVector& p,
const int flag)
99 if (flag == KFitConst::kBeforeFit)
113 if (flag == KFitConst::kBeforeFit)
121 KFitTrack::setError(
const HepSymMatrix& e,
const int flag)
124 checkMatrixDimension(e, KFitConst::kNumber7);
126 if (flag == KFitConst::kBeforeFit)
134 KFitTrack::setCharge(
const double charge)
148 KFitTrack::setVertexError(
const HepSymMatrix& ve)
150 checkMatrixDimension(ve, 3);
155 const HepLorentzVector
156 KFitTrack::getMomentum(
const int flag)
const
159 return flag == KFitConst::kBeforeFit ? m_PXEBefore.m_P : m_PXEAfter.m_P;
167 return flag == KFitConst::kBeforeFit ? m_PXEBefore.m_X : m_PXEAfter.m_X;
172 KFitTrack::getError(
const int flag)
const
175 return flag == KFitConst::kBeforeFit ? m_PXEBefore.m_E : m_PXEAfter.m_E;
180 KFitTrack::getCharge()
const
187 KFitTrack::getMass()
const
194 KFitTrack::getVertex()
const
201 KFitTrack::getVertexError()
const
203 return m_VertexError;
208 KFitTrack::getFitParameter(
const int which,
const int flag)
const
212 const struct KFitPXE& pxe = flag == KFitConst::kBeforeFit ? m_PXEBefore : m_PXEAfter;
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();
223 sprintf(buf,
"%s:%s(): which=%d out of range", __FILE__, __func__, which);
234 KFitTrack::getFitParameter(
const int flag)
const
236 HepMatrix a(KFitConst::kNumber6, 1, 0);
238 for (
int i = 0; i <= 5; i++)
239 a[i][0] = getFitParameter(i, flag);
246 KFitTrack::getFitError(
const int flag)
const
249 HepSymMatrix err(KFitConst::kNumber6, 0);
251 const HepSymMatrix& e = flag == KFitConst::kBeforeFit ? m_PXEBefore.m_E : m_PXEAfter.m_E;
254 for (
int i = 0; i < 3; i++) {
255 for (
int j = i; j < 3; j++) {
257 err[3 + i][3 + j] = e[4 + i][4 + j];
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];
272 KFitTrack::getMomPos(
const int flag)
const
274 HepMatrix a(KFitConst::kNumber7, 1, 0);
277 case KFitConst::kBeforeFit:
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();
287 case KFitConst::kAfterFit:
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();
KFitTrack is a container of the track information (Lorentz vector, position, and error matrix),...
ExpRunEvt getPosition(const std::vector< Evt > &events, double tEdge)
Get the exp-run-evt number from the event time [hours].
Abstract base class for different kinds of events.
KFitPXE is a container of the track information (Lorentz vector, position, and error matrix).
HepPoint3D m_X
Position of the track.
CLHEP::HepLorentzVector m_P
Lorentz vector of the track.