00001 #ifndef Input_HepMCFileReader_h
00002 #define Input_HepMCFileReader_h
00003
00004
00005
00020 #include <vector>
00021 #include <map>
00022
00023
00024 namespace HepMC {
00025 class IO_BaseClass;
00026 class GenEvent;
00027 class GenParticle;
00028 }
00029
00030
00031 class HepMCFileReader {
00032
00033 protected:
00034 HepMCFileReader();
00035
00036 public:
00037 virtual ~HepMCFileReader();
00038 virtual void initialize(const std::string &filename, bool useExtendedAscii);
00039 inline bool isInitialized() const;
00040
00041 virtual bool setEvent(int event);
00042 virtual bool readCurrentEvent();
00043 virtual bool printHepMcEvent() const;
00044 HepMC::GenEvent *fillCurrentEventData();
00045
00046
00047
00048 void printEvent() const;
00049
00050
00051
00052 virtual void getStatsFromTuple(int &mo1, int &mo2, int &da1, int &da2,
00053 int &status, int &pid, int j) const;
00054 virtual void ReadStats();
00055
00056 static HepMCFileReader *instance();
00057
00058 private:
00059
00060 HepMC::GenEvent *evt_;
00061 HepMC::IO_BaseClass *input_;
00062
00063 static HepMCFileReader *instance_;
00064
00065 int rdstate() const;
00066
00067
00068 std::vector<HepMC::GenParticle*> index_to_particle;
00069 std::map<HepMC::GenParticle*,int> particle_to_index;
00070
00071 int find_in_map(const std::map<HepMC::GenParticle*,int>& m,
00072 HepMC::GenParticle *p) const;
00073 };
00074
00075
00076 bool HepMCFileReader::isInitialized() const
00077 {
00078 return input_ != 0;
00079 }
00080
00081 #endif