00001 #ifndef Candidate_CompositeRefCandidate_h 00002 #define Candidate_CompositeRefCandidate_h 00003 #include "DataFormats/Candidate/interface/Candidate.h" 00016 #include "DataFormats/Candidate/interface/iterator_imp_specific.h" 00017 00018 namespace reco { 00019 00020 class CompositeRefCandidate : public Candidate { 00021 public: 00023 typedef CandidateRefVector daughters; 00025 typedef CandidateRefVector mothers; 00027 CompositeRefCandidate() : Candidate() { } 00029 CompositeRefCandidate( Charge q, const LorentzVector & p4, const Point & vtx = Point( 0, 0, 0 ), 00030 int pdgId = 0, int status = 0, bool integerCharge = true ) : 00031 Candidate( q, p4, vtx, pdgId, status, integerCharge ) { } 00033 CompositeRefCandidate( Charge q, const PolarLorentzVector & p4, const Point & vtx = Point( 0, 0, 0 ), 00034 int pdgId = 0, int status = 0, bool integerCharge = true ) : 00035 Candidate( q, p4, vtx, pdgId, status, integerCharge ) { } 00037 explicit CompositeRefCandidate( const Particle & p ) : Candidate( p ) { } 00039 virtual ~CompositeRefCandidate(); 00041 virtual CompositeRefCandidate * clone() const; 00043 virtual const_iterator begin() const; 00045 virtual const_iterator end() const; 00047 virtual iterator begin(); 00049 virtual iterator end(); 00051 virtual size_t numberOfDaughters() const; 00053 virtual const Candidate * daughter( size_type ) const; 00055 virtual Candidate * daughter( size_type ); 00057 void addDaughter( const CandidateRef & ); 00059 void addMother( const CandidateRef & ); 00061 void clearDaughters() { dau.clear(); } 00063 CandidateRef daughterRef( size_type i ) const { return dau[ i ]; } 00065 const daughters & daughterRefVector() const { return dau; } 00067 CandidateRef motherRef( size_type i = 0 ) const { return mom[ i ]; } 00069 const mothers & motherRefVector() const { return mom; } 00071 void resetDaughters( const edm::ProductID & id ) { dau = daughters( id ); } 00073 virtual size_t numberOfMothers() const; 00075 virtual const Candidate * mother( size_t i = 0 ) const; 00076 00077 private: 00079 typedef candidate::const_iterator_imp_specific<daughters> const_iterator_imp_specific; 00081 typedef candidate::iterator_imp_specific_dummy<daughters> iterator_imp_specific; 00083 daughters dau; 00085 daughters mom; 00087 virtual bool overlap( const Candidate & ) const; 00088 }; 00089 00090 inline void CompositeRefCandidate::addDaughter( const CandidateRef & cand ) { 00091 dau.push_back( cand ); 00092 } 00093 00094 inline void CompositeRefCandidate::addMother( const CandidateRef & cand ) { 00095 mom.push_back( cand ); 00096 } 00097 } 00098 00099 #endif