Go to the documentation of this file.00001 #ifndef Candidate_CompositeRefCandidate_h
00002 #define Candidate_CompositeRefCandidate_h
00003 #include "DataFormats/Candidate/interface/LeafCandidate.h"
00016 #include "DataFormats/Candidate/interface/iterator_imp_specific.h"
00017
00018 namespace reco {
00019
00020 class CompositeRefCandidate : public LeafCandidate {
00021 public:
00023 typedef CandidateRefVector daughters;
00025 typedef CandidateRefVector mothers;
00027 CompositeRefCandidate() : LeafCandidate() { }
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 LeafCandidate( 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 LeafCandidate( q, p4, vtx, pdgId, status, integerCharge ) { }
00037 explicit CompositeRefCandidate( const Candidate & p ) : LeafCandidate( 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 );
00056 using reco::LeafCandidate::daughter;
00058 void addDaughter( const CandidateRef & );
00060 void addMother( const CandidateRef & );
00062 void clearDaughters() { dau.clear(); }
00064 CandidateRef daughterRef( size_type i ) const { return dau[ i ]; }
00066 const daughters & daughterRefVector() const { return dau; }
00068 CandidateRef motherRef( size_type i = 0 ) const { return mom[ i ]; }
00070 const mothers & motherRefVector() const { return mom; }
00072 void resetDaughters( const edm::ProductID & id ) { dau = daughters( id ); }
00074 virtual size_t numberOfMothers() const;
00076 virtual const Candidate * mother( size_t i = 0 ) const;
00077
00078 private:
00080 typedef candidate::const_iterator_imp_specific<daughters> const_iterator_imp_specific;
00082 typedef candidate::iterator_imp_specific_dummy<daughters> iterator_imp_specific;
00084 daughters dau;
00086 daughters mom;
00088 virtual bool overlap( const Candidate & ) const;
00089 };
00090
00091 inline void CompositeRefCandidate::addDaughter( const CandidateRef & cand ) {
00092 dau.push_back( cand );
00093 }
00094
00095 inline void CompositeRefCandidate::addMother( const CandidateRef & cand ) {
00096 mom.push_back( cand );
00097 }
00098 }
00099
00100 #endif