PhotosHEPEVTParticle.h

00001 #ifndef _PhotosHEPEVTParticle_h_included_
00002 #define _PhotosHEPEVTParticle_h_included_
00003 
00004 /**
00005  * @class PhotosHEPEVTParticle
00006  *
00007  * @brief Single particle of HEPEVT event record
00008  *
00009  * This class implements the virtual methods of
00010  * PhotosParticle. In this way it provides an
00011  * interface between the generic PhotosParticle class
00012  * and information stored in HEPEVT event record.
00013  *
00014  * @author Tomasz Przedzinski
00015  * @date 24 November 2011
00016  */
00017 
00018 #include <iostream>
00019 #include <vector>
00020 #include <cmath>
00021 #include <cstdio>
00022 
00023 #include "Photos.h"
00024 #include "PhotosParticle.h"
00025 #include "PhotosHEPEVTEvent.h"
00026 
00027 namespace Photospp
00028 {
00029 
00030 class PhotosHEPEVTEvent;
00031 
00032 class PhotosHEPEVTParticle: public PhotosParticle {
00033 
00034  public:
00035   /** Default destructor */
00036   ~PhotosHEPEVTParticle();
00037 
00038   /** Default constructor */
00039   PhotosHEPEVTParticle(int pdgid, int status, double px, double py, double pz, double e, double m, int ms, int me, int ds, int de);
00040 
00041   /** Add a new daughter to this particle */
00042   void addDaughter(PhotosParticle* daughter);
00043 
00044   /** Set the mothers of this particle via a vector of PhotosParticle*/
00045   void setMothers(std::vector<PhotosParticle*> mothers);
00046 
00047   /** Set the daughters of this particle via a vector of PhotosParticle*/
00048   void setDaughters(std::vector<PhotosParticle*> daughters);
00049 
00050   /** Returns the mothers of this particle via a vector of PhotosParticle */
00051   std::vector<PhotosParticle*> getMothers();
00052 
00053   /** Returns the daughters of this particle via a vector of PhotosParticle */
00054   std::vector<PhotosParticle*> getDaughters();
00055 
00056   /** Returns all particles in the decay tree of this particle
00057       via a vector of PhotosParticle */
00058   std::vector<PhotosParticle*> getAllDecayProducts();
00059 
00060   /** Check that the 4 momentum in conserved in the decay of this particle */
00061   bool checkMomentumConservation();
00062 
00063   /** Creates a new particle of type PhotosHEPEVTParticle, with the given
00064       properties. The new particle bares no relations to this 
00065       particle, but `this particle' provides only a way of creating an instance of
00066       this derived class. eg. createNewParticle() is used inside
00067       filhep_() so that a PhotosHEPEVTParticle can be created without
00068       the method having explicit knowledge of the PhotosHEPEVTParticle
00069       class */
00070   PhotosHEPEVTParticle * createNewParticle(int pdg_id, int status, double mass,
00071                                           double px, double py,
00072                                           double pz, double e);
00073 
00074   /** Creating history entries not implemented in HEPEVT */
00075   void createHistoryEntry();
00076 
00077   /** Create a self-decay vertex for this particle
00078       with 'out' being the outgoing particle in new vertex */
00079   void createSelfDecayVertex(PhotosParticle *out);
00080 
00081   /** Check if particle 'p' is daughter of this particle */
00082   bool isDaughterOf(PhotosHEPEVTParticle *p);
00083 
00084   /** Check if particle 'p' is mother of this particle */
00085   bool isMotherOf  (PhotosHEPEVTParticle *p);
00086 
00087   /** Print information on this particle into standard output */
00088   void print();
00089 
00090   /** Set the PDG ID code of this particle */
00091   void setPdgID(int pdg_id);
00092 
00093   /** Set the status of this particle */
00094   void setStatus(int statu);
00095 
00096   /** Set the mass of this particle */
00097   void setMass(double mass);
00098 
00099   /** Get the PDG ID code of this particle */
00100   int getPdgID();
00101 
00102   /** Get the status of this particle */
00103   int getStatus();
00104 
00105   /** Get the mass stored (i.e. not calculated from four vector) at generation step */
00106   double getMass();
00107 
00108   /** Returns the px component of the four vector*/
00109   double getPx();
00110 
00111   /** Returns the py component of the four vector */
00112   double getPy();
00113 
00114   /** Returns the pz component of the four vector */
00115   double getPz();
00116 
00117   /** Returns the energy component of the four vector */
00118   double getE();
00119 
00120   /** Set the px component of the four vector */
00121   void setPx( double px );
00122 
00123   /** Set the px component of the four vector */
00124   void setPy( double py );
00125 
00126   /** Set the pz component of the four vector */
00127   void setPz( double pz );
00128 
00129   /** Set the energy component of the four vector */
00130   void setE( double e );
00131 
00132   /** Get the barcode (position in list) of this particle */
00133   int getBarcode();
00134 
00135   /** Set barcode (position in  list) of this particle */
00136   void setBarcode(int barcode);
00137 
00138   /** Set event of this particle */
00139   void setEvent(PhotosHEPEVTEvent *event);
00140   
00141   /** Get index of first mother */
00142   int getFirstMotherIndex();
00143   
00144   /** Get index of second mother */
00145   int getSecondMotherIndex();
00146 
00147   /** Get index of first daughter */
00148   int getDaughterRangeStart();
00149 
00150   /** Get index of last daughter */
00151   int getDaughterRangeEnd();  
00152 
00153 private:
00154 
00155   /** Set index of first daughter */
00156   void setDaughterRangeStart(int i) { m_daughter_start=i; }
00157   
00158   /** Set index of last daughter */
00159   void setDaughterRangeEnd(int i)   { m_daughter_end  =i; }
00160 
00161   /** Event from which this particle is taken */
00162   PhotosHEPEVTEvent *m_event;
00163 
00164   /** Position in the event record */
00165   int m_barcode;
00166 
00167   /** Indexes of mothers (-1 if do not have mothers) */
00168   int m_first_mother, m_second_mother;
00169 
00170   /** Range of indexes of daughters (-1 if do not have daughters) */
00171   int m_daughter_start, m_daughter_end;
00172 
00173   /** PDG ID */
00174   int m_pdgid;
00175 
00176   /** Status (stable, decayed) */
00177   int m_status;
00178 
00179   /** Momentum */
00180   double m_px, m_py, m_pz, m_e;
00181 
00182   /** Mass saved at generation step */
00183   double m_generated_mass;
00184 
00185   /** List of created particles - if they are not in the event, they
00186       will be deleted when no longer needed */
00187   vector<PhotosHEPEVTParticle*> cache;
00188 };
00189 
00190 } // namespace Photospp
00191 #endif
00192 
Generated on Sun Oct 20 20:23:56 2013 for C++InterfacetoPHOTOS by  doxygen 1.6.3