CMS 3D CMS Logo

Classes | Functions

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/RecoVertex/AdaptiveVertexFinder/plugins/VertexMerger.cc File Reference

#include <memory>
#include <set>
#include "FWCore/Framework/interface/EDProducer.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "DataFormats/Common/interface/Handle.h"
#include "DataFormats/TrackReco/interface/Track.h"
#include "DataFormats/TrackReco/interface/TrackFwd.h"
#include "DataFormats/VertexReco/interface/Vertex.h"
#include "DataFormats/VertexReco/interface/VertexFwd.h"
#include "RecoVertex/VertexTools/interface/VertexDistance3D.h"

Go to the source code of this file.

Classes

class  VertexMerger

Functions

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

Function Documentation

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

Definition at line 39 of file VertexMerger.cc.

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

Referenced by VertexMerger::produce().

{
        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;
}
DEFINE_FWK_MODULE ( VertexMerger  )