Back to home page

EIC code displayed by LXR

 
 

    


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

0001 #ifndef _PhotosHEPEVTParticle_h_included_
0002 #define _PhotosHEPEVTParticle_h_included_
0003 
0004 /**
0005  * @class PhotosHEPEVTParticle
0006  *
0007  * @brief Single particle of HEPEVT event record
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 information stored in HEPEVT event record.
0013  *
0014  * @author Tomasz Przedzinski
0015  * @date 24 November 2011
0016  */
0017 
0018 #include <iostream>
0019 #include <vector>
0020 #include <cmath>
0021 #include <cstdio>
0022 
0023 #include "Photos.h"
0024 #include "PhotosParticle.h"
0025 #include "PhotosHEPEVTEvent.h"
0026 
0027 namespace Photospp
0028 {
0029 
0030 class PhotosHEPEVTEvent;
0031 
0032 class PhotosHEPEVTParticle: public PhotosParticle {
0033 
0034  public:
0035   /** Default destructor */
0036   ~PhotosHEPEVTParticle();
0037 
0038   /** Default constructor */
0039   PhotosHEPEVTParticle(int pdgid, int status, double px, double py, double pz, double e, double m, int ms, int me, int ds, int de);
0040 
0041   /** Add a new daughter to this particle */
0042   void addDaughter(PhotosParticle* daughter);
0043 
0044   /** Set the mothers of this particle via a vector of PhotosParticle*/
0045   void setMothers(std::vector<PhotosParticle*> mothers);
0046 
0047   /** Set the daughters of this particle via a vector of PhotosParticle*/
0048   void setDaughters(std::vector<PhotosParticle*> daughters);
0049 
0050   /** Returns the mothers of this particle via a vector of PhotosParticle */
0051   std::vector<PhotosParticle*> getMothers();
0052 
0053   /** Returns the daughters of this particle via a vector of PhotosParticle */
0054   std::vector<PhotosParticle*> getDaughters();
0055 
0056   /** Returns all particles in the decay tree of this particle
0057       via a vector of PhotosParticle */
0058   std::vector<PhotosParticle*> getAllDecayProducts();
0059 
0060   /** Check that the 4 momentum in conserved in the decay of this particle */
0061   bool checkMomentumConservation();
0062 
0063   /** Creates a new particle of type PhotosHEPEVTParticle, with the given
0064       properties. The new particle bares no relations to this 
0065       particle, but `this particle' provides only a way of creating an instance of
0066       this derived class. eg. createNewParticle() is used inside
0067       filhep_() so that a PhotosHEPEVTParticle can be created without
0068       the method having explicit knowledge of the PhotosHEPEVTParticle
0069       class */
0070   PhotosHEPEVTParticle * createNewParticle(int pdg_id, int status, double mass,
0071                                           double px, double py,
0072                                           double pz, double e);
0073 
0074   /** Creating history entries not implemented in HEPEVT */
0075   void createHistoryEntry();
0076 
0077   /** Create a self-decay vertex for this particle
0078       with 'out' being the outgoing particle in new vertex */
0079   void createSelfDecayVertex(PhotosParticle *out);
0080 
0081   /** Check if particle 'p' is daughter of this particle */
0082   bool isDaughterOf(PhotosHEPEVTParticle *p);
0083 
0084   /** Check if particle 'p' is mother of this particle */
0085   bool isMotherOf  (PhotosHEPEVTParticle *p);
0086 
0087   /** Print information on this particle into standard output */
0088   void print();
0089 
0090   /** Set the PDG ID code of this particle */
0091   void setPdgID(int pdg_id);
0092 
0093   /** Set the status of this particle */
0094   void setStatus(int statu);
0095 
0096   /** Set the mass of this particle */
0097   void setMass(double mass);
0098 
0099   /** Get the PDG ID code of this particle */
0100   int getPdgID();
0101 
0102   /** Get the status of this particle */
0103   int getStatus();
0104 
0105   /** Get the mass stored (i.e. not calculated from four vector) at generation step */
0106   double getMass();
0107 
0108   /** Returns the px component of the four vector*/
0109   double getPx();
0110 
0111   /** Returns the py component of the four vector */
0112   double getPy();
0113 
0114   /** Returns the pz component of the four vector */
0115   double getPz();
0116 
0117   /** Returns the energy component of the four vector */
0118   double getE();
0119 
0120   /** Set the px component of the four vector */
0121   void setPx( double px );
0122 
0123   /** Set the px component of the four vector */
0124   void setPy( double py );
0125 
0126   /** Set the pz component of the four vector */
0127   void setPz( double pz );
0128 
0129   /** Set the energy component of the four vector */
0130   void setE( double e );
0131 
0132   /** Get the barcode (position in list) of this particle */
0133   int getBarcode();
0134 
0135   /** Set barcode (position in  list) of this particle */
0136   void setBarcode(int barcode);
0137 
0138   /** Set event of this particle */
0139   void setEvent(PhotosHEPEVTEvent *event);
0140   
0141   /** Get index of first mother */
0142   int getFirstMotherIndex();
0143   
0144   /** Get index of second mother */
0145   int getSecondMotherIndex();
0146 
0147   /** Get index of first daughter */
0148   int getDaughterRangeStart();
0149 
0150   /** Get index of last daughter */
0151   int getDaughterRangeEnd();  
0152 
0153 private:
0154 
0155   /** Set index of first daughter */
0156   void setDaughterRangeStart(int i) { m_daughter_start=i; }
0157   
0158   /** Set index of last daughter */
0159   void setDaughterRangeEnd(int i)   { m_daughter_end  =i; }
0160 
0161   /** Event from which this particle is taken */
0162   PhotosHEPEVTEvent *m_event;
0163 
0164   /** Position in the event record */
0165   int m_barcode;
0166 
0167   /** Indexes of mothers (-1 if do not have mothers) */
0168   int m_first_mother, m_second_mother;
0169 
0170   /** Range of indexes of daughters (-1 if do not have daughters) */
0171   int m_daughter_start, m_daughter_end;
0172 
0173   /** PDG ID */
0174   int m_pdgid;
0175 
0176   /** Status (stable, decayed) */
0177   int m_status;
0178 
0179   /** Momentum */
0180   double m_px, m_py, m_pz, m_e;
0181 
0182   /** Mass saved at generation step */
0183   double m_generated_mass;
0184 
0185   /** List of created particles - if they are not in the event, they
0186       will be deleted when no longer needed */
0187   vector<PhotosHEPEVTParticle*> cache;
0188 };
0189 
0190 } // namespace Photospp
0191 #endif
0192