CMS 3D CMS Logo

CompositeCandidate.h
Go to the documentation of this file.
1 #ifndef Candidate_CompositeCandidate_h
2 #define Candidate_CompositeCandidate_h
4 #include <memory>
16 #include <string>
17 #include <vector>
18 
19 namespace reco {
20 
22  public:
25  typedef std::vector<std::string> role_collection;
29  template<typename P4>
30  CompositeCandidate( Charge q, const P4 & p4, const Point & vtx = Point( 0, 0, 0 ),
31  int pdgId = 0, int status = 0, bool integerCharge = true,
32  std::string name="") :
33  LeafCandidate( q, p4, vtx, pdgId, status, integerCharge ), name_(name) { }
35  explicit CompositeCandidate( const Candidate & p, const std::string& name="" );
37  explicit CompositeCandidate( const Candidate & p, const std::string& name, role_collection const & roles );
39  virtual ~CompositeCandidate();
41  std::string name() const { return name_;}
43  void setName(std::string name) { name_ = name;}
45  role_collection const & roles() const { return roles_; }
47  void setRoles( const role_collection & roles ) { roles_.clear(); roles_ = roles; }
49  virtual CompositeCandidate * clone() const;
51  virtual size_type numberOfDaughters() const;
53  virtual const Candidate * daughter( size_type ) const;
55  virtual Candidate * daughter( size_type );
56  // Get candidate based on role
57  virtual Candidate * daughter(const std::string& s );
58  virtual const Candidate * daughter(const std::string& s ) const;
60  void addDaughter( const Candidate &, const std::string& s="" );
62  void addDaughter( std::unique_ptr<Candidate>, const std::string& s="" );
64  void clearDaughters() { dau.clear(); }
65  // clear roles
66  void clearRoles() { roles_.clear(); }
67  // Apply the roles to the objects
68  void applyRoles();
70  virtual size_type numberOfMothers() const;
72  virtual const Candidate * mother( size_type i = 0 ) const;
73 
74  private:
76  daughters dau;
78  virtual bool overlap( const Candidate & ) const;
82  role_collection roles_;
83  };
84 
85 }
86 
87 #endif
int Charge
electric charge type
Definition: Candidate.h:35
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:30
role_collection const & roles() const
get the roles
role_collection roles_
candidate roles
void setRoles(const role_collection &roles)
set the roles
virtual int status() const final
status word
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 pdgId() const final
PDG identifier.
void clear()
Definition: OwnVector.h:445
CompositeCandidate(std::string name="")
default constructor
virtual double p() const final
magnitude of momentum vector
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
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) ...
fixed size matrix
math::XYZPoint Point
point in the space
Definition: Candidate.h:41
daughters dau
collection of daughters
virtual const LorentzVector & p4() const final
four-momentum Lorentz vector
Definition: LeafCandidate.h:99
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
math::XYZPoint Point
point in the space
Definition: LeafCandidate.h:27