CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch12/src/DataFormats/Candidate/src/OverlapChecker.cc

Go to the documentation of this file.
00001 // $Id: OverlapChecker.cc,v 1.3 2007/09/27 13:51:55 llista Exp $
00002 #include "DataFormats/Candidate/interface/OverlapChecker.h"  
00003 #include "DataFormats/Candidate/interface/Candidate.h"
00004 using namespace reco;
00005   
00006 bool OverlapChecker::operator()( const Candidate & c1, const Candidate & c2 ) const {
00007   typedef Candidate::const_iterator iterator;
00008   if( c1.numberOfDaughters() == 0 ) {
00009     if ( c2.numberOfDaughters() == 0 ) {
00010       if( c2.hasMasterClone() )
00011         return c1.overlap( *(c2.masterClone()) );
00012       else
00013         return c1.overlap( c2 );
00014     }
00015     iterator b2 = c2.begin(), e2 = c2.end();
00016     for( iterator i2 = b2; i2 != e2; ++ i2 ) {
00017       if( operator()( c1, * i2 ) ) { 
00018         return true;
00019       }
00020     }
00021     return false;
00022   }
00023   iterator b1 = c1.begin(), e1 = c1.end();
00024   for( iterator i1 = b1; i1 != e1; ++ i1 ) {
00025     if( operator()( * i1, c2 ) ) { 
00026       return true;
00027     }
00028   }
00029   return false;
00030 }
00031