Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-09-28 07:02:48

0001 /**
0002  \file
0003  Declaration of class erhic::hadronic::ParticleMC.
0004  
0005  \author    Thomas Burton 
0006  \date      2012-05-02
0007  \copyright 2012 Brookhaven National Lab
0008  */
0009 
0010 #ifndef INCLUDE_EICSMEAR_HADRONIC_PARTICLEMC_H_
0011 #define INCLUDE_EICSMEAR_HADRONIC_PARTICLEMC_H_
0012 
0013 #include <iostream>
0014 
0015 #include <TLorentzVector.h>
0016 #include <TVector3.h>
0017 
0018 #include "eicsmear/erhic/Pid.h"
0019 #include "eicsmear/erhic/VirtualParticle.h"
0020 
0021 class TMCParticle;  // ROOT Monte Carlo particle class
0022 
0023 namespace erhic {
0024 namespace hadronic {
0025 
0026 /**
0027  A realisation of erhic::VirtualParticle for tracks from a
0028  hadron-hadron Monte Carlo event.
0029  */
0030 class ParticleMC : public erhic::VirtualParticle {
0031  public:
0032   /**
0033    Destructor
0034    */
0035   virtual ~ParticleMC() { }
0036 
0037   /**
0038    Default constructor
0039    */
0040   ParticleMC();
0041 
0042   /**
0043    Initialise from a PYTHIA TParticleMC
0044    */
0045   explicit ParticleMC(const TMCParticle&);
0046 
0047   /**
0048    Initialise from energy-momentum 4-vector, vertex 3-vector and PDG,
0049    status, parent index.
0050    */
0051   ParticleMC(const TLorentzVector&, const TVector3&, int, int, int);
0052 
0053   /**
0054    Returns identity information for the Particle species.
0055    */
0056   virtual erhic::Pid Id() const;
0057 
0058   /**
0059    Returns the momentum-energy four-vector (px, py, pz, E).
0060    */
0061   virtual TLorentzVector Get4Vector() const;
0062 
0063   /**
0064    Returns the x component of 3-momentum.
0065    */
0066   virtual Double_t GetPx() const;
0067 
0068   /**
0069    Returns the y component of 3-momentum.
0070    */
0071   virtual Double_t GetPy() const;
0072 
0073   /**
0074    Returns the z component of 3-momentum.
0075    */
0076   virtual Double_t GetPz() const;
0077 
0078   /**
0079    Returns total energy.
0080    */
0081   virtual Double_t GetE() const;
0082 
0083   /**
0084    Returns the magnitude of 3-momentum (GeV).
0085    */
0086   virtual Double_t GetP() const;
0087 
0088   /**
0089    Returns invariant mass (GeV/c<sup>2</sup>).
0090    */
0091   virtual Double_t GetM() const;
0092 
0093   /**
0094    Returns momentum perpendicular to the beam direction.
0095    */
0096   virtual Double_t GetPt() const;
0097 
0098   /**
0099    Returns the polar angle in the range [0, pi] radians.
0100    */
0101   virtual Double_t GetTheta() const;
0102 
0103   /**
0104    Returns the polar angle in the range [0, 2pi] radians.
0105    */
0106   virtual Double_t GetPhi() const;
0107 
0108   /**
0109    Returns the rapidity.
0110    */
0111   virtual Double_t GetRapidity() const;
0112 
0113   /**
0114    Returns the pseudorapidity.
0115    */
0116   virtual Double_t GetEta() const;
0117 
0118   /**
0119    Returns the origin point of the particle in cm.
0120    (0,0,0) indicates a particle originating in the collision.
0121    */
0122   virtual TVector3 GetVertex() const;
0123 
0124   /**
0125    A general "status" code for the particle
0126    (definition depends on implementation).
0127    */
0128   virtual UShort_t GetStatus() const;
0129 
0130   /**
0131    Index of this particle's precursor in the event.
0132    Returns 0 if the particle has no direct parent.
0133    */
0134   virtual UShort_t GetParentIndex() const;
0135 
0136   /**
0137    Returns Feynman-x.
0138    x<sub>F</sub> = 2*p<sub>z</sub>/sqrt(s).
0139    */
0140   virtual Double_t GetXFeynman() const;
0141 
0142   /**
0143    Sets the status code.
0144    */
0145   virtual void SetStatus(UShort_t);
0146 
0147   /**
0148    Sets the parent index, in the range [1, N - 1] for particles with
0149    parents, or 0 for those without.
0150    */
0151   virtual void SetParentIndex(UShort_t);
0152 
0153   /**
0154    Sets the Feynman-x
0155    */
0156   virtual void SetXFeynman(double xf);
0157 
0158   /**
0159    Sets the four-momentum of the particle.
0160    Changes are propagated to derived quantities.
0161    */
0162   virtual void Set4Vector(const TLorentzVector&);
0163 
0164   /**
0165    Sets the origin coordinates.
0166    */
0167   virtual void SetVertex(const TVector3&);
0168 
0169  protected:
0170   UShort_t KS;  ///< Status code: see PYTHIA manual
0171   UShort_t orig;  ///< I of parent particle
0172   Int_t id;  ///< PDG code identifying the particle
0173   Double32_t px;  ///< x component of momentum (GeV/c)
0174   Double32_t py;  ///< y component of momentum (GeV/c)
0175   Double32_t pz;  ///< z component of momentum (GeV/c)
0176   Double32_t E;  ///< Total energy (GeV)
0177   Double32_t p;  ///< Magnitude of momentum (GeV/c)
0178   Double32_t m;  ///< Invariant mass (GeV/c2)
0179   Double32_t pt;  ///< Momentum transverse to the beam direction (GeV/c)
0180   Double32_t theta;  ///< Polar angle (radians [0, pi])
0181   Double32_t phi;  ///< Angle of azimuth (radians [0, 2pi])
0182   Double32_t rapidity;  ///< Rapidity
0183   Double32_t eta;  ///< Pseudorapidity
0184   Double32_t xFeynman;  ///< Feynman x = 2 * pz / centre of mass energy
0185   Double32_t xv;  ///< x vertex position (cm)
0186   Double32_t yv;  ///< y vertex position (cm)
0187   Double32_t zv;  ///< z vertex position (cm)
0188 
0189   ClassDef(erhic::hadronic::ParticleMC, 1)
0190 };
0191 
0192 inline Pid ParticleMC::Id() const {
0193   return Pid(id);
0194 }
0195 
0196 inline TLorentzVector ParticleMC::Get4Vector() const {
0197   return TLorentzVector(GetPx(), GetPy(), GetPz(), GetE());
0198 }
0199 
0200 inline Double_t ParticleMC::GetPx() const {
0201   return px;
0202 }
0203 
0204 inline Double_t ParticleMC::GetPy() const {
0205   return py;
0206 }
0207 
0208 inline Double_t ParticleMC::GetPz() const {
0209   return pz;
0210 }
0211 
0212 inline Double_t ParticleMC::GetE() const {
0213   return E;
0214 }
0215 
0216 inline Double_t ParticleMC::GetP() const {
0217   return p;
0218 }
0219 
0220 inline Double_t ParticleMC::GetM() const {
0221   return m;
0222 }
0223 
0224 inline Double_t ParticleMC::GetPt() const {
0225   return pt;
0226 }
0227 
0228 inline Double_t ParticleMC::GetTheta() const {
0229   return theta;
0230 }
0231 
0232 inline Double_t ParticleMC::GetPhi() const {
0233   return phi;
0234 }
0235 
0236 inline Double_t ParticleMC::GetRapidity() const {
0237   return rapidity;
0238 }
0239 
0240 inline Double_t ParticleMC::GetEta() const {
0241   return eta;
0242 }
0243 
0244 inline TVector3 ParticleMC::GetVertex() const {
0245   return TVector3(xv, yv, zv);
0246 }
0247 
0248 inline UShort_t ParticleMC::GetStatus() const {
0249   return KS;
0250 }
0251 
0252 inline UShort_t ParticleMC::GetParentIndex() const {
0253   return orig;
0254 }
0255 
0256 inline Double_t ParticleMC::GetXFeynman() const {
0257   return xFeynman;
0258 }
0259 
0260 inline void ParticleMC::SetStatus(UShort_t i) {
0261   KS = i;
0262 }
0263 
0264 inline void ParticleMC::SetXFeynman(double xf) {
0265   xFeynman = xf;
0266 }
0267 
0268 inline void ParticleMC::SetVertex(const TVector3& v) {
0269   xv = v.x();
0270   yv = v.y();
0271   zv = v.z();
0272 }
0273 
0274 }  // namespace hadronic
0275 }  // namespace erhic
0276 
0277 #endif  // INCLUDE_EICSMEAR_HADRONIC_PARTICLEMC_H_