CMS 3D CMS Logo

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

#include <OverlapChecker.h>

Public Member Functions

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

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

6  {
7  typedef Candidate::const_iterator iterator;
8  if( c1.numberOfDaughters() == 0 ) {
9  if ( c2.numberOfDaughters() == 0 ) {
10  if( c2.hasMasterClone() )
11  return c1.overlap( *(c2.masterClone()) );
12  else
13  return c1.overlap( c2 );
14  }
15  iterator b2 = c2.begin(), e2 = c2.end();
16  for( iterator i2 = b2; i2 != e2; ++ i2 ) {
17  if( operator()( c1, * i2 ) ) {
18  return true;
19  }
20  }
21  return false;
22  }
23  iterator b1 = c1.begin(), e1 = c1.end();
24  for( iterator i1 = b1; i1 != e1; ++ i1 ) {
25  if( operator()( * i1, c2 ) ) {
26  return true;
27  }
28  }
29  return false;
30 }
virtual size_type numberOfDaughters() const =0
number of daughters
virtual bool hasMasterClone() const =0
virtual const_iterator end() const =0
last daughter const_iterator
virtual const_iterator begin() const =0
first daughter const_iterator
virtual bool overlap(const Candidate &) const =0
check overlap with another Candidate
virtual const CandidateBaseRef & masterClone() const =0