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>
18 #include <string>
19 #include <map>
20 
21 namespace reco {
22 
24  public:
25  typedef std::vector<std::string> role_collection;
26 
30  const role_collection & roles ) :
31  CompositeCandidate(), name_(name), roles_(roles) { }
34  const role_collection & roles,
35  Charge q, const LorentzVector & p4, const Point & vtx = Point( 0, 0, 0 ),
36  int pdgId = 0, int status = 0, bool integerCharge = true ) :
37  CompositeCandidate( q, p4, vtx, pdgId, status, integerCharge ),
38  name_ (name), roles_(roles) { }
40  NamedCompositeCandidate( std::string name,
41  const role_collection & roles,
42  const Candidate & p );
43 
45  virtual ~NamedCompositeCandidate();
47  virtual NamedCompositeCandidate * clone() const;
48  // get name
49  std::string name() const { return name_; }
50  // set name
51  void setName( std::string n ) { name_ = n; }
52  // get roles
54  // set roles
56  // Get candidate based on role
57  virtual Candidate * daughter(const std::string& s );
58  virtual const Candidate * daughter(const std::string& s ) const;
59  // Get candidate based on index
61  virtual const Candidate * daughter( size_type i ) const { return CompositeCandidate::daughter(i); }
62  // Add daughters
63  void addDaughter( const Candidate &, const std::string&s );
64  void addDaughter( std::auto_ptr<Candidate>, const std::string& s );
65  // Clear daughters and roles
67  void clearRoles() { roles_.clear(); }
68  // Apply the roles to the objects
69  void applyRoles();
70  private:
71  std::string name_;
73  };
74 
75 }
76 
77 #endif
int Charge
electric charge type
Definition: Candidate.h:36
int i
Definition: DBlmapReader.cc:9
virtual int pdgId() const
PDG identifier.
virtual double p() const
magnitude of momentum vector
size_t size_type
Definition: Candidate.h:31
virtual int status() const
status word
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
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:38
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:42
virtual ~NamedCompositeCandidate()
destructor
virtual const LorentzVector & p4() const
four-momentum Lorentz vector
std::vector< std::string > role_collection
math::XYZPoint Point
point in the space
Definition: LeafCandidate.h:29
virtual Candidate * daughter(size_type i)
return daughter at a given position, i = 0, ... numberOfDaughters() - 1