CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
NamedCompositeCandidate.h
Go to the documentation of this file.
1 #ifndef Candidate_NamedCompositeCandidate_H
2 #define Candidate_NamedCompositeCandidate_H
4 #include <memory>
17 #include <string>
18 #include <map>
19 
20 namespace reco {
21 
23  public:
24  typedef std::vector<std::string> role_collection;
25 
29  const role_collection & roles ) :
30  CompositeCandidate(), name_(name), roles_(roles) { }
33  const role_collection & roles,
34  Charge q, const LorentzVector & p4, const Point & vtx = Point( 0, 0, 0 ),
35  int pdgId = 0, int status = 0, bool integerCharge = true ) :
36  CompositeCandidate( q, p4, vtx, pdgId, status, integerCharge ),
37  name_ (name), roles_(roles) { }
40  const role_collection & roles,
41  const Candidate & p );
42 
44  virtual ~NamedCompositeCandidate();
46  virtual NamedCompositeCandidate * clone() const;
47  // get name
48  std::string name() const { return name_; }
49  // set name
50  void setName( std::string n ) { name_ = n; }
51  // get roles
53  // set roles
55  // Get candidate based on role
56  virtual Candidate * daughter(const std::string& s );
57  virtual const Candidate * daughter(const std::string& s ) const;
58  // Get candidate based on index
60  virtual const Candidate * daughter( size_type i ) const { return CompositeCandidate::daughter(i); }
61  // Add daughters
62  void addDaughter( const Candidate &, const std::string&s );
63  void addDaughter( std::auto_ptr<Candidate>, const std::string& s );
64  // Clear daughters and roles
66  void clearRoles() { roles_.clear(); }
67  // Apply the roles to the objects
68  void applyRoles();
69  private:
72  };
73 
74 }
75 
76 #endif
int Charge
electric charge type
Definition: Candidate.h:39
int i
Definition: DBlmapReader.cc:9
size_t size_type
Definition: Candidate.h:34
virtual double p() const GCC11_FINAL
magnitude of momentum vector
virtual const LorentzVector & p4() const GCC11_FINAL
four-momentum Lorentz vector
virtual int pdgId() const GCC11_FINAL
PDG identifier.
NamedCompositeCandidate(std::string name="")
default constructor
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
virtual int status() const GCC11_FINAL
status word
NamedCompositeCandidate(std::string name, const role_collection &roles)
virtual Candidate * daughter(const std::string &s)
return daughter with a specified role name
std::vector< std::string > role_collection
void clearDaughters()
clear daughters
virtual const Candidate * daughter(size_type i) const
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
virtual const Candidate * daughter(size_type) const
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:41
virtual NamedCompositeCandidate * clone() const
returns a clone of the candidate
void addDaughter(const Candidate &, const std::string &s)
math::XYZPoint Point
point in the space
Definition: Candidate.h:45
virtual ~NamedCompositeCandidate()
destructor
std::vector< std::string > role_collection
math::XYZPoint Point
point in the space
Definition: LeafCandidate.h:30
virtual Candidate * daughter(size_type i)
return daughter at a given position, i = 0, ... numberOfDaughters() - 1