test
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/stream/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)
 
static const
edm::ParameterSetDescriptionFillerPluginFactory::PMaker
< edm::ParameterSetDescriptionFiller
< VertexMerger > > 
s_filler__LINE__ ("VertexMerger")
 
static const
edm::MakerPluginFactory::PMaker
< edm::WorkerMaker
< VertexMerger > > 
s_maker__LINE__ ("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, getDQMSummary::iter, pileupDistInMC::total, reco::Vertex::tracks_begin(), reco::Vertex::tracks_end(), and reco::Vertex::trackWeight().

Referenced by VertexMerger::produce().

41 {
42  std::set<reco::TrackRef> pvTracks;
43  for(std::vector<reco::TrackBaseRef>::const_iterator iter = pv.tracks_begin();
44  iter != pv.tracks_end(); iter++) {
45  if (pv.trackWeight(*iter) >= 0.5)
46  pvTracks.insert(iter->castTo<reco::TrackRef>());
47  }
48 
49  unsigned int count = 0, total = 0;
50  for(std::vector<reco::TrackBaseRef>::const_iterator iter = sv.tracks_begin();
51  iter != sv.tracks_end(); iter++) {
52  if (sv.trackWeight(*iter) >= 0.5) {
53  total++;
54  count += pvTracks.count(iter->castTo<reco::TrackRef>());
55  }
56  }
57 
58  return (double)count / (double)total;
59 }
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
static const edm::ParameterSetDescriptionFillerPluginFactory::PMaker<edm::ParameterSetDescriptionFiller< VertexMerger > > s_filler__LINE__ ( "VertexMerger"  )
static
static const edm::MakerPluginFactory ::PMaker< edm::WorkerMaker< VertexMerger > > s_maker__LINE__ ( "VertexMerger"  )
static