CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
NbSharedTracks.cc
Go to the documentation of this file.
4 
5 // this class' header
7 
8 
10  const reco::Vertex &v2) const {
11 
12  int nSharedTracks = 0;
13 
14  // for first vertex
15  Vertex::trackRef_iterator v1TrackIter;
16  Vertex::trackRef_iterator v1TrackBegin = v1.tracks_begin();
17  Vertex::trackRef_iterator v1TrackEnd = v1.tracks_end();
18 
19 
20  // for second vertex
21  Vertex::trackRef_iterator v2TrackIter;
22  Vertex::trackRef_iterator v2TrackBegin = v2.tracks_begin();
23  Vertex::trackRef_iterator v2TrackEnd = v2.tracks_end();
24 
25  for (v1TrackIter = v1TrackBegin; v1TrackIter != v1TrackEnd; v1TrackIter++) {
26  for (v2TrackIter = v2TrackBegin; v2TrackIter != v2TrackEnd; v2TrackIter++) {
27  if ( (*v1TrackIter) == (*v2TrackIter) ) {
28  nSharedTracks++;
29  } // if
30  } // for v2TrackIter
31  } //for v1TrackIter
32 
33 
34  return nSharedTracks;
35 } // int sharedTracks
trackRef_iterator tracks_end() const
last iterator over tracks
Definition: Vertex.cc:44
int sharedTracks(const reco::Vertex &v1, const reco::Vertex &v2) const
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector&lt;TrackRef&gt;
Definition: Vertex.h:37
trackRef_iterator tracks_begin() const
first iterator over tracks
Definition: Vertex.cc:39