00001 // $Id: CompositePtrCandidate.cc,v 1.4 2010/12/06 20:04:17 wmtan Exp $ 00002 #include "DataFormats/Candidate/interface/CompositePtrCandidate.h" 00003 #include "FWCore/Utilities/interface/Exception.h" 00004 00005 using namespace reco; 00006 00007 CompositePtrCandidate::~CompositePtrCandidate() { 00008 } 00009 00010 CompositePtrCandidate * CompositePtrCandidate::clone() const { 00011 return new CompositePtrCandidate( * this ); 00012 } 00013 00014 Candidate::const_iterator CompositePtrCandidate::begin() const { 00015 return const_iterator( new const_iterator_imp_specific( dau.begin() ) ); 00016 } 00017 00018 Candidate::const_iterator CompositePtrCandidate::end() const { 00019 return const_iterator( new const_iterator_imp_specific( dau.end() ) ); 00020 } 00021 00022 Candidate::iterator CompositePtrCandidate::begin() { 00023 return iterator( new iterator_imp_specific ); 00024 } 00025 00026 Candidate::iterator CompositePtrCandidate::end() { 00027 return iterator( new iterator_imp_specific ); 00028 } 00029 00030 const Candidate * CompositePtrCandidate::daughter( size_type i ) const { 00031 return ( i < numberOfDaughters() ) ? & * dau[ i ] : 0; // i >= 0, since i is unsigned 00032 } 00033 00034 const Candidate * CompositePtrCandidate::mother( size_type i ) const { 00035 return 0; 00036 } 00037 00038 Candidate * CompositePtrCandidate::daughter( size_type i ) { 00039 return 0; 00040 } 00041 00042 size_t CompositePtrCandidate::numberOfDaughters() const { 00043 return dau.size(); 00044 } 00045 00046 size_t CompositePtrCandidate::numberOfMothers() const { 00047 return 0; 00048 } 00049 00050 size_t CompositePtrCandidate::numberOfSourceCandidatePtrs() const { 00051 return numberOfDaughters(); 00052 } 00053 00054 CandidatePtr CompositePtrCandidate::sourceCandidatePtr( size_type i ) const { 00055 return daughterPtr(i); 00056 } 00057 00058 bool CompositePtrCandidate::overlap( const Candidate & c2 ) const { 00059 throw cms::Exception( "Error" ) << "can't check overlap internally for CompositePtrCanddate"; 00060 }