Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:16:11

0001 // Tell emacs that this is a C++ source
0002 //  -*- C++ -*-.
0003 // This Master manages the reading of the Input.
0004 // In principle all of this could be done in the Fun4AllServer
0005 // but this is simpler to develop and test while Fun4All is allready in use.
0006 
0007 #ifndef FUN4ALL_FUN4ALLSYNCMANAGER_H
0008 #define FUN4ALL_FUN4ALLSYNCMANAGER_H
0009 
0010 #include "Fun4AllBase.h"
0011 
0012 #include <string>  // for string
0013 #include <vector>
0014 
0015 class Fun4AllInputManager;
0016 class SyncObject;
0017 
0018 class Fun4AllSyncManager : public Fun4AllBase
0019 {
0020  public:
0021   Fun4AllSyncManager(const std::string &name = "SYNCMANAGERNONAME");
0022   ~Fun4AllSyncManager() override;
0023   int registerInputManager(Fun4AllInputManager *InputManager);
0024   Fun4AllInputManager *getInputManager(const std::string &name);
0025 
0026   //! run n events (0 means up to end of file
0027   int run(const int nevnts = 0);
0028 
0029   /*!
0030     \brief skip n events (0 means up to the end of file).
0031     Skip means read, don't process.
0032   */
0033   int skip(const int nevnts = 0);
0034 
0035   int fileopen(const std::string &managername, const std::string &filename);
0036   int fileclose(const std::string &managername = "NONE");
0037   int CurrentRun() { return m_CurrentRun; }
0038   void CurrentRun(const int ival) { m_CurrentRun = ival; }
0039   void CurrentEvent(const int evt);
0040   void Print(const std::string &what = "ALL") const override;
0041   void SegmentNumber(const int iseg) { m_PrdfSegment = iseg; }
0042   int SegmentNumber() const { return m_PrdfSegment; }
0043   int BranchSelect(const std::string &managername, const std::string &branch, int iflag);
0044   int BranchSelect(const std::string &branch, const int iflag);
0045   int setBranches(const std::string &managername);
0046   int setBranches();
0047   void TotalEvents(const int i) { m_EventsTotal = i; }
0048   int TotalEvents() const { return m_EventsTotal; }
0049   void PrdfEvents(const int i) { m_PrdfEvents = i; }
0050   int PrdfEvents() const { return m_PrdfEvents; }
0051   void GetInputFullFileList(std::vector<std::string> &fnames) const;
0052   void Repeat(const int i = -1) { m_Repeat = i; }
0053   void PushBackInputMgrsEvents(const int i);
0054   int ResetEvent();
0055   const std::vector<Fun4AllInputManager *> &GetInputManagers() const { return m_InManager; }
0056   bool MixRunsOk() const { return m_MixRunsOkFlag; }
0057   void MixRunsOk(bool b) { m_MixRunsOkFlag = b; }
0058 
0059  private:
0060   void PrintSyncProblem() const;
0061   int CheckSync(unsigned i);
0062   int m_PrdfSegment = 0;
0063   int m_PrdfEvents = 0;
0064   int m_EventsTotal = 0;
0065   int m_CurrentRun = 0;
0066   int m_CurrentEvent = 0;
0067   int m_Repeat = 0;
0068   bool m_MixRunsOkFlag = false;
0069   SyncObject *m_MasterSync = nullptr;
0070   std::vector<Fun4AllInputManager *> m_InManager;
0071   std::vector<int> m_iretInManager;
0072 };
0073 
0074 #endif