FairShip
Loading...
Searching...
No Matches
SHiP::RecoVertex Class Reference

#include <RecoVertex.h>

Inheritance diagram for SHiP::RecoVertex:
[legend]
Collaboration diagram for SHiP::RecoVertex:
[legend]

Public Member Functions

 RecoVertex ()=default
 RecoVertex (const TVector3 &position, const std::array< Double_t, 6 > &covariance, Double_t chi2, Double_t nDoF)
 ~RecoVertex () override=default
void AddTrack (Int_t trackId, const TVector3 &momentum, const std::array< Double_t, 6 > &momentumCovariance)
void SetDoca (Double_t doca)
 Distance of closest approach of the two tracks, before the vertex fit.
Double_t x () const
Double_t y () const
Double_t z () const
Double_t err_x () const
Double_t err_y () const
Double_t err_z () const
Double_t chi2 () const
Double_t nDoF () const
Double_t doca () const
 Distance of closest approach in cm for two-track vertices, else -1.
const std::vector< Double_t > & GetCovarianceElements () const
const std::vector< Int_t > & trackIds () const
const std::vector< Double_t > & trackPx () const
const std::vector< Double_t > & trackPy () const
const std::vector< Double_t > & trackPz () const
std::array< Double_t, 6 > GetTrackMomentumCovariance (size_t i) const
 Momentum covariance of track i, as 6 upper-triangle elements.

Private Member Functions

 ClassDefOverride (RecoVertex, 1)

Private Attributes

Double_t m_x {0.}
Double_t m_y {0.}
Double_t m_z {0.}
Double_t m_err_x {0.}
Double_t m_err_y {0.}
Double_t m_err_z {0.}
Double_t m_chi2 {0.}
Double_t m_nDoF {0.}
Double_t m_doca {-1.}
std::vector< Double_t > m_cov_elements
std::vector< Int_t > m_trackIds
std::vector< Double_t > m_trackPx
std::vector< Double_t > m_trackPy
std::vector< Double_t > m_trackPz
std::vector< Double_t > m_trackCovP
 Momentum covariances of all tracks, 6 elements per track.

Detailed Description

Fitted vertex from the ACTS straw tracker vertex fit, in the SHiP frame.

Positions are in cm, momenta in GeV. Covariances are stored as the upper triangle of the 3x3 matrix in row-major order: (0,0), (0,1), (0,2), (1,1), (1,2), (2,2).

The class does not depend on ACTS, so reco files can be read without it.

Definition at line 24 of file RecoVertex.h.

Constructor & Destructor Documentation

◆ RecoVertex() [1/2]

SHiP::RecoVertex::RecoVertex ( )
default

◆ RecoVertex() [2/2]

SHiP::RecoVertex::RecoVertex ( const TVector3 & position,
const std::array< Double_t, 6 > & covariance,
Double_t chi2,
Double_t nDoF )

Definition at line 13 of file RecoVertex.cxx.

16 : TObject(),
17 m_x(position.X()),
18 m_y(position.Y()),
19 m_z(position.Z()),
20 m_err_x(std::sqrt(std::max(0.0, covariance[0]))),
21 m_err_y(std::sqrt(std::max(0.0, covariance[3]))),
22 m_err_z(std::sqrt(std::max(0.0, covariance[5]))),
23 m_chi2(chi2),
24 m_nDoF(nDoF),
25 m_cov_elements(covariance.begin(), covariance.end()) {}
Double_t chi2() const
Definition RecoVertex.h:48
Double_t m_err_z
Definition RecoVertex.h:69
Double_t nDoF() const
Definition RecoVertex.h:49
Double_t m_nDoF
Definition RecoVertex.h:71
Double_t m_err_x
Definition RecoVertex.h:67
Double_t m_chi2
Definition RecoVertex.h:70
std::vector< Double_t > m_cov_elements
Definition RecoVertex.h:73
Double_t m_err_y
Definition RecoVertex.h:68

◆ ~RecoVertex()

SHiP::RecoVertex::~RecoVertex ( )
overridedefault

Member Function Documentation

◆ AddTrack()

void SHiP::RecoVertex::AddTrack ( Int_t trackId,
const TVector3 & momentum,
const std::array< Double_t, 6 > & momentumCovariance )

Add a track fitted to this vertex.

trackId is the index of the track in the RecoTracks branch, momentum its momentum at the vertex and momentumCovariance the covariance of that momentum.

Definition at line 27 of file RecoVertex.cxx.

28 {
29 m_trackIds.push_back(trackId);
30 m_trackPx.push_back(momentum.X());
31 m_trackPy.push_back(momentum.Y());
32 m_trackPz.push_back(momentum.Z());
33 m_trackCovP.insert(m_trackCovP.end(), momentumCovariance.begin(),
34 momentumCovariance.end());
35}
std::vector< Double_t > m_trackCovP
Momentum covariances of all tracks, 6 elements per track.
Definition RecoVertex.h:79
std::vector< Double_t > m_trackPx
Definition RecoVertex.h:75
std::vector< Double_t > m_trackPz
Definition RecoVertex.h:77
std::vector< Int_t > m_trackIds
Definition RecoVertex.h:74
std::vector< Double_t > m_trackPy
Definition RecoVertex.h:76

◆ chi2()

Double_t SHiP::RecoVertex::chi2 ( ) const
inline

Definition at line 48 of file RecoVertex.h.

48{ return m_chi2; }

◆ ClassDefOverride()

SHiP::RecoVertex::ClassDefOverride ( RecoVertex ,
1  )
private

◆ doca()

Double_t SHiP::RecoVertex::doca ( ) const
inline

Distance of closest approach in cm for two-track vertices, else -1.

Definition at line 51 of file RecoVertex.h.

51{ return m_doca; }
Double_t m_doca
Definition RecoVertex.h:72

◆ err_x()

Double_t SHiP::RecoVertex::err_x ( ) const
inline

Definition at line 45 of file RecoVertex.h.

45{ return m_err_x; }

◆ err_y()

Double_t SHiP::RecoVertex::err_y ( ) const
inline

Definition at line 46 of file RecoVertex.h.

46{ return m_err_y; }

◆ err_z()

Double_t SHiP::RecoVertex::err_z ( ) const
inline

Definition at line 47 of file RecoVertex.h.

47{ return m_err_z; }

◆ GetCovarianceElements()

const std::vector< Double_t > & SHiP::RecoVertex::GetCovarianceElements ( ) const
inline

Definition at line 52 of file RecoVertex.h.

52 {
53 return m_cov_elements;
54 }

◆ GetTrackMomentumCovariance()

std::array< Double_t, 6 > SHiP::RecoVertex::GetTrackMomentumCovariance ( size_t i) const

Momentum covariance of track i, as 6 upper-triangle elements.

Definition at line 37 of file RecoVertex.cxx.

37 {
38 if (i >= m_trackIds.size()) {
39 throw std::out_of_range("RecoVertex: track index out of range");
40 }
41 std::array<Double_t, 6> covariance{};
42 std::copy_n(m_trackCovP.begin() + 6 * i, 6, covariance.begin());
43 return covariance;
44}

◆ nDoF()

Double_t SHiP::RecoVertex::nDoF ( ) const
inline

Definition at line 49 of file RecoVertex.h.

49{ return m_nDoF; }

◆ SetDoca()

void SHiP::RecoVertex::SetDoca ( Double_t doca)
inline

Distance of closest approach of the two tracks, before the vertex fit.

Definition at line 40 of file RecoVertex.h.

40{ m_doca = doca; }
Double_t doca() const
Distance of closest approach in cm for two-track vertices, else -1.
Definition RecoVertex.h:51

◆ trackIds()

const std::vector< Int_t > & SHiP::RecoVertex::trackIds ( ) const
inline

Definition at line 56 of file RecoVertex.h.

56{ return m_trackIds; }

◆ trackPx()

const std::vector< Double_t > & SHiP::RecoVertex::trackPx ( ) const
inline

Definition at line 57 of file RecoVertex.h.

57{ return m_trackPx; }

◆ trackPy()

const std::vector< Double_t > & SHiP::RecoVertex::trackPy ( ) const
inline

Definition at line 58 of file RecoVertex.h.

58{ return m_trackPy; }

◆ trackPz()

const std::vector< Double_t > & SHiP::RecoVertex::trackPz ( ) const
inline

Definition at line 59 of file RecoVertex.h.

59{ return m_trackPz; }

◆ x()

Double_t SHiP::RecoVertex::x ( ) const
inline

Definition at line 42 of file RecoVertex.h.

42{ return m_x; }

◆ y()

Double_t SHiP::RecoVertex::y ( ) const
inline

Definition at line 43 of file RecoVertex.h.

43{ return m_y; }

◆ z()

Double_t SHiP::RecoVertex::z ( ) const
inline

Definition at line 44 of file RecoVertex.h.

44{ return m_z; }

Member Data Documentation

◆ m_chi2

Double_t SHiP::RecoVertex::m_chi2 {0.}
private

Definition at line 70 of file RecoVertex.h.

70{0.};

◆ m_cov_elements

std::vector<Double_t> SHiP::RecoVertex::m_cov_elements
private

Definition at line 73 of file RecoVertex.h.

◆ m_doca

Double_t SHiP::RecoVertex::m_doca {-1.}
private

Definition at line 72 of file RecoVertex.h.

72{-1.};

◆ m_err_x

Double_t SHiP::RecoVertex::m_err_x {0.}
private

Definition at line 67 of file RecoVertex.h.

67{0.};

◆ m_err_y

Double_t SHiP::RecoVertex::m_err_y {0.}
private

Definition at line 68 of file RecoVertex.h.

68{0.};

◆ m_err_z

Double_t SHiP::RecoVertex::m_err_z {0.}
private

Definition at line 69 of file RecoVertex.h.

69{0.};

◆ m_nDoF

Double_t SHiP::RecoVertex::m_nDoF {0.}
private

Definition at line 71 of file RecoVertex.h.

71{0.};

◆ m_trackCovP

std::vector<Double_t> SHiP::RecoVertex::m_trackCovP
private

Momentum covariances of all tracks, 6 elements per track.

Definition at line 79 of file RecoVertex.h.

◆ m_trackIds

std::vector<Int_t> SHiP::RecoVertex::m_trackIds
private

Definition at line 74 of file RecoVertex.h.

◆ m_trackPx

std::vector<Double_t> SHiP::RecoVertex::m_trackPx
private

Definition at line 75 of file RecoVertex.h.

◆ m_trackPy

std::vector<Double_t> SHiP::RecoVertex::m_trackPy
private

Definition at line 76 of file RecoVertex.h.

◆ m_trackPz

std::vector<Double_t> SHiP::RecoVertex::m_trackPz
private

Definition at line 77 of file RecoVertex.h.

◆ m_x

Double_t SHiP::RecoVertex::m_x {0.}
private

Definition at line 64 of file RecoVertex.h.

64{0.};

◆ m_y

Double_t SHiP::RecoVertex::m_y {0.}
private

Definition at line 65 of file RecoVertex.h.

65{0.};

◆ m_z

Double_t SHiP::RecoVertex::m_z {0.}
private

Definition at line 66 of file RecoVertex.h.

66{0.};

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