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:
85  daughters dau;
87  daughters mom;
89  bool overlap(const Candidate&) const override;
90  };
91 
92  template <typename D>
93  inline void CompositeRefCandidateT<D>::addDaughter(const typename daughters::value_type& cand) {
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>
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
bool overlap(const Candidate &) const override
check overlap with another candidate
int pdgId() const final
PDG identifier.
const Candidate * daughter(size_type) const override
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
int Charge
electric charge type
Definition: Candidate.h:35
daughters::value_type daughterRef(size_type i) const
reference to daughter at given position
CompositeRefCandidateT(const LeafCandidate &c)
constructor from a particle
size_t size_type
Definition: Candidate.h:30
daughters mom
collection of references to mothers
size_t numberOfMothers() const override
number of mothers
const daughters & daughterRefVector() const
references to daughtes
#define CMS_CLASS_VERSION(_version_)
void clearDaughters()
clear daughter references
void addDaughter(const typename daughters::value_type &)
add a daughter via a reference
void resetDaughters(const edm::ProductID &id)
set daughters product ID
void push_back(D *&d)
Definition: OwnVector.h:326
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
const LorentzVector & p4() const final
four-momentum Lorentz vector
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
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:141
size_t numberOfDaughters() const override
number of daughters
~CompositeRefCandidateT() override
destructor
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
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
int status() const final
status word
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 * mother(size_type=0) const override
return mother at a given position, i = 0, ... numberOfMothers() - 1 (read only mode) ...
CompositeRefCandidateT< D > * clone() const override
returns a clone of the candidate
math::XYZPoint Point
point in the space
Definition: LeafCandidate.h:27
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: Candidate.h:39