Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 // Tell emacs that this is a C++ source
0002 //  -*- C++ -*-.
0003 #ifndef FUN4ALLRAW_FUN4ALLSTREAMINGINPUTMANAGER_H
0004 #define FUN4ALLRAW_FUN4ALLSTREAMINGINPUTMANAGER_H
0005 
0006 #include "InputManagerType.h"
0007 
0008 #include <fun4all/Fun4AllInputManager.h>
0009 
0010 #include <map>
0011 #include <set>
0012 #include <string>
0013 
0014 class SingleStreamingInput;
0015 class Gl1Packet;
0016 class InttRawHit;
0017 class MicromegasRawHit;
0018 class MvtxRawHit;
0019 class MvtxFeeIdInfo;
0020 class PHCompositeNode;
0021 class SyncObject;
0022 class TpcRawHit;
0023 class TH1;
0024 class TH2;
0025 class Fun4AllStreamingInputManager : public Fun4AllInputManager
0026 {
0027  public:
0028   Fun4AllStreamingInputManager(const std::string &name = "DUMMY", const std::string &dstnodename = "DST", const std::string &topnodename = "TOP");
0029   ~Fun4AllStreamingInputManager() override;
0030   int fileopen(const std::string & /*filenam*/) override { return 0; }
0031   // cppcheck-suppress virtualCallInConstructor
0032   int fileclose() override;
0033   int run(const int nevents = 0) override;
0034 
0035   void Print(const std::string &what = "ALL") const override;
0036   int ResetEvent() override;
0037   int PushBackEvents(const int i) override;
0038   int GetSyncObject(SyncObject **mastersync) override;
0039   int SyncIt(const SyncObject *mastersync) override;
0040   int HasSyncObject() const override { return 1; }
0041   std::string GetString(const std::string &what) const override;
0042   void registerStreamingInput(SingleStreamingInput *evtin, InputManagerType::enu_subsystem);
0043   int FillGl1();
0044   int FillIntt();
0045   int FillMicromegas();
0046   int FillMvtx();
0047   int FillTpc();
0048   void AddGl1RawHit(uint64_t bclk, Gl1Packet *hit);
0049   void AddInttRawHit(uint64_t bclk, InttRawHit *hit);
0050   void AddMicromegasRawHit(uint64_t /* bclk */, MicromegasRawHit * /* hit */);
0051   void AddMvtxFeeIdInfo(uint64_t bclk, uint16_t feeid, uint32_t detField);
0052   void AddMvtxL1TrgBco(uint64_t bclk, uint64_t lv1Bco);
0053   void AddMvtxRawHit(uint64_t bclk, MvtxRawHit *hit);
0054   void AddTpcRawHit(uint64_t bclk, TpcRawHit *hit);
0055   void SetInttBcoRange(const unsigned int i);
0056   void SetInttNegativeBco(const unsigned int value);
0057   void SetMicromegasBcoRange(const unsigned int i);
0058   void SetMicromegasNegativeBco(const unsigned int value);
0059   void SetMvtxBcoRange(const unsigned int i);
0060   void SetMvtxNegativeBco(const unsigned int value);
0061   void SetTpcBcoRange(const unsigned int i);
0062   void SetTpcNegativeBco(const unsigned int value);
0063   int FillInttPool();
0064   int FillMicromegasPool();
0065   int FillMvtxPool();
0066   int FillTpcPool();
0067   void Streaming(bool b = true) { m_StreamingFlag = b; }
0068 
0069   void runMvtxTriggered(bool b = true) { m_mvtx_is_triggered = b; }
0070 
0071  private:
0072   struct MvtxRawHitInfo
0073   {
0074     std::set<uint64_t> MvtxL1TrgBco;
0075     std::vector<MvtxFeeIdInfo *> MvtxFeeIdInfoVector;
0076     std::vector<MvtxRawHit *> MvtxRawHitVector;
0077     unsigned int EventFoundCounter{0};
0078   };
0079 
0080   struct Gl1RawHitInfo
0081   {
0082     std::vector<Gl1Packet *> Gl1RawHitVector;
0083     unsigned int EventFoundCounter{0};
0084   };
0085 
0086   struct InttRawHitInfo
0087   {
0088     std::vector<InttRawHit *> InttRawHitVector;
0089     unsigned int EventFoundCounter{0};
0090   };
0091 
0092   struct MicromegasRawHitInfo
0093   {
0094     std::vector<MicromegasRawHit *> MicromegasRawHitVector;
0095     unsigned int EventFoundCounter{0};
0096   };
0097 
0098   struct TpcRawHitInfo
0099   {
0100     std::vector<TpcRawHit *> TpcRawHitVector;
0101     unsigned int EventFoundCounter{0};
0102   };
0103 
0104   void createQAHistos();
0105 
0106   SyncObject *m_SyncObject{nullptr};
0107   PHCompositeNode *m_topNode{nullptr};
0108 
0109   uint64_t m_RefBCO{0};
0110 
0111   int m_RunNumber{0};
0112   unsigned int m_intt_bco_range{0};
0113   unsigned int m_intt_negative_bco{0};
0114   unsigned int m_micromegas_bco_range{0};
0115   unsigned int m_micromegas_negative_bco{0};
0116   unsigned int m_mvtx_bco_range{0};
0117   unsigned int m_mvtx_negative_bco{0};
0118   unsigned int m_tpc_bco_range{0};
0119   unsigned int m_tpc_negative_bco{0};
0120 
0121   bool m_gl1_registered_flag{false};
0122   bool m_intt_registered_flag{false};
0123   bool m_micromegas_registered_flag{false};
0124   bool m_mvtx_registered_flag{false};
0125   bool m_StreamingFlag{false};
0126   bool m_tpc_registered_flag{false};
0127   bool m_mvtx_is_triggered{false};
0128 
0129   std::vector<SingleStreamingInput *> m_Gl1InputVector;
0130   std::vector<SingleStreamingInput *> m_InttInputVector;
0131   std::vector<SingleStreamingInput *> m_MicromegasInputVector;
0132   std::vector<SingleStreamingInput *> m_MvtxInputVector;
0133   std::vector<SingleStreamingInput *> m_TpcInputVector;
0134   std::map<uint64_t, Gl1RawHitInfo> m_Gl1RawHitMap;
0135   std::map<uint64_t, InttRawHitInfo> m_InttRawHitMap;
0136   std::map<uint64_t, MicromegasRawHitInfo> m_MicromegasRawHitMap;
0137   std::map<uint64_t, MvtxRawHitInfo> m_MvtxRawHitMap;
0138   std::map<uint64_t, TpcRawHitInfo> m_TpcRawHitMap;
0139   std::map<int, std::map<int, uint64_t>> m_InttPacketFeeBcoMap;
0140 
0141   // QA histos
0142   TH1 *h_refbco_mvtx{nullptr};
0143   TH1 *h_taggedAllFelixes_mvtx{nullptr};
0144   TH1 *h_taggedAllFelixesAllFees_mvtx{nullptr};
0145   TH1 *h_tagBcoFelix_mvtx[12]{nullptr};
0146 
0147   TH1 *h_bcoGL1LL1diff[12]{nullptr};
0148   TH1 *h_bcoLL1Strobediff[12]{nullptr};
0149   TH1 *h_tagStBcoFelix_mvtx[12]{nullptr};
0150   TH1 *h_tagBcoFelixAllFees_mvtx[12]{nullptr};
0151   TH1 *h_tagStBcoFEE_mvtx[12]{nullptr};
0152   TH1 *h_tagL1BcoFEE_mvtx[12]{nullptr};
0153 
0154   TH1 *h_refbco_intt{nullptr};
0155   TH1 *h_taggedAll_intt{nullptr};
0156   TH1 *h_taggedAllFee_intt{nullptr};
0157   TH1 *h_gl1tagged_intt[8]{nullptr};
0158   TH1 *h_taggedAllFees_intt[8]{nullptr};
0159   TH1 *h_gl1taggedfee_intt[8][14]{{nullptr}};
0160   TH2 *h_bcodiff_intt[8]{nullptr};
0161 
0162 };
0163 
0164 #endif /* FUN4ALL_FUN4ALLSTREAMINGINPUTMANAGER_H */