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>
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  virtual ~NamedCompositeCandidate();
45  virtual NamedCompositeCandidate * clone() const;
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  virtual Candidate * daughter(const std::string& s );
56  virtual const Candidate * daughter(const std::string& s ) const;
57  // Get candidate based on index
59  virtual const Candidate * daughter( size_type i ) const { return CompositeCandidate::daughter(i); }
60  // Add daughters
61  void addDaughter( const Candidate &, const std::string&s );
62  void addDaughter( std::auto_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:
71  };
72 
73 }
74 
75 #endif
int Charge
electric charge type
Definition: Candidate.h:35
int i
Definition: DBlmapReader.cc:9
size_t size_type
Definition: Candidate.h:30
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 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:37
virtual NamedCompositeCandidate * clone() const
returns a clone of the candidate
virtual double p() const final
magnitude of momentum vector
virtual int pdgId() const final
PDG identifier.
void addDaughter(const Candidate &, const std::string &s)
math::XYZPoint Point
point in the space
Definition: Candidate.h:41
virtual ~NamedCompositeCandidate()
destructor
std::vector< std::string > role_collection
virtual const LorentzVector & p4() const final
four-momentum Lorentz vector
Definition: LeafCandidate.h:99
math::XYZPoint Point
point in the space
Definition: LeafCandidate.h:27
virtual Candidate * daughter(size_type i)
return daughter at a given position, i = 0, ... numberOfDaughters() - 1