File indexing completed on 2024-04-06 12:03:48
0001 #ifndef Candidate_CompositeRefBaseCandidate_h
0002 #define Candidate_CompositeRefBaseCandidate_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 CompositeRefBaseCandidate : public LeafCandidate {
0018 public:
0019
0020 typedef std::vector<CandidateBaseRef> daughters;
0021
0022 CompositeRefBaseCandidate() : LeafCandidate() {}
0023
0024 CompositeRefBaseCandidate(Charge q,
0025 const LorentzVector& p4,
0026 const Point& vtx = Point(0, 0, 0),
0027 int pdgId = 0,
0028 int status = 0,
0029 bool integerCharge = true)
0030 : LeafCandidate(q, p4, vtx, pdgId, status, integerCharge) {}
0031
0032 CompositeRefBaseCandidate(Charge q,
0033 const PolarLorentzVector& p4,
0034 const Point& vtx = Point(0, 0, 0),
0035 int pdgId = 0,
0036 int status = 0,
0037 bool integerCharge = true)
0038 : LeafCandidate(q, p4, vtx, pdgId, status, integerCharge) {}
0039
0040 explicit CompositeRefBaseCandidate(const Candidate& c) : LeafCandidate(c) {}
0041
0042 ~CompositeRefBaseCandidate() override;
0043
0044 CompositeRefBaseCandidate* clone() const override;
0045
0046 size_t numberOfDaughters() const override;
0047
0048 size_t numberOfMothers() const override;
0049
0050 const Candidate* daughter(size_type) const override;
0051
0052 const Candidate* mother(size_type) const override;
0053
0054 Candidate* daughter(size_type) override;
0055 using reco::LeafCandidate::daughter;
0056
0057 void addDaughter(const CandidateBaseRef&);
0058
0059 void clearDaughters() { dau.clear(); }
0060
0061 CandidateBaseRef daughterRef(size_type i) const { return dau[i]; }
0062
0063 private:
0064
0065 daughters dau;
0066
0067 bool overlap(const Candidate&) const override;
0068 };
0069
0070 inline void CompositeRefBaseCandidate::addDaughter(const CandidateBaseRef& cand) { dau.push_back(cand); }
0071 }
0072
0073 #endif