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>
17 #include <string>
18 #include <vector>
19 
20 namespace reco {
21 
23  public:
26  typedef std::vector<std::string> role_collection;
30  template<typename P4>
31  CompositeCandidate( Charge q, const P4 & 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  explicit CompositeCandidate( const Candidate & p, const std::string& name="" );
38  explicit CompositeCandidate( const Candidate & p, const std::string& name, role_collection const & roles );
40  virtual ~CompositeCandidate();
42  std::string name() const { return name_;}
46  role_collection const & roles() const { return roles_; }
48  void setRoles( const role_collection & roles ) { roles_.clear(); roles_ = roles; }
50  virtual CompositeCandidate * clone() const;
52  virtual const_iterator begin() const;
54  virtual const_iterator end() const;
56  virtual iterator begin();
58  virtual iterator end();
60  virtual size_type numberOfDaughters() const;
62  virtual const Candidate * daughter( size_type ) const;
64  virtual Candidate * daughter( size_type );
65  // Get candidate based on role
66  virtual Candidate * daughter(const std::string& s );
67  virtual const Candidate * daughter(const std::string& s ) const;
69  void addDaughter( const Candidate &, const std::string& s="" );
71  void addDaughter( std::auto_ptr<Candidate>, const std::string& s="" );
73  void clearDaughters() { dau.clear(); }
74  // clear roles
75  void clearRoles() { roles_.clear(); }
76  // Apply the roles to the objects
77  void applyRoles();
79  virtual size_type numberOfMothers() const;
81  virtual const Candidate * mother( size_type i = 0 ) const;
82 
83  private:
84  // const iterator implementation
86  // iterator implementation
91  virtual bool overlap( const Candidate & ) const;
96  };
97 
98 }
99 
100 #endif
int Charge
electric charge type
Definition: Candidate.h:39
int i
Definition: DBlmapReader.cc:9
virtual size_type numberOfMothers() const
number of mothers (zero or one in most of but not all the cases)
std::string name_
candidate name
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
role_collection const & roles() const
get the roles
candidate::const_iterator const_iterator
Definition: Candidate.h:35
virtual int pdgId() const GCC11_FINAL
PDG identifier.
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 int status() const GCC11_FINAL
status word
virtual const_iterator begin() const
first daughter const_iterator
void clear()
Definition: OwnVector.h:370
CompositeCandidate(std::string name="")
default constructor
void addDaughter(const Candidate &, const std::string &s="")
add a clone of the passed candidate as daughter
CompositeCandidate(Charge q, const P4 &p4, const Point &vtx=Point(0, 0, 0), int pdgId=0, int status=0, bool integerCharge=true, std::string name="")
constructor from values
candidate::iterator iterator
Definition: Candidate.h:36
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::XYZPoint Point
point in the space
Definition: Candidate.h:45
daughters dau
collection of daughters
virtual CompositeCandidate * clone() const
returns a clone of the candidate
std::string name() const
get the name of the candidate
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:30