CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
LeafCandidate.h
Go to the documentation of this file.
1 #ifndef Candidate_LeafCandidate_h
2 #define Candidate_LeafCandidate_h
3 
12 #include "ParticleState.h"
13 
14 namespace reco {
15 
16  class LeafCandidate : public Candidate {
17  public:
21  typedef int Charge;
30 
31  typedef unsigned int index;
32 
34 
35  // constructor from candidate
36  explicit LeafCandidate(const Candidate& c) : m_state(c.charge(), c.polarP4(), c.vertex(), c.pdgId(), c.status()) {}
37 
38 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
39  template <typename... Args>
40  explicit LeafCandidate(Args&&... args) : m_state(std::forward<Args>(args)...) {}
41 
43 
44  LeafCandidate(LeafCandidate&&) = default;
45  LeafCandidate(LeafCandidate const&) = default;
47  LeafCandidate& operator=(LeafCandidate const&) = default;
48 #else
49  // for Reflex to parse... (compilation will use the above)
51  const PtEtaPhiMass& p4,
52  const Point& vtx = Point(0, 0, 0),
53  int pdgId = 0,
54  int status = 0,
55  bool integerCharge = true);
57  const LorentzVector& p4,
58  const Point& vtx = Point(0, 0, 0),
59  int pdgId = 0,
60  int status = 0,
61  bool integerCharge = true);
63  const PolarLorentzVector& p4,
64  const Point& vtx = Point(0, 0, 0),
65  int pdgId = 0,
66  int status = 0,
67  bool integerCharge = true);
69  const GlobalVector& p3,
70  float iEnergy,
71  float imass,
72  const Point& vtx = Point(0, 0, 0),
73  int pdgId = 0,
74  int status = 0,
75  bool integerCharge = true);
76 #endif
77 
78  void construct(int qx3, float pt, float eta, float phi, float mass, const Point& vtx, int pdgId, int status) {
79  m_state = ParticleState(qx3, PolarLorentzVector(pt, eta, phi, mass), vtx, pdgId, status, false);
80  }
81 
83  ~LeafCandidate() override;
85  size_t numberOfDaughters() const override;
87  const Candidate* daughter(size_type) const override;
89  size_t numberOfMothers() const override;
91  const Candidate* mother(size_type) const override;
93  Candidate* daughter(size_type) override;
95  Candidate* daughter(const std::string& s) override;
97  const Candidate* daughter(const std::string& s) const override;
100  size_t numberOfSourceCandidatePtrs() const override { return 0; }
104 
106  int charge() const final { return m_state.charge(); }
108  void setCharge(Charge q) final { m_state.setCharge(q); }
110  int threeCharge() const final { return m_state.threeCharge(); }
112  void setThreeCharge(Charge qx3) final { m_state.setThreeCharge(qx3); }
114  const LorentzVector& p4() const final { return m_state.p4(); }
116  const PolarLorentzVector& polarP4() const final { return m_state.polarP4(); }
118  Vector momentum() const final { return m_state.momentum(); }
121  Vector boostToCM() const final { return m_state.boostToCM(); }
123  double p() const final { return m_state.p(); }
125  double energy() const final { return m_state.energy(); }
127  double et() const final { return m_state.et(); }
129  double et2() const final { return m_state.et2(); }
131  double mass() const final { return m_state.mass(); }
133  double massSqr() const final { return mass() * mass(); }
134 
136  double mt() const final { return m_state.mt(); }
138  double mtSqr() const final { return m_state.mtSqr(); }
140  double px() const final { return m_state.px(); }
142  double py() const final { return m_state.py(); }
144  double pz() const final { return m_state.pz(); }
146  double pt() const final { return m_state.pt(); }
148  double phi() const final { return m_state.phi(); }
150  double theta() const final { return m_state.theta(); }
152  double eta() const final { return m_state.eta(); }
154  double rapidity() const final { return m_state.rapidity(); }
156  double y() const final { return rapidity(); }
158  void setP4(const LorentzVector& p4) final { m_state.setP4(p4); }
160  void setP4(const PolarLorentzVector& p4) final { m_state.setP4(p4); }
162  void setMass(double m) final { m_state.setMass(m); }
163  void setPz(double pz) final { m_state.setPz(pz); }
165  const Point& vertex() const override { return m_state.vertex(); }
167  double vx() const override { return m_state.vx(); }
169  double vy() const override { return m_state.vy(); }
171  double vz() const override { return m_state.vz(); }
173  void setVertex(const Point& vertex) override { m_state.setVertex(vertex); }
174 
176  int pdgId() const final { return m_state.pdgId(); }
177  // set PDG identifier
178  void setPdgId(int pdgId) final { m_state.setPdgId(pdgId); }
180  int status() const final { return m_state.status(); }
182  void setStatus(int status) final { m_state.setStatus(status); }
185  void setLongLived() final { m_state.setLongLived(); }
187  bool longLived() const final { return m_state.longLived(); }
192  bool massConstraint() const final { return m_state.massConstraint(); }
193 
195  LeafCandidate* clone() const override { return new LeafCandidate(*this); }
196 
198  double vertexChi2() const override;
205  double vertexNdof() const override;
207  double vertexNormalizedChi2() const override;
209  double vertexCovariance(int i, int j) const override;
214  return m;
215  }
217  void fillVertexCovariance(CovarianceMatrix& v) const override;
220  bool hasMasterClone() const override;
223  const CandidateBaseRef& masterClone() const override;
226  bool hasMasterClonePtr() const override;
229  const CandidatePtr& masterClonePtr() const override;
230 
232  template <typename Ref>
233  Ref masterRef() const {
234  return masterClone().template castTo<Ref>();
235  }
237 
238  template <typename T>
239  T get() const {
240  if (hasMasterClone())
241  return masterClone()->get<T>();
242  else
243  return reco::get<T>(*this);
244  }
246  template <typename T, typename Tag>
247  T get() const {
248  if (hasMasterClone())
249  return masterClone()->get<T, Tag>();
250  else
251  return reco::get<T, Tag>(*this);
252  }
254  template <typename T>
255  T get(size_type i) const {
256  if (hasMasterClone())
257  return masterClone()->get<T>(i);
258  else
259  return reco::get<T>(*this, i);
260  }
262  template <typename T, typename Tag>
263  T get(size_type i) const {
264  if (hasMasterClone())
265  return masterClone()->get<T, Tag>(i);
266  else
267  return reco::get<T, Tag>(*this, i);
268  }
270  template <typename T>
271  size_type numberOf() const {
272  if (hasMasterClone())
273  return masterClone()->numberOf<T>();
274  else
275  return reco::numberOf<T>(*this);
276  }
278  template <typename T, typename Tag>
279  size_type numberOf() const {
280  if (hasMasterClone())
281  return masterClone()->numberOf<T, Tag>();
282  else
283  return reco::numberOf<T, Tag>(*this);
284  }
285 
286  bool isElectron() const override;
287  bool isMuon() const override;
288  bool isStandAloneMuon() const override;
289  bool isGlobalMuon() const override;
290  bool isTrackerMuon() const override;
291  bool isCaloMuon() const override;
292  bool isPhoton() const override;
293  bool isConvertedPhoton() const override;
294  bool isJet() const override;
295 
296  private:
298 
299  private:
301  bool overlap(const Candidate&) const override;
302  template <typename, typename, typename>
303  friend struct component;
304  friend class ::OverlapChecker;
305  friend class ShallowCloneCandidate;
307  };
308 
309 } // namespace reco
310 
311 #endif
double rapidity() const
repidity
int Charge
electric charge type
Definition: Candidate.h:34
void fillVertexCovariance(CovarianceMatrix &v) const override
fill SMatrix
double px() const
x coordinate of momentum vector
const edm::EventSetup & c
Vector momentum() const final
spatial momentum vector
double pz() const final
z coordinate of momentum vector
const CandidatePtr & masterClonePtr() const override
bool isCaloMuon() const override
double vertexNormalizedChi2() const override
chi-squared divided by n.d.o.f.
LeafCandidate(LeafCandidate &rh)
Definition: LeafCandidate.h:42
double y() const final
rapidity
double pt() const final
transverse momentum
math::XYZVector Vector
point in the space
Definition: Candidate.h:42
int pdgId() const
PDG identifier.
void setMass(double m) final
set particle mass
size_t size_type
Definition: Candidate.h:29
double vz() const override
z coordinate of vertex position
double et2() const final
transverse energy squared (use this for cut!)
double theta() const
momentum polar angle
size_type numberOf() const
number of components
size_type numberOf() const
number of components
double pz() const
z coordinate of momentum vector
int threeCharge() const
electric charge
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: LeafCandidate.h:25
CandidateCollection daughters
collection of daughter candidates
Definition: LeafCandidate.h:19
LeafCandidate(Args &&...args)
Definition: LeafCandidate.h:40
double vy() const override
y coordinate of vertex position
CandidatePtr sourceCandidatePtr(size_type i) const override
int status() const final
status word
bool hasMasterClonePtr() const override
const Point & vertex() const override
vertex position (overwritten by PF...)
void setMassConstraint()
set mass constraint flag
bool isMuon() const override
double energy() const
energy
void setPdgId(int pdgId)
void setPz(double pz)
double mt() const final
transverse mass
ParticleState m_state
const LorentzVector & p4() const final
four-momentum Lorentz vector
bool longLived() const final
is long lived?
void setVertex(const Point &vertex) override
set vertex
double phi() const
momentum azimuthal angle
bool massConstraint() const
do mass constraint?
int pdgId() const final
PDG identifier.
const LorentzVector & p4() const
four-momentum Lorentz vector
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
void setCharge(Charge q) final
set electric charge
const Candidate * daughter(size_type) const override
return daughter at a given position (throws an exception)
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
double vertexNdof() const override
int threeCharge() const final
electric charge
double theta() const final
momentum polar angle
Vector boostToCM() const final
double px() const final
x coordinate of momentum vector
double pt() const
transverse momentum
void setP4(const PolarLorentzVector &p4) final
set 4-momentum
void setStatus(int status)
set status word
double p() const final
magnitude of momentum vector
double mt() const
transverse mass
double mass() const
mass
double massSqr() const final
mass squared
void setLongLived() final
bool longLived() const
is long lived?
bool massConstraint() const final
do mass constraint?
Ref masterRef() const
cast master clone reference to a concrete type
LeafCandidate(const Candidate &c)
Definition: LeafCandidate.h:36
bool isGlobalMuon() const override
double rapidity() const final
rapidity
const PolarLorentzVector & polarP4() const final
four-momentum Lorentz vector
bool isTrackerMuon() const override
void setVertex(const Point &vertex)
set vertex
double mtSqr() const
transverse mass squared
void setMassConstraint() final
const Candidate * mother(size_type) const override
return mother at a given position (throws an exception)
math::XYZTLorentzVector LorentzVector
bool isJet() const override
bool isStandAloneMuon() const override
Vector boostToCM() const
void setThreeCharge(Charge qx3)
set electric charge
size_type numberOf() const
number of components
Definition: Candidate.h:253
double et2() const
transverse energy squared (use this for cuts)!
unsigned int index
Definition: LeafCandidate.h:31
double py() const final
y coordinate of momentum vector
double vx() const override
x coordinate of vertex position
void setLongLived()
set long lived flag
const PolarLorentzVector & polarP4() const
four-momentum Lorentz vector
bool overlap(const Candidate &) const override
check overlap with another Candidate
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< float >, ROOT::Math::GlobalCoordinateSystemTag > GlobalVector
vector in glovbal coordinate system
Definition: Vector3D.h:28
double et() const
transverse energy
double vy() const
y coordinate of vertex position
edm::Ptr< Candidate > CandidatePtr
persistent reference to an object in a collection of Candidate objects
Definition: CandidateFwd.h:25
bool isConvertedPhoton() const override
double vz() const
z coordinate of vertex position
int charge() const
electric charge
Definition: ParticleState.h:98
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
void setThreeCharge(Charge qx3) final
set electric charge
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
int status() const
status word
const Point & vertex() const
vertex position
bool hasMasterClone() const override
CovarianceMatrix vertexCovariance() const final
return SMatrix
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:36
size_t numberOfSourceCandidatePtrs() const override
bool isPhoton() const override
double mtSqr() const final
transverse mass squared
~LeafCandidate() override
destructor
Definition: LeafCandidate.cc:5
double et() const final
transverse energy
double mass() const final
mass
Structure Point Contains parameters of Gaussian fits to DMRs.
Definition: DMRtrends.cc:57
Vector momentum() const
spatial momentum vector
math::XYZVector Vector
point in the space
Definition: LeafCandidate.h:29
T get() const
get a component
Definition: Candidate.h:221
void construct(int qx3, float pt, float eta, float phi, float mass, const Point &vtx, int pdgId, int status)
Definition: LeafCandidate.h:78
double vertexChi2() const override
chi-squares
double eta() const
momentum pseudorapidity
LeafCandidate * clone() const override
returns a clone of the Candidate object
const CandidateBaseRef & masterClone() const override
Definition: LeafCandidate.cc:7
void setP4(const LorentzVector &p4)
set 4-momentum
size_t numberOfDaughters() const override
number of daughters
void setStatus(int status) final
set status word
LeafCandidate & operator=(LeafCandidate &&)=default
long double T
double phi() const final
momentum azimuthal angle
void setPz(double pz) final
void setPdgId(int pdgId) final
double p() const
magnitude of momentum vector
double py() const
y coordinate of momentum vector
void setCharge(Charge q)
set electric charge
void setP4(const LorentzVector &p4) final
set 4-momentum
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: LeafCandidate.h:23
size_t numberOfMothers() const override
number of mothers
double vx() const
x coordinate of vertex position
int Charge
electric charge type
Definition: LeafCandidate.h:21
int charge() const final
electric charge
math::XYZPoint Point
point in the space
Definition: LeafCandidate.h:27
bool isElectron() const override
double energy() const final
energy
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: Candidate.h:38
double eta() const final
momentum pseudorapidity
void setMass(double m)
set particle mass