PhotosHEPEVTEvent.h

00001 #ifndef _PhotosHEPEVTEvent_h_included_
00002 #define _PhotosHEPEVTEvent_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  * PhotosEvent. In this way it provides an
00011  * interface between the generic PhotosEvent 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 "PhotosEvent.h"
00020 #include "PhotosParticle.h"
00021 #include "PhotosHEPEVTParticle.h"
00022 
00023 namespace Photospp
00024 {
00025 
00026 // Uncomment this line to use interface to common block HEPEVT
00027 // But first be sure about suitable for you value of NMXHEP
00028 // and whether phep, vhep should be declared float or double
00029 //#define USE_HEPEVT_INTERFACE
00030 
00031 #ifdef USE_HEPEVT_INTERFACE
00032 
00033 // Change this value to match HEPEVT size
00034 const int NMXHEP = 10000;
00035 
00036 extern "C" struct {
00037   int    nevhep;            // serial number
00038   int    nhep;              // number of particles
00039   int    isthep[NMXHEP];    // status code
00040   int    idhep [NMXHEP];    // particle PDG ID
00041   int    jmohep[NMXHEP][2]; // parent particles
00042   int    jdahep[NMXHEP][2]; // childreen particles
00043   double phep  [NMXHEP][5]; // four-momentum, mass [GeV]
00044   double vhep  [NMXHEP][4]; // vertex [mm]
00045 } hepevt_;
00046 
00047 #endif
00048 
00049 class PhotosHEPEVTParticle;
00050 
00051 class PhotosHEPEVTEvent : public PhotosEvent {
00052 
00053  public:
00054 
00055   /** Default destructor */
00056   ~PhotosHEPEVTEvent();
00057 
00058   /** Default constructor */
00059   PhotosHEPEVTEvent();
00060 
00061   /** Add particle at the end of event record */
00062   void addParticle(PhotosHEPEVTParticle *p);
00063 
00064   /** Get particle at index 'i' */
00065   PhotosHEPEVTParticle *getParticle(int i);
00066 
00067   /** Set particle at index 'i' */
00068   void setParticle(int i, PhotosHEPEVTParticle *p);
00069 
00070   /** Get higher-most index of the particles in event (nhep) */
00071   int getParticleCount();
00072 
00073   /** Get an unfiltered list of particles from the event record */
00074   std::vector<PhotosParticle*> getParticleList();
00075 
00076   /** Print out list of particles in the event */
00077   void print();
00078   
00079   /** Remove all particles from the event */
00080   void clear();
00081 
00082 #ifdef USE_HEPEVT_INTERFACE
00083   /** Fill PhotosHEPEVTEvent from HEPEVT common block */
00084   static void read_event_from_HEPEVT(PhotosHEPEVTEvent *evt);
00085   
00086   /** Write to HEPEVT common block content of PhotosHEPEVTEvent */
00087   static void write_event_to_HEPEVT(PhotosHEPEVTEvent *evt);
00088 #endif
00089 
00090  private:
00091 
00092   /** List of all particles */
00093   std::vector<PhotosHEPEVTParticle*> particle_list;
00094 };
00095 
00096 } // namespace Photospp
00097 #endif
00098 
Generated on Sun Oct 20 20:23:56 2013 for C++InterfacetoPHOTOS by  doxygen 1.6.3