Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:16:45

0001 // Tell emacs that this is a C++ source
0002 //  -*- C++ -*-.
0003 #ifndef FUN4ALL_FUN4ALLINPUTMANAGER_H
0004 #define FUN4ALL_FUN4ALLINPUTMANAGER_H
0005 
0006 #include "Fun4AllBase.h"
0007 #include "Fun4AllReturnCodes.h"
0008 
0009 #include <list>
0010 #include <string>
0011 #include <type_traits>  // for __decay_and_strip<>::__type
0012 #include <utility>      // for make_pair, pair
0013 #include <vector>
0014 
0015 class PHCompositeNode;
0016 class SubsysReco;
0017 class SyncObject;
0018 class Fun4AllSyncManager;
0019 
0020 class Fun4AllInputManager : public Fun4AllBase
0021 {
0022  public:
0023   ~Fun4AllInputManager() override;
0024   virtual int fileopen(const std::string & /*filename*/) { return -1; }
0025   virtual int fileclose() { return -1; }
0026   virtual int run(const int /*nevents=0*/) { return -1; }
0027   virtual int ReadInRunNode(PHCompositeNode * /*RunNode*/) { return -1; }
0028   virtual int GetSyncObject(SyncObject ** /*mastersync*/) { return 0; }
0029   virtual int SyncIt(const SyncObject * /*mastersync*/) { return Fun4AllReturnCodes::SYNC_FAIL; }
0030   virtual int BranchSelect(const std::string & /*branch*/, const int /*iflag*/) { return -1; }
0031   virtual int setBranches() { return -1; }  // publich bc needed by the sync manager
0032   virtual int IsOpen() const { return m_IsOpen; }
0033   virtual int SkipForThisManager(const int /*nevents*/) { return 0; }
0034   virtual int HasSyncObject() const { return 0; }
0035   virtual std::string GetString(const std::string &) const { return ""; }
0036   virtual int PushBackEvents(const int /*nevt*/) { return -1; }
0037   virtual int RejectEvent();
0038   // so people can use the skip they are used to instead of PushBackEvents
0039   // with negative arg
0040   virtual int skip(const int nevt) { return PushBackEvents(-nevt); }
0041   virtual int NoSyncPushBackEvents(const int /*nevt*/) { return -1; }
0042   virtual void setSyncManager(Fun4AllSyncManager *master) { m_MySyncManager = master; }
0043   virtual int ResetFileList();
0044   virtual int ResetEvent() { return 0; }
0045   virtual void SetRunNumber(const int runno) { m_MyRunNumber = runno; }
0046   virtual int RunNumber() const { return m_MyRunNumber; }
0047 
0048   void Print(const std::string &what = "ALL") const override;
0049 
0050   int AddFile(const std::string &filename);
0051   int AddListFile(const std::string &filename, const int do_it = 0);
0052   int registerSubsystem(SubsysReco *subsystem);
0053   void Repeat(const int i = -1) { m_Repeat = i; }
0054   void AddToFileOpened(const std::string &filename) { m_FileListOpened.push_back(filename); }
0055   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()); }
0056   const std::string &InputNode() { return m_InputNode; }
0057   void InputNode(const std::string &innode) { m_InputNode = innode; }
0058   const std::string &TopNodeName() const { return m_TopNodeName; }
0059   bool FileListEmpty() const { return m_FileList.empty(); }
0060   const std::string &FileName() const { return m_FileName; }
0061   void FileName(const std::string &fn) { m_FileName = fn; }
0062   const std::list<std::string> &GetFileList() const { return m_FileListCopy; }
0063   const std::list<std::string> &GetFileOpenedList() const { return m_FileListOpened; }
0064 
0065  protected:
0066   Fun4AllInputManager(const std::string &name = "DUMMY", const std::string &nodename = "DST", const std::string &topnodename = "TOP");
0067   void UpdateFileList();
0068   int OpenNextFile();
0069   void IsOpen(const int i) { m_IsOpen = i; }
0070   Fun4AllSyncManager *MySyncManager() { return m_MySyncManager; }
0071   void DisableReadCache() { m_disable_read_cache_flag = true; }
0072   bool ReadCacheDisabled() const { return m_disable_read_cache_flag; }
0073 
0074  private:
0075   Fun4AllSyncManager *m_MySyncManager {nullptr};
0076   int m_IsOpen {0};
0077   int m_Repeat {0};
0078   int m_MyRunNumber {0};
0079   int m_InitRun {0};
0080   bool m_disable_read_cache_flag{false};
0081   std::vector<SubsysReco *> m_SubsystemsVector;
0082   std::string m_InputNode;
0083   std::string m_FileName;
0084   std::string m_TopNodeName;
0085   std::list<std::string> m_FileList;
0086   std::list<std::string> m_FileListCopy;
0087   std::list<std::string> m_FileListOpened;  // all files which were opened during running
0088 };
0089 
0090 #endif