CMS 3D CMS Logo

CompositeRefCandidateT.h
Go to the documentation of this file.
1 #ifndef Candidate_CompositeRefCandidateT_h
2 #define Candidate_CompositeRefCandidateT_h
3 
15 
16 namespace reco {
17 
18  template <typename D>
20  public:
22  typedef D daughters;
24  typedef D mothers;
29  const LorentzVector& p4,
30  const Point& vtx = Point(0, 0, 0),
31  int pdgId = 0,
32  int status = 0,
33  bool integerCharge = true)
34  : LeafCandidate(q, p4, vtx, pdgId, status, integerCharge) {}
37  const PolarLorentzVector& p4,
38  const Point& vtx = Point(0, 0, 0),
39  int pdgId = 0,
40  int status = 0,
41  bool integerCharge = true)
42  : LeafCandidate(q, p4, vtx, pdgId, status, integerCharge) {}
46  ~CompositeRefCandidateT() override;
48  CompositeRefCandidateT<D>* clone() const override;
50  size_t numberOfDaughters() const override;
52  size_t numberOfMothers() const override;
54  const Candidate* daughter(size_type) const override;
55  using ::reco::LeafCandidate::daughter; // avoid hiding the base
57  const Candidate* mother(size_type = 0) const override;
59  Candidate* daughter(size_type) override;
61  void addDaughter(const typename daughters::value_type&);
63  void addMother(const typename mothers::value_type&);
65  void clearDaughters() { dau.clear(); }
67  void clearMothers() { mom.clear(); }
69  typename daughters::value_type daughterRef(size_type i) const { return dau[i]; }
71  const daughters& daughterRefVector() const { return dau; }
73  typename daughters::value_type motherRef(size_type i = 0) const { return mom[i]; }
75  const mothers& motherRefVector() const { return mom; }
77  void resetDaughters(const edm::ProductID& id) { dau = daughters(id); }
79  void resetMothers(const edm::ProductID& id) { mom = mothers(id); }
80 
82 
83  private:
89  bool overlap(const Candidate&) const override;
90  };
91 
92  template <typename D>
94  dau.push_back(cand);
95  }
96 
97  template <typename D>
99  mom.push_back(cand);
100  }
101 
102  template <typename D>
104 
105  template <typename D>
106  CompositeRefCandidateT<D>* CompositeRefCandidateT<D>::clone() const {
107  return new CompositeRefCandidateT(*this);
108  }
109 
110  template <typename D>
112  return (i < numberOfDaughters()) ? &*dau[i] : nullptr;
113  }
114 
115  template <typename D>
117  return (i < numberOfMothers()) ? &*mom[i] : nullptr;
118  }
119 
120  template <typename D>
122  return nullptr;
123  }
124 
125  template <typename D>
127  return dau.size();
128  }
129 
130  template <typename D>
132  return mom.size();
133  }
134 
135  template <typename D>
136  bool CompositeRefCandidateT<D>::overlap(const Candidate& c2) const {
137  throw cms::Exception("Error") << "can't check overlap internally for CompositeRefCanddate";
138  }
139 } // namespace reco
140 
141 #endif
int Charge
electric charge type
Definition: Candidate.h:34
const Candidate * mother(size_type=0) const override
return mother at a given position, i = 0, ... numberOfMothers() - 1 (read only mode) ...
CompositeRefCandidateT(const LeafCandidate &c)
constructor from a particle
size_t size_type
Definition: Candidate.h:29
daughters mom
collection of references to mothers
size_t numberOfDaughters() const override
number of daughters
int status() const final
status word
size_t numberOfMothers() const override
number of mothers
#define CMS_CLASS_VERSION(_version_)
const daughters & daughterRefVector() const
references to daughtes
const LorentzVector & p4() const final
four-momentum Lorentz vector
void clearDaughters()
clear daughter references
daughters::value_type daughterRef(size_type i) const
reference to daughter at given position
void addDaughter(const typename daughters::value_type &)
add a daughter via a reference
int pdgId() const final
PDG identifier.
void resetDaughters(const edm::ProductID &id)
set daughters product ID
const mothers & motherRefVector() const
references to mothers
def template(fileName, svg, replaceme="REPLACEME")
Definition: svgfig.py:521
CompositeRefCandidateT(Charge q, const PolarLorentzVector &p4, const Point &vtx=Point(0, 0, 0), int pdgId=0, int status=0, bool integerCharge=true)
constructor from values
daughters::value_type motherRef(size_type i=0) const
reference to mother at given position
void addMother(const typename mothers::value_type &)
add a daughter via a reference
bool overlap(const Candidate &) const override
check overlap with another candidate
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:141
Candidate()
default constructor
Definition: Candidate.h:53
CompositeRefCandidateT< D > * clone() const override
returns a clone of the candidate
~CompositeRefCandidateT() override
destructor
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:36
fixed size matrix
Structure Point Contains parameters of Gaussian fits to DMRs.
Definition: DMRtrends.cc:57
daughters dau
collection of references to daughters
D daughters
collection of references to daughters
CompositeRefCandidateT()
default constructor
D mothers
collection of references to daughters
void resetMothers(const edm::ProductID &id)
set mother product ID
CompositeRefCandidateT(Charge q, const LorentzVector &p4, const Point &vtx=Point(0, 0, 0), int pdgId=0, int status=0, bool integerCharge=true)
constructor from values
void clearMothers()
clear mother references
const Candidate * daughter(size_type) const override
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
math::XYZPoint Point
point in the space
Definition: LeafCandidate.h:27
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: Candidate.h:38