CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_7_hltpatch2/src/DataFormats/Candidate/interface/CompositeRefBaseCandidate.h

Go to the documentation of this file.
00001 #ifndef Candidate_CompositeRefBaseCandidate_h
00002 #define Candidate_CompositeRefBaseCandidate_h
00003 #include "DataFormats/Candidate/interface/LeafCandidate.h"
00015 #include "DataFormats/Candidate/interface/iterator_imp_specific.h"
00016 
00017 namespace reco {
00018 
00019   class CompositeRefBaseCandidate : public LeafCandidate {
00020   public:
00022     typedef std::vector<CandidateBaseRef> daughters;
00024     CompositeRefBaseCandidate() : LeafCandidate() { }
00026     CompositeRefBaseCandidate( Charge q, const LorentzVector & p4, const Point & vtx = Point( 0, 0, 0 ),
00027                                int pdgId = 0, int status = 0, bool integerCharge = true ) :
00028       LeafCandidate( q, p4, vtx, pdgId, status, integerCharge ) { }
00030     CompositeRefBaseCandidate( Charge q, const PolarLorentzVector & p4, const Point & vtx = Point( 0, 0, 0 ),
00031                                int pdgId = 0, int status = 0, bool integerCharge = true ) :
00032       LeafCandidate( q, p4, vtx, pdgId, status, integerCharge ) { }
00034     explicit CompositeRefBaseCandidate( const Candidate & c ) : LeafCandidate( c ) { }
00036     virtual ~CompositeRefBaseCandidate();
00038     virtual CompositeRefBaseCandidate * clone() const;
00040     virtual const_iterator begin() const;
00042     virtual const_iterator end() const;
00044     virtual iterator begin();
00046     virtual iterator end();
00048     virtual size_t numberOfDaughters() const;
00050     virtual size_t numberOfMothers() const;
00052     virtual const Candidate * daughter( size_type ) const;
00054     virtual const Candidate * mother( size_type ) const;
00056     virtual Candidate * daughter( size_type );
00057     using reco::LeafCandidate::daughter; // avoid hiding the base
00059     void addDaughter( const CandidateBaseRef & );    
00061     void clearDaughters() { dau.clear(); }
00063     CandidateBaseRef daughterRef( size_type i ) const { return dau[ i ]; }
00064 
00065   private:
00067     typedef candidate::const_iterator_imp_specific<daughters> const_iterator_imp_specific;
00069     typedef candidate::iterator_imp_specific_dummy<daughters> iterator_imp_specific;
00071     daughters dau;
00073     virtual bool overlap( const Candidate & ) const;
00074   };
00075 
00076   inline void CompositeRefBaseCandidate::addDaughter( const CandidateBaseRef & cand ) { 
00077     dau.push_back( cand ); 
00078   }
00079 }
00080 
00081 #endif