CMS 3D CMS Logo

getBestVertex.h
Go to the documentation of this file.
4 #include <limits>
5 
7 
8 inline Point getBestVertex(reco::Track const& trk,
10  const size_t minNtracks = 2) {
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 }
27 
30  Point& error,
31  const size_t minNtracks = 2) {
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 }
PDWG_EXOHSCP_cff.tracks
tracks
Definition: PDWG_EXOHSCP_cff.py:28
reco::VertexCollection
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
relativeConstraints.error
error
Definition: relativeConstraints.py:53
Track.h
reco::Track
Definition: Track.h:27
reco::TrackBase::dz
double dz() const
dz parameter (= dsz/cos(lambda)). This is the track z0 w.r.t (0,0,0) only if the refPoint is close to...
Definition: TrackBase.h:602
getBestVertex_withError
Point getBestVertex_withError(reco::Track const &trk, reco::VertexCollection const &vertices, Point &error, const size_t minNtracks=2)
Definition: getBestVertex.h:28
Vertex.h
Point
Structure Point Contains parameters of Gaussian fits to DMRs.
Definition: DMRtrends.cc:57
bphysicsOniaDQM_cfi.vertex
vertex
Definition: bphysicsOniaDQM_cfi.py:7
math::XYZPoint
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
VertexFwd.h
PVValHelper::dz
Definition: PVValidationHelpers.h:50
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
getBestVertex
Point getBestVertex(reco::Track const &trk, reco::VertexCollection const &vertices, const size_t minNtracks=2)
Definition: getBestVertex.h:8
pwdgSkimBPark_cfi.vertices
vertices
Definition: pwdgSkimBPark_cfi.py:7