CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes
reco::Vertex Class Reference

#include <Vertex.h>

Inheritance diagram for reco::Vertex:
reco::PFDisplacedVertex

Classes

class  TrackEqual
 

Public Types

typedef math::Error< dimension >::type CovarianceMatrix
 covariance error matrix (3x3) More...
 
typedef math::Error< dimension4D >::type CovarianceMatrix4D
 covariance error matrix (4x4) More...
 
typedef math::Error< dimension >::type Error
 covariance error matrix (3x3) More...
 
typedef math::Error< dimension4D >::type Error4D
 covariance error matrix (4x4) More...
 
typedef unsigned int index
 index type More...
 
typedef math::XYZPoint Point
 point in the space More...
 
typedef std::vector< TrackBaseRef >::const_iterator trackRef_iterator
 The iteratator for the vector<TrackRef> More...
 

Public Member Functions

template<typename Ref >
void add (Ref const &r, float w=1.0)
 add a reference to a Track More...
 
void add (const TrackBaseRef &r, const Track &refTrack, float w=1.0)
 add the original a Track(reference) and the smoothed Track More...
 
double chi2 () const
 chi-squares More...
 
double covariance (int i, int j) const
 (i, j)-th element of error matrix, i, j = 0, ... 2 More...
 
CovarianceMatrix covariance () const
 return SMatrix More...
 
CovarianceMatrix4D covariance4D () const
 return SMatrix 4D More...
 
Error error () const
 return SMatrix More...
 
Error4D error4D () const
 return SMatrix More...
 
void fill (CovarianceMatrix &v) const
 fill SMatrix More...
 
void fill (CovarianceMatrix4D &v) const
 4D version More...
 
bool hasRefittedTracks () const
 Checks whether refitted tracks are stored. More...
 
bool isFake () const
 
bool isValid () const
 Tells whether the vertex is valid. More...
 
double ndof () const
 
double normalizedChi2 () const
 chi-squared divided by n.d.o.f. More...
 
unsigned int nTracks (float minWeight=0.5) const
 Returns the number of tracks in the vertex with weight above minWeight. More...
 
TrackBaseRef originalTrack (const Track &refTrack) const
 
math::XYZTLorentzVectorD p4 (float mass=0.13957018, float minWeight=0.5) const
 Returns the four momentum of the sum of the tracks, assuming the given mass for the decay products. More...
 
const Pointposition () const
 position More...
 
Track refittedTrack (const TrackBaseRef &track) const
 
Track refittedTrack (const TrackRef &track) const
 
const std::vector< Track > & refittedTracks () const
 Returns the container of refitted tracks. More...
 
void removeTracks ()
 
void reserve (int size, bool refitAsWell=false)
 reserve space for the tracks More...
 
double t () const
 t coordinate More...
 
double tError () const
 error on t More...
 
const TrackBaseReftrackRefAt (size_t idx) const
 python friendly track getting More...
 
auto const & tracks () const
 
trackRef_iterator tracks_begin () const
 first iterator over tracks More...
 
trackRef_iterator tracks_end () const
 last iterator over tracks More...
 
size_t tracksSize () const
 number of tracks More...
 
template<typename TREF >
float trackWeight (const TREF &r) const
 returns the weight with which a Track has contributed to the vertex-fit. More...
 
 Vertex ()
 
 Vertex (const Point &, const Error &)
 Constructor for a fake vertex. More...
 
 Vertex (const Point &, const Error4D &, double)
 Constructor for a fake vertex. 4D. More...
 
 Vertex (const Point &, const Error &, double chi2, double ndof, size_t size)
 constructor for a valid vertex, with all data More...
 
 Vertex (const Point &, const Error4D &, double time, double chi2, double ndof, size_t size)
 constructor for a valid vertex, with all data 4D More...
 
double x () const
 x coordinate More...
 
double xError () const
 error on x More...
 
double y () const
 y coordinate More...
 
double yError () const
 error on y More...
 
double z () const
 z coordinate More...
 
double zError () const
 error on z More...
 

Static Public Attributes

static constexpr int dimension = 3
 error matrix dimension More...
 
static constexpr int dimension4D = 4
 
static constexpr int size = dimension * (dimension + 1) / 2
 matix size More...
 
static constexpr int size4D = (dimension4D) * (dimension4D + 1) / 2
 

Private Member Functions

index idx (index i, index j) const
 position index More...
 

Private Attributes

float chi2_
 chi-sqared More...
 
float covariance_ [size4D]
 covariance matrix (4x4) as vector More...
 
float ndof_
 number of degrees of freedom More...
 
Point position_
 position More...
 
std::vector< TrackrefittedTracks_
 The vector of refitted tracks. More...
 
double time_
 
std::vector< TrackBaseReftracks_
 reference to tracks More...
 
bool validity_
 tells wether the vertex is really valid. More...
 
std::vector< uint8_t > weights_
 

Detailed Description

A reconstructed Vertex providing position, error, chi2, ndof and reconstrudted tracks. The vertex can be valid, fake, or invalid. A valid vertex is one which has been obtained from a vertex fit of tracks, and all data is meaningful A fake vertex is a vertex which was not made out of a proper fit with tracks, but still has a position and error (chi2 and ndof are null). For a primary vertex, it could simply be the beam line. A fake vertex is considered valid. An invalid vertex has no meaningful data.

Author
Luca Lista, INFN

Definition at line 35 of file Vertex.h.

Member Typedef Documentation

◆ CovarianceMatrix

covariance error matrix (3x3)

Definition at line 47 of file Vertex.h.

◆ CovarianceMatrix4D

covariance error matrix (4x4)

Definition at line 51 of file Vertex.h.

◆ Error

covariance error matrix (3x3)

Definition at line 45 of file Vertex.h.

◆ Error4D

covariance error matrix (4x4)

Definition at line 49 of file Vertex.h.

◆ index

typedef unsigned int reco::Vertex::index

index type

Definition at line 55 of file Vertex.h.

◆ Point

point in the space

Definition at line 40 of file Vertex.h.

◆ trackRef_iterator

typedef std::vector<TrackBaseRef>::const_iterator reco::Vertex::trackRef_iterator

The iteratator for the vector<TrackRef>

Definition at line 38 of file Vertex.h.

Constructor & Destructor Documentation

◆ Vertex() [1/5]

reco::Vertex::Vertex ( )
inline

default constructor - The vertex will not be valid. Position, error, chi2, ndof will have random entries, and the vectors of tracks will be empty Use the isValid method to check that your vertex is valid.

Definition at line 59 of file Vertex.h.

References covariance_, mps_fire::i, size4D, and validity_.

59  : chi2_(0.0), ndof_(0), position_(0., 0., 0.), time_(0.) {
60  validity_ = false;
61  for (int i = 0; i < size4D; ++i)
62  covariance_[i] = 0.;
63  }
float chi2_
chi-sqared
Definition: Vertex.h:216
static constexpr int size4D
Definition: Vertex.h:53
Point position_
position
Definition: Vertex.h:220
float covariance_[size4D]
covariance matrix (4x4) as vector
Definition: Vertex.h:222
double time_
Definition: Vertex.h:230
float ndof_
number of degrees of freedom
Definition: Vertex.h:218
bool validity_
tells wether the vertex is really valid.
Definition: Vertex.h:229

◆ Vertex() [2/5]

Vertex::Vertex ( const Point p,
const Error err 
)

Constructor for a fake vertex.

Definition at line 34 of file Vertex.cc.

References covariance_, dimension, dimension4D, submitPVResolutionJobs::err, mps_fire::i, idx(), dqmiolumiharvest::j, and validity_.

34  : chi2_(0.0), ndof_(0), position_(p), time_(0.) {
35  index idx = 0;
36  for (index i = 0; i < dimension4D; ++i) {
37  for (index j = 0; j <= i; ++j) {
38  if (i == dimension || j == dimension) {
39  covariance_[idx++] = 0.0;
40  } else {
41  covariance_[idx++] = err(i, j);
42  }
43  }
44  }
45  validity_ = true;
46 }
float chi2_
chi-sqared
Definition: Vertex.h:216
unsigned int index
index type
Definition: Vertex.h:55
static constexpr int dimension4D
Definition: Vertex.h:43
Point position_
position
Definition: Vertex.h:220
float covariance_[size4D]
covariance matrix (4x4) as vector
Definition: Vertex.h:222
double time_
Definition: Vertex.h:230
static constexpr int dimension
error matrix dimension
Definition: Vertex.h:42
index idx(index i, index j) const
position index
Definition: Vertex.h:233
float ndof_
number of degrees of freedom
Definition: Vertex.h:218
bool validity_
tells wether the vertex is really valid.
Definition: Vertex.h:229

◆ Vertex() [3/5]

Vertex::Vertex ( const Point p,
const Error4D err,
double  time 
)

Constructor for a fake vertex. 4D.

Definition at line 48 of file Vertex.cc.

References covariance_, dimension, submitPVResolutionJobs::err, mps_fire::i, idx(), dqmiolumiharvest::j, and validity_.

48  : chi2_(0.0), ndof_(0), position_(p), time_(time) {
49  index idx = 0;
50  for (index i = 0; i < dimension + 1; ++i)
51  for (index j = 0; j <= i; ++j)
52  covariance_[idx++] = err(i, j);
53  validity_ = true;
54 }
float chi2_
chi-sqared
Definition: Vertex.h:216
unsigned int index
index type
Definition: Vertex.h:55
Point position_
position
Definition: Vertex.h:220
float covariance_[size4D]
covariance matrix (4x4) as vector
Definition: Vertex.h:222
double time_
Definition: Vertex.h:230
static constexpr int dimension
error matrix dimension
Definition: Vertex.h:42
index idx(index i, index j) const
position index
Definition: Vertex.h:233
float ndof_
number of degrees of freedom
Definition: Vertex.h:218
bool validity_
tells wether the vertex is really valid.
Definition: Vertex.h:229

◆ Vertex() [4/5]

Vertex::Vertex ( const Point p,
const Error err,
double  chi2,
double  ndof,
size_t  size 
)

constructor for a valid vertex, with all data

Definition at line 8 of file Vertex.cc.

References covariance_, dimension, dimension4D, submitPVResolutionJobs::err, mps_fire::i, idx(), dqmiolumiharvest::j, size, tracks_, and validity_.

9  : chi2_(chi2), ndof_(ndof), position_(p), time_(0.) {
10  tracks_.reserve(size);
11  index idx = 0;
12  for (index i = 0; i < dimension4D; ++i) {
13  for (index j = 0; j <= i; ++j) {
14  if (i == dimension || j == dimension) {
15  covariance_[idx++] = 0.0;
16  } else {
17  covariance_[idx++] = err(i, j);
18  }
19  }
20  }
21  validity_ = true;
22 }
float chi2_
chi-sqared
Definition: Vertex.h:216
std::vector< TrackBaseRef > tracks_
reference to tracks
Definition: Vertex.h:224
unsigned int index
index type
Definition: Vertex.h:55
double ndof() const
Definition: Vertex.h:124
static constexpr int dimension4D
Definition: Vertex.h:43
Point position_
position
Definition: Vertex.h:220
float covariance_[size4D]
covariance matrix (4x4) as vector
Definition: Vertex.h:222
double chi2() const
chi-squares
Definition: Vertex.h:117
double time_
Definition: Vertex.h:230
static constexpr int dimension
error matrix dimension
Definition: Vertex.h:42
index idx(index i, index j) const
position index
Definition: Vertex.h:233
static constexpr int size
matix size
Definition: Vertex.h:53
float ndof_
number of degrees of freedom
Definition: Vertex.h:218
bool validity_
tells wether the vertex is really valid.
Definition: Vertex.h:229

◆ Vertex() [5/5]

Vertex::Vertex ( const Point p,
const Error4D err,
double  time,
double  chi2,
double  ndof,
size_t  size 
)

constructor for a valid vertex, with all data 4D

Definition at line 24 of file Vertex.cc.

References covariance_, dimension4D, submitPVResolutionJobs::err, mps_fire::i, idx(), dqmiolumiharvest::j, size4D, tracks_, and validity_.

26  tracks_.reserve(size4D);
27  index idx = 0;
28  for (index i = 0; i < dimension4D; ++i)
29  for (index j = 0; j <= i; ++j)
30  covariance_[idx++] = err(i, j);
31  validity_ = true;
32 }
float chi2_
chi-sqared
Definition: Vertex.h:216
std::vector< TrackBaseRef > tracks_
reference to tracks
Definition: Vertex.h:224
unsigned int index
index type
Definition: Vertex.h:55
double ndof() const
Definition: Vertex.h:124
static constexpr int dimension4D
Definition: Vertex.h:43
static constexpr int size4D
Definition: Vertex.h:53
Point position_
position
Definition: Vertex.h:220
float covariance_[size4D]
covariance matrix (4x4) as vector
Definition: Vertex.h:222
double chi2() const
chi-squares
Definition: Vertex.h:117
double time_
Definition: Vertex.h:230
index idx(index i, index j) const
position index
Definition: Vertex.h:233
float ndof_
number of degrees of freedom
Definition: Vertex.h:218
bool validity_
tells wether the vertex is really valid.
Definition: Vertex.h:229

Member Function Documentation

◆ add() [1/2]

template<typename Ref >
void reco::Vertex::add ( Ref const &  r,
float  w = 1.0 
)
inline

add a reference to a Track

Definition at line 87 of file Vertex.h.

References f, tracks_, w(), and weights_.

Referenced by reco::PFDisplacedVertex::addElement(), counter.Counter::register(), SequenceTypes._TaskBase::remove(), and SequenceTypes._TaskBase::replace().

87  {
88  tracks_.emplace_back(r);
89  weights_.emplace_back(w * 255.f);
90  }
T w() const
std::vector< TrackBaseRef > tracks_
reference to tracks
Definition: Vertex.h:224
double f[11][100]
std::vector< uint8_t > weights_
Definition: Vertex.h:227

◆ add() [2/2]

void Vertex::add ( const TrackBaseRef r,
const Track refTrack,
float  w = 1.0 
)

add the original a Track(reference) and the smoothed Track

Definition at line 69 of file Vertex.cc.

References alignCSCRings::r, refittedTracks_, tracks_, w(), and weights_.

Referenced by counter.Counter::register(), SequenceTypes._TaskBase::remove(), and SequenceTypes._TaskBase::replace().

69  {
70  tracks_.push_back(r);
71  refittedTracks_.push_back(refTrack);
72  weights_.push_back(w * 255);
73 }
T w() const
std::vector< Track > refittedTracks_
The vector of refitted tracks.
Definition: Vertex.h:226
std::vector< TrackBaseRef > tracks_
reference to tracks
Definition: Vertex.h:224
std::vector< uint8_t > weights_
Definition: Vertex.h:227

◆ chi2()

double reco::Vertex::chi2 ( void  ) const
inline

◆ covariance() [1/2]

double reco::Vertex::covariance ( int  i,
int  j 
) const
inline

(i, j)-th element of error matrix, i, j = 0, ... 2

Definition at line 149 of file Vertex.h.

References covariance_, mps_fire::i, idx(), and dqmiolumiharvest::j.

Referenced by VertexDistance::compatibility(), VertexDistance::distance(), V0Fitter::fitAll(), and reco::V0Candidate::vtxCovariance().

149 { return covariance_[idx(i, j)]; }
float covariance_[size4D]
covariance matrix (4x4) as vector
Definition: Vertex.h:222
index idx(index i, index j) const
position index
Definition: Vertex.h:233

◆ covariance() [2/2]

CovarianceMatrix reco::Vertex::covariance ( void  ) const
inline

return SMatrix

Definition at line 151 of file Vertex.h.

References fill(), and visualization-live-secondInstance_cfg::m.

Referenced by tError(), xError(), yError(), and zError().

151  {
152  Error m;
153  fill(m);
154  return m;
155  }
math::Error< dimension >::type Error
covariance error matrix (3x3)
Definition: Vertex.h:45
void fill(CovarianceMatrix &v) const
fill SMatrix

◆ covariance4D()

CovarianceMatrix4D reco::Vertex::covariance4D ( ) const
inline

return SMatrix 4D

Definition at line 157 of file Vertex.h.

References fill(), and visualization-live-secondInstance_cfg::m.

157  {
158  Error4D m;
159  fill(m);
160  return m;
161  }
void fill(CovarianceMatrix &v) const
fill SMatrix
math::Error< dimension4D >::type Error4D
covariance error matrix (4x4)
Definition: Vertex.h:49

◆ error()

Error reco::Vertex::error ( ) const
inline

return SMatrix

Definition at line 164 of file Vertex.h.

References fill(), and visualization-live-secondInstance_cfg::m.

Referenced by Page1Parser.Page1Parser::check_for_whole_start_tag(), VertexAnalysis::dist2D(), HLTmumutkFilter::hltFilter(), HLTmumutktkFilter::hltFilter(), ConeIsolation::produce(), and Onia2MuMuPAT::produce().

164  {
165  Error m;
166  fill(m);
167  return m;
168  }
math::Error< dimension >::type Error
covariance error matrix (3x3)
Definition: Vertex.h:45
void fill(CovarianceMatrix &v) const
fill SMatrix

◆ error4D()

Error4D reco::Vertex::error4D ( ) const
inline

return SMatrix

Definition at line 170 of file Vertex.h.

References fill(), and visualization-live-secondInstance_cfg::m.

170  {
171  Error4D m;
172  fill(m);
173  return m;
174  }
void fill(CovarianceMatrix &v) const
fill SMatrix
math::Error< dimension4D >::type Error4D
covariance error matrix (4x4)
Definition: Vertex.h:49

◆ fill() [1/2]

void reco::Vertex::fill ( CovarianceMatrix v) const

fill SMatrix

Referenced by covariance(), covariance4D(), error(), error4D(), and fill().

◆ fill() [2/2]

void Vertex::fill ( CovarianceMatrix4D v) const

4D version

Definition at line 56 of file Vertex.cc.

References submitPVResolutionJobs::err, fill(), and groupFilesInBlocks::temp.

56  {
57  Error4D temp;
58  fill(temp);
59  err = temp.Sub<Error>(0, 0);
60 }
fixed size error matrix
Definition: Error.h:31
void fill(CovarianceMatrix &v) const
fill SMatrix
math::Error< dimension4D >::type Error4D
covariance error matrix (4x4)
Definition: Vertex.h:49

◆ hasRefittedTracks()

bool reco::Vertex::hasRefittedTracks ( ) const
inline

Checks whether refitted tracks are stored.

Definition at line 182 of file Vertex.h.

References refittedTracks_.

Referenced by nTracks(), p4(), and Onia2MuMuPAT::produce().

182 { return !refittedTracks_.empty(); }
std::vector< Track > refittedTracks_
The vector of refitted tracks.
Definition: Vertex.h:226

◆ idx()

index reco::Vertex::idx ( index  i,
index  j 
) const
inlineprivate

position index

Definition at line 233 of file Vertex.h.

References a, b, mps_fire::i, and dqmiolumiharvest::j.

Referenced by covariance(), ntupleDataFormat.TrackMatchInfo::track(), ntupleDataFormat.TrackingParticleMatchInfo::trackingParticle(), trackRefAt(), and Vertex().

233  {
234  int a = (i <= j ? i : j), b = (i <= j ? j : i);
235  return b * (b + 1) / 2 + a;
236  }
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121

◆ isFake()

bool reco::Vertex::isFake ( ) const
inline

Tells whether a Vertex is fake, i.e. not a vertex made out of a proper fit with tracks. For a primary vertex, it could simply be the beam line.

Definition at line 77 of file Vertex.h.

References chi2_, ndof_, and tracks_.

Referenced by JetHTAnalyzer::analyze(), TrackingMonitor::analyze(), FSQDQM::analyze(), SplitVertexResolution::analyze(), and BVertexFilterT< VTX >::filter().

77 { return (chi2_ == 0 && ndof_ == 0 && tracks_.empty()); }
float chi2_
chi-sqared
Definition: Vertex.h:216
std::vector< TrackBaseRef > tracks_
reference to tracks
Definition: Vertex.h:224
float ndof_
number of degrees of freedom
Definition: Vertex.h:218

◆ isValid()

bool reco::Vertex::isValid ( void  ) const
inline

◆ ndof()

double reco::Vertex::ndof ( ) const
inline

Number of degrees of freedom Meant to be Double32_t for soft-assignment fitters: tracks may contribute to the vertex with fractional weights. The ndof is then = to the sum of the track weights. see e.g. CMS NOTE-2006/032, CMS NOTE-2004/002

Definition at line 124 of file Vertex.h.

References ndof_.

Referenced by BPHGenericVertexSelect::accept(), SiPixelTrackResidualSource::analyze(), TkConvValidator::analyze(), BPHMonitor::analyze(), JetHTAnalyzer::analyze(), TrackingMonitor::analyze(), SplitVertexResolution::analyze(), ConversionProducer::buildCollection(), ConversionLessByChi2(), reco::PFDisplacedVertex::Dump(), V0Fitter::fitAll(), PFDisplacedVertexFinder::fitVertexFromSeed(), HLTmumutkFilter::hltFilter(), HLTmumutktkFilter::hltFilter(), and ConeIsolation::produce().

124 { return ndof_; }
float ndof_
number of degrees of freedom
Definition: Vertex.h:218

◆ normalizedChi2()

double reco::Vertex::normalizedChi2 ( ) const
inline

chi-squared divided by n.d.o.f.

Definition at line 126 of file Vertex.h.

References chi2_, and ndof_.

Referenced by FSQDQM::analyze(), reco::PFDisplacedVertex::Dump(), V0Fitter::fitAll(), HLTmumutkFilter::hltFilter(), and HLTmumutktkFilter::hltFilter().

126 { return ndof_ != 0 ? chi2_ / ndof_ : chi2_ * 1e6; }
float chi2_
chi-sqared
Definition: Vertex.h:216
float ndof_
number of degrees of freedom
Definition: Vertex.h:218

◆ nTracks()

unsigned int Vertex::nTracks ( float  minWeight = 0.5) const

Returns the number of tracks in the vertex with weight above minWeight.

Definition at line 131 of file Vertex.cc.

References hasRefittedTracks(), fftjetcommon_cfi::minWeight, dqmiodumpmetadata::n, originalTrack(), refittedTracks_, tracks_begin(), tracks_end(), and trackWeight().

Referenced by SplitVertexResolution::analyze().

131  {
132  int n = 0;
133  if (hasRefittedTracks()) {
134  for (std::vector<Track>::const_iterator iter = refittedTracks_.begin(); iter != refittedTracks_.end(); ++iter)
135  if (trackWeight(originalTrack(*iter)) >= minWeight)
136  n++;
137  } else {
138  for (std::vector<reco::TrackBaseRef>::const_iterator iter = tracks_begin(); iter != tracks_end(); iter++)
139  if (trackWeight(*iter) >= minWeight)
140  n++;
141  }
142  return n;
143 }
std::vector< Track > refittedTracks_
The vector of refitted tracks.
Definition: Vertex.h:226
trackRef_iterator tracks_end() const
last iterator over tracks
Definition: Vertex.h:111
float trackWeight(const TREF &r) const
returns the weight with which a Track has contributed to the vertex-fit.
Definition: Vertex.h:97
trackRef_iterator tracks_begin() const
first iterator over tracks
Definition: Vertex.h:109
bool hasRefittedTracks() const
Checks whether refitted tracks are stored.
Definition: Vertex.h:182
TrackBaseRef originalTrack(const Track &refTrack) const
Definition: Vertex.cc:81

◆ originalTrack()

TrackBaseRef Vertex::originalTrack ( const Track refTrack) const

Returns the original track which corresponds to a particular refitted Track Throws an exception if now refitted tracks are stored ot the track is not found in the list

Definition at line 81 of file Vertex.cc.

References ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, reco::TrackBase::pt(), refittedTracks_, and tracks_.

Referenced by PFDisplacedVertexFinder::commonTracks(), PF_PU_AssoMapAlgos::FindNIVertex(), reco::PFDisplacedVertex::isIncomingTrack(), reco::PFDisplacedVertex::isMergedTrack(), reco::PFDisplacedVertex::isOutgoingTrack(), reco::PFDisplacedVertex::isPrimaryTrack(), reco::PFDisplacedVertex::isSecondaryTrack(), reco::PFDisplacedVertex::momentum(), nTracks(), p4(), Onia2MuMuPAT::produce(), reco::PFDisplacedVertex::trackHitFullInfo(), and reco::PFDisplacedVertex::trackPosition().

81  {
82  if (refittedTracks_.empty())
83  throw cms::Exception("Vertex") << "No refitted tracks stored in vertex\n";
84  std::vector<Track>::const_iterator it = find_if(refittedTracks_.begin(), refittedTracks_.end(), TrackEqual(refTrack));
85  if (it == refittedTracks_.end())
86  throw cms::Exception("Vertex") << "Refitted track not found in list.\n pt used for comparison: " << refTrack.pt();
87  size_t pos = it - refittedTracks_.begin();
88  return tracks_[pos];
89 }
std::vector< Track > refittedTracks_
The vector of refitted tracks.
Definition: Vertex.h:226
std::vector< TrackBaseRef > tracks_
reference to tracks
Definition: Vertex.h:224
double pt() const
track transverse momentum
Definition: TrackBase.h:637

◆ p4()

math::XYZTLorentzVectorD Vertex::p4 ( float  mass = 0.13957018,
float  minWeight = 0.5 
) const

Returns the four momentum of the sum of the tracks, assuming the given mass for the decay products.

Definition at line 103 of file Vertex.cc.

References hasRefittedTracks(), EgHLTOffHistBins_cfi::mass, fftjetcommon_cfi::minWeight, originalTrack(), refittedTracks_, tracks_begin(), tracks_end(), and trackWeight().

Referenced by Tau.Tau::dxy_approx(), Tau.Tau::dz(), Lepton.Lepton::p4WithFSR(), and reco::Conversion::refittedPair4Momentum().

103  {
105  ROOT::Math::LorentzVector<ROOT::Math::PxPyPzM4D<double> > vec;
106 
107  if (hasRefittedTracks()) {
108  for (std::vector<Track>::const_iterator iter = refittedTracks_.begin(); iter != refittedTracks_.end(); ++iter) {
109  if (trackWeight(originalTrack(*iter)) >= minWeight) {
110  vec.SetPx(iter->px());
111  vec.SetPy(iter->py());
112  vec.SetPz(iter->pz());
113  vec.SetM(mass);
114  sum += vec;
115  }
116  }
117  } else {
118  for (std::vector<reco::TrackBaseRef>::const_iterator iter = tracks_begin(); iter != tracks_end(); iter++) {
119  if (trackWeight(*iter) >= minWeight) {
120  vec.SetPx((*iter)->px());
121  vec.SetPy((*iter)->py());
122  vec.SetPz((*iter)->pz());
123  vec.SetM(mass);
124  sum += vec;
125  }
126  }
127  }
128  return sum;
129 }
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > XYZTLorentzVectorD
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:14
std::vector< Track > refittedTracks_
The vector of refitted tracks.
Definition: Vertex.h:226
trackRef_iterator tracks_end() const
last iterator over tracks
Definition: Vertex.h:111
float trackWeight(const TREF &r) const
returns the weight with which a Track has contributed to the vertex-fit.
Definition: Vertex.h:97
trackRef_iterator tracks_begin() const
first iterator over tracks
Definition: Vertex.h:109
bool hasRefittedTracks() const
Checks whether refitted tracks are stored.
Definition: Vertex.h:182
TrackBaseRef originalTrack(const Track &refTrack) const
Definition: Vertex.cc:81

◆ position()

const Point& reco::Vertex::position ( ) const
inline

position

Definition at line 128 of file Vertex.h.

References position_.

Referenced by DiMuonVertexMonitor::analyze(), ElectronConversionRejectionValidator::analyze(), TrackTypeMonitor::analyze(), TkConvValidator::analyze(), StandaloneTrackMonitor::analyze(), TrackToTrackComparisonHists::analyze(), MtdEleIsoValidation::analyze(), TrackingMonitor::analyze(), DiMuonVertexValidation::analyze(), DiElectronVertexValidation::analyze(), FSQDQM::analyze(), EopElecTreeWriter::analyze(), PackedCandidateTrackValidator::analyze(), pat::LeptonVertexSignificance::calculate(), reco::PFMETProducerMVA::chargedFracInCone(), PFAlgo::checkGoodTrackDeadHcal(), VertexDistance::compatibility(), reco::PFMETProducerMVA::computePFCandidateInfo(), JetCoreMCtruthSeedGenerator::coreHitsFilling(), JetCoreMCtruthSeedGenerator::DetectorSelector(), DeepCoreSeedGenerator::DetectorSelector(), VertexDistance::distance(), reco::PFDisplacedVertex::Dump(), SingleTopTChannelLepton_miniAOD::MonitorEnsemble::fill(), TopSingleLepton_miniAOD::MonitorEnsemble::fill(), BPHWriteSpecificDecay::fill(), TopSingleLepton::MonitorEnsemble::fill(), SingleTopTChannelLepton::MonitorEnsemble::fill(), DeepBoostedJetTagInfoProducer::fillParticleFeatures(), PFEGammaAlgo::fillPFCandidates(), TrackingFailureFilter::filter(), PF_PU_AssoMapAlgos::FindNIVertex(), L1TTauOffline::getPrimaryVertex(), HLTmumutkFilter::hltFilter(), HLTmumutktkFilter::hltFilter(), isTightMuonCustom(), PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo::loop(), L3MuonTrajectoryBuilder::makeTkCandCollection(), NuclearTrackCorrector::newTrajNeeded(), TOFPIDProducer::produce(), Onia2MuMuPAT::produce(), DeepCoreSeedGenerator::produce(), PFAlgo::recoTracksNotHCAL(), reco::PFDisplacedVertex::setPrimaryDirection(), reco::V0Candidate::setRecoVertex(), VertexDistanceXY::signedDistance(), VertexDistance3D::signedDistance(), JetCoreMCtruthSeedGenerator::splittedClusterDirections(), DeepCoreSeedGenerator::splittedClusterDirections(), and ConversionProducer::trackD0Cut().

128 { return position_; }
Point position_
position
Definition: Vertex.h:220

◆ refittedTrack() [1/2]

Track Vertex::refittedTrack ( const TrackBaseRef track) const

Returns the refitted track which corresponds to a particular original Track Throws an exception if now refitted tracks are stored ot the track is not found in the list

Definition at line 91 of file Vertex.cc.

References Exception, spr::find(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, refittedTracks_, HLT_2024v13_cff::track, tracks_begin(), and tracks_end().

Referenced by refittedTrack(), and reco::PFDisplacedVertex::trackPosition().

91  {
92  if (refittedTracks_.empty())
93  throw cms::Exception("Vertex") << "No refitted tracks stored in vertex\n";
95  if (it == tracks_end())
96  throw cms::Exception("Vertex") << "Track not found in list\n";
97  size_t pos = it - tracks_begin();
98  return refittedTracks_[pos];
99 }
std::vector< Track > refittedTracks_
The vector of refitted tracks.
Definition: Vertex.h:226
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
trackRef_iterator tracks_end() const
last iterator over tracks
Definition: Vertex.h:111
trackRef_iterator tracks_begin() const
first iterator over tracks
Definition: Vertex.h:109
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector<TrackRef>
Definition: Vertex.h:38

◆ refittedTrack() [2/2]

Track Vertex::refittedTrack ( const TrackRef track) const

Returns the refitted track which corresponds to a particular original Track Throws an exception if now refitted tracks are stored ot the track is not found in the list

Definition at line 101 of file Vertex.cc.

References refittedTrack(), and HLT_2024v13_cff::track.

101 { return refittedTrack(TrackBaseRef(track)); }
Track refittedTrack(const TrackBaseRef &track) const
Definition: Vertex.cc:91
edm::RefToBase< reco::Track > TrackBaseRef
persistent reference to a Track, using views
Definition: TrackFwd.h:35

◆ refittedTracks()

const std::vector<Track>& reco::Vertex::refittedTracks ( ) const
inline

Returns the container of refitted tracks.

Definition at line 197 of file Vertex.h.

References refittedTracks_.

Referenced by TkConvValidator::analyze(), PFDisplacedVertexFinder::commonTracks(), PF_PU_AssoMapAlgos::FindNIVertex(), reco::PFDisplacedVertex::momentum(), Onia2MuMuPAT::produce(), reco::PFDisplacedVertex::totalCharge(), and reco::PFDisplacedVertex::trackPosition().

197 { return refittedTracks_; }
std::vector< Track > refittedTracks_
The vector of refitted tracks.
Definition: Vertex.h:226

◆ removeTracks()

void Vertex::removeTracks ( )

Definition at line 75 of file Vertex.cc.

References refittedTracks_, tracks_, and weights_.

Referenced by reco::PFDisplacedVertex::cleanTracks(), and PFDisplacedVertexFinder::fitVertexFromSeed().

75  {
76  weights_.clear();
77  tracks_.clear();
78  refittedTracks_.clear();
79 }
std::vector< Track > refittedTracks_
The vector of refitted tracks.
Definition: Vertex.h:226
std::vector< TrackBaseRef > tracks_
reference to tracks
Definition: Vertex.h:224
std::vector< uint8_t > weights_
Definition: Vertex.h:227

◆ reserve()

void reco::Vertex::reserve ( int  size,
bool  refitAsWell = false 
)
inline

reserve space for the tracks

Definition at line 79 of file Vertex.h.

References refittedTracks_, size, tracks_, and weights_.

Referenced by Onia2MuMuPAT::produce().

79  {
80  tracks_.reserve(size);
81  if (refitAsWell)
82  refittedTracks_.reserve(size);
83  weights_.reserve(size);
84  }
std::vector< Track > refittedTracks_
The vector of refitted tracks.
Definition: Vertex.h:226
std::vector< TrackBaseRef > tracks_
reference to tracks
Definition: Vertex.h:224
static constexpr int size
matix size
Definition: Vertex.h:53
std::vector< uint8_t > weights_
Definition: Vertex.h:227

◆ t()

double reco::Vertex::t ( ) const
inline

t coordinate

Definition at line 136 of file Vertex.h.

References time_.

Referenced by MtdEleIsoValidation::analyze(), reco::Vertex::TrackEqual::operator()(), TOFPIDProducer::produce(), and trackWeight().

136 { return time_; }
double time_
Definition: Vertex.h:230

◆ tError()

double reco::Vertex::tError ( ) const
inline

error on t

Definition at line 144 of file Vertex.h.

References covariance(), and mathSSE::sqrt().

Referenced by MtdEleIsoValidation::analyze().

144 { return sqrt(covariance(3, 3)); }
CovarianceMatrix covariance() const
return SMatrix
Definition: Vertex.h:151
T sqrt(T t)
Definition: SSEVec.h:19

◆ trackRefAt()

const TrackBaseRef& reco::Vertex::trackRefAt ( size_t  idx) const
inline

python friendly track getting

Definition at line 115 of file Vertex.h.

References idx(), and tracks_.

115 { return tracks_[idx]; }
std::vector< TrackBaseRef > tracks_
reference to tracks
Definition: Vertex.h:224
index idx(index i, index j) const
position index
Definition: Vertex.h:233

◆ tracks()

auto const& reco::Vertex::tracks ( void  ) const
inline

Definition at line 107 of file Vertex.h.

References tracks_.

107 { return tracks_; }
std::vector< TrackBaseRef > tracks_
reference to tracks
Definition: Vertex.h:224

◆ tracks_begin()

trackRef_iterator reco::Vertex::tracks_begin ( ) const
inline

◆ tracks_end()

trackRef_iterator reco::Vertex::tracks_end ( ) const
inline

◆ tracksSize()

size_t reco::Vertex::tracksSize ( ) const
inline

◆ trackWeight()

template<typename TREF >
float reco::Vertex::trackWeight ( const TREF &  r) const
inline

returns the weight with which a Track has contributed to the vertex-fit.

Definition at line 97 of file Vertex.h.

References mps_fire::i, t(), tracks_, and weights_.

Referenced by MtdEleIsoValidation::analyze(), nTracks(), p4(), and Onia2MuMuPAT::produce().

97  {
98  int i = 0;
99  for (auto const &t : tracks_) {
100  if ((r.id() == t.id()) && (t.key() == r.key()))
101  return weights_[i] / 255.f;
102  ++i;
103  }
104  return 0;
105  }
std::vector< TrackBaseRef > tracks_
reference to tracks
Definition: Vertex.h:224
double t() const
t coordinate
Definition: Vertex.h:136
std::vector< uint8_t > weights_
Definition: Vertex.h:227

◆ x()

double reco::Vertex::x ( ) const
inline

◆ xError()

double reco::Vertex::xError ( ) const
inline

error on x

Definition at line 138 of file Vertex.h.

References covariance(), and mathSSE::sqrt().

Referenced by FSQDQM::analyze(), SplitVertexResolution::analyze(), PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo::loop(), and PrimaryVertexResolution::Resolution::Resolution().

138 { return sqrt(covariance(0, 0)); }
CovarianceMatrix covariance() const
return SMatrix
Definition: Vertex.h:151
T sqrt(T t)
Definition: SSEVec.h:19

◆ y()

double reco::Vertex::y ( ) const
inline

◆ yError()

double reco::Vertex::yError ( ) const
inline

error on y

Definition at line 140 of file Vertex.h.

References covariance(), and mathSSE::sqrt().

Referenced by FSQDQM::analyze(), SplitVertexResolution::analyze(), and PrimaryVertexResolution::Resolution::Resolution().

140 { return sqrt(covariance(1, 1)); }
CovarianceMatrix covariance() const
return SMatrix
Definition: Vertex.h:151
T sqrt(T t)
Definition: SSEVec.h:19

◆ z()

double reco::Vertex::z ( ) const
inline

◆ zError()

double reco::Vertex::zError ( ) const
inline

Member Data Documentation

◆ chi2_

float reco::Vertex::chi2_
private

chi-sqared

Definition at line 216 of file Vertex.h.

Referenced by chi2(), isFake(), and normalizedChi2().

◆ covariance_

float reco::Vertex::covariance_[size4D]
private

covariance matrix (4x4) as vector

Definition at line 222 of file Vertex.h.

Referenced by covariance(), and Vertex().

◆ dimension

constexpr int reco::Vertex::dimension = 3
static

error matrix dimension

Definition at line 42 of file Vertex.h.

Referenced by PFTauTransverseImpactParameters::produce(), and Vertex().

◆ dimension4D

constexpr int reco::Vertex::dimension4D = 4
static

Definition at line 43 of file Vertex.h.

Referenced by Vertex().

◆ ndof_

float reco::Vertex::ndof_
private

number of degrees of freedom

Definition at line 218 of file Vertex.h.

Referenced by isFake(), ndof(), and normalizedChi2().

◆ position_

Point reco::Vertex::position_
private

position

Definition at line 220 of file Vertex.h.

Referenced by position(), x(), y(), and z().

◆ refittedTracks_

std::vector<Track> reco::Vertex::refittedTracks_
private

The vector of refitted tracks.

Definition at line 226 of file Vertex.h.

Referenced by add(), hasRefittedTracks(), nTracks(), originalTrack(), p4(), refittedTrack(), refittedTracks(), removeTracks(), and reserve().

◆ size

constexpr int reco::Vertex::size = dimension * (dimension + 1) / 2
static

◆ size4D

constexpr int reco::Vertex::size4D = (dimension4D) * (dimension4D + 1) / 2
static

Definition at line 53 of file Vertex.h.

Referenced by Vertex().

◆ time_

double reco::Vertex::time_
private

Definition at line 230 of file Vertex.h.

Referenced by t().

◆ tracks_

std::vector<TrackBaseRef> reco::Vertex::tracks_
private

◆ validity_

bool reco::Vertex::validity_
private

tells wether the vertex is really valid.

Definition at line 229 of file Vertex.h.

Referenced by isValid(), and Vertex().

◆ weights_

std::vector<uint8_t> reco::Vertex::weights_
private

Definition at line 227 of file Vertex.h.

Referenced by add(), removeTracks(), reserve(), and trackWeight().