CMS 3D CMS Logo

LeafRefCandidateT.h
Go to the documentation of this file.
1 #ifndef Candidate_LeafRefCandidateT_h
2 #define Candidate_LeafRefCandidateT_h
3 
14 
15 namespace reco {
16 
18  public:
22  typedef int Charge;
31 
32  typedef unsigned int index;
33 
36  // constructor from T
37  template <class REF>
38  LeafRefCandidateT(const REF& c, float m)
39  : LeafCandidate(c->charge(), PolarLorentzVector(c->pt(), c->eta(), c->phi(), m), c->vertex()),
40  ref_(c.refCore(), c.key()) {}
42  ~LeafRefCandidateT() override {}
43 
44  protected:
45  // get the ref (better be the correct ref!)
46  template <typename REF>
47  REF getRef() const {
48  return REF(ref_.toRefCore(), ref_.index());
49  }
50 
51  public:
53  size_t numberOfDaughters() const final { return 0; }
55  const Candidate* daughter(size_type) const final { return nullptr; }
57  size_t numberOfMothers() const final { return 0; }
59  const Candidate* mother(size_type) const final { return nullptr; }
61  Candidate* daughter(size_type) final { return nullptr; }
63  Candidate* daughter(const std::string& s) final { return nullptr; }
65  const Candidate* daughter(const std::string& s) const final { return nullptr; }
68  size_t numberOfSourceCandidatePtrs() const final { return 0; }
72  static const CandidatePtr dummyPtr;
73  return dummyPtr;
74  }
75 
77  bool hasMasterClone() const final { return false; }
81  static const CandidateBaseRef dummyRef;
82  return dummyRef;
83  }
86  bool hasMasterClonePtr() const final { return false; }
90  static const CandidatePtr dummyPtr;
91  return dummyPtr;
92  }
93 
95  template <typename Ref>
96  Ref masterRef() const {
97  Ref dummyRef;
98  return dummyRef;
99  }
101 
102  template <typename C>
103  C get() const {
104  if (hasMasterClone())
105  return masterClone()->template get<C>();
106  else
107  return reco::get<C>(*this);
108  }
110  template <typename C, typename Tag>
111  C get() const {
112  if (hasMasterClone())
113  return masterClone()->template get<C, Tag>();
114  else
115  return reco::get<C, Tag>(*this);
116  }
118  template <typename C>
119  C get(size_type i) const {
120  if (hasMasterClone())
121  return masterClone()->template get<C>(i);
122  else
123  return reco::get<C>(*this, i);
124  }
126  template <typename C, typename Tag>
127  C get(size_type i) const {
128  if (hasMasterClone())
129  return masterClone()->template get<C, Tag>(i);
130  else
131  return reco::get<C, Tag>(*this, i);
132  }
134  template <typename C>
135  size_type numberOf() const {
136  if (hasMasterClone())
137  return masterClone()->template numberOf<C>();
138  else
139  return reco::numberOf<C>(*this);
140  }
142  template <typename C, typename Tag>
143  size_type numberOf() const {
144  if (hasMasterClone())
145  return masterClone()->template numberOf<C, Tag>();
146  else
147  return reco::numberOf<C, Tag>(*this);
148  }
149 
150  bool isElectron() const final { return false; }
151  bool isMuon() const final { return false; }
152  bool isStandAloneMuon() const final { return false; }
153  bool isGlobalMuon() const final { return false; }
154  bool isTrackerMuon() const final { return false; }
155  bool isCaloMuon() const final { return false; }
156  bool isPhoton() const final { return false; }
157  bool isConvertedPhoton() const final { return false; }
158  bool isJet() const final { return false; }
159 
161 
162  protected:
164  bool overlap(const Candidate&) const override;
165  virtual bool overlap(const LeafRefCandidateT&) const;
166  template <typename, typename, typename>
167  friend struct component;
168  friend class ::OverlapChecker;
169  friend class ShallowCloneCandidate;
171 
172  protected:
173  edm::RefCoreWithIndex ref_;
174 
175  private:
179  /*
180  virtual void setCharge( Charge q ) final {}
181  virtual void setThreeCharge( Charge qx3 ) final {}
182  virtual void setP4( const LorentzVector & p4 ) final {}
183  virtual void setP4( const PolarLorentzVector & p4 ) final {}
184  virtual void setPz( double pz ) final {}
185  virtual void setVertex( const Point & vertex ) final {}
186  virtual void setPdgId( int pdgId ) final {}
187  virtual void setStatus( int status ) final {}
188  virtual void setLongLived() final {}
189  virtual void setMassConstraint() final {}
190 
191  virtual double vertexChi2() const final { return 0.; }
192  virtual double vertexNdof() const final { return 0.; }
193  virtual double vertexNormalizedChi2() const final { return 0.; }
194  virtual double vertexCovariance(int i, int j) const final { return 0.; }
195  virtual void fillVertexCovariance(CovarianceMatrix & v) const final {}
196  */
197  };
198 
199  inline bool LeafRefCandidateT::overlap(const Candidate& o) const {
200  return p4() == o.p4() && vertex() == o.vertex() && charge() == o.charge();
201  }
202 
203  inline bool LeafRefCandidateT::overlap(const LeafRefCandidateT& o) const {
204  return (ref_.id() == o.ref_.id()) & (ref_.index() == o.ref_.index());
205  }
206 
207 } // namespace reco
208 
209 #endif
reco::LeafRefCandidateT::numberOfDaughters
size_t numberOfDaughters() const final
number of daughters
Definition: LeafRefCandidateT.h:53
OverlapChecker
Definition: OverlapChecker.h:17
mps_fire.i
i
Definition: mps_fire.py:428
reco::LeafRefCandidateT::LorentzVector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: LeafRefCandidateT.h:24
reco::LeafRefCandidateT::ref_
edm::RefCoreWithIndex ref_
Definition: LeafRefCandidateT.h:173
reco::LeafRefCandidateT::numberOfMothers
size_t numberOfMothers() const final
number of mothers
Definition: LeafRefCandidateT.h:57
edm::RefCoreWithIndex::index
unsigned int index() const
Definition: RefCoreWithIndex.h:78
reco::LeafRefCandidateT
Definition: LeafRefCandidateT.h:17
reco::LeafRefCandidateT::Charge
int Charge
electric charge type
Definition: LeafRefCandidateT.h:22
edm
HLT enums.
Definition: AlignableModifier.h:19
reco::Candidate::PolarLorentzVector
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: Candidate.h:38
reco::LeafRefCandidateT::index
unsigned int index
Definition: LeafRefCandidateT.h:32
reco::LeafRefCandidateT::Point
math::XYZPoint Point
point in the space
Definition: LeafRefCandidateT.h:28
RefCoreWithIndex.h
reco::LeafRefCandidateT::LeafRefCandidateT
LeafRefCandidateT(const REF &c, float m)
Definition: LeafRefCandidateT.h:38
reco::LeafRefCandidateT::isStandAloneMuon
bool isStandAloneMuon() const final
Definition: LeafRefCandidateT.h:152
reco::LeafCandidate::pt
double pt() const final
transverse momentum
Definition: LeafCandidate.h:146
reco::LeafRefCandidateT::overlap
bool overlap(const Candidate &) const override
check overlap with another Candidate
Definition: LeafRefCandidateT.h:199
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
reco::LeafRefCandidateT::numberOf
size_type numberOf() const
number of components
Definition: LeafRefCandidateT.h:143
reco::LeafRefCandidateT::numberOfSourceCandidatePtrs
size_t numberOfSourceCandidatePtrs() const final
Definition: LeafRefCandidateT.h:68
reco::LeafRefCandidateT::isPhoton
bool isPhoton() const final
Definition: LeafRefCandidateT.h:156
watchdog.const
const
Definition: watchdog.py:83
reco::LeafRefCandidateT::daughter
const Candidate * daughter(const std::string &s) const final
return daughter with a specified role name
Definition: LeafRefCandidateT.h:65
reco::LeafRefCandidateT::daughter
Candidate * daughter(size_type) final
return daughter at a given position (throws an exception)
Definition: LeafRefCandidateT.h:61
EcalTangentSkim_cfg.o
o
Definition: EcalTangentSkim_cfg.py:42
reco::LeafRefCandidateT::get
C get(size_type i) const
get a component
Definition: LeafRefCandidateT.h:119
alignCSCRings.s
s
Definition: alignCSCRings.py:92
reco::LeafRefCandidateT::get
C get() const
get a component
Definition: LeafRefCandidateT.h:111
reco::LeafRefCandidateT::getRef
REF getRef() const
Definition: LeafRefCandidateT.h:47
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
LeafCandidate.h
CMS_CLASS_VERSION
#define CMS_CLASS_VERSION(_version_)
Definition: CMS_CLASS_VERSION.h:30
reco::LeafRefCandidateT::isCaloMuon
bool isCaloMuon() const final
Definition: LeafRefCandidateT.h:155
reco::LeafRefCandidateT::LeafRefCandidateT
LeafRefCandidateT()
default constructor
Definition: LeafRefCandidateT.h:35
reco::LeafRefCandidateT::mother
const Candidate * mother(size_type) const final
return mother at a given position (throws an exception)
Definition: LeafRefCandidateT.h:59
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
math::XYZPoint
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
reco::LeafRefCandidateT::isTrackerMuon
bool isTrackerMuon() const final
Definition: LeafRefCandidateT.h:154
reco::LeafRefCandidateT::masterClone
const CandidateBaseRef & masterClone() const final
Definition: LeafRefCandidateT.h:80
reco::LeafCandidate::eta
double eta() const final
momentum pseudorapidity
Definition: LeafCandidate.h:152
math::XYZVector
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
reco::LeafRefCandidateT::daughters
CandidateCollection daughters
collection of daughter candidates
Definition: LeafRefCandidateT.h:20
reco::LeafRefCandidateT::get
C get() const
get a component
Definition: LeafRefCandidateT.h:103
reco::LeafCandidate::p4
const LorentzVector & p4() const final
four-momentum Lorentz vector
Definition: LeafCandidate.h:114
reco::LeafRefCandidateT::isConvertedPhoton
bool isConvertedPhoton() const final
Definition: LeafRefCandidateT.h:157
reco::LeafCandidate::charge
int charge() const final
electric charge
Definition: LeafCandidate.h:106
reco::LeafRefCandidateT::isJet
bool isJet() const final
Definition: LeafRefCandidateT.h:158
reco::LeafRefCandidateT::sourceCandidatePtr
CandidatePtr sourceCandidatePtr(size_type i) const final
Definition: LeafRefCandidateT.h:71
svgfig.template
def template(fileName, svg, replaceme="REPLACEME")
Definition: svgfig.py:521
reco::LeafRefCandidateT::numberOf
size_type numberOf() const
number of components
Definition: LeafRefCandidateT.h:135
reco::LeafRefCandidateT::daughter
const Candidate * daughter(size_type) const final
return daughter at a given position (throws an exception)
Definition: LeafRefCandidateT.h:55
reco::LeafCandidate::vertex
const Point & vertex() const override
vertex position (overwritten by PF...)
Definition: LeafCandidate.h:165
edm::Ptr< Candidate >
reco::LeafRefCandidateT::~LeafRefCandidateT
~LeafRefCandidateT() override
destructor
Definition: LeafRefCandidateT.h:42
reco::Candidate
Definition: Candidate.h:27
reco::LeafRefCandidateT::PolarLorentzVector
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: LeafRefCandidateT.h:26
reco::LeafRefCandidateT::daughter
Candidate * daughter(const std::string &s) final
return daughter with a specified role name
Definition: LeafRefCandidateT.h:63
reco::LeafRefCandidateT::isMuon
bool isMuon() const final
Definition: LeafRefCandidateT.h:151
reco::LeafCandidate::phi
double phi() const final
momentum azimuthal angle
Definition: LeafCandidate.h:148
gen::C
C
Definition: PomwigHadronizer.cc:78
math::XYZTLorentzVector
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
reco::JetExtendedAssociation::Ref
edm::Ref< Container > Ref
Definition: JetExtendedAssociation.h:32
reco::LeafRefCandidateT::hasMasterClonePtr
bool hasMasterClonePtr() const final
Definition: LeafRefCandidateT.h:86
edm::RefToBase< Candidate >
reco::LeafRefCandidateT::get
C get(size_type i) const
get a component
Definition: LeafRefCandidateT.h:127
edm::RefCoreWithIndex::toRefCore
RefCore const & toRefCore() const
Definition: RefCoreWithIndex.h:95
reco::LeafRefCandidateT::hasMasterClone
bool hasMasterClone() const final
This only happens if the concrete Candidate type is ShallowCloneCandidate.
Definition: LeafRefCandidateT.h:77
reco::ShallowCloneCandidate
Definition: ShallowCloneCandidate.h:15
reco::LeafCandidate
Definition: LeafCandidate.h:16
math::PtEtaPhiMLorentzVector
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
reco::LeafRefCandidateT::isGlobalMuon
bool isGlobalMuon() const final
Definition: LeafRefCandidateT.h:153
edm::RefCoreWithIndex::id
ProductID id() const
Definition: RefCoreWithIndex.h:59
reco::ShallowClonePtrCandidate
Definition: ShallowClonePtrCandidate.h:15
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:46
reco::LeafRefCandidateT::isElectron
bool isElectron() const final
Definition: LeafRefCandidateT.h:150
crabWrapper.key
key
Definition: crabWrapper.py:19
reco::component
Definition: component.h:57
reco::LeafRefCandidateT::Vector
math::XYZVector Vector
point in the space
Definition: LeafRefCandidateT.h:30
reco::Candidate::size_type
size_t size_type
Definition: Candidate.h:29
edm::OwnVector
Definition: OwnVector.h:24
reco::LeafRefCandidateT::masterRef
Ref masterRef() const
cast master clone reference to a concrete type
Definition: LeafRefCandidateT.h:96
reco::LeafRefCandidateT::masterClonePtr
const CandidatePtr & masterClonePtr() const final
Definition: LeafRefCandidateT.h:89