Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:17:19

0001 // Tell emacs that this is a C++ source
0002 //  -*- C++ -*-.
0003 #ifndef FUN4ALLRAW_FUN4ALLPRDFINPUTPOOLMANAGER_H
0004 #define FUN4ALLRAW_FUN4ALLPRDFINPUTPOOLMANAGER_H
0005 
0006 #include <fun4all/Fun4AllInputManager.h>
0007 
0008 #include <Event/phenixTypes.h>
0009 
0010 #include <map>
0011 #include <string>
0012 #include <utility>
0013 #include <vector>
0014 
0015 class Event;
0016 class SinglePrdfInput;
0017 class oEvent;
0018 class Packet;
0019 class PHCompositeNode;
0020 class SyncObject;
0021 
0022 class Fun4AllPrdfInputPoolManager : public Fun4AllInputManager
0023 {
0024  public:
0025   Fun4AllPrdfInputPoolManager(const std::string &name = "DUMMY", const std::string &prdfnodename = "PRDF", const std::string &topnodename = "TOP");
0026   ~Fun4AllPrdfInputPoolManager() override;
0027   int fileopen(const std::string & /* filenam */) override { return 0; }
0028   // cppcheck-suppress virtualCallInConstructor
0029   int fileclose() override;
0030   int run(const int nevents = 0) override;
0031 
0032   void Print(const std::string &what = "ALL") const override;
0033   int ResetEvent() override;
0034   int PushBackEvents(const int i) override;
0035   int GetSyncObject(SyncObject **mastersync) override;
0036   int SyncIt(const SyncObject *mastersync) override;
0037   int HasSyncObject() const override { return 1; }
0038   std::string GetString(const std::string &what) const override;
0039   SinglePrdfInput *AddPrdfInputList(const std::string &listfile);
0040   SinglePrdfInput *AddPrdfInputFile(const std::string &filename);
0041   SinglePrdfInput *registerPrdfInput(SinglePrdfInput *prdfin);
0042   void AddPacket(const int evtno, Packet *p);
0043   void UpdateEventFoundCounter(const int evtno);
0044   void UpdateDroppedPacket(const int packetid);
0045   void AddBeamClock(const int evtno, const int bclk, SinglePrdfInput *prdfin);
0046   void SetReferenceClock(const int evtno, const int bclk);
0047   void SetReferenceInputMgr(SinglePrdfInput *inp) { m_RefPrdfInput = inp; }
0048   void CreateBclkOffsets();
0049   int CalcDiffBclk(const int bclk1, const int bclk2);
0050   void DitchEvent(const int eventno);
0051   void Resynchronize();
0052   void ClearAllEvents();
0053   void SetPoolDepth(unsigned int d) { m_PoolDepth = d; }
0054 
0055  private:
0056   struct PacketInfo
0057   {
0058     std::vector<Packet *> PacketVector;
0059     unsigned int EventFoundCounter = 0;
0060   };
0061 
0062   struct SinglePrdfInputInfo
0063   {
0064     int bclkoffset = 0;
0065   };
0066 
0067   bool m_StartUpFlag = true;
0068   int m_RunNumber = 0;
0069   unsigned int m_PoolDepth = 100;
0070   unsigned int m_InitialPoolDepth = 20;
0071   std::vector<SinglePrdfInput *> m_PrdfInputVector;
0072   SyncObject *m_SyncObject = nullptr;
0073   PHCompositeNode *m_topNode = nullptr;
0074   Event *m_Event = nullptr;
0075   PHDWORD workmem[4 * 1024 * 1024] = {};
0076   oEvent *oph = nullptr;
0077   SinglePrdfInput *m_RefPrdfInput = nullptr;
0078   std::map<int, PacketInfo> m_PacketMap;
0079   std::string m_PrdfNodeName;
0080   std::map<int, int> m_DroppedPacketMap;
0081   std::map<int, std::vector<std::pair<int, SinglePrdfInput *>>> m_ClockCounters;
0082   std::map<int, int> m_RefClockCounters;
0083   std::map<SinglePrdfInput *, SinglePrdfInputInfo> m_SinglePrdfInputInfo;
0084 };
0085 
0086 #endif /* FUN4ALL_FUN4ALLPRDFINPUTPOOLMANAGER_H */