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

Definition at line 6 of file getBestVertex.h.

Function Documentation

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

Definition at line 9 of file getBestVertex.h.

References funct::abs(), PVValHelper::dz, reco::TrackBase::dz(), SiStripPI::max, and l1t::tracks.

Referenced by TrackingNtuple::fillTracks(), and MultiTrackSelector::produce().

9  {
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 
27  }
math::XYZPoint Point
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Point getBestVertex_withError ( reco::Track const &  trk,
reco::VertexCollection const &  vertices,
Point error,
const size_t  minNtracks = 2 
)
inline

Definition at line 30 of file getBestVertex.h.

References funct::abs(), PVValHelper::dz, reco::TrackBase::dz(), SiStripPI::max, and l1t::tracks.

30  {
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 
49  }
math::XYZPoint Point
Abs< T >::type abs(const T &t)
Definition: Abs.h:22