CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/DataFormats/Candidate/interface/CompositePtrCandidate.h

Go to the documentation of this file.
00001 #ifndef Candidate_CompositePtrCandidate_h
00002 #define Candidate_CompositePtrCandidate_h
00003 #include "DataFormats/Candidate/interface/LeafCandidate.h"
00016 #include "DataFormats/Candidate/interface/iterator_imp_specific.h"
00017 
00018 namespace reco {
00019 
00020   class CompositePtrCandidate : public LeafCandidate {
00021   public:
00023     typedef std::vector<CandidatePtr> daughters;
00025     typedef std::vector<CandidatePtr> mothers;
00027     CompositePtrCandidate() : LeafCandidate() { }
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       LeafCandidate( 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       LeafCandidate( q, p4, vtx, pdgId, status, integerCharge ) { }
00037     explicit CompositePtrCandidate( const Candidate & p ) : LeafCandidate( 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;
00056     using reco::LeafCandidate::daughter; // avoid hiding the base
00058     virtual Candidate * daughter( size_type );
00060     void addDaughter( const CandidatePtr & );    
00062     void clearDaughters() { dau.clear(); }
00064     CandidatePtr daughterPtr( size_type i ) const { return dau[ i ]; }
00066     const daughters & daughterPtrVector() const { return dau; }
00068     virtual const Candidate * mother( size_t i = 0 ) const;
00073     virtual size_type numberOfSourceCandidatePtrs() const ;
00078     virtual CandidatePtr sourceCandidatePtr( size_type i ) const;
00079 
00080   private:
00082     typedef candidate::const_iterator_imp_specific<daughters> const_iterator_imp_specific;
00084     typedef candidate::iterator_imp_specific_dummy<daughters> iterator_imp_specific;
00086     daughters dau;
00088     virtual bool overlap( const Candidate & ) const;
00089   };
00090 
00091   inline void CompositePtrCandidate::addDaughter( const CandidatePtr & cand ) { 
00092     dau.push_back( cand ); 
00093   }
00094 
00095 }
00096 
00097 #endif