PhotosHepMCParticle.h

00001 #ifndef _PhotosHepMCParticle_h_included_
00002 #define _PhotosHepMCParticle_h_included_
00003 
00004 /**
00005  * @class PhotosHepMCParticle
00006  *
00007  * @brief Interface to HepMC::GenParticle objects
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 a HepMC::GenParticle object.
00013  *
00014  * @author Nadia Davidson
00015  * @date 17 June 2008
00016  *
00017  * This code is licensed under GNU General Public Licence.
00018  * For more informations, see: http://www.gnu.org/licenses/
00019  */
00020 
00021 #include <vector>
00022 
00023 #include "HepMC/GenParticle.h"
00024 #include "PhotosParticle.h"
00025 
00026 using namespace std;
00027 
00028 namespace Photospp
00029 {
00030 
00031 class PhotosHepMCParticle: public PhotosParticle{
00032 
00033  public:
00034   /** General constructor */
00035   PhotosHepMCParticle();
00036 
00037   /** Constructor which keeps a pointer to the HepMC::GenParticle*/
00038   PhotosHepMCParticle(HepMC::GenParticle * particle); 
00039 
00040   /** Constructor which creates a new HepMC::GenParticle and
00041        sets the properties pdg_id, statu and mass. */
00042   PhotosHepMCParticle(int pdg_id, int status, double mass);
00043 
00044   /** Destructor */
00045   ~PhotosHepMCParticle();
00046   
00047   /** return the HepMC::GenParticle */
00048   HepMC::GenParticle * getHepMC();
00049 
00050   /** Set the mothers of this particle via a vector of PhotosParticle*/
00051   void setMothers(std::vector<PhotosParticle*> mothers);
00052 
00053   /** Set the daughters of this particle via a vector of PhotosParticle*/
00054   void setDaughters(std::vector<PhotosParticle*> daughters);
00055 
00056   /** Add a new daughter to the end vertex of this particle */ 
00057   void addDaughter(PhotosParticle* daughter);
00058 
00059   /** Returns the mothers of this particle via a vector of PhotosParticle */
00060   std::vector<PhotosParticle*> getMothers();
00061 
00062   /** Returns the daughters of this particle via a vector of PhotosParticle
00063       IMPORTANT: this method will remeber list from the first call. Particles
00064       (e.g. photons) added later will be ignored */
00065   std::vector<PhotosParticle*> getDaughters();
00066 
00067   /** Returns all particles in the decay tree of this particle
00068       via a vector of PhotosParticle */
00069   std::vector<PhotosParticle*> getAllDecayProducts();
00070 
00071   /** Set the PDG ID code of this particle */
00072   void setPdgID(int pdg_id);
00073 
00074   /** Set the status of this particle */
00075   void setStatus(int statu);
00076 
00077   /** Set the mass of this particle */
00078   void setMass(double mass);
00079 
00080   /** Get the PDG ID code of this particle */
00081   int getPdgID();
00082 
00083   /** Get the status of this particle */
00084   int getStatus();
00085 
00086   /** Get the barcode of this particle */
00087   int getBarcode();
00088 
00089   /** check that the 4 momentum in conserved at the vertices producing
00090       and ending this particle */
00091   bool checkMomentumConservation();
00092 
00093   /** Create a new particle of type PhotosHepMCParticle, with the given
00094       properties. The new particle bares no relations to this
00095       particle, but it provides a way of creating a instance of
00096       this derived class. eg. createNewParticle() is used inside
00097       filhep_() so that a PhotosHepMCParticle can be created without
00098       the method having explicit knowledge of the PhotosHepMCParticle 
00099       class */
00100   PhotosHepMCParticle * createNewParticle(int pdg_id, int status, double mass,
00101                                        double px, double py,
00102                                        double pz, double e);
00103 
00104   /** Create history entry for HepMC event record.
00105       Creates copy of this particle with status = 3 */
00106   void createHistoryEntry();
00107 
00108   /** Create a self-decay vertex for this particle
00109       with 'out' being the outgoing particle in new vertex */
00110   void createSelfDecayVertex(PhotosParticle *out);
00111 
00112   /** Print some information about this particle to standard output */
00113   void print();
00114 
00115   /** Returns the px component of the four vector*/
00116   double getPx();
00117 
00118   /** Returns the py component of the four vector */
00119   double getPy();
00120 
00121   /** Returns the pz component of the four vector */
00122   double getPz();
00123 
00124   /** Returns the energy component of the four vector */
00125   double getE();
00126 
00127   /** Returns the mass taken from event record */
00128   double getMass();
00129 
00130   /** Set the px component of the four vector */
00131   void setPx( double px );
00132 
00133   /** Set the px component of the four vector */
00134   void setPy( double py );
00135 
00136   /** Set the pz component of the four vector */
00137   void setPz( double pz );
00138 
00139   /** Set the energy component of the four vector */
00140   void setE( double e );
00141 
00142  private:
00143   /** Internal function used to clear particles from the vector */
00144   void clear(std::vector<PhotosParticle*> v);
00145 
00146   /** A pointer to the HepMC::GenParticle particle */
00147   HepMC::GenParticle * m_particle;
00148 
00149   /** A vector of this particles mothers */
00150   std::vector<PhotosParticle*> m_mothers;
00151 
00152   /** A vector of this particles daughters */
00153   std::vector<PhotosParticle*> m_daughters;
00154 
00155   /** A vector of all decay products of this particle */
00156   std::vector<PhotosParticle*> m_decay_products;
00157 
00158   /** list to keep track of new particles which have been
00159       created from this one, so we can call their destructor later */
00160   std::vector<PhotosParticle*> m_created_particles;
00161 
00162 };
00163 
00164 } // namespace Photospp
00165 #endif  
00166 
Generated on Sun Oct 20 20:23:56 2013 for C++InterfacetoPHOTOS by  doxygen 1.6.3