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>
31  const P4& p4,
32  const Point& vtx = Point(0, 0, 0),
33  int pdgId = 0,
34  int status = 0,
35  bool integerCharge = true,
36  std::string name = "")
37  : LeafCandidate(q, p4, vtx, pdgId, status, integerCharge), name_(name) {}
39  explicit CompositeCandidate(const Candidate& p, const std::string& name = "");
41  explicit CompositeCandidate(const Candidate& p, const std::string& name, role_collection const& roles);
43  ~CompositeCandidate() override;
45  std::string name() const { return name_; }
49  role_collection const& roles() const { return roles_; }
52  roles_.clear();
53  roles_ = roles;
54  }
56  CompositeCandidate* clone() const override;
58  size_type numberOfDaughters() const override;
60  const Candidate* daughter(size_type) const override;
62  Candidate* daughter(size_type) override;
63  // Get candidate based on role
64  Candidate* daughter(const std::string& s) override;
65  const Candidate* daughter(const std::string& s) const override;
67  void addDaughter(const Candidate&, const std::string& s = "");
69  void addDaughter(std::unique_ptr<Candidate>, const std::string& s = "");
71  void clearDaughters() { dau.clear(); }
72  // clear roles
73  void clearRoles() { roles_.clear(); }
74  // Apply the roles to the objects
75  void applyRoles();
77  size_type numberOfMothers() const override;
79  const Candidate* mother(size_type i = 0) const override;
80 
81  private:
85  bool overlap(const Candidate&) const override;
90  };
91 
92 } // namespace reco
93 
94 #endif
reco::CompositeCandidate::~CompositeCandidate
~CompositeCandidate() override
destructor
Definition: CompositeCandidate.cc:26
reco::CompositeCandidate::role_collection
std::vector< std::string > role_collection
Definition: CompositeCandidate.h:25
mps_fire.i
i
Definition: mps_fire.py:428
reco::LeafCandidate::Point
math::XYZPoint Point
point in the space
Definition: LeafCandidate.h:27
reco::LeafCandidate::status
int status() const final
status word
Definition: LeafCandidate.h:180
reco::CompositeCandidate::roles_
role_collection roles_
candidate roles
Definition: CompositeCandidate.h:89
reco::Candidate::Charge
int Charge
electric charge type
Definition: Candidate.h:34
reco::CompositeCandidate::name_
std::string name_
candidate name
Definition: CompositeCandidate.h:87
reco::CompositeCandidate::setRoles
void setRoles(const role_collection &roles)
set the roles
Definition: CompositeCandidate.h:51
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:46
reco::CompositeCandidate::mother
const Candidate * mother(size_type i=0) const override
return pointer to mother
Definition: CompositeCandidate.cc:39
reco::CompositeCandidate::numberOfMothers
size_type numberOfMothers() const override
number of mothers (zero or one in most of but not all the cases)
Definition: CompositeCandidate.cc:43
alignCSCRings.s
s
Definition: alignCSCRings.py:92
reco::CompositeCandidate::overlap
bool overlap(const Candidate &) const override
check overlap with another daughter
Definition: CompositeCandidate.cc:45
reco::CompositeCandidate::daughters
CandidateCollection daughters
collection of daughters
Definition: CompositeCandidate.h:24
LeafCandidate.h
reco::CompositeCandidate::name
std::string name() const
get the name of the candidate
Definition: CompositeCandidate.h:45
reco::CompositeCandidate::roles
role_collection const & roles() const
get the roles
Definition: CompositeCandidate.h:49
reco::CompositeCandidate::applyRoles
void applyRoles()
Definition: CompositeCandidate.cc:49
reco::CompositeCandidate::addDaughter
void addDaughter(const Candidate &, const std::string &s="")
add a clone of the passed candidate as daughter
Definition: CompositeCandidate.cc:108
reco::CompositeCandidate::clearRoles
void clearRoles()
Definition: CompositeCandidate.h:73
CompositeCandidateFwd.h
Point
Structure Point Contains parameters of Gaussian fits to DMRs.
Definition: DMRtrends.cc:57
reco::CompositeCandidate::clone
CompositeCandidate * clone() const override
returns a clone of the candidate
Definition: CompositeCandidate.cc:28
reco::CompositeCandidate::setName
void setName(std::string name)
set the name of the candidate
Definition: CompositeCandidate.h:47
reco::LeafCandidate::pdgId
int pdgId() const final
PDG identifier.
Definition: LeafCandidate.h:176
reco::LeafCandidate::p4
const LorentzVector & p4() const final
four-momentum Lorentz vector
Definition: LeafCandidate.h:114
reco::CompositeCandidate::CompositeCandidate
CompositeCandidate(std::string name="")
default constructor
Definition: CompositeCandidate.h:27
reco::CompositeCandidate::CompositeCandidate
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
Definition: CompositeCandidate.h:30
submitPVResolutionJobs.q
q
Definition: submitPVResolutionJobs.py:84
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
reco::Candidate
Definition: Candidate.h:27
reco::CompositeCandidate::numberOfDaughters
size_type numberOfDaughters() const override
number of daughters
Definition: CompositeCandidate.cc:41
reco::CompositeCandidate::dau
daughters dau
collection of daughters
Definition: CompositeCandidate.h:83
extraflags_cff.vtx
vtx
Definition: extraflags_cff.py:19
reco::CompositeCandidate::clearDaughters
void clearDaughters()
clear daughters
Definition: CompositeCandidate.h:71
reco::LeafCandidate::p
double p() const final
magnitude of momentum vector
Definition: LeafCandidate.h:123
reco::LeafCandidate
Definition: LeafCandidate.h:16
reco::CompositeCandidate::daughter
const Candidate * daughter(size_type) const override
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode)
Definition: CompositeCandidate.cc:30
edm::OwnVector::clear
void clear()
Definition: OwnVector.h:481
reco::Candidate::size_type
size_t size_type
Definition: Candidate.h:29
reco::CompositeCandidate
Definition: CompositeCandidate.h:21
edm::OwnVector
Definition: OwnVector.h:24