CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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) :
41  m_state(std::forward<Args>(args)...) {}
42 
44 
45  LeafCandidate(LeafCandidate&&)=default;
46  LeafCandidate(LeafCandidate const&)=default;
48  LeafCandidate& operator=(LeafCandidate const&)=default;
49 #else
50  // for Reflex to parse... (compilation will use the above)
51  LeafCandidate( Charge q, const PtEtaPhiMass & p4, const Point & vtx = Point( 0, 0, 0 ),
52  int pdgId = 0, int status = 0, bool integerCharge = true );
53  LeafCandidate( Charge q, const LorentzVector & p4, const Point & vtx = Point( 0, 0, 0 ),
54  int pdgId = 0, int status = 0, bool integerCharge = true );
55  LeafCandidate( Charge q, const PolarLorentzVector & p4, const Point & vtx = Point( 0, 0, 0 ),
56  int pdgId = 0, int status = 0, bool integerCharge = true );
57  LeafCandidate( Charge q, const GlobalVector & p3, float iEnergy, float imass, const Point & vtx = Point( 0, 0, 0 ),
58  int pdgId = 0, int status = 0, bool integerCharge = true );
59 #endif
60 
61  void construct(int qx3, float pt, float eta, float phi, float mass, const Point & vtx, int pdgId, int status) {
62  m_state = ParticleState(qx3, PolarLorentzVector(pt,eta,phi,mass), vtx, pdgId, status, false);
63  }
64 
66  virtual ~LeafCandidate();
68  virtual size_t numberOfDaughters() const;
70  virtual const Candidate * daughter( size_type ) const;
72  virtual size_t numberOfMothers() const;
74  virtual const Candidate * mother( size_type ) const;
76  virtual Candidate * daughter( size_type );
78  virtual Candidate * daughter(const std::string& s );
80  virtual const Candidate * daughter(const std::string& s ) const;
83  virtual size_t numberOfSourceCandidatePtrs() const { return 0;}
87  return CandidatePtr();
88  }
89 
91  virtual int charge() const GCC11_FINAL { return m_state.charge(); }
93  virtual void setCharge( Charge q ) GCC11_FINAL { m_state.setCharge(q); }
95  virtual int threeCharge() const GCC11_FINAL { return m_state.threeCharge(); }
99  virtual const LorentzVector & p4() const GCC11_FINAL { return m_state.p4(); }
101  virtual const PolarLorentzVector & polarP4() const GCC11_FINAL { return m_state.polarP4(); }
108  virtual double p() const GCC11_FINAL { return m_state.p(); }
110  virtual double energy() const GCC11_FINAL { return m_state.energy(); }
112  virtual double et() const GCC11_FINAL { return m_state.et(); }
114  virtual double et2() const GCC11_FINAL { return m_state.et2(); }
116  virtual double mass() const GCC11_FINAL { return m_state.mass(); }
118  virtual double massSqr() const GCC11_FINAL { return mass() * mass(); }
119 
121  virtual double mt() const GCC11_FINAL { return m_state.mt(); }
123  virtual double mtSqr() const GCC11_FINAL { return m_state.mtSqr(); }
125  virtual double px() const GCC11_FINAL { return m_state.px(); }
127  virtual double py() const GCC11_FINAL { return m_state.py(); }
129  virtual double pz() const GCC11_FINAL { return m_state.pz(); }
131  virtual double pt() const GCC11_FINAL { return m_state.pt();}
133  virtual double phi() const GCC11_FINAL { return m_state.phi(); }
135  virtual double theta() const GCC11_FINAL { return m_state.theta(); }
137  virtual double eta() const GCC11_FINAL { return m_state.eta(); }
139  virtual double rapidity() const GCC11_FINAL { return m_state.rapidity(); }
141  virtual double y() const GCC11_FINAL { return rapidity(); }
143  virtual void setP4( const LorentzVector & p4 ) GCC11_FINAL { m_state.setP4(p4);}
145  virtual void setP4( const PolarLorentzVector & p4 ) GCC11_FINAL {m_state.setP4(p4); }
147  virtual void setMass( double m ) GCC11_FINAL {m_state.setMass(m);}
148  virtual void setPz( double pz ) GCC11_FINAL { m_state.setPz(pz);}
150  virtual const Point & vertex() const { return m_state.vertex(); }
152  virtual double vx() const { return m_state.vx(); }
154  virtual double vy() const { return m_state.vy(); }
156  virtual double vz() const { return m_state.vz(); }
158  virtual void setVertex( const Point & vertex ) { m_state.setVertex(vertex); }
159 
161  virtual int pdgId() const GCC11_FINAL { return m_state.pdgId(); }
162  // set PDG identifier
163  virtual void setPdgId( int pdgId ) GCC11_FINAL { m_state.setPdgId(pdgId); }
165  virtual int status() const GCC11_FINAL { return m_state.status(); }
172  virtual bool longLived() const GCC11_FINAL { return m_state.longLived(); }
178 
180  virtual LeafCandidate * clone() const {
181  return new LeafCandidate( *this );
182  }
183 
185  virtual double vertexChi2() const;
192  virtual double vertexNdof() const;
194  virtual double vertexNormalizedChi2() const;
196  virtual double vertexCovariance(int i, int j) const;
200  virtual void fillVertexCovariance(CovarianceMatrix & v) const;
203  virtual bool hasMasterClone() const;
206  virtual const CandidateBaseRef & masterClone() const;
209  virtual bool hasMasterClonePtr() const;
212  virtual const CandidatePtr & masterClonePtr() const;
213 
215  template<typename Ref>
216  Ref masterRef() const { return masterClone().template castTo<Ref>(); }
218 
219  template<typename T> T get() const {
220  if ( hasMasterClone() ) return masterClone()->get<T>();
221  else return reco::get<T>( * this );
222  }
224  template<typename T, typename Tag> T get() const {
225  if ( hasMasterClone() ) return masterClone()->get<T, Tag>();
226  else return reco::get<T, Tag>( * this );
227  }
229  template<typename T> T get( size_type i ) const {
230  if ( hasMasterClone() ) return masterClone()->get<T>( i );
231  else return reco::get<T>( * this, i );
232  }
234  template<typename T, typename Tag> T get( size_type i ) const {
235  if ( hasMasterClone() ) return masterClone()->get<T, Tag>( i );
236  else return reco::get<T, Tag>( * this, i );
237  }
239  template<typename T> size_type numberOf() const {
240  if ( hasMasterClone() ) return masterClone()->numberOf<T>();
241  else return reco::numberOf<T>( * this );
242  }
244  template<typename T, typename Tag> size_type numberOf() const {
245  if ( hasMasterClone() ) return masterClone()->numberOf<T, Tag>();
246  else return reco::numberOf<T, Tag>( * this );
247  }
248 
249 
250 
251  virtual bool isElectron() const;
252  virtual bool isMuon() const;
253  virtual bool isStandAloneMuon() const;
254  virtual bool isGlobalMuon() const;
255  virtual bool isTrackerMuon() const;
256  virtual bool isCaloMuon() const;
257  virtual bool isPhoton() const;
258  virtual bool isConvertedPhoton() const;
259  virtual bool isJet() const;
260 
261  private:
263 
264  private:
266  virtual bool overlap( const Candidate & ) const;
267  template<typename, typename, typename> friend struct component;
268  friend class ::OverlapChecker;
269  friend class ShallowCloneCandidate;
271 
272  };
273 
274 }
275 
276 #endif
double rapidity() const
repidity
value_type const * get() const
Definition: RefToBase.h:212
int Charge
electric charge type
Definition: Candidate.h:35
int i
Definition: DBlmapReader.cc:9
virtual int pdgId() const
PDG identifier.
virtual double p() const
magnitude of momentum vector
double px() const
x coordinate of momentum vector
virtual void setMassConstraint()
#define GCC11_FINAL
LeafCandidate(LeafCandidate &rh)
Definition: LeafCandidate.h:43
math::XYZVector Vector
point in the space
Definition: Candidate.h:43
int pdgId() const
PDG identifier.
size_t size_type
Definition: Candidate.h:30
virtual double et2() const
transverse energy squared (use this for cut!)
virtual double et() const
transverse energy
double theta() const
momentum polar angle
virtual void setCharge(Charge q)
set electric charge
Definition: LeafCandidate.h:93
size_type numberOf() const
number of components
virtual double vertexChi2() const
chi-squares
virtual void setStatus(int status)
set status word
virtual const Point & vertex() const
vertex position (overwritten by PF...)
size_type numberOf() const
number of components
virtual double massSqr() const
mass squared
virtual int status() const
status word
virtual bool isConvertedPhoton() const
double pz() const
z coordinate of momentum vector
int threeCharge() const
electric charge
Definition: ParticleState.h:76
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
virtual Vector momentum() const
spatial momentum vector
virtual bool isPhoton() const
virtual double y() const
rapidity
virtual bool isStandAloneMuon() const
virtual void setP4(const LorentzVector &p4)
set 4-momentum
void setMassConstraint()
set mass constraint flag
double energy() const
energy
Definition: ParticleState.h:91
void setPdgId(int pdgId)
void setPz(double pz)
virtual double vy() const
y coordinate of vertex position
ParticleState m_state
virtual double eta() const
momentum pseudorapidity
virtual double pt() const
transverse momentum
virtual bool longLived() const
is long lived?
virtual bool isMuon() const
virtual void setP4(const PolarLorentzVector &p4)
set 4-momentum
double phi() const
momentum azimuthal angle
bool massConstraint() const
do mass constraint?
virtual size_t numberOfDaughters() const
number of daughters
const LorentzVector & p4() const
four-momentum Lorentz vector
Definition: ParticleState.h:80
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
virtual bool isGlobalMuon() const
virtual double mass() const
mass
virtual double energy() const
energy
double pt() const
transverse momentum
virtual const CandidatePtr & masterClonePtr() const
virtual const Candidate * daughter(size_type) const
return daughter at a given position (throws an exception)
void setStatus(int status)
set status word
CovarianceMatrix vertexCovariance() const
return SMatrix
double mt() const
transverse mass
double mass() const
mass
Definition: ParticleState.h:97
virtual ~LeafCandidate()
destructor
Definition: LeafCandidate.cc:5
virtual void setThreeCharge(Charge qx3)
set electric charge
Definition: LeafCandidate.h:97
bool longLived() const
is long lived?
virtual bool hasMasterClone() const
Ref masterRef() const
cast master clone reference to a concrete type
LeafCandidate(const Candidate &c)
Definition: LeafCandidate.h:36
void setVertex(const Point &vertex)
set vertex
math::XYZPoint Point
virtual int charge() const
electric charge
Definition: LeafCandidate.h:91
double mtSqr() const
transverse mass squared
virtual CandidatePtr sourceCandidatePtr(size_type i) const
Definition: LeafCandidate.h:86
int j
Definition: DBlmapReader.cc:9
virtual double vertexNormalizedChi2() const
chi-squared divided by n.d.o.f.
Vector boostToCM() const
Definition: ParticleState.h:87
void setThreeCharge(Charge qx3)
set electric charge
Definition: ParticleState.h:78
double et2() const
transverse energy squared (use this for cuts)!
Definition: ParticleState.h:95
virtual int threeCharge() const
electric charge
Definition: LeafCandidate.h:95
unsigned int index
Definition: LeafCandidate.h:31
virtual bool overlap(const Candidate &) const
check overlap with another Candidate
virtual double vz() const
z coordinate of vertex position
virtual bool hasMasterClonePtr() const
virtual void setVertex(const Point &vertex)
set vertex
virtual bool isElectron() const
void setLongLived()
set long lived flag
const PolarLorentzVector & polarP4() const
four-momentum Lorentz vector
Definition: ParticleState.h:82
virtual double theta() const
momentum polar angle
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< float >, ROOT::Math::GlobalCoordinateSystemTag > GlobalVector
vector in glovbal coordinate system
Definition: Vector3D.h:27
virtual bool isCaloMuon() const
virtual void setPz(double pz)
double et() const
transverse energy
Definition: ParticleState.h:93
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
virtual size_t numberOfSourceCandidatePtrs() const
Definition: LeafCandidate.h:83
double vz() const
z coordinate of vertex position
virtual double px() const
x coordinate of momentum vector
int charge() const
electric charge
Definition: ParticleState.h:72
virtual void setLongLived()
virtual bool isTrackerMuon() const
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
virtual double mt() const
transverse mass
int status() const
status word
const Point & vertex() const
vertex position
string const
Definition: compareJSON.py:14
virtual bool isJet() const
virtual double pz() const
z coordinate of momentum vector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
virtual double rapidity() const
rapidity
virtual Vector boostToCM() const
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< float > > LorentzVector
Definition: analysisEnums.h:9
virtual const PolarLorentzVector & polarP4() const
four-momentum Lorentz vector
virtual size_t numberOfMothers() const
number of mothers
virtual const CandidateBaseRef & masterClone() const
Definition: LeafCandidate.cc:7
Vector momentum() const
spatial momentum vector
Definition: ParticleState.h:84
virtual void setPdgId(int pdgId)
math::XYZVector Vector
point in the space
Definition: LeafCandidate.h:29
virtual double mtSqr() const
transverse mass squared
virtual double vx() const
x coordinate of vertex position
void construct(int qx3, float pt, float eta, float phi, float mass, const Point &vtx, int pdgId, int status)
Definition: LeafCandidate.h:61
math::XYZPoint Point
point in the space
Definition: Candidate.h:41
double eta() const
momentum pseudorapidity
virtual LeafCandidate * clone() const
returns a clone of the Candidate object
virtual void setMass(double m)
set particle mass
void setP4(const LorentzVector &p4)
set 4-momentum
LeafCandidate & operator=(LeafCandidate &&)=default
long double T
virtual double phi() const
momentum azimuthal angle
virtual const LorentzVector & p4() const
four-momentum Lorentz vector
Definition: LeafCandidate.h:99
virtual bool massConstraint() const
do mass constraint?
double p() const
magnitude of momentum vector
Definition: ParticleState.h:89
double py() const
y coordinate of momentum vector
void setCharge(Charge q)
set electric charge
Definition: ParticleState.h:74
virtual void fillVertexCovariance(CovarianceMatrix &v) const
fill SMatrix
virtual double vertexNdof() const
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: LeafCandidate.h:23
virtual double py() const
y coordinate of momentum vector
double vx() const
x coordinate of vertex position
int Charge
electric charge type
Definition: LeafCandidate.h:21
virtual const Candidate * mother(size_type) const
return mother at a given position (throws an exception)
math::XYZPoint Point
point in the space
Definition: LeafCandidate.h:27
double p3[4]
Definition: TauolaWrapper.h:91
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: Candidate.h:39
void setMass(double m)
set particle mass