CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions
reco::NbSharedTracks Class Reference

#include <NbSharedTracks.h>

Public Member Functions

 NbSharedTracks ()
 
int sharedTracks (const reco::Vertex &v1, const reco::Vertex &v2) const
 
 ~NbSharedTracks ()
 

Detailed Description

Definition at line 17 of file NbSharedTracks.h.

Constructor & Destructor Documentation

reco::NbSharedTracks::NbSharedTracks ( )
inline

Definition at line 20 of file NbSharedTracks.h.

20 {};
reco::NbSharedTracks::~NbSharedTracks ( )
inline

Definition at line 21 of file NbSharedTracks.h.

21 {};

Member Function Documentation

int reco::NbSharedTracks::sharedTracks ( const reco::Vertex v1,
const reco::Vertex v2 
) const

Definition at line 9 of file NbSharedTracks.cc.

References reco::Vertex::tracks_begin(), and reco::Vertex::tracks_end().

10  {
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
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