CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/DataFormats/Candidate/interface/ShallowCloneCandidate.h

Go to the documentation of this file.
00001 #ifndef Candidate_ShallowCloneCandidate_h
00002 #define Candidate_ShallowCloneCandidate_h
00003 
00013 #include "DataFormats/Candidate/interface/LeafCandidate.h"
00014 #include "DataFormats/Candidate/interface/iterator_imp_specific.h"
00015 
00016 namespace reco {
00017   class ShallowCloneCandidate : public LeafCandidate {
00018   public:
00020     typedef CandidateCollection daughters;
00022     ShallowCloneCandidate() : LeafCandidate() {  }
00024     explicit ShallowCloneCandidate( const CandidateBaseRef & masterClone ) : 
00025       LeafCandidate( * masterClone ), 
00026       masterClone_( masterClone->hasMasterClone() ? 
00027                     masterClone->masterClone() : 
00028                     masterClone ) { 
00029     }
00031     ShallowCloneCandidate( const CandidateBaseRef & masterClone, 
00032                            Charge q, const LorentzVector & p4, const Point & vtx = Point( 0, 0, 0 ) ) : 
00033       LeafCandidate( q, p4, vtx ), masterClone_( masterClone ) { }
00035     ShallowCloneCandidate( const CandidateBaseRef & masterClone, 
00036                            Charge q, const PolarLorentzVector & p4, const Point & vtx = Point( 0, 0, 0 ) ) : 
00037       LeafCandidate( q, p4, vtx ), masterClone_( masterClone ) { }
00039     virtual ~ShallowCloneCandidate();
00041     virtual ShallowCloneCandidate * 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 i ) const;
00057     virtual const Candidate * mother( size_type i ) const;
00059     virtual Candidate * daughter( size_type i );
00060     using reco::LeafCandidate::daughter; // avoid hiding the base
00062     virtual bool hasMasterClone() const;
00064     virtual const CandidateBaseRef & masterClone() const;
00065 
00066     virtual bool isElectron() const;
00067     virtual bool isMuon() const;
00068     virtual bool isGlobalMuon() const;
00069     virtual bool isStandAloneMuon() const;
00070     virtual bool isTrackerMuon() const;
00071     virtual bool isCaloMuon() const;
00072     virtual bool isPhoton() const;
00073     virtual bool isConvertedPhoton() const;
00074     virtual bool isJet() const;
00075   private:
00076     // const iterator implementation
00077     typedef candidate::const_iterator_imp_specific<daughters> const_iterator_imp_specific;
00078     // iterator implementation
00079     typedef candidate::iterator_imp_specific<daughters> iterator_imp_specific;
00081     virtual bool overlap( const Candidate & c ) const { return masterClone_->overlap( c ); }
00083     CandidateBaseRef masterClone_;
00084   };
00085 
00086 }
00087 
00088 #endif