CMS 3D CMS Logo

ParticleState.h
Go to the documentation of this file.
1 #ifndef Candidate_ParticleState_h
2 #define Candidate_ParticleState_h
3 
18 #include "Rtypes.h"
19 
20 namespace reco {
21 
22  class ParticleState {
23  public:
25  typedef int Charge;
35  ParticleState() : vertex_(0, 0, 0),
36  qx3_(0), pdgId_(0), status_(0){}
37 
39  ParticleState( Charge q, const PtEtaPhiMass & p4, const Point & vertex= Point( 0, 0, 0 ),
40  int pdgId=0, int status=0, bool integerCharge=true)
41  : vertex_( vertex ), p4Polar_( p4.pt(), p4.eta(), p4.phi(), p4.mass() ),
43  qx3_( integerCharge ? q*3 : q ),pdgId_( pdgId ), status_( status ){}
44 
46  ParticleState( Charge q, const LorentzVector & p4, const Point & vertex = Point( 0, 0, 0 ),
47  int pdgId = 0, int status = 0, bool integerCharge = true ) :
48  vertex_( vertex ),
49  p4Polar_(p4), p4Cartesian_(p4),
50  qx3_( integerCharge ? q*3 : q ),pdgId_( pdgId ), status_( status ){}
51 
52 
54  ParticleState( Charge q, const PolarLorentzVector & p4, const Point & vertex = Point( 0, 0, 0 ),
55  int pdgId = 0, int status = 0, bool integerCharge = true ):
56  vertex_( vertex ),
57  p4Polar_(p4), p4Cartesian_(p4),
58  qx3_( integerCharge ? q*3 : q ),pdgId_( pdgId ), status_( status ){}
59 
60  ParticleState( Charge q, const GlobalVector & p3, float iEnergy, float imass, const Point & vertex = Point( 0, 0, 0 ),
61  int pdgId = 0, int status = 0, bool integerCharge = true ) :
62  vertex_( vertex ),
63  p4Polar_(p3.perp(),p3.eta(),p3.phi(),imass), p4Cartesian_(p3.x(),p3.y(),p3.z(), iEnergy),
64  qx3_( integerCharge ? q*3 : q ), pdgId_( pdgId ), status_( status ){}
65 
67  inline void setCartesian() {
69  }
70 
72  int charge() const { return qx3_ / 3; }
74  void setCharge( Charge q ) { qx3_ = q * 3; }
76  int threeCharge() const { return qx3_; }
78  void setThreeCharge( Charge qx3 ) { qx3_ = qx3; }
80  const LorentzVector & p4() const { return p4Cartesian_; }
82  const PolarLorentzVector & polarP4() const { return p4Polar_; }
84  Vector momentum() const { return p4Cartesian_.Vect(); }
87  Vector boostToCM() const { return p4Cartesian_.BoostToCM(); }
89  double p() const { return p4Cartesian_.P(); }
91  double energy() const { return p4Cartesian_.E(); }
93  double et() const { return (pt()<=0) ? 0 : p4Cartesian_.Et(); }
95  double et2() const { return (pt()<=0) ? 0 : p4Cartesian_.Et2(); }
97  double mass() const { return p4Polar_.mass(); }
99  double massSqr() const { return mass()*mass(); }
101  double mt() const { return p4Polar_.Mt(); }
103  double mtSqr() const { return p4Polar_.Mt2(); }
105  double px() const { return p4Cartesian_.Px(); }
107  double py() const { return p4Cartesian_.Py(); }
109  double pz() const { return p4Cartesian_.Pz(); }
111  double pt() const { return p4Polar_.pt(); }
113  double phi() const { return p4Polar_.phi(); }
115  double theta() const { return p4Cartesian_.Theta(); }
117  double eta() const { return p4Polar_.eta(); }
119  double rapidity() const { return p4Polar_.Rapidity(); }
121  double y() const { return rapidity(); }
123  void setP4( const LorentzVector & p4 ) {
124  p4Cartesian_ = p4;
125  p4Polar_ = p4;
126 
127  }
129  void setP4( const PolarLorentzVector & p4 ) {
130  p4Polar_ = p4;
131  p4Cartesian_ = p4;
132  }
134  void setMass( double m ) {
135  p4Polar_.SetM(m);
136  setCartesian();
137 
138  }
139  void setPz( double pz ) {
140  p4Cartesian_.SetPz(pz);
142 
143  }
145  const Point & vertex() const { return vertex_; }
147  double vx() const { return vertex_.X(); }
149  double vy() const { return vertex_.Y(); }
151  double vz() const { return vertex_.Z(); }
153  void setVertex( const Point & vertex ) { vertex_ = vertex; }
155  int pdgId() const { return pdgId_; }
156  // set PDG identifier
157  void setPdgId( int pdgId ) { pdgId_ = pdgId; }
159  int status() const { return status_; }
161  void setStatus( int status ) { status_ = status; }
165  bool longLived() const { return status_ & longLivedTag; }
169  bool massConstraint() const { return status_ & massConstraintTag; }
170 
171 
172  private:
173  static const unsigned int longLivedTag = 65536;
174  static const unsigned int massConstraintTag = 131072;
175 
176  private:
178  Point vertex_;
179 
181  PolarLorentzVector p4Polar_;
183  LorentzVector p4Cartesian_;
184 
186  Charge qx3_;
187 
189  int pdgId_;
191  int status_;
192 
193  };
194 
195 }
196 
197 #endif
double rapidity() const
repidity
ParticleState(Charge q, const PolarLorentzVector &p4, const Point &vertex=Point(0, 0, 0), int pdgId=0, int status=0, bool integerCharge=true)
constructor from values
Definition: ParticleState.h:54
double px() const
x coordinate of momentum vector
int pdgId_
PDG identifier.
Point vertex_
vertex position
int pdgId() const
PDG identifier.
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: ParticleState.h:29
void setCartesian()
set internal cache
Definition: ParticleState.h:67
double theta() const
momentum polar angle
LorentzVector p4Cartesian_
internal cache for p4
double pz() const
z coordinate of momentum vector
int threeCharge() const
electric charge
Definition: ParticleState.h:76
void setP4(const PolarLorentzVector &p4)
set 4-momentum
static const unsigned int longLivedTag
int Charge
electric charge type
Definition: ParticleState.h:25
math::XYZPoint Point
point in the space
Definition: ParticleState.h:31
void setMassConstraint()
set mass constraint flag
double energy() const
energy
Definition: ParticleState.h:91
void setPdgId(int pdgId)
void setPz(double pz)
PolarLorentzVector p4Polar_
four-momentum Lorentz vector
double y() const
repidity
double phi() const
momentum azimuthal angle
bool massConstraint() const
do mass constraint?
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
T x() const
Cartesian x coordinate.
double pt() const
transverse momentum
void setStatus(int status)
set status word
ParticleState(Charge q, const LorentzVector &p4, const Point &vertex=Point(0, 0, 0), int pdgId=0, int status=0, bool integerCharge=true)
constructor from values
Definition: ParticleState.h:46
double mt() const
transverse mass
double mass() const
mass
Definition: ParticleState.h:97
math::XYZVector Vector
point in the space
Definition: ParticleState.h:33
bool longLived() const
is long lived?
void setVertex(const Point &vertex)
set vertex
double mtSqr() const
transverse mass squared
double massSqr() const
mass squared
Definition: ParticleState.h:99
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: ParticleState.h:27
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
ParticleState(Charge q, const GlobalVector &p3, float iEnergy, float imass, const Point &vertex=Point(0, 0, 0), int pdgId=0, int status=0, bool integerCharge=true)
Definition: ParticleState.h:60
void setLongLived()
set long lived flag
const PolarLorentzVector & polarP4() const
four-momentum Lorentz vector
Definition: ParticleState.h:82
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< float >, ROOT::Math::GlobalCoordinateSystemTag > GlobalVector
vector in glovbal coordinate system
Definition: Vector3D.h:27
double et() const
transverse energy
Definition: ParticleState.h:93
double vy() const
y coordinate of vertex position
double vz() const
z coordinate of vertex position
int charge() const
electric charge
Definition: ParticleState.h:72
Charge qx3_
electric charge
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
int status() const
status word
const Point & vertex() const
vertex position
ParticleState(Charge q, const PtEtaPhiMass &p4, const Point &vertex=Point(0, 0, 0), int pdgId=0, int status=0, bool integerCharge=true)
constructor from values
Definition: ParticleState.h:39
T perp() const
Magnitude of transverse component.
fixed size matrix
static const unsigned int massConstraintTag
Vector momentum() const
spatial momentum vector
Definition: ParticleState.h:84
double eta() const
momentum pseudorapidity
void setP4(const LorentzVector &p4)
set 4-momentum
ParticleState()
default constructor
Definition: ParticleState.h:35
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
double vx() const
x coordinate of vertex position
int status_
status word
double p3[4]
Definition: TauolaWrapper.h:91
void setMass(double m)
set particle mass