Back to home page

EIC code displayed by LXR

 
 

    


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

0001 #ifndef _PhotosHepMC3Particle_h_included_
0002 #define _PhotosHepMC3Particle_h_included_
0003 
0004 /**
0005  * @class PhotosHepMC3Particle
0006  *
0007  * @brief Interface to GenParticle objects
0008  *
0009  * This class implements the virtual methods of
0010  * PhotosParticle. In this way it provides an
0011  * interface between the generic PhotosParticle class
0012  * and a GenParticle object.
0013  *
0014  * @date 26 Jan 2020
0015  *
0016  * This code is licensed under GNU General Public Licence.
0017  * For more informations, see: http://www.gnu.org/licenses/
0018  */
0019 
0020 #include <vector>
0021 
0022 #include "HepMC3/GenParticle.h"
0023 #include "PhotosParticle.h"
0024 
0025 namespace Photospp
0026 {
0027 using namespace HepMC3;
0028 class PhotosHepMC3Particle: public PhotosParticle{
0029 
0030  public:
0031   /** General constructor */
0032   PhotosHepMC3Particle();
0033 
0034   /** Constructor which keeps a pointer to the GenParticle*/
0035   PhotosHepMC3Particle(GenParticlePtr particle);
0036 
0037   /** Constructor which creates a new GenParticle and
0038        sets the properties pdg_id, statu and mass. */
0039   PhotosHepMC3Particle(int pdg_id, int status, double mass);
0040 
0041   /** Destructor */
0042   ~PhotosHepMC3Particle();
0043 
0044   /** return the GenParticlePtr */
0045   GenParticlePtr getHepMC3();
0046 
0047   /** Set the mothers of this particle via a vector of PhotosParticle*/
0048   void setMothers(std::vector<PhotosParticle*> mothers);
0049 
0050   /** Set the daughters of this particle via a vector of PhotosParticle*/
0051   void setDaughters(std::vector<PhotosParticle*> daughters);
0052 
0053   /** Add a new daughter to the end vertex of this particle */
0054   void addDaughter(PhotosParticle* daughter);
0055 
0056   /** Returns the mothers of this particle via a vector of PhotosParticle */
0057   std::vector<PhotosParticle*> getMothers();
0058 
0059   /** Returns the daughters of this particle via a vector of PhotosParticle
0060       IMPORTANT: this method will remeber list from the first call. Particles
0061       (e.g. photons) added later will be ignored */
0062   std::vector<PhotosParticle*> getDaughters();
0063 
0064   /** Returns all particles in the decay tree of this particle
0065       via a vector of PhotosParticle */
0066   std::vector<PhotosParticle*> getAllDecayProducts();
0067 
0068   /** Set the PDG ID code of this particle */
0069   void setPdgID(int pdg_id);
0070 
0071   /** Set the status of this particle */
0072   void setStatus(int statu);
0073 
0074   /** Set the mass of this particle */
0075   void setMass(double mass);
0076 
0077   /** Get the PDG ID code of this particle */
0078   int getPdgID();
0079 
0080   /** Get the status of this particle */
0081   int getStatus();
0082 
0083   /** Get the barcode of this particle */
0084   int getBarcode();
0085 
0086   /** check that the 4 momentum in conserved at the vertices producing
0087       and ending this particle */
0088   bool checkMomentumConservation();
0089 
0090   /** Create a new particle of type PhotosHepMC3Particle, with the given
0091       properties. The new particle bares no relations to this
0092       particle, but it provides a way of creating a instance of
0093       this derived class. eg. createNewParticle() is used inside
0094       filhep_() so that a PhotosHepMC3Particle can be created without
0095       the method having explicit knowledge of the PhotosHepMC3Particle
0096       class */
0097   PhotosHepMC3Particle * createNewParticle(int pdg_id, int status, double mass,
0098                                        double px, double py,
0099                                        double pz, double e);
0100 
0101   /** Create history entry for HepMC event record.
0102       Creates copy of this particle with status = 3 */
0103   void createHistoryEntry();
0104 
0105   /** Create a self-decay vertex for this particle
0106       with 'out' being the outgoing particle in new vertex */
0107   void createSelfDecayVertex(PhotosParticle *out);
0108 
0109   /** Print some information about this particle to standard output */
0110   void print();
0111 
0112   /** Returns the px component of the four vector*/
0113   double getPx();
0114 
0115   /** Returns the py component of the four vector */
0116   double getPy();
0117 
0118   /** Returns the pz component of the four vector */
0119   double getPz();
0120 
0121   /** Returns the energy component of the four vector */
0122   double getE();
0123 
0124   /** Returns the mass taken from event record */
0125   double getMass();
0126 
0127   /** Set the px component of the four vector */
0128   void setPx( double px );
0129 
0130   /** Set the px component of the four vector */
0131   void setPy( double py );
0132 
0133   /** Set the pz component of the four vector */
0134   void setPz( double pz );
0135 
0136   /** Set the energy component of the four vector */
0137   void setE( double e );
0138 
0139  private:
0140   /** Internal function used to clear particles from the vector */
0141   void clear(std::vector<PhotosParticle*> v);
0142 
0143   /** A pointer to the GenParticle particle */
0144   GenParticlePtr m_particle;
0145 
0146   /** A vector of this particles mothers */
0147   std::vector<PhotosParticle*> m_mothers;
0148 
0149   /** A vector of this particles daughters */
0150   std::vector<PhotosParticle*> m_daughters;
0151 
0152   /** A vector of all decay products of this particle */
0153   std::vector<PhotosParticle*> m_decay_products;
0154 
0155   /** list to keep track of new particles which have been
0156       created from this one, so we can call their destructor later */
0157   std::vector<PhotosParticle*> m_created_particles;
0158 
0159 };
0160 
0161 } // namespace Photospp
0162 #endif