File indexing completed on 2024-04-06 12:03:48
0001 #ifndef Candidate_CompositePtrCandidate_h
0002 #define Candidate_CompositePtrCandidate_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 CompositePtrCandidate : public LeafCandidate {
0018 public:
0019
0020 typedef std::vector<CandidatePtr> daughters;
0021
0022 typedef std::vector<CandidatePtr> mothers;
0023
0024 CompositePtrCandidate() : LeafCandidate() {}
0025
0026 CompositePtrCandidate(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 CompositePtrCandidate(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 CompositePtrCandidate(const Candidate& p) : LeafCandidate(p) {}
0043
0044 ~CompositePtrCandidate() override;
0045
0046 CompositePtrCandidate* clone() const override;
0047
0048 size_t numberOfDaughters() const override;
0049
0050 size_t numberOfMothers() const override;
0051
0052 const Candidate* daughter(size_type) const override;
0053 using reco::LeafCandidate::daughter;
0054
0055 Candidate* daughter(size_type) override;
0056
0057 void addDaughter(const CandidatePtr&);
0058
0059 virtual void clearDaughters() { dau.clear(); }
0060
0061 virtual CandidatePtr daughterPtr(size_type i) const { return dau[i]; }
0062
0063 virtual const daughters& daughterPtrVector() const { return dau; }
0064
0065 const Candidate* mother(size_t i = 0) const override;
0066
0067
0068
0069
0070 size_type numberOfSourceCandidatePtrs() const override;
0071
0072
0073
0074
0075 CandidatePtr sourceCandidatePtr(size_type i) const override;
0076
0077 private:
0078
0079 daughters dau;
0080
0081 bool overlap(const Candidate&) const override;
0082 };
0083
0084 inline void CompositePtrCandidate::addDaughter(const CandidatePtr& cand) { dau.push_back(cand); }
0085
0086 }
0087
0088 #endif