CMS 3D CMS Logo

Functions

/data/refman/pasoursint/CMSSW_5_3_9_patch3/src/RecoVertex/AdaptiveVertexFinder/src/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, pileupDistInMC::total, reco::Vertex::tracks_begin(), reco::Vertex::tracks_end(), and reco::Vertex::trackWeight().

Referenced by VertexMerging::mergeVertex().

{
        std::set<reco::TrackRef> pvTracks;
        for(std::vector<reco::TrackBaseRef>::const_iterator iter = pv.tracks_begin();
            iter != pv.tracks_end(); iter++) {
                if (pv.trackWeight(*iter) >= 0.5)
                        pvTracks.insert(iter->castTo<reco::TrackRef>());
        }

        unsigned int count = 0, total = 0;
        for(std::vector<reco::TrackBaseRef>::const_iterator iter = sv.tracks_begin();
            iter != sv.tracks_end(); iter++) {
                if (sv.trackWeight(*iter) >= 0.5) {
                        total++;
                        count += pvTracks.count(iter->castTo<reco::TrackRef>());
                }
        }

        return (double)count / (double)total;
}