CMS 3D CMS Logo

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/Candidate.h"
00014 #include "DataFormats/Candidate/interface/iterator_imp_specific.h"
00015 
00016 namespace reco {
00017   class ShallowCloneCandidate : public Candidate {
00018   public:
00020     typedef CandidateCollection daughters;
00022     ShallowCloneCandidate() : Candidate() {  }
00024     explicit ShallowCloneCandidate( const CandidateBaseRef & masterClone ) : 
00025       Candidate( * 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       Candidate( q, p4, vtx ), masterClone_( masterClone ) { }
00035     ShallowCloneCandidate( const CandidateBaseRef & masterClone, 
00036                            Charge q, const PolarLorentzVector & p4, const Point & vtx = Point( 0, 0, 0 ) ) : 
00037       Candidate( 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 );
00061     virtual bool hasMasterClone() const;
00063     virtual const CandidateBaseRef & masterClone() const;
00064 
00065     virtual bool isElectron() const;
00066     virtual bool isMuon() const;
00067     virtual bool isGlobalMuon() const;
00068     virtual bool isStandAloneMuon() const;
00069     virtual bool isTrackerMuon() const;
00070     virtual bool isCaloMuon() const;
00071     virtual bool isPhoton() const;
00072     virtual bool isConvertedPhoton() const;
00073     virtual bool isJet() const;
00074   private:
00075     // const iterator implementation
00076     typedef candidate::const_iterator_imp_specific<daughters> const_iterator_imp_specific;
00077     // iterator implementation
00078     typedef candidate::iterator_imp_specific<daughters> iterator_imp_specific;
00080     virtual bool overlap( const Candidate & c ) const { return masterClone_->overlap( c ); }
00082     CandidateBaseRef masterClone_;
00083   };
00084 
00085 }
00086 
00087 #endif

Generated on Tue Jun 9 17:27:27 2009 for CMSSW by  doxygen 1.5.4