EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Fun4AllInputManager.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Fun4AllInputManager.h
1 // Tell emacs that this is a C++ source
2 // -*- C++ -*-.
3 #ifndef FUN4ALL_FUN4ALLINPUTMANAGER_H
4 #define FUN4ALL_FUN4ALLINPUTMANAGER_H
5 
6 #include "Fun4AllBase.h"
7 #include "Fun4AllReturnCodes.h"
8 
9 #include <list>
10 #include <string>
11 #include <type_traits> // for __decay_and_strip<>::__type
12 #include <utility> // for make_pair, pair
13 #include <vector>
14 
15 class PHCompositeNode;
16 class SubsysReco;
17 class SyncObject;
18 class Fun4AllSyncManager;
19 
21 {
22  public:
23  ~Fun4AllInputManager() override;
24  virtual int fileopen(const std::string & /*filename*/) { return -1; }
25  virtual int fileclose() { return -1; }
26  virtual int run(const int /*nevents=0*/) { return -1; }
27  virtual int ReadInRunNode(PHCompositeNode * /*RunNode*/) { return -1; }
28  std::string FileName() const { return m_FileName; }
29  void FileName(const std::string &fn) { m_FileName = fn; }
30  virtual int GetSyncObject(SyncObject ** /*mastersync*/) { return 0; }
31  virtual int SyncIt(const SyncObject * /*mastersync*/) { return Fun4AllReturnCodes::SYNC_FAIL; }
32  virtual int BranchSelect(const std::string & /*branch*/, const int /*iflag*/) { return -1; }
33  virtual int setBranches() { return -1; } // publich bc needed by the sync manager
34  void Print(const std::string &what = "ALL") const override;
35  virtual int PushBackEvents(const int /*nevt*/) { return -1; }
36  // so people can use the skip they are used to instead of PushBackEvents
37  // with negative arg
38  virtual int skip(const int nevt) { return PushBackEvents(-nevt); }
39  virtual int NoSyncPushBackEvents(const int /*nevt*/) { return -1; }
40  int AddFile(const std::string &filename);
41  int AddListFile(const std::string &filename, const int do_it = 0);
42  int registerSubsystem(SubsysReco *subsystem);
43  virtual int RejectEvent();
44  void Repeat(const int i = -1) { m_Repeat = i; }
45  virtual void setSyncManager(Fun4AllSyncManager *master) { m_MySyncManager = master; }
46  virtual int ResetFileList();
47  virtual int ResetEvent() { return 0; }
48  virtual void SetRunNumber(const int runno) { m_MyRunNumber = runno; }
49  virtual int RunNumber() const { return m_MyRunNumber; }
50  void AddToFileOpened(const std::string &filename) { m_FileListOpened.push_back(filename); }
51  std::pair<std::list<std::string>::const_iterator, std::list<std::string>::const_iterator> FileOpenListBeginEnd() { return std::make_pair(m_FileListOpened.begin(), m_FileListOpened.end()); }
52  std::string InputNode() { return m_InputNode; }
53  void InputNode(const std::string &innode) { m_InputNode = innode; }
54  std::string TopNodeName() const { return m_TopNodeName; }
55  bool FileListEmpty() const { return m_FileList.empty(); }
56  virtual int IsOpen() const { return m_IsOpen; }
57  virtual int SkipForThisManager(const int /*nevents*/) { return 0; }
58  virtual int HasSyncObject() const { return 0; }
59 
60  protected:
61  Fun4AllInputManager(const std::string &name = "DUMMY", const std::string &nodename = "DST", const std::string &topnodename = "TOP");
62  void UpdateFileList();
63  int OpenNextFile();
64  void IsOpen(const int i) { m_IsOpen = i; }
66 
67  private:
69  int m_IsOpen;
70  int m_Repeat;
72  int m_InitRun;
73  std::vector<SubsysReco *> m_SubsystemsVector;
74  std::string m_InputNode;
75  std::string m_FileName;
76  std::string m_TopNodeName;
77  std::list<std::string> m_FileList;
78  std::list<std::string> m_FileListCopy;
79  std::list<std::string> m_FileListOpened; // all files which were opened during running
80 };
81 
82 #endif