CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 11 of file VertexMerging.cc.

References prof2calltree::count, getDQMSummary::iter, 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:44
float trackWeight(const TrackBaseRef &r) const
returns the weight with which a Track has contributed to the vertex-fit.
trackRef_iterator tracks_begin() const
first iterator over tracks
Definition: Vertex.cc:39