CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Functions
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 41 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().

43 {
44  std::set<reco::TrackRef> pvTracks;
45  for(std::vector<reco::TrackBaseRef>::const_iterator iter = pv.tracks_begin();
46  iter != pv.tracks_end(); iter++) {
47  if (pv.trackWeight(*iter) >= 0.5)
48  pvTracks.insert(iter->castTo<reco::TrackRef>());
49  }
50 
51  unsigned int count = 0, total = 0;
52  for(std::vector<reco::TrackBaseRef>::const_iterator iter = sv.tracks_begin();
53  iter != sv.tracks_end(); iter++) {
54  if (sv.trackWeight(*iter) >= 0.5) {
55  total++;
56  count += pvTracks.count(iter->castTo<reco::TrackRef>());
57  }
58  }
59 
60  return (double)count / (double)total;
61 }
trackRef_iterator tracks_end() const
last iterator over tracks
Definition: Vertex.cc:45
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:40
DEFINE_FWK_MODULE ( VertexMerger  )