Analysis Software
Documentation for sPHENIX simulation 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 <vector>
14 
15 class PHCompositeNode;
16 class SyncObject;
17 
18 // forward declaration of classes in namespace
19 namespace HepMC
20 {
21  class IO_GenEvent;
22  class GenEvent;
23 } // namespace HepMC
24 
26 {
27  public:
28  Fun4AllHepMCInputManager(const std::string &name = "DUMMY", const std::string &nodename = "DST", const std::string &topnodename = "TOP");
29  ~Fun4AllHepMCInputManager() override;
30  int fileopen(const std::string &filenam) override;
31 // cppcheck-suppress virtualCallInConstructor
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 
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 
78 };
79 
80 #endif /* PHHEPMC_FUN4ALLHEPMCINPUTMANAGER_H */