CMS 3D CMS Logo

Typedefs | Functions
getBestVertex.h File Reference
#include "DataFormats/TrackReco/interface/Track.h"
#include "DataFormats/VertexReco/interface/Vertex.h"
#include "DataFormats/VertexReco/interface/VertexFwd.h"
#include <limits>

Go to the source code of this file.

Typedefs

using Point = math::XYZPoint
 

Functions

Point getBestVertex (reco::Track const &trk, reco::VertexCollection const &vertices, const size_t minNtracks=2)
 
Point getBestVertex_withError (reco::Track const &trk, reco::VertexCollection const &vertices, Point &error, const size_t minNtracks=2)
 

Typedef Documentation

◆ Point

Definition at line 6 of file getBestVertex.h.

Function Documentation

◆ getBestVertex()

Point getBestVertex ( reco::Track const &  trk,
reco::VertexCollection const &  vertices,
const size_t  minNtracks = 2 
)
inline

Definition at line 8 of file getBestVertex.h.

10  {
11  Point p_dz(0, 0, -99999);
12  float dzmin = std::numeric_limits<float>::max();
13  for (auto const& vertex : vertices) {
14  size_t tracks = vertex.tracksSize();
15  if (tracks < minNtracks) {
16  continue;
17  }
18  float dz = std::abs(trk.dz(vertex.position()));
19  if (dz < dzmin) {
20  p_dz = vertex.position();
21  dzmin = dz;
22  }
23  }
24 
25  return p_dz;
26 }

References funct::abs(), PVValHelper::dz, reco::TrackBase::dz(), SiStripPI::max, tracks, bphysicsOniaDQM_cfi::vertex, and pwdgSkimBPark_cfi::vertices.

Referenced by TrackingNtuple::fillTracks().

◆ getBestVertex_withError()

Point getBestVertex_withError ( reco::Track const &  trk,
reco::VertexCollection const &  vertices,
Point error,
const size_t  minNtracks = 2 
)
inline

Definition at line 28 of file getBestVertex.h.

31  {
32  Point p_dz(0, 0, -99999);
33  float dzmin = std::numeric_limits<float>::max();
34  for (auto const& vertex : vertices) {
35  size_t tracks = vertex.tracksSize();
36  if (tracks < minNtracks) {
37  continue;
38  }
39  float dz = std::abs(trk.dz(vertex.position()));
40  if (dz < dzmin) {
41  p_dz = vertex.position();
42  error.SetXYZ(vertex.xError(), vertex.yError(), vertex.zError());
43  dzmin = dz;
44  }
45  }
46 
47  return p_dz;
48 }

References funct::abs(), PVValHelper::dz, reco::TrackBase::dz(), relativeConstraints::error, SiStripPI::max, tracks, bphysicsOniaDQM_cfi::vertex, and pwdgSkimBPark_cfi::vertices.

relativeConstraints.error
error
Definition: relativeConstraints.py:53
Point
Structure Point Contains parameters of Gaussian fits to DMRs.
Definition: DMRtrends.cc:57
bphysicsOniaDQM_cfi.vertex
vertex
Definition: bphysicsOniaDQM_cfi.py:7
tracks
const uint32_t *__restrict__ const HitContainer *__restrict__ TkSoA *__restrict__ tracks
Definition: CAHitNtupletGeneratorKernelsImpl.h:159
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
PVValHelper::dz
Definition: PVValidationHelpers.h:51
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
pwdgSkimBPark_cfi.vertices
vertices
Definition: pwdgSkimBPark_cfi.py:7