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