00001 #ifndef Candidate_CompositePtrCandidate_h 00002 #define Candidate_CompositePtrCandidate_h 00003 #include "DataFormats/Candidate/interface/Candidate.h" 00016 #include "DataFormats/Candidate/interface/iterator_imp_specific.h" 00017 00018 namespace reco { 00019 00020 class CompositePtrCandidate : public Candidate { 00021 public: 00023 typedef std::vector<CandidatePtr> daughters; 00025 typedef std::vector<CandidatePtr> mothers; 00027 CompositePtrCandidate() : Candidate() { } 00029 CompositePtrCandidate( 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 CompositePtrCandidate( 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 CompositePtrCandidate( const Particle & p ) : Candidate( p ) { } 00039 virtual ~CompositePtrCandidate(); 00041 virtual CompositePtrCandidate * 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 size_t numberOfMothers() const; 00055 virtual const Candidate * daughter( size_type ) const; 00057 virtual Candidate * daughter( size_type ); 00059 void addDaughter( const CandidatePtr & ); 00061 void clearDaughters() { dau.clear(); } 00063 CandidatePtr daughterPtr( size_type i ) const { return dau[ i ]; } 00065 const daughters & daughterPtrVector() const { return dau; } 00067 virtual const Candidate * mother( size_t i = 0 ) const; 00072 virtual size_type numberOfSourceCandidatePtrs() const ; 00077 virtual CandidatePtr sourceCandidatePtr( size_type i ) const; 00078 00079 private: 00081 typedef candidate::const_iterator_imp_specific<daughters> const_iterator_imp_specific; 00083 typedef candidate::iterator_imp_specific_dummy<daughters> iterator_imp_specific; 00085 daughters dau; 00087 virtual bool overlap( const Candidate & ) const; 00088 }; 00089 00090 inline void CompositePtrCandidate::addDaughter( const CandidatePtr & cand ) { 00091 dau.push_back( cand ); 00092 } 00093 00094 } 00095 00096 #endif