File indexing completed on 2023-03-17 10:49:17
0001 #ifndef Candidate_CompositeCandidate_h
0002 #define Candidate_CompositeCandidate_h
0003 #include "DataFormats/Candidate/interface/LeafCandidate.h"
0004 #include <memory>
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include "DataFormats/Candidate/interface/CompositeCandidateFwd.h"
0016 #include <string>
0017 #include <vector>
0018
0019 namespace reco {
0020
0021 class CompositeCandidate : public LeafCandidate {
0022 public:
0023
0024 typedef CandidateCollection daughters;
0025 typedef std::vector<std::string> role_collection;
0026
0027 CompositeCandidate(std::string name = "") : LeafCandidate(), name_(name) {}
0028
0029 template <typename P4>
0030 CompositeCandidate(Charge q,
0031 const P4& p4,
0032 const Point& vtx = Point(0, 0, 0),
0033 int pdgId = 0,
0034 int status = 0,
0035 bool integerCharge = true,
0036 std::string name = "")
0037 : LeafCandidate(q, p4, vtx, pdgId, status, integerCharge), name_(name) {}
0038
0039 explicit CompositeCandidate(const Candidate& p, const std::string& name = "");
0040
0041 explicit CompositeCandidate(const Candidate& p, const std::string& name, role_collection const& roles);
0042
0043 ~CompositeCandidate() override;
0044
0045 std::string name() const { return name_; }
0046
0047 void setName(std::string name) { name_ = name; }
0048
0049 role_collection const& roles() const { return roles_; }
0050
0051 void setRoles(const role_collection& roles) {
0052 roles_.clear();
0053 roles_ = roles;
0054 }
0055
0056 CompositeCandidate* clone() const override;
0057
0058 size_type numberOfDaughters() const override;
0059
0060 const Candidate* daughter(size_type) const override;
0061
0062 Candidate* daughter(size_type) override;
0063
0064 Candidate* daughter(const std::string& s) override;
0065 const Candidate* daughter(const std::string& s) const override;
0066
0067 void addDaughter(const Candidate&, const std::string& s = "");
0068
0069 void addDaughter(std::unique_ptr<Candidate>, const std::string& s = "");
0070
0071 void clearDaughters() { dau.clear(); }
0072
0073 void clearRoles() { roles_.clear(); }
0074
0075 void applyRoles();
0076
0077 size_type numberOfMothers() const override;
0078
0079 const Candidate* mother(size_type i = 0) const override;
0080
0081 private:
0082
0083 daughters dau;
0084
0085 bool overlap(const Candidate&) const override;
0086
0087 std::string name_;
0088
0089 role_collection roles_;
0090 };
0091
0092 }
0093
0094 #endif