File indexing completed on 2024-04-06 12:03:48
0001 #ifndef Candidate_CompositeRefCandidate_h
0002 #define Candidate_CompositeRefCandidate_h
0003 #include "DataFormats/Candidate/interface/LeafCandidate.h"
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 namespace reco {
0016
0017 class CompositeRefCandidate : public LeafCandidate {
0018 public:
0019
0020 typedef CandidateRefVector daughters;
0021
0022 typedef CandidateRefVector mothers;
0023
0024 CompositeRefCandidate() : LeafCandidate() {}
0025
0026 CompositeRefCandidate(Charge q,
0027 const LorentzVector& p4,
0028 const Point& vtx = Point(0, 0, 0),
0029 int pdgId = 0,
0030 int status = 0,
0031 bool integerCharge = true)
0032 : LeafCandidate(q, p4, vtx, pdgId, status, integerCharge) {}
0033
0034 CompositeRefCandidate(Charge q,
0035 const PolarLorentzVector& p4,
0036 const Point& vtx = Point(0, 0, 0),
0037 int pdgId = 0,
0038 int status = 0,
0039 bool integerCharge = true)
0040 : LeafCandidate(q, p4, vtx, pdgId, status, integerCharge) {}
0041
0042 explicit CompositeRefCandidate(const Candidate& p) : LeafCandidate(p) {}
0043
0044 ~CompositeRefCandidate() override;
0045
0046 CompositeRefCandidate* clone() const override;
0047
0048 size_t numberOfDaughters() const override;
0049
0050 const Candidate* daughter(size_type) const override;
0051
0052 Candidate* daughter(size_type) override;
0053 using reco::LeafCandidate::daughter;
0054
0055 void addDaughter(const CandidateRef&);
0056
0057 void addMother(const CandidateRef&);
0058
0059 void clearDaughters() { dau.clear(); }
0060
0061 CandidateRef daughterRef(size_type i) const { return dau[i]; }
0062
0063 const daughters& daughterRefVector() const { return dau; }
0064
0065 CandidateRef motherRef(size_type i = 0) const { return mom[i]; }
0066
0067 const mothers& motherRefVector() const { return mom; }
0068
0069 void resetDaughters(const edm::ProductID& id) { dau = daughters(id); }
0070
0071 size_t numberOfMothers() const override;
0072
0073 const Candidate* mother(size_t i = 0) const override;
0074
0075 private:
0076
0077 daughters dau;
0078
0079 daughters mom;
0080
0081 bool overlap(const Candidate&) const override;
0082 };
0083
0084 inline void CompositeRefCandidate::addDaughter(const CandidateRef& cand) { dau.push_back(cand); }
0085
0086 inline void CompositeRefCandidate::addMother(const CandidateRef& cand) { mom.push_back(cand); }
0087 }
0088
0089 #endif