CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Functions
VertexMerging.cc File Reference
#include "RecoVertex/AdaptiveVertexFinder/interface/VertexMerging.h"

Go to the source code of this file.

Functions

static double computeSharedTracks (const reco::Vertex &pv, const reco::Vertex &sv)
 

Function Documentation

static double computeSharedTracks ( const reco::Vertex pv,
const reco::Vertex sv 
)
static

Definition at line 7 of file VertexMerging.cc.

References submitPVResolutionJobs::count, dqmMemoryStats::total, reco::Vertex::tracks_begin(), reco::Vertex::tracks_end(), and reco::Vertex::trackWeight().

Referenced by VertexMerging::mergeVertex().

7  {
8  std::set<reco::TrackRef> pvTracks;
9  for (std::vector<reco::TrackBaseRef>::const_iterator iter = pv.tracks_begin(); iter != pv.tracks_end(); iter++) {
10  if (pv.trackWeight(*iter) >= 0.5)
11  pvTracks.insert(iter->castTo<reco::TrackRef>());
12  }
13 
14  unsigned int count = 0, total = 0;
15  for (std::vector<reco::TrackBaseRef>::const_iterator iter = sv.tracks_begin(); iter != sv.tracks_end(); iter++) {
16  if (sv.trackWeight(*iter) >= 0.5) {
17  total++;
18  count += pvTracks.count(iter->castTo<reco::TrackRef>());
19  }
20  }
21 
22  return (double)count / (double)total;
23 }
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