ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Fun4AllHepMCInputManager.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Fun4AllHepMCInputManager.h
1 #ifndef PHHEPMC_FUN4ALLHEPMCINPUTMANAGER_H
2 #define PHHEPMC_FUN4ALLHEPMCINPUTMANAGER_H
3 
4 #include "PHHepMCGenHelper.h"
5 
8 
9 #include <boost/iostreams/filtering_streambuf.hpp>
10 
11 #include <fstream>
12 #include <string>
13 #include <utility> // for swap
14 #include <vector>
15 
16 class PHCompositeNode;
17 class SyncObject;
18 
19 // forward declaration of classes in namespace
20 namespace HepMC
21 {
22  class IO_GenEvent;
23  class GenEvent;
24 } // namespace HepMC
25 
27 {
28  public:
29  Fun4AllHepMCInputManager(const std::string &name = "DUMMY", const std::string &nodename = "DST", const std::string &topnodename = "TOP");
30  ~Fun4AllHepMCInputManager() override;
31  int fileopen(const std::string &filenam) override;
32  int fileclose() override;
33  int run(const int nevents = 0) override;
34  int ResetEvent() override;
35  void ReadOscar(const int i) { m_ReadOscarFlag = i; }
36  int ReadOscar() const { return m_ReadOscarFlag; }
37  void Print(const std::string &what = "ALL") const override;
38  int PushBackEvents(const int i) override;
39 
40  // Effectivly turn off the synchronization checking
41  //
42  int SyncIt(const SyncObject * /*mastersync*/) override { return Fun4AllReturnCodes::SYNC_OK; }
43  int GetSyncObject(SyncObject ** /*mastersync*/) override { return Fun4AllReturnCodes::SYNC_NOOBJECT; }
44  int NoSyncPushBackEvents(const int nevt) override { return PushBackEvents(nevt); }
45  HepMC::GenEvent *ConvertFromOscar();
46 
47  int SkipForThisManager(const int nevents) override { return PushBackEvents(-nevents); }
48  int MyCurrentEvent(const unsigned int index = 0) const;
49 
50  protected:
51  HepMC::GenEvent *evt = nullptr;
52 
53  int events_total = 0;
54  int events_thisfile = 0;
56 
57  HepMC::IO_GenEvent *ascii_in = nullptr;
58 
59  std::string m_HepMCTmpFile;
60 
61  private:
63 
64  // some pointers for use in decompression handling
65  std::ifstream *filestream = nullptr; // holds compressed filestream
66  std::istream *unzipstream = nullptr; // feed into HepMc
67 
68  int m_ReadOscarFlag = 0;
69 
70  std::vector<int> m_MyEvent;
71 
72  boost::iostreams::filtering_streambuf<boost::iostreams::input> zinbuffer;
73 
74  std::ifstream theOscarFile;
75 
76  std::string filename;
77  std::string topNodeName;
78 };
79 
80 #endif /* PHHEPMC_FUN4ALLHEPMCINPUTMANAGER_H */