Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:03:49

0001 #ifndef Candidate_Particle_h
0002 #define Candidate_Particle_h
0003 /** \class reco::Particle
0004  *
0005  * Base class describing a generic reconstructed particle
0006  * its main subclass is Candidate
0007  *
0008  * \author Luca Lista, INFN
0009  *
0010  *
0011  */
0012 
0013 #include "ParticleState.h"
0014 namespace reco {
0015 
0016   class Particle {
0017   public:
0018     /// electric charge type
0019     typedef int Charge;
0020     /// Lorentz vector
0021     typedef math::XYZTLorentzVector LorentzVector;
0022     /// Lorentz vector
0023     typedef math::PtEtaPhiMLorentzVector PolarLorentzVector;
0024     /// point in the space
0025     typedef math::XYZPoint Point;
0026     /// point in the space
0027     typedef math::XYZVector Vector;
0028 
0029     typedef unsigned int index;
0030 
0031 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
0032     template <typename... Args>
0033     explicit Particle(Args&&... args) : m_state(std::forward<Args>(args)...) {}
0034 
0035     Particle(Particle& rh) : m_state(rh.m_state) {}
0036 
0037     Particle(Particle&&) = default;
0038     Particle(Particle const&) = default;
0039     Particle& operator=(Particle&&) = default;
0040     Particle& operator=(Particle const&) = default;
0041 #else
0042     // for Reflex to parse...  (compilation will use the above)
0043     Particle();
0044     Particle(Charge q,
0045              const PtEtaPhiMass& p4,
0046              const Point& vtx = Point(0, 0, 0),
0047              int pdgId = 0,
0048              int status = 0,
0049              bool integerCharge = true);
0050     Particle(Charge q,
0051              const LorentzVector& p4,
0052              const Point& vtx = Point(0, 0, 0),
0053              int pdgId = 0,
0054              int status = 0,
0055              bool integerCharge = true);
0056     Particle(Charge q,
0057              const PolarLorentzVector& p4,
0058              const Point& vtx = Point(0, 0, 0),
0059              int pdgId = 0,
0060              int status = 0,
0061              bool integerCharge = true);
0062     Particle(Charge q,
0063              const GlobalVector& p3,
0064              float iEnergy,
0065              float imass,
0066              const Point& vtx = Point(0, 0, 0),
0067              int pdgId = 0,
0068              int status = 0,
0069              bool integerCharge = true);
0070 #endif
0071 
0072     void construct(int qx3, float pt, float eta, float phi, float mass, const Point& vtx, int pdgId, int status) {
0073       m_state = ParticleState(qx3, PolarLorentzVector(pt, eta, phi, mass), vtx, pdgId, status, false);
0074     }
0075 
0076     /// destructor
0077     virtual ~Particle() {}
0078 
0079     /// electric charge
0080     int charge() const { return m_state.charge(); }
0081     /// set electric charge
0082     void setCharge(Charge q) { m_state.setCharge(q); }
0083     /// electric charge
0084     int threeCharge() const { return m_state.threeCharge(); }
0085     /// set electric charge
0086     void setThreeCharge(Charge qx3) { m_state.setThreeCharge(qx3); }
0087     /// four-momentum Lorentz vector
0088     const LorentzVector& p4() const { return m_state.p4(); }
0089     /// four-momentum Lorentz vector
0090     const PolarLorentzVector& polarP4() const { return m_state.polarP4(); }
0091     /// spatial momentum vector
0092     Vector momentum() const { return m_state.momentum(); }
0093     /// boost vector to boost a Lorentz vector
0094     /// to the particle center of mass system
0095     Vector boostToCM() const { return m_state.boostToCM(); }
0096     /// magnitude of momentum vector
0097     double p() const { return m_state.p(); }
0098     /// energy
0099     double energy() const { return m_state.energy(); }
0100     /// transverse energy
0101     double et() const { return m_state.et(); }
0102     /// transverse energy squared (use this for cut!)
0103     double et2() const { return m_state.et2(); }
0104     /// mass
0105     double mass() const { return m_state.mass(); }
0106     /// mass squared
0107     double massSqr() const { return mass() * mass(); }
0108 
0109     /// transverse mass
0110     double mt() const { return m_state.mt(); }
0111     /// transverse mass squared
0112     double mtSqr() const { return m_state.mtSqr(); }
0113     /// x coordinate of momentum vector
0114     double px() const { return m_state.px(); }
0115     /// y coordinate of momentum vector
0116     double py() const { return m_state.py(); }
0117     /// z coordinate of momentum vector
0118     double pz() const { return m_state.pz(); }
0119     /// transverse momentum
0120     double pt() const { return m_state.pt(); }
0121     /// momentum azimuthal angle
0122     double phi() const { return m_state.phi(); }
0123     /// momentum polar angle
0124     double theta() const { return m_state.theta(); }
0125     /// momentum pseudorapidity
0126     double eta() const { return m_state.eta(); }
0127     /// rapidity
0128     double rapidity() const { return m_state.rapidity(); }
0129     /// rapidity
0130     double y() const { return rapidity(); }
0131     /// set 4-momentum
0132     void setP4(const LorentzVector& p4) { m_state.setP4(p4); }
0133     /// set 4-momentum
0134     void setP4(const PolarLorentzVector& p4) { m_state.setP4(p4); }
0135     /// set particle mass
0136     void setMass(double m) { m_state.setMass(m); }
0137     void setPz(double pz) { m_state.setPz(pz); }
0138     /// vertex position                 (overwritten by PF...)
0139     const Point& vertex() const { return m_state.vertex(); }
0140     /// x coordinate of vertex position
0141     double vx() const { return m_state.vx(); }
0142     /// y coordinate of vertex position
0143     double vy() const { return m_state.vy(); }
0144     /// z coordinate of vertex position
0145     double vz() const { return m_state.vz(); }
0146     /// set vertex
0147     void setVertex(const Point& vertex) { m_state.setVertex(vertex); }
0148 
0149     /// PDG identifier
0150     int pdgId() const { return m_state.pdgId(); }
0151     // set PDG identifier
0152     void setPdgId(int pdgId) { m_state.setPdgId(pdgId); }
0153     /// status word
0154     int status() const { return m_state.status(); }
0155     /// set status word
0156     void setStatus(int status) { m_state.setStatus(status); }
0157     /// long lived flag
0158     /// set long lived flag
0159     void setLongLived() { m_state.setLongLived(); }
0160     /// is long lived?
0161     bool longLived() const { return m_state.longLived(); }
0162     /// do mass constraint flag
0163     /// set mass constraint flag
0164     void setMassConstraint() { m_state.setMassConstraint(); }
0165     /// do mass constraint?
0166     bool massConstraint() const { return m_state.massConstraint(); }
0167 
0168   private:
0169     ParticleState m_state;
0170   };
0171 
0172 }  // namespace reco
0173 
0174 #endif