CMS 3D CMS Logo

Public Member Functions

reco::NbSharedTracks Class Reference

#include <NbSharedTracks.h>

List of all members.

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.

{};
reco::NbSharedTracks::~NbSharedTracks ( ) [inline]

Definition at line 21 of file NbSharedTracks.h.

{};

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().

                                                                   {

  int nSharedTracks = 0;

  // for first vertex
  Vertex::trackRef_iterator v1TrackIter;
  Vertex::trackRef_iterator v1TrackBegin = v1.tracks_begin();
  Vertex::trackRef_iterator v1TrackEnd   = v1.tracks_end();
  

  // for second vertex
  Vertex::trackRef_iterator v2TrackIter;
  Vertex::trackRef_iterator v2TrackBegin = v2.tracks_begin();
  Vertex::trackRef_iterator v2TrackEnd   = v2.tracks_end();
  
  for (v1TrackIter = v1TrackBegin; v1TrackIter != v1TrackEnd; v1TrackIter++) {
    for (v2TrackIter = v2TrackBegin; v2TrackIter != v2TrackEnd; v2TrackIter++) {
      if ( (*v1TrackIter) == (*v2TrackIter) ) {
        nSharedTracks++;
      } // if 
    } // for v2TrackIter
  } //for v1TrackIter


  return nSharedTracks;
} // int sharedTracks