Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-27 09:20:26

0001 #ifndef _PhotosParticle_h_included_
0002 #define _PhotosParticle_h_included_
0003 
0004 /**
0005  * @class PhotosParticle
0006  *
0007  * @brief Abstract base class for particle in the event. This class also
0008  * handles boosting.
0009  *
0010  * PhotosParticle is a Photos representation of a particle. It has virtual
0011  * getter and setter methods that need to be implemented by a derived class.
0012  * An example of this is PhotosHepMCParticle. In this way it provides an
0013  * interface to the information in the Event Record.
0014  * 
0015  * @author Nadia Davidson
0016  * @date 16 June 2008
0017  */
0018 
0019 #include <vector>
0020 #include "Photos.h"
0021 
0022 namespace Photospp
0023 {
0024 
0025 class PhotosParticle
0026 {
0027 public:
0028     /** Stable particle status */
0029     static const int STABLE=1;
0030 
0031     /** Decayed particle status */
0032     static const int DECAYED=2;
0033 
0034     /** History particle status */
0035     static const int HISTORY=3;
0036 
0037     /** X Axis */
0038     static const int X_AXIS=1;
0039 
0040     /** Y Axis */
0041     static const int Y_AXIS=2;
0042 
0043     /** Z Axis */
0044     static const int Z_AXIS=3;
0045 
0046     /** Z0 particle */
0047     static const int Z0 = 23;
0048 
0049     /** H particle */
0050     static const int HIGGS = 25;
0051 
0052     /** H0 particle */
0053     static const int HIGGS_H = 35;
0054 
0055     /** A0 particle */
0056     static const int HIGGS_A = 36;
0057 
0058     /** H+ particle */
0059     static const int HIGGS_PLUS = 37;
0060 
0061     /** H- particle */
0062     static const int HIGGS_MINUS = -37;
0063 
0064     /** W+ particle */
0065     static const int W_PLUS = 24;
0066 
0067     /** W- particle */
0068     static const int W_MINUS = -24;
0069 
0070     /** photon */
0071     static const int GAMMA = 22;
0072 
0073     /** tau+ particle */
0074     static const int TAU_PLUS = -15;
0075 
0076     /** tau- particle */
0077     static const int TAU_MINUS = 15;
0078 
0079     /** tau neutrino particle */
0080     static const int TAU_NEUTRINO = 16;
0081 
0082     /** tau antineutrino particle */
0083     static const int TAU_ANTINEUTRINO = -16;
0084 
0085     /** muon+ particle */
0086     static const int MUON_PLUS = -13;
0087 
0088     /** muon- particle */
0089     static const int MUON_MINUS = 13;
0090 
0091     /** muon neutrino particle */
0092     static const int MUON_NEUTRINO = 14;
0093 
0094     /** muon antineutrino particle */
0095     static const int MUON_ANTINEUTRINO = -14;
0096 
0097     /** e+ particle */
0098     static const int POSITRON = -11;
0099 
0100     /** e- particle */
0101     static const int ELECTRON = 11;
0102 
0103     /** e neutrino particle */
0104     static const int ELECTRON_NEUTRINO = 12;
0105 
0106     /** e antineutrino particle */
0107     static const int ELECTRON_ANTINEUTRINO = -12;
0108 
0109     /** up quark */
0110     static const int UP = 2;
0111 
0112     /** anti-up quark */
0113     static const int ANTIUP = -2;
0114 
0115     /** down quark */
0116     static const int DOWN = 1;
0117 
0118     /** anti-down quark */
0119     static const int ANTIDOWN = -1;
0120 
0121     /** All other particle types*/
0122     static const int OTHER = 0;
0123 
0124 public:
0125     virtual ~PhotosParticle(){};
0126 
0127     /** Return whether the particle has any chidren */
0128     bool hasDaughters();
0129 
0130     /** Traverse the event structure and find the final version
0131         of this particle which does not have a particle of it's own type
0132         as it's daughter. eg. Generally the final stable copy */
0133     PhotosParticle * findLastSelf();
0134 
0135     /** Traverse the event structure and find the first set of mothers
0136         which are not of the same type as this particle. */
0137     std::vector<PhotosParticle *> findProductionMothers();
0138 
0139     /** Return whole decay tree starting from this particle */
0140     std::vector<PhotosParticle *> getDecayTree();
0141 
0142     /** Transform this particles four momentum from the lab frome
0143         into the rest frame of the paramter PhotosParticle. */
0144     void boostToRestFrame(PhotosParticle * boost);
0145 
0146     /** Transform the four momentum of all the daughters recursively
0147         into the frame of the "particle" PhotosParticle. */
0148     void boostDaughtersToRestFrame(PhotosParticle * boost);
0149 
0150     /** Transform this particles four momentum from the rest frame of
0151         the paramter PhotosParticle, back into the lab frame. */
0152     void boostFromRestFrame(PhotosParticle * boost);
0153 
0154     /** Transform this particles four momentum from the lab frame to
0155         the rest frame of the parameter PhotosParticle. */
0156     void boostDaughtersFromRestFrame(PhotosParticle * boost);
0157 
0158     /** Do a Lorenz transformation along the Z axis. */
0159     void boostAlongZ(double pz, double e);
0160 
0161     /** rotate this particles 4-momentum by an angle phi from
0162         the axisis "axis" towards the axis "second_axis". */
0163     void rotate(int axis, double phi, int second_axis=Z_AXIS);
0164 
0165     /** rotate 4-momentum of daughters of this particle by an angle phi from
0166         the axisis "axis" towards the axis "second_axis". */
0167     void rotateDaughters(int axis, double phi, int second_axis=Z_AXIS);
0168 
0169     /** Returns the angle around the axis "axis" needed to rotate
0170         the four momenum is such a way that the non-Z component
0171         disappears and Z>0. This is used to in rotating the coordinate
0172         system into a frame with only a Z component before calling
0173         boostAlongZ(). */
0174     double getRotationAngle(int axis, int second_axis=Z_AXIS);
0175 
0176     /** Get scalar momentum */
0177     double getP();
0178 
0179     /** Get momentum component in the direction of "axis" (x,y,z) */
0180     double getP(int axis);
0181 
0182     /** Set momentum component in the direction of "axis" (x,y,z) */
0183     void  setP(int axis, double p_component);
0184 
0185     /** Get sqrt(e^2-p^2) */
0186     virtual double getVirtuality();
0187 
0188 public:
0189     /** check that the 4 momentum in conserved at the vertices producing
0190         and ending this particle */
0191     virtual bool checkMomentumConservation()=0;
0192 
0193     /** Returns the px component of the four vector */
0194     virtual double getPx()=0;
0195 
0196     /** Returns the py component of the four vector */
0197     virtual double getPy()=0;
0198 
0199     /** Returns the pz component of the four vector */
0200     virtual double getPz()=0;
0201 
0202     /** Returns the energy component of the four vector */
0203     virtual double getE()=0;
0204     
0205     /** Get the invariant mass from the event record*/
0206     virtual double getMass() = 0;
0207 
0208     /** Set the px component of the four vector */
0209     virtual void setPx( double px )=0;
0210 
0211     /** Set the px component of the four vector */
0212     virtual void setPy( double py )=0;
0213 
0214     /** Set the pz component of the four vector */
0215     virtual void setPz( double pz )=0;
0216 
0217     /** Set the energy component of the four vector */
0218     virtual void setE( double e )=0;
0219 
0220     /** Set the mothers of this particle via a vector of PhotosParticle */
0221     virtual void setMothers(std::vector<PhotosParticle*> mothers)=0;
0222 
0223     /** Set the daughters of this particle via a vector of PhotosParticle */
0224     virtual void setDaughters(std::vector<PhotosParticle*> daughters)=0;
0225 
0226     /** Add a new daughter to this particle */
0227     virtual void addDaughter(PhotosParticle* daughter)=0;
0228 
0229     /** Returns the mothers of this particle via a vector of PhotosParticle */
0230     virtual std::vector<PhotosParticle*> getMothers()=0;
0231 
0232     /** Returns the daughters of this particle via a vector of PhotosParticle */
0233     virtual std::vector<PhotosParticle*> getDaughters()=0;
0234 
0235     /** Returns all particles in the decay tree of this particle
0236         via a vector of PhotosParticle */
0237     virtual std::vector<PhotosParticle*> getAllDecayProducts()=0;
0238 
0239     /** Set the PDG ID code of this particle */
0240     virtual void setPdgID(int pdg_id)=0;
0241 
0242     /** Set the mass of this particle */
0243     virtual void setMass(double mass)=0;
0244 
0245     /** Set the status of this particle */
0246     virtual void setStatus(int status)=0;
0247 
0248     /** Get the PDG ID code of this particle */
0249     virtual int getPdgID()=0;
0250 
0251     /** Get the status of this particle */
0252     virtual int getStatus()=0;
0253 
0254     /** Get the barcode of this particle */
0255     virtual int getBarcode()=0;
0256 
0257     /** Create a new particle of the same type, with the given
0258         properties. The new particle bares no relations to this
0259         particle, but it provides a way of creating a intance of
0260         the derived class. eg. createNewParticle() is used inside
0261         filhep_() so that an eg. PhotosHepMCParticle is created without
0262         the method having explicit knowledge of the PhotosHepMCParticle
0263         class */
0264     virtual PhotosParticle * createNewParticle(int pdg_id, int status,
0265                                                double mass, double px,
0266                                                double py, double pz,
0267                                                double e)=0;
0268 
0269   /** Create history entry of this particle before modifications
0270       of PHOTOS. Implementation of this method depends strongly
0271       on the event record. */
0272   virtual void createHistoryEntry()=0;
0273   
0274     /** Create a self-decay vertex for this particle
0275         with 'out' being the outgoing particle in new vertex */
0276     virtual void createSelfDecayVertex(PhotosParticle *out)=0;
0277 
0278     /** Print some information about this particle to standard output */
0279     virtual void print()=0;
0280 };
0281 
0282 } // namespace Photospp
0283 #endif