Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /**
0002  \file
0003  Declaration of class Smear::ParticleMCS.
0004 
0005  \author    Michael Savastio
0006  \date      2011-08-19
0007  \copyright 2011 Brookhaven National Lab
0008  */
0009 
0010 #ifndef INCLUDE_EICSMEAR_SMEAR_PARTICLEMCS_H_
0011 #define INCLUDE_EICSMEAR_SMEAR_PARTICLEMCS_H_
0012 
0013 #include <cmath>
0014 #include <TLorentzVector.h>
0015 
0016 #include "eicsmear/erhic/Pid.h"
0017 #include "eicsmear/erhic/VirtualParticle.h"
0018 #include "eicsmear/smear/SmearConstants.h"
0019 #include <iostream>
0020 
0021 namespace Smear {
0022 
0023 class Event;
0024 
0025 /**
0026  A smeared Monte Carlo particle.
0027  */
0028 class ParticleMCS : public erhic::VirtualParticle {
0029 
0030  public:
0031   /**
0032    Destructor.
0033    */
0034   virtual ~ParticleMCS();
0035 
0036   /**
0037    Default constructor.
0038    Initialises the Particle from the argument string with the format
0039    I KS id orig daughter ldaughter px py pz m E xv yv zv
0040    */
0041   ParticleMCS();
0042 
0043   /**
0044    Construct from an E-p 4-vector, pdg code and status code.
0045    */
0046   ParticleMCS(const TLorentzVector&, int pdg, int status);
0047 
0048   // Let's kill all else
0049   ParticleMCS(const ParticleMCS&) =delete;
0050   ParticleMCS& operator=(const ParticleMCS&) =delete;
0051   
0052 
0053   // ---------------
0054   // --- Getters ---
0055   // ---------------
0056   /**
0057    Returns the x component of 3-momentum.
0058    */
0059   virtual Double_t GetPx() const;
0060 
0061   /**
0062    Returns the y component of 3-momentum.
0063    */
0064   virtual Double_t GetPy() const;
0065 
0066   /**
0067    Returns the z component of 3-momentum.
0068    */
0069   virtual Double_t GetPz() const;
0070 
0071   /**
0072    Returns the energy of the particle in the lab frame.
0073    */
0074   virtual Double_t GetE() const;
0075 
0076   /**
0077    Returns the (E,p) 4-vector in the lab frame.
0078    */
0079   virtual TLorentzVector Get4Vector() const;
0080 
0081   /**
0082    Returns the (E,p) 4-vector in the lab frame.
0083    */
0084   virtual TLorentzVector PxPyPzE() const { return Get4Vector(); }
0085 
0086   /**
0087    Returns the apparent mass of the smeared particle.
0088    \todo Consider the implementation here.
0089    If the particle is identified (either correctly or incorrectly),
0090    it could return the PDG mass of that particle.
0091    If the particle is not identified, should it return sqrt(E^2 - p^2)?
0092    What about if p or E are not known? Return E or p? Or zero (e.g.
0093    that would work for photons, E known, p not).
0094    */
0095   virtual Double_t GetM() const;
0096 
0097   /**
0098    Returns momentum transverse to the beam direction.
0099    \todo check this is set properly
0100    */
0101   virtual Double_t GetPt() const;
0102 
0103   /**
0104    Returns the origin point of the particle (cm).
0105    (0,0,0) indicates a particle originating in the collision.
0106    */
0107   virtual TVector3 GetVertex() const;
0108 
0109   /**
0110    Returns the total momentum (GeV).
0111    */
0112   virtual Double_t GetP() const;
0113 
0114   /**
0115    Returns the polar angle in the range [0,pi] radians.
0116    */
0117   virtual Double_t GetTheta() const;
0118 
0119   /**
0120    Returns the polar angle in the range [0,2pi] radians.
0121    */
0122   virtual Double_t GetPhi() const;
0123 
0124   /**
0125    Returns the rapidity.
0126    */
0127   virtual Double_t GetRapidity() const;
0128 
0129   /**
0130    Returns the pseudorapidity.
0131    */
0132   virtual Double_t GetEta() const;
0133 
0134   /** Returns a status code following the PYTHIA defintion, where
0135    21 indicates an initial-state particle and 1 indicates a final-
0136    state particle
0137    */
0138   virtual UShort_t GetStatus() const;
0139 
0140   /**
0141    Returns the pdg ID of the particle.
0142    */
0143   virtual ::erhic::Pid Id() const;
0144 
0145   /**
0146      Returns the numSigma deviation of this particle
0147   */
0148   double GetNumSigma() const;
0149 
0150   /**
0151      Returns the numSigma deviation type (pi_k, k_p) of this particle
0152   */
0153   int GetNumSigmaType() const;
0154 
0155   /** should always be true for a ParticleMCS
0156       This replaces the brittle mechanism of checking values against 0
0157       If false, it should indicate an old tree was used.
0158   */
0159   virtual bool IsSmeared() const;
0160   virtual bool IsESmeared() const; //< E smeared?
0161   virtual bool IsPSmeared() const; //< Total momentum smeared?
0162   virtual bool IsPtSmeared() const; //< P_t smeared?
0163   virtual bool IsPxSmeared() const; //< P_x smeared?
0164   virtual bool IsPySmeared() const; //< P_y smeared?
0165   virtual bool IsPzSmeared() const; //< P_z smeared?
0166   virtual bool IsThetaSmeared() const; //< &theta; smeared?
0167   virtual bool IsPhiSmeared() const; //< &phi; smeared?
0168   virtual bool IsIdSmeared() const; //< pdg Id smeared?
0169   virtual bool IsNumSigmaSmeared() const; //< PID numSigma smeared?
0170 
0171   // ---------------
0172   // --- Setters ---
0173   // ---------------
0174   /** Set energy. By default, marks it as smeared and checks that it wasn't before.
0175       @param CheckSetSmearFlag=false disables this check (e.g. for adjustments)
0176   */
0177   virtual void SetE(const Double_t value, const bool CheckSetSmearFlag=true);
0178 
0179   /** Set total momentum P. By default, marks it as smeared and checks that it wasn't before.
0180       @param CheckSetSmearFlag=false disables this check (e.g. for adjustments)
0181   */
0182   virtual void SetP(const Double_t value, const bool CheckSetSmearFlag=true);
0183 
0184   /** Set transverse momentum Pt. By default, marks it as smeared and checks that it wasn't before.
0185       @param CheckSetSmearFlag=false disables this check (e.g. for adjustments)
0186   */
0187   virtual void SetPt(const Double_t value, const bool CheckSetSmearFlag=true);
0188 
0189   /** Set P_x. By default, marks it as smeared and checks that it wasn't before.
0190       @param CheckSetSmearFlag=false disables this check (e.g. for adjustments)
0191   */
0192   virtual void SetPx(const Double_t value, const bool CheckSetSmearFlag=true);
0193 
0194   /** Set P_y. By default, marks it as smeared and checks that it wasn't before.
0195       @param CheckSetSmearFlag=false disables this check (e.g. for adjustments)
0196   */
0197   virtual void SetPy(const Double_t value, const bool CheckSetSmearFlag=true);
0198 
0199   /** Set P_z. By default, marks it as smeared and checks that it wasn't before.
0200       @param CheckSetSmearFlag=false disables this check (e.g. for adjustments)
0201   */
0202   virtual void SetPz(const Double_t value, const bool CheckSetSmearFlag=true);
0203 
0204   /** Set azimuth &phi;. By default, marks it as smeared and checks that it wasn't before.
0205       @param CheckSetSmearFlag=false disables this check (e.g. for adjustments)
0206   */
0207   virtual void SetPhi(const Double_t value, const bool CheckSetSmearFlag=true);
0208 
0209   /** Set polar angle &theta;. By default, marks it as smeared and checks that it wasn't before.
0210       @param CheckSetSmearFlag=false disables this check (e.g. for adjustments)
0211   */
0212   virtual void SetTheta(const Double_t value, const bool CheckSetSmearFlag=true);
0213 
0214   /** Set particle id (pdg code). By default, marks it as smeared and checks that it wasn't before.
0215       @param CheckSetSmearFlag=false disables this check (e.g. for adjustments)
0216   */
0217   virtual void SetId(Int_t value, const bool CheckSetSmearFlag=true);
0218 
0219   /** Set the numSigma deviation of this particle
0220   */
0221   virtual void  SetNumSigma( const double d, const bool CheckSetSmearFlag=true);
0222 
0223   /** Set the numSigma deviation type (pi_k, k_p) of this particle
0224   */
0225   virtual void  SetNumSigmaType( const int i);
0226 
0227   virtual void SetSmeared( bool flag=true);  //< Particle smeared
0228   virtual void SetESmeared( bool flag=true); //< E smeared
0229   virtual void SetPSmeared( bool flag=true); //< Total momentum smeared
0230   virtual void SetPtSmeared( bool flag=true); //< P_t smeared
0231   virtual void SetPxSmeared( bool flag=true); //< P_x smeared
0232   virtual void SetPySmeared( bool flag=true); //< P_y smeared
0233   virtual void SetPzSmeared( bool flag=true); //< P_z smeared
0234   virtual void SetThetaSmeared( bool flag=true); //< &theta; smeared
0235   virtual void SetPhiSmeared( bool flag=true); //< &phi; smeared
0236   virtual void SetIdSmeared( bool flag=true); //< pdg Id smeared
0237   virtual void SetNumSigmaSmeared( bool flag=true); //< PID numSigma smeared
0238   
0239 
0240   /**
0241    Dummy one; just need to compile;
0242    */
0243   void Set4Vector(const TLorentzVector&) { }
0244 
0245   virtual void SetStatus(Int_t);
0246 
0247   virtual UShort_t GetParentIndex() const { return 0; }
0248 
0249   /**
0250    Prints the attributes of this particle to standard output.
0251    The output format is "status id px py pz E".
0252    */
0253   virtual void Print(Option_t* = "") const;
0254 
0255   /**
0256    Sets the origin coordinates.
0257    No-op, just required for compilation.
0258    */
0259   virtual void SetVertex(const TVector3&) { }
0260 
0261   /**
0262      Stores z in the ParticleS.K where K is the kinematic variable associated with kin.
0263   */
0264   virtual void SetVariable(const double z, const KinType kin);
0265 
0266   /**
0267      This dictates how the class deals with positive definite variables
0268      which have been smeared to negative values.
0269   */
0270   void HandleBogusValues( const KinType kin );
0271 
0272 
0273  protected:
0274 
0275   /** should always be true for a ParticleMCS
0276       This replaces the brittle mechanism of checking values against 0
0277       If false, it should indicate an old tree was used.
0278    */
0279   bool kParticleSmeared=false;
0280   bool kESmeared=false;
0281   bool kPSmeared=false;
0282   bool kPtSmeared=false;
0283   bool kPxSmeared=false;
0284   bool kPySmeared=false;
0285   bool kPzSmeared=false;
0286   bool kThetaSmeared=false;
0287   bool kPhiSmeared=false;
0288   bool kIdSmeared=false;
0289   bool kNumSigmaSmeared=false;
0290 
0291 
0292   UShort_t   status;      ///< Status code
0293   Int_t      id;          ///< PDG particle code
0294   Double32_t px;          ///< x component of particle momentum
0295   Double32_t py;          ///< y component of particle momentum
0296   Double32_t pz;          ///< z component of particle momentum
0297   Double32_t E;           ///< Energy of particle
0298   Double32_t pt;          ///< Transverse momentum of particle
0299   Double32_t p;           ///< Total momentum of particle
0300   Double32_t theta;       ///< Polar angle
0301   Double32_t phi;         ///< Azimuthal angle
0302 
0303   double  numSigma;       ///< PID: nSigma deviation
0304   int numSigmaType;       ///< PID: nSigma deviation type. pi_k == 1, k_p == 2. \TODO: This should be agreed upon and fixed better.
0305 
0306   ClassDef(Smear::ParticleMCS, 3)
0307 };
0308 
0309 
0310 }  // namespace Smear
0311 
0312 #endif  // INCLUDE_EICSMEAR_SMEAR_PARTICLEMCS_H_