Back to home page

EIC code displayed by LXR

 
 

    


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

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