8#include <mdst/dataobjects/TrackFitResult.h>
9#include <framework/dataobjects/UncertainHelix.h>
10#include <mdst/dataobjects/HitPatternCDC.h>
11#include <mdst/dataobjects/HitPatternVXD.h>
13#include <framework/utilities/HTML.h>
15#include <boost/math/special_functions/gamma.hpp>
23 m_pdg(0), m_pValue(0),
24 m_hitPatternCDCInitializer(0),
25 m_hitPatternVXDInitializer(0),
33 const TMatrixDSym& covariance,
const short int charge,
36 const uint64_t hitPatternCDCInitializer,
37 const uint32_t hitPatternVXDInitializer,
39 m_pdg(
std::abs(particleType.getPDGCode())), m_pValue(pValue),
40 m_hitPatternCDCInitializer(hitPatternCDCInitializer),
41 m_hitPatternVXDInitializer(hitPatternVXDInitializer),
42 m_NDF100(int(NDF * 100.))
44 UncertainHelix h(position, momentum, charge, bField, covariance, pValue);
53 const TMatrixDSym& cov = h.getCovariance();
54 unsigned int counter = 0;
55 for (
unsigned int i = 0; i <
c_NPars; ++i) {
56 for (
unsigned int j = i; j <
c_NPars; ++j) {
57 m_cov5[counter++] = cov(i, j);
65 const uint64_t hitPatternCDCInitializer,
66 const uint32_t hitPatternVXDInitializer,
68 m_pdg(
std::abs(particleType.getPDGCode())), m_pValue(pValue),
69 m_hitPatternCDCInitializer(hitPatternCDCInitializer),
70 m_hitPatternVXDInitializer(hitPatternVXDInitializer),
71 m_NDF100(int(NDF * 100.))
75 B2FATAL(
"Invalid initializer for TrackFitResult.");
77 for (
unsigned int i = 0; i <
c_NPars; ++i)
86 if (
this == &input)
return;
93 std::copy(std::begin(input.m_tau), std::end(input.m_tau), std::begin(this->m_tau));
95 std::copy(std::begin(input.m_cov5), std::end(input.m_cov5), std::begin(this->m_cov5));
112 return std::numeric_limits<double>::infinity();
115 return std::numeric_limits<double>::quiet_NaN();
117 return 2 * boost::math::gamma_q_inv(nDF / 2., pValue);
123 unsigned int counter = 0;
124 for (
unsigned int i = 0; i <
c_NPars; ++i) {
125 for (
unsigned int j = i; j <
c_NPars; ++j) {
126 cov5(i, j) = cov5(j, i) =
m_cov5[counter];
145 std::stringstream out;
146 out <<
"<b>Fit Hypothesis (PDG)</b>: " <<
m_pdg <<
"<br>";
150 out <<
"<b>NDF</b>: " <<
getNDF() <<
"<br>";
152 out <<
"<b>d0</b>: " <<
m_tau[
iD0] <<
" cm <br>";
153 out <<
"<b>phi0</b>: " <<
m_tau[
iPhi0] <<
" rad <br>";
154 out <<
"<b>omega</b>: " <<
m_tau[
iOmega] <<
" 1/GeV<br>";
155 out <<
"<b>z0</b>: " <<
m_tau[
iZ0] <<
" cm <br>";
159 out <<
"<b>pValue</b>: " <<
m_pValue <<
"<br>";
The ParticleType class for identifying different particle types.
Hit pattern of CDC hits within a track.
unsigned short getNHits() const
Get the total Number of CDC hits in the fit.
Hit pattern of the VXD within a track.
unsigned short getNPXDHits() const
Get total number of hits in the PXD.
unsigned short getNSVDHits() const
Get total number of hits in the SVD.
Values of the result of a track fit with a given particle hypothesis.
static const unsigned int c_NPars
Number of helix parameters.
TMatrixDSym getCovariance5() const
Getter for covariance matrix of perigee parameters in matrix form.
uint32_t m_hitPatternVXDInitializer
Member for initializing the information about hits in the VXD.
static const unsigned int iZ0
Index for z0.
static const unsigned int c_NCovEntries
Number of covariance entries.
float getNDF() const
Getter for number of degrees of freedom of the track fit.
unsigned int m_pdg
PDG Code for hypothesis with which the corresponding fit was performed.
Double32_t m_tau[c_NPars]
perigee helix parameters; tau = d0, phi0, omega, z0, tanLambda.
double getChi2() const
Get chi2 given NDF and p-value.
double getPValue() const
Getter for Chi2 Probability of the track fit.
Double32_t m_pValue
Chi2 Probability of the fit.
virtual std::string getInfoHTML() const override
Return a short summary of this object's contents in HTML format.
uint16_t m_NDF100
Member for number of degrees of freedom multiplied by 100 in order to store inside an int a float wit...
void updateTrackFitResult(const TrackFitResult &input)
update the TrackFitResults
static const unsigned int iTanLambda
Index tan lambda.
TrackFitResult()
Constructor initializing everything to zero.
static const unsigned int iD0
Index for d0.
uint64_t m_hitPatternCDCInitializer
Member for initializing the information about hits in the CDC.
static const unsigned int iOmega
Index for omega.
static const uint16_t c_NDFFlag
backward compatibility initialisation for NDF
Double32_t m_cov5[c_NCovEntries]
The 15 = 5*(5+1)/2 covariance matrix elements.
static const unsigned int iPhi0
Index for phi0.
HitPatternCDC getHitPatternCDC() const
Getter for the hit pattern in the CDC;.
HitPatternVXD getHitPatternVXD() const
Getter for the hit pattern in the VXD;.
This class represents an ideal helix in perigee parameterization including the covariance matrix of t...
std::string getString(const TMatrixFBase &matrix, int precision=2, bool color=true)
get HTML table representing a matrix.
Abstract base class for different kinds of events.