CMS 3D CMS Logo

NamedCompositeCandidate.h
Go to the documentation of this file.
1 #ifndef Candidate_NamedCompositeCandidate_H
2 #define Candidate_NamedCompositeCandidate_H
4 #include <memory>
16 #include <string>
17 #include <map>
18 
19 namespace reco {
20 
22  public:
23  typedef std::vector<std::string> role_collection;
24 
31  const role_collection& roles,
32  Charge q,
33  const LorentzVector& p4,
34  const Point& vtx = Point(0, 0, 0),
35  int pdgId = 0,
36  int status = 0,
37  bool integerCharge = true)
38  : CompositeCandidate(q, p4, vtx, pdgId, status, integerCharge), name_(name), roles_(roles) {}
41 
43  ~NamedCompositeCandidate() override;
45  NamedCompositeCandidate* clone() const override;
46  // get name
47  std::string name() const { return name_; }
48  // set name
49  void setName(std::string n) { name_ = n; }
50  // get roles
52  // set roles
54  roles_.clear();
55  roles_ = roles;
56  }
57  // Get candidate based on role
58  Candidate* daughter(const std::string& s) override;
59  const Candidate* daughter(const std::string& s) const override;
60  // Get candidate based on index
62  const Candidate* daughter(size_type i) const override { return CompositeCandidate::daughter(i); }
63  // Add daughters
64  void addDaughter(const Candidate&, const std::string& s);
65  void addDaughter(std::unique_ptr<Candidate>, const std::string& s);
66  // Clear daughters and roles
68  void clearRoles() { roles_.clear(); }
69  // Apply the roles to the objects
70  void applyRoles();
71 
72  private:
75  };
76 
77 } // namespace reco
78 
79 #endif
int Charge
electric charge type
Definition: Candidate.h:34
const Candidate * daughter(size_type) const override
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
size_t size_type
Definition: Candidate.h:29
NamedCompositeCandidate(std::string name="")
default constructor
int status() const final
status word
void setRoles(const NamedCompositeCandidate::role_collection &roles)
NamedCompositeCandidate(std::string name, const role_collection &roles, Charge q, const LorentzVector &p4, const Point &vtx=Point(0, 0, 0), int pdgId=0, int status=0, bool integerCharge=true)
constructor from values
const LorentzVector & p4() const final
four-momentum Lorentz vector
~NamedCompositeCandidate() override
destructor
Candidate * daughter(const std::string &s) override
return daughter with a specified role name
int pdgId() const final
PDG identifier.
double p() const final
magnitude of momentum vector
NamedCompositeCandidate(std::string name, const role_collection &roles)
const NamedCompositeCandidate::role_collection & roles() const
std::vector< std::string > role_collection
void clearDaughters()
clear daughters
Candidate * daughter(size_type i) override
return daughter at a given position, i = 0, ... numberOfDaughters() - 1
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:36
void addDaughter(const Candidate &, const std::string &s)
fixed size matrix
Structure Point Contains parameters of Gaussian fits to DMRs.
NamedCompositeCandidate * clone() const override
returns a clone of the candidate
std::vector< std::string > role_collection
const Candidate * daughter(size_type i) const override
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
math::XYZPoint Point
point in the space
Definition: LeafCandidate.h:27