CMS 3D CMS Logo

Public Member Functions

OverlapChecker Class Reference

#include <OverlapChecker.h>

List of all members.

Public Member Functions

bool operator() (const reco::Candidate &, const reco::Candidate &) const
 return true if two candidates overlap

Detailed Description

Functor that checks the overlap of two Candidate objects

Author:
Luca Lista, INFN
Version:
Revision:
1.2
Id:
OverlapChecker.h,v 1.2 2006/03/08 12:57:07 llista Exp

Definition at line 19 of file OverlapChecker.h.


Member Function Documentation

bool OverlapChecker::operator() ( const reco::Candidate c1,
const reco::Candidate c2 
) const

return true if two candidates overlap

Definition at line 6 of file OverlapChecker.cc.

References reco::Candidate::begin(), reco::Candidate::end(), reco::Candidate::hasMasterClone(), reco::Candidate::masterClone(), reco::Candidate::numberOfDaughters(), and reco::Candidate::overlap().

                                                                                  {
  typedef Candidate::const_iterator iterator;
  if( c1.numberOfDaughters() == 0 ) {
    if ( c2.numberOfDaughters() == 0 ) {
      if( c2.hasMasterClone() )
        return c1.overlap( *(c2.masterClone()) );
      else
        return c1.overlap( c2 );
    }
    iterator b2 = c2.begin(), e2 = c2.end();
    for( iterator i2 = b2; i2 != e2; ++ i2 ) {
      if( operator()( c1, * i2 ) ) { 
        return true;
      }
    }
    return false;
  }
  iterator b1 = c1.begin(), e1 = c1.end();
  for( iterator i1 = b1; i1 != e1; ++ i1 ) {
    if( operator()( * i1, c2 ) ) { 
      return true;
    }
  }
  return false;
}