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 
28  const role_collection & roles ) :
29  CompositeCandidate(), name_(name), roles_(roles) { }
32  const role_collection & roles,
33  Charge q, const LorentzVector & p4, const Point & vtx = Point( 0, 0, 0 ),
34  int pdgId = 0, int status = 0, bool integerCharge = true ) :
35  CompositeCandidate( q, p4, vtx, pdgId, status, integerCharge ),
36  name_ (name), roles_(roles) { }
39  const role_collection & roles,
40  const Candidate & p );
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  // Get candidate based on role
55  Candidate * daughter(const std::string& s ) override;
56  const Candidate * daughter(const std::string& s ) const override;
57  // Get candidate based on index
59  const Candidate * daughter( size_type i ) const override { return CompositeCandidate::daughter(i); }
60  // Add daughters
61  void addDaughter( const Candidate &, const std::string&s );
62  void addDaughter( std::unique_ptr<Candidate>, const std::string& s );
63  // Clear daughters and roles
65  void clearRoles() { roles_.clear(); }
66  // Apply the roles to the objects
67  void applyRoles();
68  private:
70  role_collection roles_;
71  };
72 
73 }
74 
75 #endif
int pdgId() const final
PDG identifier.
int Charge
electric charge type
Definition: Candidate.h:35
size_t size_type
Definition: Candidate.h:30
NamedCompositeCandidate(std::string name="")
default constructor
const Candidate * daughter(size_type i) const override
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
const NamedCompositeCandidate::role_collection & roles() const
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
~NamedCompositeCandidate() override
destructor
Candidate * daughter(const std::string &s) override
return daughter with a specified role name
NamedCompositeCandidate(std::string name, const role_collection &roles)
const LorentzVector & p4() const final
four-momentum Lorentz vector
Definition: LeafCandidate.h:99
const Candidate * daughter(size_type) const override
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
std::vector< std::string > role_collection
double p() const final
magnitude of momentum vector
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:37
void addDaughter(const Candidate &, const std::string &s)
fixed size matrix
Structure Point Contains parameters of Gaussian fits to DMRs.
Definition: DMRtrends.cc:55
int status() const final
status word
NamedCompositeCandidate * clone() const override
returns a clone of the candidate
math::XYZPoint Point
point in the space
Definition: LeafCandidate.h:27