CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CompositeCandidate.h
Go to the documentation of this file.
1 #ifndef Candidate_CompositeCandidate_h
2 #define Candidate_CompositeCandidate_h
4 #include <memory>
18 #include <string>
19 #include <vector>
20 
21 namespace reco {
22 
24  public:
27  typedef std::vector<std::string> role_collection;
29  CompositeCandidate(std::string name="") : LeafCandidate(), name_(name) { }
31  CompositeCandidate( Charge q, const LorentzVector & p4, const Point & vtx = Point( 0, 0, 0 ),
32  int pdgId = 0, int status = 0, bool integerCharge = true,
33  std::string name="") :
34  LeafCandidate( q, p4, vtx, pdgId, status, integerCharge ), name_(name) { }
36  CompositeCandidate( Charge q, const PolarLorentzVector & p4, const Point & vtx = Point( 0, 0, 0 ),
37  int pdgId = 0, int status = 0, bool integerCharge = true,
38  std::string name="" ) :
39  LeafCandidate( q, p4, vtx, pdgId, status, integerCharge ), name_(name) { }
41  explicit CompositeCandidate( const Candidate & p, const std::string& name="" );
43  explicit CompositeCandidate( const Candidate & p, const std::string& name, role_collection const & roles );
45  virtual ~CompositeCandidate();
47  std::string name() const { return name_;}
49  void setName(std::string name) { name_ = name;}
51  role_collection const & roles() const { return roles_; }
53  void setRoles( const role_collection & roles ) { roles_.clear(); roles_ = roles; }
55  virtual CompositeCandidate * clone() const;
57  virtual const_iterator begin() const;
59  virtual const_iterator end() const;
61  virtual iterator begin();
63  virtual iterator end();
65  virtual size_type numberOfDaughters() const;
67  virtual const Candidate * daughter( size_type ) const;
69  virtual Candidate * daughter( size_type );
70  // Get candidate based on role
71  virtual Candidate * daughter(const std::string& s );
72  virtual const Candidate * daughter(const std::string& s ) const;
74  void addDaughter( const Candidate &, const std::string& s="" );
76  void addDaughter( std::auto_ptr<Candidate>, const std::string& s="" );
78  void clearDaughters() { dau.clear(); }
79  // clear roles
80  void clearRoles() { roles_.clear(); }
81  // Apply the roles to the objects
82  void applyRoles();
84  virtual size_type numberOfMothers() const;
86  virtual const Candidate * mother( size_type i = 0 ) const;
87 
88  private:
89  // const iterator implementation
91  // iterator implementation
96  virtual bool overlap( const Candidate & ) const;
98  std::string name_;
101  };
102 
103 }
104 
105 #endif
CompositeCandidate(Charge q, const PolarLorentzVector &p4, const Point &vtx=Point(0, 0, 0), int pdgId=0, int status=0, bool integerCharge=true, std::string name="")
constructor from values
int Charge
electric charge type
Definition: Candidate.h:37
int i
Definition: DBlmapReader.cc:9
virtual int pdgId() const
PDG identifier.
virtual double p() const
magnitude of momentum vector
virtual size_type numberOfMothers() const
number of mothers (zero or one in most of but not all the cases)
std::string name_
candidate name
CompositeCandidate(Charge q, const LorentzVector &p4, const Point &vtx=Point(0, 0, 0), int pdgId=0, int status=0, bool integerCharge=true, std::string name="")
constructor from values
size_t size_type
Definition: Candidate.h:32
role_collection const & roles() const
get the roles
candidate::const_iterator const_iterator
Definition: Candidate.h:33
virtual int status() const
status word
role_collection roles_
candidate roles
virtual const_iterator end() const
last daughter const_iterator
void setRoles(const role_collection &roles)
set the roles
candidate::const_iterator_imp_specific< daughters > const_iterator_imp_specific
CandidateCollection daughters
collection of daughters
virtual size_type numberOfDaughters() const
number of daughters
virtual bool overlap(const Candidate &) const
check overlap with another daughter
virtual ~CompositeCandidate()
destructor
virtual const_iterator begin() const
first daughter const_iterator
void clear()
Definition: OwnVector.h:397
CompositeCandidate(std::string name="")
default constructor
void addDaughter(const Candidate &, const std::string &s="")
add a clone of the passed candidate as daughter
candidate::iterator iterator
Definition: Candidate.h:34
void clearDaughters()
clear daughters
void setName(std::string name)
set the name of the candidate
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:39
math::XYZPoint Point
point in the space
Definition: Candidate.h:43
daughters dau
collection of daughters
string s
Definition: asciidump.py:422
virtual CompositeCandidate * clone() const
returns a clone of the candidate
std::string name() const
get the name of the candidate
virtual const LorentzVector & p4() const
four-momentum Lorentz vector
std::vector< std::string > role_collection
virtual const Candidate * mother(size_type i=0) const
return pointer to mother
candidate::iterator_imp_specific< daughters > iterator_imp_specific
math::XYZPoint Point
point in the space
Definition: LeafCandidate.h:29
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: Candidate.h:41