File indexing completed on 2024-04-06 12:03:49
0001 #ifndef Candidate_ShallowCloneCandidate_h
0002 #define Candidate_ShallowCloneCandidate_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #include "DataFormats/Candidate/interface/LeafCandidate.h"
0013
0014 namespace reco {
0015 class ShallowCloneCandidate : public LeafCandidate {
0016 public:
0017
0018 typedef CandidateCollection daughters;
0019
0020 ShallowCloneCandidate() : LeafCandidate() {}
0021
0022 explicit ShallowCloneCandidate(const CandidateBaseRef& masterClone)
0023 : LeafCandidate(*masterClone),
0024 masterClone_(masterClone->hasMasterClone() ? masterClone->masterClone() : masterClone) {}
0025
0026 ShallowCloneCandidate(const CandidateBaseRef& masterClone,
0027 Charge q,
0028 const LorentzVector& p4,
0029 const Point& vtx = Point(0, 0, 0))
0030 : LeafCandidate(q, p4, vtx), masterClone_(masterClone) {}
0031
0032 ShallowCloneCandidate(const CandidateBaseRef& masterClone,
0033 Charge q,
0034 const PolarLorentzVector& p4,
0035 const Point& vtx = Point(0, 0, 0))
0036 : LeafCandidate(q, p4, vtx), masterClone_(masterClone) {}
0037
0038 ~ShallowCloneCandidate() override;
0039
0040 ShallowCloneCandidate* clone() const override;
0041
0042 size_t numberOfDaughters() const override;
0043
0044 size_t numberOfMothers() const override;
0045
0046 const Candidate* daughter(size_type i) const override;
0047
0048 const Candidate* mother(size_type i) const override;
0049
0050 Candidate* daughter(size_type i) override;
0051 using reco::LeafCandidate::daughter;
0052
0053 bool hasMasterClone() const override;
0054
0055 const CandidateBaseRef& masterClone() const override;
0056
0057 bool isElectron() const override;
0058 bool isMuon() const override;
0059 bool isGlobalMuon() const override;
0060 bool isStandAloneMuon() const override;
0061 bool isTrackerMuon() const override;
0062 bool isCaloMuon() const override;
0063 bool isPhoton() const override;
0064 bool isConvertedPhoton() const override;
0065 bool isJet() const override;
0066
0067 private:
0068
0069 bool overlap(const Candidate& c) const override { return masterClone_->overlap(c); }
0070
0071 CandidateBaseRef masterClone_;
0072 };
0073
0074 }
0075
0076 #endif