File indexing completed on 2024-04-06 12:03:49
0001 #ifndef Candidate_NamedCompositeCandidate_H
0002 #define Candidate_NamedCompositeCandidate_H
0003 #include "DataFormats/Candidate/interface/CompositeCandidate.h"
0004 #include <memory>
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include "DataFormats/Candidate/interface/NamedCompositeCandidateFwd.h"
0016 #include <string>
0017 #include <map>
0018
0019 namespace reco {
0020
0021 class NamedCompositeCandidate : public CompositeCandidate {
0022 public:
0023 typedef std::vector<std::string> role_collection;
0024
0025
0026 NamedCompositeCandidate(std::string name = "") : CompositeCandidate(), name_(name) {}
0027 NamedCompositeCandidate(std::string name, const role_collection& roles)
0028 : CompositeCandidate(), name_(name), roles_(roles) {}
0029
0030 NamedCompositeCandidate(std::string name,
0031 const role_collection& roles,
0032 Charge q,
0033 const LorentzVector& p4,
0034 const Point& vtx = Point(0, 0, 0),
0035 int pdgId = 0,
0036 int status = 0,
0037 bool integerCharge = true)
0038 : CompositeCandidate(q, p4, vtx, pdgId, status, integerCharge), name_(name), roles_(roles) {}
0039
0040 NamedCompositeCandidate(std::string name, const role_collection& roles, const Candidate& p);
0041
0042
0043 ~NamedCompositeCandidate() override;
0044
0045 NamedCompositeCandidate* clone() const override;
0046
0047 std::string name() const { return name_; }
0048
0049 void setName(std::string n) { name_ = n; }
0050
0051 const NamedCompositeCandidate::role_collection& roles() const { return roles_; }
0052
0053 void setRoles(const NamedCompositeCandidate::role_collection& roles) {
0054 roles_.clear();
0055 roles_ = roles;
0056 }
0057
0058 Candidate* daughter(const std::string& s) override;
0059 const Candidate* daughter(const std::string& s) const override;
0060
0061 Candidate* daughter(size_type i) override { return CompositeCandidate::daughter(i); }
0062 const Candidate* daughter(size_type i) const override { return CompositeCandidate::daughter(i); }
0063
0064 void addDaughter(const Candidate&, const std::string& s);
0065 void addDaughter(std::unique_ptr<Candidate>, const std::string& s);
0066
0067 void clearDaughters() { CompositeCandidate::clearDaughters(); }
0068 void clearRoles() { roles_.clear(); }
0069
0070 void applyRoles();
0071
0072 private:
0073 std::string name_;
0074 role_collection roles_;
0075 };
0076
0077 }
0078
0079 #endif