CMS 3D CMS Logo

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 11 of file VertexMerging.cc.

References KineDebug3::count(), pileupDistInMC::total, reco::Vertex::tracks_begin(), reco::Vertex::tracks_end(), and reco::Vertex::trackWeight().

Referenced by VertexMerging::mergeVertex().

13 {
14  std::set<reco::TrackRef> pvTracks;
15  for(std::vector<reco::TrackBaseRef>::const_iterator iter = pv.tracks_begin();
16  iter != pv.tracks_end(); iter++) {
17  if (pv.trackWeight(*iter) >= 0.5)
18  pvTracks.insert(iter->castTo<reco::TrackRef>());
19  }
20 
21  unsigned int count = 0, total = 0;
22  for(std::vector<reco::TrackBaseRef>::const_iterator iter = sv.tracks_begin();
23  iter != sv.tracks_end(); iter++) {
24  if (sv.trackWeight(*iter) >= 0.5) {
25  total++;
26  count += pvTracks.count(iter->castTo<reco::TrackRef>());
27  }
28  }
29 
30  return (double)count / (double)total;
31 }
trackRef_iterator tracks_end() const
last iterator over tracks
Definition: Vertex.cc:81
float trackWeight(const TREF &r) const
returns the weight with which a Track has contributed to the vertex-fit.
Definition: Vertex.h:81
trackRef_iterator tracks_begin() const
first iterator over tracks
Definition: Vertex.cc:76