Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 #ifndef FUN4ALLRAW_SINGLEPRDFINPUT_H
0002 #define FUN4ALLRAW_SINGLEPRDFINPUT_H
0003 
0004 #include <fun4all/Fun4AllBase.h>
0005 #include <fun4all/InputFileHandler.h>
0006 
0007 #include <array>
0008 #include <limits>
0009 #include <map>
0010 #include <set>
0011 #include <string>
0012 #include <utility>  // for pair
0013 #include <vector>
0014 
0015 class Eventiterator;
0016 class Fun4AllPrdfInputPoolManager;
0017 class Packet;
0018 
0019 class SinglePrdfInput : public Fun4AllBase, public InputFileHandler
0020 {
0021  public:
0022   explicit SinglePrdfInput(const std::string &name, Fun4AllPrdfInputPoolManager *inman);
0023   ~SinglePrdfInput() override;
0024   Eventiterator *GetEventIterator() { return m_EventIterator; }
0025   virtual void FillPool(const unsigned int nevents);
0026   int RunNumber() const { return m_RunNumber; }
0027   void RunNumber(const int irun) { m_RunNumber = irun; }
0028   int fileopen(const std::string &filename) override;
0029   int fileclose() override;
0030   int AllDone() const { return m_AllDone; }
0031   void AllDone(const int i) { m_AllDone = i; }
0032   void EventNumberOffset(const int i) { m_EventNumberOffset = i; }  // if beam clk are out of sync, tweak this one
0033   int EventNumberOffset() const { return m_EventNumberOffset; }
0034   Fun4AllPrdfInputPoolManager *InputMgr() { return m_InputMgr; }
0035   void MakeReference(const bool b);
0036   bool ReferenceFlag() const { return m_MeReferenceFlag; }
0037 
0038  private:
0039   int majority_eventnumber();
0040   int majority_beamclock();
0041   void adjust_eventnumber_offset(const int decided_evtno);
0042   struct PacketInfo
0043   {
0044     std::vector<Packet *> PacketVector;
0045     unsigned int EventFoundCounter = 0;
0046   };
0047   Eventiterator *m_EventIterator = nullptr;
0048   Fun4AllPrdfInputPoolManager *m_InputMgr = nullptr;
0049   Packet **plist = nullptr;
0050   unsigned int m_NumSpecialEvents = 0;
0051   int m_EventNumberOffset = 1;               // packet event counters start at 0 but we start with event number 1
0052   int *m_PacketEventNumberOffset = nullptr;  // packet event counters start at 0 but we start with event number 1
0053   int m_RunNumber = 0;
0054   int m_EventsThisFile = 0;
0055   int m_AllDone = 0;
0056   bool m_MeReferenceFlag = false;
0057   std::map<int, std::vector<Packet *>> m_PacketMap;
0058   std::set<int> m_EvtSet;
0059   std::vector<std::pair<int, int>> m_Event;
0060   std::array<unsigned int, 100> rollover{};
0061   std::array<int, 100> previous_eventnumber{};
0062 };
0063 
0064 #endif