CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
VertexMerging Class Reference

#include <VertexMerging.h>

Public Member Functions

reco::VertexCollection mergeVertex (reco::VertexCollection &secondaryVertices)
 
 VertexMerging (const edm::ParameterSet &params)
 

Private Member Functions

bool trackFilter (const reco::TrackRef &track) const
 

Private Attributes

double maxFraction
 
double minSignificance
 

Detailed Description

Definition at line 17 of file VertexMerging.h.

Constructor & Destructor Documentation

VertexMerging::VertexMerging ( const edm::ParameterSet params)

Definition at line 4 of file VertexMerging.cc.

4  :
5  maxFraction(params.getParameter<double>("maxFraction")),
6  minSignificance(params.getParameter<double>("minSignificance"))
7 {
8 
9 }
T getParameter(std::string const &) const
double minSignificance
Definition: VertexMerging.h:29
double maxFraction
Definition: VertexMerging.h:28

Member Function Documentation

reco::VertexCollection VertexMerging::mergeVertex ( reco::VertexCollection secondaryVertices)

Definition at line 37 of file VertexMerging.cc.

References computeSharedTracks(), VertexDistance3D::distance(), maxFraction, minSignificance, and Measurement1D::significance().

38  {
39 
40 
41 
42 
43  VertexDistance3D dist;
44  reco::VertexCollection recoVertices;
45  for(std::vector<reco::Vertex>::const_iterator sv = secondaryVertices.begin();
46  sv != secondaryVertices.end(); ++sv) {
47  recoVertices.push_back(*sv);
48  }
49  for(std::vector<reco::Vertex>::iterator sv = recoVertices.begin();
50  sv != recoVertices.end(); ++sv) {
51 
52  bool shared=false;
53  for(std::vector<reco::Vertex>::iterator sv2 = recoVertices.begin();
54  sv2 != recoVertices.end(); ++sv2) {
55  double fr=computeSharedTracks(*sv2, *sv);
56  // std::cout << sv2-recoVertices->begin() << " vs " << sv-recoVertices->begin() << " : " << fr << " " << computeSharedTracks(*sv, *sv2) << " sig " << dist.distance(*sv,*sv2).significance() << std::endl;
57  // std::cout << (fr > maxFraction) << " && " << (dist.distance(*sv,*sv2).significance() < 2) << " && " << (sv-sv2!=0) << " && " << (fr >= computeSharedTracks(*sv2, *sv)) << std::endl;
58  if (fr > maxFraction && dist.distance(*sv,*sv2).significance() < minSignificance && sv-sv2!=0
59  && fr >= computeSharedTracks(*sv, *sv2) )
60  {
61  shared=true;
62  // std::cout << "shared " << sv-recoVertices->begin() << " and " << sv2-recoVertices->begin() << " fractions: " << fr << " , " << computeSharedTracks(*sv2, *sv) << " sig: " << dist.distance(*sv,*sv2).significance() << std::endl;
63 
64  }
65 
66 
67  }
68  if(shared) { sv=recoVertices.erase(sv)-1; }
69  // std::cout << "it = " << sv-recoVertices->begin() << " new size is: " << recoVertices->size() << std::endl;
70  }
71 
72  return recoVertices;
73 
74 
75 }
virtual Measurement1D distance(const GlobalPoint &vtx1Position, const GlobalError &vtx1PositionError, const GlobalPoint &vtx2Position, const GlobalError &vtx2PositionError) const
double minSignificance
Definition: VertexMerging.h:29
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
double significance() const
Definition: Measurement1D.h:32
double maxFraction
Definition: VertexMerging.h:28
static double computeSharedTracks(const reco::Vertex &pv, const reco::Vertex &sv)
bool VertexMerging::trackFilter ( const reco::TrackRef track) const
private

Member Data Documentation

double VertexMerging::maxFraction
private

Definition at line 28 of file VertexMerging.h.

Referenced by mergeVertex().

double VertexMerging::minSignificance
private

Definition at line 29 of file VertexMerging.h.

Referenced by mergeVertex().