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>
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
reco::CompositeRefCandidateT::daughters
D daughters
collection of references to daughters
Definition: CompositeRefCandidateT.h:22
mps_fire.i
i
Definition: mps_fire.py:355
reco::CompositeRefCandidateT::numberOfDaughters
size_t numberOfDaughters() const override
number of daughters
CompositeRefCandidateT< D >
reco::LeafCandidate::Point
math::XYZPoint Point
point in the space
Definition: LeafCandidate.h:27
reco::CompositeRefCandidateT::CompositeRefCandidateT
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
Definition: CompositeRefCandidateT.h:36
reco::LeafCandidate::status
int status() const final
status word
Definition: LeafCandidate.h:180
reco::CompositeRefCandidateT::daughterRef
daughters::value_type daughterRef(size_type i) const
reference to daughter at given position
Definition: CompositeRefCandidateT.h:69
reco::CompositeRefCandidateT::mother
const Candidate * mother(size_type=0) const override
return mother at a given position, i = 0, ... numberOfMothers() - 1 (read only mode)
reco::Candidate::PolarLorentzVector
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: Candidate.h:38
reco::CompositeRefCandidateT::addMother
void addMother(const typename mothers::value_type &)
add a daughter via a reference
reco::CompositeRefCandidateT::mothers
D mothers
collection of references to daughters
Definition: CompositeRefCandidateT.h:24
data-class-funcs.q
q
Definition: data-class-funcs.py:169
reco::Candidate::Charge
int Charge
electric charge type
Definition: Candidate.h:34
reco::CompositeRefCandidateT::numberOfMothers
size_t numberOfMothers() const override
number of mothers
edm::RefVector< GenParticleCollection >
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
watchdog.const
const
Definition: watchdog.py:83
reco::CompositeRefCandidateT::motherRefVector
const mothers & motherRefVector() const
references to mothers
Definition: CompositeRefCandidateT.h:75
reco::CompositeRefCandidateT
Definition: CompositeRefCandidateT.h:19
edm::OwnVector::value_type
T value_type
Definition: OwnVector.h:34
reco::CompositeRefCandidateT::dau
daughters dau
collection of references to daughters
Definition: CompositeRefCandidateT.h:85
LeafCandidate.h
CMS_CLASS_VERSION
#define CMS_CLASS_VERSION(_version_)
Definition: CMS_CLASS_VERSION.h:30
badGlobalMuonTaggersAOD_cff.vtx
vtx
Definition: badGlobalMuonTaggersAOD_cff.py:5
reco::CompositeRefCandidateT::~CompositeRefCandidateT
~CompositeRefCandidateT() override
destructor
reco::CompositeRefCandidateT::clearMothers
void clearMothers()
clear mother references
Definition: CompositeRefCandidateT.h:67
Point
Structure Point Contains parameters of Gaussian fits to DMRs.
Definition: DMRtrends.cc:57
reco::CompositeRefCandidateT::resetDaughters
void resetDaughters(const edm::ProductID &id)
set daughters product ID
Definition: CompositeRefCandidateT.h:77
reco::LeafCandidate::pdgId
int pdgId() const final
PDG identifier.
Definition: LeafCandidate.h:176
cand
Definition: decayParser.h:34
reco::LeafCandidate::p4
const LorentzVector & p4() const final
four-momentum Lorentz vector
Definition: LeafCandidate.h:114
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition: JetExtendedAssociation.h:30
svgfig.template
def template(fileName, svg, replaceme="REPLACEME")
Definition: svgfig.py:521
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
reco::CompositeRefCandidateT::resetMothers
void resetMothers(const edm::ProductID &id)
set mother product ID
Definition: CompositeRefCandidateT.h:79
reco::Candidate
Definition: Candidate.h:27
reco::CompositeRefCandidateT::overlap
bool overlap(const Candidate &) const override
check overlap with another candidate
funct::D
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:141
CMS_CLASS_VERSION.h
reco::CompositeRefCandidateT::clone
CompositeRefCandidateT< D > * clone() const override
returns a clone of the candidate
Exception
Definition: hltDiff.cc:246
reco::CompositeRefCandidateT::CompositeRefCandidateT
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
Definition: CompositeRefCandidateT.h:28
reco::CompositeRefCandidateT::daughterRefVector
const daughters & daughterRefVector() const
references to daughtes
Definition: CompositeRefCandidateT.h:71
reco::CompositeRefCandidateT::motherRef
daughters::value_type motherRef(size_type i=0) const
reference to mother at given position
Definition: CompositeRefCandidateT.h:73
reco::CompositeRefCandidateT::clearDaughters
void clearDaughters()
clear daughter references
Definition: CompositeRefCandidateT.h:65
reco::Candidate::Candidate
Candidate()
default constructor
Definition: Candidate.h:53
reco::CompositeRefCandidateT::daughter
const Candidate * daughter(size_type) const override
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode)
reco::CompositeRefCandidateT::addDaughter
void addDaughter(const typename daughters::value_type &)
add a daughter via a reference
reco::LeafCandidate
Definition: LeafCandidate.h:16
reco::CompositeRefCandidateT::mom
daughters mom
collection of references to mothers
Definition: CompositeRefCandidateT.h:87
reco::Candidate::LorentzVector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:36
reco::Candidate::size_type
size_t size_type
Definition: Candidate.h:29
reco::CompositeRefCandidateT::CompositeRefCandidateT
CompositeRefCandidateT()
default constructor
Definition: CompositeRefCandidateT.h:26
edm::ProductID
Definition: ProductID.h:27
edm::OwnVector
Definition: OwnVector.h:24
reco::CompositeRefCandidateT::CompositeRefCandidateT
CompositeRefCandidateT(const LeafCandidate &c)
constructor from a particle
Definition: CompositeRefCandidateT.h:44