CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
OverlapChecker.cc
Go to the documentation of this file.
1 // $Id: OverlapChecker.cc,v 1.3 2007/09/27 13:51:55 llista Exp $
4 using namespace reco;
5 
6 bool OverlapChecker::operator()( const Candidate & c1, const Candidate & c2 ) const {
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 }
31 
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
bool operator()(const reco::Candidate &, const reco::Candidate &) const
return true if two candidates overlap
virtual const CandidateBaseRef & masterClone() const =0