CMS 3D CMS Logo

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

#include <Vertex.h>

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

Classes

class  TrackEqual
 

Public Types

enum  { dimension = 3, dimension4D = 4 }
 error matrix dimension More...
 
enum  { size = dimension * (dimension + 1) / 2, size4D = (dimension4D) * (dimension4D + 1) / 2 }
 matix size More...
 
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...
 

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 46 of file Vertex.h.

◆ CovarianceMatrix4D

covariance error matrix (4x4)

Definition at line 50 of file Vertex.h.

◆ Error

covariance error matrix (3x3)

Definition at line 44 of file Vertex.h.

◆ Error4D

covariance error matrix (4x4)

Definition at line 48 of file Vertex.h.

◆ index

typedef unsigned int reco::Vertex::index

index type

Definition at line 54 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.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

error matrix dimension

Enumerator
dimension 
dimension4D 

Definition at line 42 of file Vertex.h.

◆ anonymous enum

anonymous enum

matix size

Enumerator
size 
size4D 

Definition at line 52 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 58 of file Vertex.h.

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

58  : chi2_(0.0), ndof_(0), position_(0., 0., 0.), time_(0.) {
59  validity_ = false;
60  for (int i = 0; i < size4D; ++i)
61  covariance_[i] = 0.;
62  }
float chi2_
chi-sqared
Definition: Vertex.h:215
Point position_
position
Definition: Vertex.h:219
float covariance_[size4D]
covariance matrix (4x4) as vector
Definition: Vertex.h:221
double time_
Definition: Vertex.h:229
float ndof_
number of degrees of freedom
Definition: Vertex.h:217
bool validity_
tells wether the vertex is really valid.
Definition: Vertex.h:228

◆ 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:215
unsigned int index
index type
Definition: Vertex.h:54
Point position_
position
Definition: Vertex.h:219
float covariance_[size4D]
covariance matrix (4x4) as vector
Definition: Vertex.h:221
double time_
Definition: Vertex.h:229
index idx(index i, index j) const
position index
Definition: Vertex.h:232
float ndof_
number of degrees of freedom
Definition: Vertex.h:217
bool validity_
tells wether the vertex is really valid.
Definition: Vertex.h:228

◆ 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:215
unsigned int index
index type
Definition: Vertex.h:54
Point position_
position
Definition: Vertex.h:219
float covariance_[size4D]
covariance matrix (4x4) as vector
Definition: Vertex.h:221
double time_
Definition: Vertex.h:229
index idx(index i, index j) const
position index
Definition: Vertex.h:232
float ndof_
number of degrees of freedom
Definition: Vertex.h:217
bool validity_
tells wether the vertex is really valid.
Definition: Vertex.h:228

◆ 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:215
std::vector< TrackBaseRef > tracks_
reference to tracks
Definition: Vertex.h:223
unsigned int index
index type
Definition: Vertex.h:54
double ndof() const
Definition: Vertex.h:123
Point position_
position
Definition: Vertex.h:219
float covariance_[size4D]
covariance matrix (4x4) as vector
Definition: Vertex.h:221
double chi2() const
chi-squares
Definition: Vertex.h:116
double time_
Definition: Vertex.h:229
index idx(index i, index j) const
position index
Definition: Vertex.h:232
float ndof_
number of degrees of freedom
Definition: Vertex.h:217
bool validity_
tells wether the vertex is really valid.
Definition: Vertex.h:228

◆ 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:215
std::vector< TrackBaseRef > tracks_
reference to tracks
Definition: Vertex.h:223
unsigned int index
index type
Definition: Vertex.h:54
double ndof() const
Definition: Vertex.h:123
Point position_
position
Definition: Vertex.h:219
float covariance_[size4D]
covariance matrix (4x4) as vector
Definition: Vertex.h:221
double chi2() const
chi-squares
Definition: Vertex.h:116
double time_
Definition: Vertex.h:229
index idx(index i, index j) const
position index
Definition: Vertex.h:232
float ndof_
number of degrees of freedom
Definition: Vertex.h:217
bool validity_
tells wether the vertex is really valid.
Definition: Vertex.h:228

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 86 of file Vertex.h.

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

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

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

◆ 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:225
std::vector< TrackBaseRef > tracks_
reference to tracks
Definition: Vertex.h:223
std::vector< uint8_t > weights_
Definition: Vertex.h:226

◆ 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 148 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().

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

◆ covariance() [2/2]

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

return SMatrix

Definition at line 150 of file Vertex.h.

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

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

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

◆ covariance4D()

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

return SMatrix 4D

Definition at line 156 of file Vertex.h.

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

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

◆ error()

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

return SMatrix

Definition at line 163 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().

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

◆ error4D()

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

return SMatrix

Definition at line 169 of file Vertex.h.

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

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

◆ 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:48

◆ hasRefittedTracks()

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

Checks whether refitted tracks are stored.

Definition at line 181 of file Vertex.h.

References refittedTracks_.

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

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

◆ idx()

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

position index

Definition at line 232 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().

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

◆ 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 76 of file Vertex.h.

References chi2_, ndof_, and tracks_.

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

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

◆ 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 123 of file Vertex.h.

References ndof_.

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

123 { return ndof_; }
float ndof_
number of degrees of freedom
Definition: Vertex.h:217

◆ normalizedChi2()

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

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

Definition at line 125 of file Vertex.h.

References chi2_, and ndof_.

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

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

◆ 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:225
trackRef_iterator tracks_end() const
last iterator over tracks
Definition: Vertex.h:110
float trackWeight(const TREF &r) const
returns the weight with which a Track has contributed to the vertex-fit.
Definition: Vertex.h:96
trackRef_iterator tracks_begin() const
first iterator over tracks
Definition: Vertex.h:108
bool hasRefittedTracks() const
Checks whether refitted tracks are stored.
Definition: Vertex.h:181
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 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:225
std::vector< TrackBaseRef > tracks_
reference to tracks
Definition: Vertex.h:223
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:225
trackRef_iterator tracks_end() const
last iterator over tracks
Definition: Vertex.h:110
float trackWeight(const TREF &r) const
returns the weight with which a Track has contributed to the vertex-fit.
Definition: Vertex.h:96
trackRef_iterator tracks_begin() const
first iterator over tracks
Definition: Vertex.h:108
bool hasRefittedTracks() const
Checks whether refitted tracks are stored.
Definition: Vertex.h:181
TrackBaseRef originalTrack(const Track &refTrack) const
Definition: Vertex.cc:81

◆ position()

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

position

Definition at line 127 of file Vertex.h.

References position_.

Referenced by CMSDAS11DijetAnalyzer::analyze(), CMSDAS11DijetTestAnalyzer::analyze(), TrackTypeMonitor::analyze(), DiMuonVertexMonitor::analyze(), ElectronConversionRejectionValidator::analyze(), TkConvValidator::analyze(), TrackToTrackComparisonHists::analyze(), TrackingMonitor::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().

127 { return position_; }
Point position_
position
Definition: Vertex.h:219

◆ 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(), refittedTracks_, HLT_2022v14_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:225
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:110
trackRef_iterator tracks_begin() const
first iterator over tracks
Definition: Vertex.h:108
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_2022v14_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 196 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().

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

◆ 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:225
std::vector< TrackBaseRef > tracks_
reference to tracks
Definition: Vertex.h:223
std::vector< uint8_t > weights_
Definition: Vertex.h:226

◆ reserve()

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

reserve space for the tracks

Definition at line 78 of file Vertex.h.

References refittedTracks_, size, tracks_, and weights_.

Referenced by Onia2MuMuPAT::produce().

78  {
79  tracks_.reserve(size);
80  if (refitAsWell)
81  refittedTracks_.reserve(size);
82  weights_.reserve(size);
83  }
std::vector< Track > refittedTracks_
The vector of refitted tracks.
Definition: Vertex.h:225
std::vector< TrackBaseRef > tracks_
reference to tracks
Definition: Vertex.h:223
std::vector< uint8_t > weights_
Definition: Vertex.h:226

◆ t()

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

t coordinate

Definition at line 135 of file Vertex.h.

References time_.

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

135 { return time_; }
double time_
Definition: Vertex.h:229

◆ tError()

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

error on t

Definition at line 143 of file Vertex.h.

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

143 { return sqrt(covariance(3, 3)); }
CovarianceMatrix covariance() const
return SMatrix
Definition: Vertex.h:150
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 114 of file Vertex.h.

References idx(), and tracks_.

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

◆ tracks()

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

Definition at line 106 of file Vertex.h.

References tracks_.

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

◆ 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 96 of file Vertex.h.

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

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

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

◆ x()

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

◆ xError()

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

error on x

Definition at line 137 of file Vertex.h.

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

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

137 { return sqrt(covariance(0, 0)); }
CovarianceMatrix covariance() const
return SMatrix
Definition: Vertex.h:150
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 139 of file Vertex.h.

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

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

139 { return sqrt(covariance(1, 1)); }
CovarianceMatrix covariance() const
return SMatrix
Definition: Vertex.h:150
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 215 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 221 of file Vertex.h.

Referenced by covariance(), and Vertex().

◆ ndof_

float reco::Vertex::ndof_
private

number of degrees of freedom

Definition at line 217 of file Vertex.h.

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

◆ position_

Point reco::Vertex::position_
private

position

Definition at line 219 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 225 of file Vertex.h.

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

◆ time_

double reco::Vertex::time_
private

Definition at line 229 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 228 of file Vertex.h.

Referenced by isValid(), and Vertex().

◆ weights_

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

Definition at line 226 of file Vertex.h.

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