CMS 3D CMS Logo

Typedefs | Functions
getBestVertex.h File Reference
#include "DataFormats/TrackReco/interface/Track.h"
#include "DataFormats/VertexReco/interface/Vertex.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 5 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 8 of file getBestVertex.h.

References funct::abs(), allConversions_cfi::dz, reco::TrackBase::dz(), hpstanc_transforms::max, and l1t::tracks.

Referenced by MultiTrackSelector::produce().

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

References funct::abs(), allConversions_cfi::dz, reco::TrackBase::dz(), hpstanc_transforms::max, and l1t::tracks.

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