diff --git a/offline/framework/rawbcolumi/Fun4AllStreamingLumiCountingInputManager.cc b/offline/framework/fun4allraw/Fun4AllStreamingLumiCountingInputManager.cc similarity index 99% rename from offline/framework/rawbcolumi/Fun4AllStreamingLumiCountingInputManager.cc rename to offline/framework/fun4allraw/Fun4AllStreamingLumiCountingInputManager.cc index 754718cfc6..6353487180 100644 --- a/offline/framework/rawbcolumi/Fun4AllStreamingLumiCountingInputManager.cc +++ b/offline/framework/fun4allraw/Fun4AllStreamingLumiCountingInputManager.cc @@ -1,7 +1,7 @@ #include "Fun4AllStreamingLumiCountingInputManager.h" #include -#include "SingleStreamingInputv2.h" +#include "SingleStreamingInput.h" #include @@ -173,7 +173,7 @@ std::string Fun4AllStreamingLumiCountingInputManager::GetString(const std::strin return ""; } -void Fun4AllStreamingLumiCountingInputManager::registerStreamingInput(SingleStreamingInputv2 *evtin, InputManagerType::enu_subsystem system) +void Fun4AllStreamingLumiCountingInputManager::registerStreamingInput(SingleStreamingInput *evtin, InputManagerType::enu_subsystem system) { evtin->StreamingLumiInputManager(this); // if the streaming flag is set, we only want the first event from the GL1 to diff --git a/offline/framework/rawbcolumi/Fun4AllStreamingLumiCountingInputManager.h b/offline/framework/fun4allraw/Fun4AllStreamingLumiCountingInputManager.h similarity index 95% rename from offline/framework/rawbcolumi/Fun4AllStreamingLumiCountingInputManager.h rename to offline/framework/fun4allraw/Fun4AllStreamingLumiCountingInputManager.h index 3f1515bb23..b84db28e4e 100644 --- a/offline/framework/rawbcolumi/Fun4AllStreamingLumiCountingInputManager.h +++ b/offline/framework/fun4allraw/Fun4AllStreamingLumiCountingInputManager.h @@ -11,7 +11,7 @@ #include #include #include -class SingleStreamingInputv2; +class SingleStreamingInput; class Gl1Packet; class PHCompositeNode; class SyncObject; @@ -34,7 +34,7 @@ class Fun4AllStreamingLumiCountingInputManager : public Fun4AllInputManager int SyncIt(const SyncObject *mastersync) override; int HasSyncObject() const override { return 1; } std::string GetString(const std::string &what) const override; - void registerStreamingInput(SingleStreamingInputv2 *evtin, InputManagerType::enu_subsystem); + void registerStreamingInput(SingleStreamingInput *evtin, InputManagerType::enu_subsystem); int FillGl1(); void AddGl1RawHit(uint64_t bclk, Gl1Packet *hit); void AddGl1Window(uint64_t bco_trim, int negative_window, int positive_window); @@ -76,7 +76,7 @@ class Fun4AllStreamingLumiCountingInputManager : public Fun4AllInputManager bool flat_overflow{false}; uint64_t bco_temp = 0; - std::vector m_Gl1InputVector; + std::vector m_Gl1InputVector; std::map m_Gl1RawHitMap; std::map> m_BCOWindows; std::map m_BCOBunchNumber; diff --git a/offline/framework/fun4allraw/Makefile.am b/offline/framework/fun4allraw/Makefile.am index 9ad2b18e85..71e1245222 100644 --- a/offline/framework/fun4allraw/Makefile.am +++ b/offline/framework/fun4allraw/Makefile.am @@ -18,6 +18,7 @@ pkginclude_HEADERS = \ Fun4AllPrdfOutputManager.h \ Fun4AllRolloverFileOutStream.h \ Fun4AllStreamingInputManager.h \ + Fun4AllStreamingLumiCountingInputManager.h \ Fun4AllTriggeredInputManager.h \ intt_pool.h \ InputManagerType.h \ @@ -75,6 +76,7 @@ libfun4allraw_la_SOURCES = \ Fun4AllPrdfOutputManager.cc \ Fun4AllRolloverFileOutStream.cc \ Fun4AllStreamingInputManager.cc \ + Fun4AllStreamingLumiCountingInputManager.cc \ Fun4AllTriggeredInputManager.cc \ intt_pool.cc \ MicromegasBcoMatchingInformation_v1.cc\ diff --git a/offline/framework/fun4allraw/SingleGl1PoolInput.cc b/offline/framework/fun4allraw/SingleGl1PoolInput.cc index 49144af4ac..107b623ae8 100644 --- a/offline/framework/fun4allraw/SingleGl1PoolInput.cc +++ b/offline/framework/fun4allraw/SingleGl1PoolInput.cc @@ -1,6 +1,7 @@ #include "SingleGl1PoolInput.h" #include "Fun4AllStreamingInputManager.h" +#include "Fun4AllStreamingLumiCountingInputManager.h" #include "InputManagerType.h" #include @@ -69,6 +70,25 @@ void SingleGl1PoolInput::FillPool(const unsigned int /*nbclks*/) { std::cout << PHWHERE << "Fetching next Event" << evt->getEvtSequence() << std::endl; } + if ((m_total_event == 0 && evt->getEvtType() == ENDRUNEVENT) || + (m_total_event != 0 && evt->getEvtSequence() - 2 == m_total_event)) + { + m_alldone_flag = true; + m_lastevent_flag = true; + } + if (evt->getEvtSequence() % 5000 == 0) + { + m_alldone_flag = true; + m_lastevent_flag = true; + } + if (Verbosity() > 2) + { + if (m_alldone_flag) + { + std::cout << "gl1 all done is true" << std::endl; + } + // else{std::cout<<"gl1 all done is false"<getRunNumber()); if (GetVerbosity() > 1) { @@ -99,6 +119,15 @@ void SingleGl1PoolInput::FillPool(const unsigned int /*nbclks*/) { std::cout << PHWHERE << "Packet 14001 is null ptr" << std::endl; evt->identify(); + m_alldone_flag = true; + m_lastevent_flag = true; + if (StreamingLumiInputManager()) + { + StreamingLumiInputManager()->SetEndofEvent(m_alldone_flag, m_lastevent_flag); + StreamingLumiInputManager()->SetEventNumber(EventSequence); + } + m_alldone_flag = false; + m_lastevent_flag = false; continue; } if (Verbosity() > 1) @@ -108,6 +137,10 @@ void SingleGl1PoolInput::FillPool(const unsigned int /*nbclks*/) Gl1Packet *newhit = new Gl1Packetv3(); uint64_t gtm_bco = packet->lValue(0, "BCO"); + uint64_t bco_trim = gtm_bco & 0xFFFFFFFFFFU; + m_BCOWindows[bco_trim] = std::make_pair(bco_trim - m_negative_bco_window, bco_trim + m_positive_bco_window); + // std::cout<<"BCO "<< m_BCOWindows.begin()->first<<" left "<second.first<<" right "<< m_BCOWindows.begin()->second.second<lValue(0, "BunchNumber"); m_FEEBclkMap.insert(gtm_bco); newhit->setBCO(packet->lValue(0, "BCO")); newhit->setHitFormat(packet->getHitFormat()); @@ -156,6 +189,20 @@ void SingleGl1PoolInput::FillPool(const unsigned int /*nbclks*/) { StreamingInputManager()->AddGl1RawHit(gtm_bco, newhit); } + if (StreamingLumiInputManager()) + { + StreamingLumiInputManager()->AddGl1Window(bco_trim, m_negative_bco_window, m_positive_bco_window); + StreamingLumiInputManager()->AddGl1BunchNumber(bco_trim, m_BCOBunchNumber[bco_trim]); + StreamingLumiInputManager()->SetEndofEvent(m_alldone_flag, m_lastevent_flag); + StreamingLumiInputManager()->SetEventNumber(EventSequence); + StreamingLumiInputManager()->SetNegativeWindow(m_negative_bco_window); + StreamingLumiInputManager()->SetPositiveWindow(m_positive_bco_window); + } + if (evt->getEvtSequence() % 5000 == 0) + { + m_alldone_flag = false; + m_lastevent_flag = false; + } m_Gl1RawHitMap[gtm_bco].push_back(newhit); m_BclkStack.insert(gtm_bco); @@ -220,6 +267,9 @@ void SingleGl1PoolInput::CleanupUsedPackets(const uint64_t bclk) m_FEEBclkMap.erase(iter); m_BclkStack.erase(iter); m_Gl1RawHitMap.erase(iter); + auto trimbclk = iter & 0xFFFFFFFFFFU; + m_BCOWindows.erase(trimbclk); + m_BCOBunchNumber.erase(trimbclk); } } diff --git a/offline/framework/fun4allraw/SingleGl1PoolInput.h b/offline/framework/fun4allraw/SingleGl1PoolInput.h index 5d9d7acfab..63543e4890 100644 --- a/offline/framework/fun4allraw/SingleGl1PoolInput.h +++ b/offline/framework/fun4allraw/SingleGl1PoolInput.h @@ -27,14 +27,22 @@ class SingleGl1PoolInput : public SingleStreamingInput void CreateDSTNode(PHCompositeNode *topNode) override; void SetBcoRange(const unsigned int i) { m_BcoRange = i; } // void ConfigureStreamingInputManager() override; - + void SetNegativeWindow(const unsigned int value) { m_negative_bco_window = value; } + void SetPositiveWindow(const unsigned int value) { m_positive_bco_window = value; } + void SetTotalEvent(const int value) { m_total_event = value; } private: unsigned int m_NumSpecialEvents{0}; unsigned int m_BcoRange{0}; - + unsigned int m_negative_bco_window = 20; + unsigned int m_positive_bco_window = 325; + int m_total_event = std::numeric_limits::max(); + bool m_alldone_flag = {false}; + bool m_lastevent_flag = {false}; //! map bco to packet std::map m_packet_bco; + std::map> m_BCOWindows; + std::map m_BCOBunchNumber; std::map> m_Gl1RawHitMap; std::set m_FEEBclkMap; std::set m_BclkStack; diff --git a/offline/framework/fun4allraw/SingleStreamingInput.h b/offline/framework/fun4allraw/SingleStreamingInput.h index 082c1a079e..bca9ff3f57 100644 --- a/offline/framework/fun4allraw/SingleStreamingInput.h +++ b/offline/framework/fun4allraw/SingleStreamingInput.h @@ -12,6 +12,7 @@ class Eventiterator; class Fun4AllEvtInputPoolManager; class Fun4AllStreamingInputManager; +class Fun4AllStreamingLumiCountingInputManager; class PHCompositeNode; class SingleStreamingInput : public Fun4AllBase, public InputFileHandler @@ -47,6 +48,8 @@ class SingleStreamingInput : public Fun4AllBase, public InputFileHandler virtual Eventiterator *GetEventiterator() const { return m_EventIterator; } virtual Fun4AllStreamingInputManager *StreamingInputManager() { return m_StreamingInputMgr; } virtual void StreamingInputManager(Fun4AllStreamingInputManager *in) { m_StreamingInputMgr = in; } + virtual Fun4AllStreamingLumiCountingInputManager *StreamingLumiInputManager() { return m_StreamingLumiInputMgr; } + virtual void StreamingLumiInputManager(Fun4AllStreamingLumiCountingInputManager *in) { m_StreamingLumiInputMgr = in; } virtual void CreateDSTNode(PHCompositeNode *) { return; } virtual void ConfigureStreamingInputManager() { return; } virtual void SubsystemEnum(const int id) { m_SubsystemEnum = id; } @@ -117,6 +120,8 @@ class SingleStreamingInput : public Fun4AllBase, public InputFileHandler Eventiterator *m_EventIterator{nullptr}; // Fun4AllEvtInputPoolManager *m_InputMgr {nullptr}; Fun4AllStreamingInputManager *m_StreamingInputMgr{nullptr}; + Fun4AllStreamingLumiCountingInputManager *m_StreamingLumiInputMgr{nullptr}; + uint64_t m_MaxBclkSpread{1000000}; unsigned int m_EventNumberOffset{1}; // packet event counters start at 0 but we start with event number 1 int m_RunNumber{0}; diff --git a/offline/framework/rawbcolumi/Makefile.am b/offline/framework/rawbcolumi/Makefile.am deleted file mode 100644 index b95b96ad16..0000000000 --- a/offline/framework/rawbcolumi/Makefile.am +++ /dev/null @@ -1,50 +0,0 @@ -AUTOMAKE_OPTIONS = foreign - -AM_CPPFLAGS = \ - -I$(includedir) \ - -isystem$(OFFLINE_MAIN)/include \ - -isystem$(ROOTSYS)/include \ - -isystem$(OPT_SPHENIX)/include - -AM_LDFLAGS = \ - -L$(libdir) \ - -L$(OFFLINE_MAIN)/lib - -pkginclude_HEADERS = \ - SingleGl1PoolInputv2.h \ - SingleStreamingInputv2.h \ - Fun4AllStreamingLumiCountingInputManager.h - -lib_LTLIBRARIES = \ - librawbcolumi.la - -# source for mvtx decoder library -librawbcolumi_la_SOURCES = \ - SingleGl1PoolInputv2.cc \ - SingleStreamingInputv2.cc \ - Fun4AllStreamingLumiCountingInputManager.cc - -librawbcolumi_la_LIBADD = \ - -lffarawobjects \ - -lfun4all \ - -lEvent \ - -lphoolraw \ - -lqautils - -BUILT_SOURCES = testexternals.cc - -noinst_PROGRAMS = \ - testexternals - -testexternals_SOURCES = testexternals.cc -testexternals_LDADD = librawbcolumi.la - -testexternals.cc: - echo "//*** this is a generated file. Do not commit, do not edit" > $@ - echo "int main()" >> $@ - echo "{" >> $@ - echo " return 0;" >> $@ - echo "}" >> $@ - -clean-local: - rm -f $(BUILT_SOURCES) diff --git a/offline/framework/rawbcolumi/SingleGl1PoolInputv2.cc b/offline/framework/rawbcolumi/SingleGl1PoolInputv2.cc deleted file mode 100644 index aa4193b7f9..0000000000 --- a/offline/framework/rawbcolumi/SingleGl1PoolInputv2.cc +++ /dev/null @@ -1,362 +0,0 @@ -#include "SingleGl1PoolInputv2.h" - -#include -#include -#include "Fun4AllStreamingLumiCountingInputManager.h" - -#include - -#include -#include // for PHIODataNode -#include // for PHNode -#include // for PHNodeIterator -#include // for PHObject -#include -#include - -#include -#include -#include -#include // for Packet - -#include // for uint64_t -#include // for operator<<, basic_ostream<... -#include // for reverse_iterator -#include // for numeric_limits -#include -#include -#include // for pair - -SingleGl1PoolInputv2::SingleGl1PoolInputv2(const std::string &name) - : SingleStreamingInputv2(name) -{ - SubsystemEnum(InputManagerType::GL1); -} - -SingleGl1PoolInputv2::~SingleGl1PoolInputv2() -{ - CleanupUsedPackets(std::numeric_limits::max()); -} - -void SingleGl1PoolInputv2::FillPool(const unsigned int /*nbclks*/) -{ - if (AllDone()) // no more files and all events read - { - return; - } - while (GetEventiterator() == nullptr) // at startup this is a null pointer - { - if (!OpenNextFile()) - { - AllDone(1); - return; - } - } - // std::set saved_beamclocks; - while (GetSomeMoreEvents()) - { - std::unique_ptr evt(GetEventiterator()->getNextEvent()); - while (!evt) - { - fileclose(); - if (!OpenNextFile()) - { - AllDone(1); - return; - } - evt.reset(GetEventiterator()->getNextEvent()); - } - if (Verbosity() > 2) - { - std::cout << PHWHERE << "Fetching next Event" << evt->getEvtSequence() << std::endl; - } - if ((m_total_event == 0 && evt->getEvtType() == ENDRUNEVENT) || - (m_total_event != 0 && evt->getEvtSequence() - 2 == m_total_event)) - { - m_alldone_flag = true; - m_lastevent_flag = true; - } - if (evt->getEvtSequence() % 5000 == 0) - { - m_alldone_flag = true; - m_lastevent_flag = true; - } - if (Verbosity() > 2) - { - if (m_alldone_flag) - { - std::cout << "gl1 all done is true" << std::endl; - } - // else{std::cout<<"gl1 all done is false"<getRunNumber()); - if (GetVerbosity() > 1) - { - evt->identify(); - } - if (evt->getEvtType() != DATAEVENT) - { - m_NumSpecialEvents++; - if (evt->getEvtType() == ENDRUNEVENT) - { - AllDone(1); - std::unique_ptr nextevt(GetEventiterator()->getNextEvent()); - if (nextevt) - { - std::cout << PHWHERE << " Found event after End Run Event " << std::endl; - std::cout << "End Run Event identify: " << std::endl; - evt->identify(); - std::cout << "Next event identify: " << std::endl; - nextevt->identify(); - } - return; - } - continue; - } - int EventSequence = evt->getEvtSequence(); - Packet *packet = evt->getPacket(14001); - if (!packet) - { - std::cout << PHWHERE << "Packet 14001 is null ptr" << std::endl; - evt->identify(); - m_alldone_flag = true; - m_lastevent_flag = true; - if (StreamingLumiInputManager()) - { - StreamingLumiInputManager()->SetEndofEvent(m_alldone_flag, m_lastevent_flag); - StreamingLumiInputManager()->SetEventNumber(EventSequence); - } - m_alldone_flag = false; - m_lastevent_flag = false; - continue; - } - if (Verbosity() > 1) - { - packet->identify(); - } - - Gl1Packet *newhit = new Gl1Packetv3(); - uint64_t gtm_bco = packet->lValue(0, "BCO"); - uint64_t bco_trim = gtm_bco & 0xFFFFFFFFFFU; - // std::cout<first<<" left "<second.first<<" right "<< m_BCOWindows.begin()->second.second<lValue(0, "BunchNumber"); - // std::cout<<"BCO "<AddGl1Window(bco_trim, m_negative_bco_window, m_positive_bco_window); - StreamingLumiInputManager()->AddGl1BunchNumber(bco_trim, m_BCOBunchNumber[bco_trim]); - StreamingLumiInputManager()->SetEndofEvent(m_alldone_flag, m_lastevent_flag); - StreamingLumiInputManager()->SetEventNumber(EventSequence); - StreamingLumiInputManager()->SetNegativeWindow(m_negative_bco_window); - StreamingLumiInputManager()->SetPositiveWindow(m_positive_bco_window); - } - if (evt->getEvtSequence() % 5000 == 0) - { - m_alldone_flag = false; - m_lastevent_flag = false; - } - - m_FEEBclkMap.insert(gtm_bco); - newhit->setBCO(packet->lValue(0, "BCO")); - newhit->setHitFormat(packet->getHitFormat()); - newhit->setIdentifier(packet->getIdentifier()); - newhit->setEvtSequence(EventSequence); - newhit->setPacketNumber(packet->iValue(0)); - newhit->setBunchNumber(packet->lValue(0, "BunchNumber")); - newhit->setTriggerInput(packet->lValue(0, "TriggerInput")); - newhit->setLiveVector(packet->lValue(0, "LiveVector")); - newhit->setScaledVector(packet->lValue(0, "ScaledVector")); - newhit->setGTMBusyVector(packet->lValue(0, "GTMBusyVector")); - newhit->setGTMAllBusyVector(packet->lValue(0, "GTMAllBusyVector")); - for (int i = 0; i < 64; i++) - { - for (int j = 0; j < 3; j++) - { - newhit->setScaler(i, j, packet->lValue(i, j)); - } - } - for (int i = 0; i < 12; i++) - { - newhit->setGl1pScaler(i, 0, packet->lValue(i, "GL1PRAW")); - newhit->setGl1pScaler(i, 1, packet->lValue(i, "GL1PLIVE")); - newhit->setGl1pScaler(i, 2, packet->lValue(i, "GL1PSCALED")); - } - if (Verbosity() > 2) - { - std::cout << PHWHERE << " Packet: " << packet->getIdentifier() - << " evtno: " << EventSequence - << ", bco: 0x" << std::hex << gtm_bco << std::dec - << ", bunch no: " << packet->lValue(0, "BunchNumber") - << std::endl; - std::cout << PHWHERE << " RB Packet: " << newhit->getIdentifier() - << " evtno: " << newhit->getEvtSequence() - << ", bco: 0x" << std::hex << newhit->getBCO() << std::dec - << ", bunch no: " << +newhit->getBunchNumber() - << std::endl; - } - if (Verbosity() > 2) - { - std::cout << PHWHERE << "evtno: " << EventSequence - << ", bco: 0x" << std::hex << gtm_bco << std::dec - << std::endl; - } - if (StreamingLumiInputManager()) - { - StreamingLumiInputManager()->AddGl1RawHit(gtm_bco, newhit); - } - - m_Gl1RawHitMap[gtm_bco].push_back(newhit); - m_BclkStack.insert(gtm_bco); - - delete packet; - } -} - -void SingleGl1PoolInputv2::Print(const std::string &what) const -{ - if (what == "ALL" || what == "FEEBCLK") - { - for (auto bcliter : m_FEEBclkMap) - { - std::cout << PHWHERE << " bclk: 0x" - << std::hex << bcliter << std::dec << std::endl; - } - } - if (what == "ALL" || what == "STORAGE") - { - for (const auto &bcliter : m_Gl1RawHitMap) - { - std::cout << PHWHERE << "Beam clock 0x" << std::hex << bcliter.first << std::dec << std::endl; - for (auto *feeiter : bcliter.second) - { - std::cout << PHWHERE << "fee: " << feeiter->getBCO() - << " at " << std::hex << feeiter << std::dec << std::endl; - } - } - } - if (what == "ALL" || what == "STACK") - { - for (auto iter : m_BclkStack) - { - std::cout << PHWHERE << "stacked bclk: 0x" << std::hex << iter << std::dec << std::endl; - } - } -} - -void SingleGl1PoolInputv2::CleanupUsedPackets(const uint64_t bclk) -{ - std::vector toclearbclk; - for (const auto &iter : m_Gl1RawHitMap) - { - if (iter.first <= bclk) - { - for (auto *pktiter : iter.second) - { - delete pktiter; - } - toclearbclk.push_back(iter.first); - } - else - { - break; - } - } - - for (auto iter : toclearbclk) - { - m_FEEBclkMap.erase(iter); - m_BclkStack.erase(iter); - m_Gl1RawHitMap.erase(iter); - } -} - -bool SingleGl1PoolInputv2::CheckPoolDepth(const uint64_t bclk) -{ - // if (m_FEEBclkMap.size() < 10) - // { - // std::cout << PHWHERE << "not all FEEs in map: " << m_FEEBclkMap.size() << std::endl; - // return true; - // } - for (auto iter : m_FEEBclkMap) - { - if (Verbosity() > 2) - { - std::cout << PHWHERE << "my bclk 0x" << std::hex << iter - << " req: 0x" << bclk << std::dec << std::endl; - } - if (iter < bclk) - { - if (Verbosity() > 1) - { - std::cout << PHWHERE << "FEE " << iter << " beamclock 0x" << std::hex << iter - << " smaller than req bclk: 0x" << bclk << std::dec << std::endl; - } - return false; - } - } - return true; -} - -void SingleGl1PoolInputv2::ClearCurrentEvent() -{ - // called interactively, to get rid of the current event - uint64_t currentbclk = *m_BclkStack.begin(); - // std::cout << PHWHERE << "clearing bclk 0x" << std::hex << currentbclk << std::dec << std::endl; - CleanupUsedPackets(currentbclk); - // m_BclkStack.erase(currentbclk); - return; -} - -bool SingleGl1PoolInputv2::GetSomeMoreEvents() -{ - if (AllDone()) - { - return false; - } - if (m_Gl1RawHitMap.empty()) - { - return true; - } - - uint64_t lowest_bclk = m_Gl1RawHitMap.begin()->first; - lowest_bclk += m_BcoRange; - uint64_t last_bclk = m_Gl1RawHitMap.rbegin()->first; - if (Verbosity() > 1) - { - std::cout << PHWHERE << "first bclk 0x" << std::hex << lowest_bclk - << " last bco: 0x" << last_bclk - << std::dec << std::endl; - } - if (lowest_bclk >= last_bclk) - { - return true; - } - return false; -} - -void SingleGl1PoolInputv2::CreateDSTNode(PHCompositeNode *topNode) -{ - PHNodeIterator iter(topNode); - PHCompositeNode *dstNode = dynamic_cast(iter.findFirst("PHCompositeNode", "DST")); - if (!dstNode) - { - dstNode = new PHCompositeNode("DST"); - topNode->addNode(dstNode); - } - PHNodeIterator iterDst(dstNode); - PHCompositeNode *detNode = dynamic_cast(iterDst.findFirst("PHCompositeNode", "GL1")); - if (!detNode) - { - detNode = new PHCompositeNode("GL1"); - dstNode->addNode(detNode); - } - Gl1Packet *gl1hitcont = findNode::getClass(detNode, "GL1RAWHIT"); - if (!gl1hitcont) - { - gl1hitcont = new Gl1Packetv3(); - PHIODataNode *newNode = new PHIODataNode(gl1hitcont, "GL1RAWHIT", "PHObject"); - detNode->addNode(newNode); - } -} diff --git a/offline/framework/rawbcolumi/SingleGl1PoolInputv2.h b/offline/framework/rawbcolumi/SingleGl1PoolInputv2.h deleted file mode 100644 index f2252571f4..0000000000 --- a/offline/framework/rawbcolumi/SingleGl1PoolInputv2.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef RAWBCOLUMI_SINGLEGL1POOLINPUTV2_H -#define RAWBCOLUMI_SINGLEGL1POOLINPUTV2_H - -#include "SingleStreamingInputv2.h" - -#include -#include -#include -#include -#include -#include - -class Gl1Packet; -class PHCompositeNode; - -class SingleGl1PoolInputv2 : public SingleStreamingInputv2 -{ - public: - explicit SingleGl1PoolInputv2(const std::string &name); - ~SingleGl1PoolInputv2() override; - void FillPool(const unsigned int) override; - void CleanupUsedPackets(const uint64_t bclk) override; - bool CheckPoolDepth(const uint64_t bclk) override; - void ClearCurrentEvent() override; - bool GetSomeMoreEvents(); - void Print(const std::string &what = "ALL") const override; - void CreateDSTNode(PHCompositeNode *topNode) override; - void SetBcoRange(const unsigned int i) { m_BcoRange = i; } - // void ConfigureStreamingInputManager() override; - void SetNegativeWindow(const unsigned int value) { m_negative_bco_window = value; } - void SetPositiveWindow(const unsigned int value) { m_positive_bco_window = value; } - void SetTotalEvent(const int value) { m_total_event = value; } - - private: - unsigned int m_NumSpecialEvents{0}; - unsigned int m_BcoRange{0}; - - //! map bco to packet - std::map m_packet_bco; - - std::map> m_Gl1RawHitMap; - std::map> m_BCOWindows; - std::map m_BCOBunchNumber; - std::set m_FEEBclkMap; - std::set m_BclkStack; - - unsigned int m_negative_bco_window = 20; - unsigned int m_positive_bco_window = 325; - bool m_alldone_flag = {false}; - bool m_lastevent_flag = {false}; - int m_total_event = std::numeric_limits::max(); -}; - -#endif diff --git a/offline/framework/rawbcolumi/SingleStreamingInputv2.cc b/offline/framework/rawbcolumi/SingleStreamingInputv2.cc deleted file mode 100644 index c0c7aef409..0000000000 --- a/offline/framework/rawbcolumi/SingleStreamingInputv2.cc +++ /dev/null @@ -1,139 +0,0 @@ -#include "SingleStreamingInputv2.h" - -#include - -#include - -#include -#include - -#include // for uint64_t -#include // for operator<<, basic_ostream, endl -#include -#include // for pair - -SingleStreamingInputv2::SingleStreamingInputv2(const std::string &name) - : Fun4AllBase(name) -{ -} - -SingleStreamingInputv2::~SingleStreamingInputv2() -{ - delete m_EventIterator; -} - -int SingleStreamingInputv2::fileopen(const std::string &filenam) -{ - std::cout << PHWHERE << "trying to open " << filenam << std::endl; - if (IsOpen()) - { - std::cout << "Closing currently open file " - << FileName() - << " and opening " << filenam << std::endl; - fileclose(); - } - FileName(filenam); - FROG frog; - std::string fname = frog.location(FileName()); - if (Verbosity() > 0) - { - std::cout << Name() << ": opening file " << FileName() << std::endl; - } - int status = 0; - m_EventIterator = new fileEventiterator(fname.c_str(), status); - m_EventsThisFile = 0; - if (status) - { - delete m_EventIterator; - m_EventIterator = nullptr; - std::cout << PHWHERE << Name() << ": could not open file " << fname << std::endl; - return -1; - } - IsOpen(1); - AddToFileOpened(fname); // add file to the list of files which were opened - return 0; -} - -int SingleStreamingInputv2::fileclose() -{ - if (!IsOpen()) - { - std::cout << Name() << ": fileclose: No Input file open" << std::endl; - return -1; - } - delete m_EventIterator; - m_EventIterator = nullptr; - IsOpen(0); - // if we have a file list, move next entry to top of the list - // or repeat the same entry again - UpdateFileList(); - return 0; -} - -void SingleStreamingInputv2::Print(const std::string &what) const -{ - if (what == "ALL" || what == "FEE") - { - for (const auto &bcliter : m_BeamClockFEE) - { - std::cout << "Beam clock 0x" << std::hex << bcliter.first << std::dec << std::endl; - for (auto feeiter : bcliter.second) - { - std::cout << "FEM: " << feeiter << std::endl; - } - } - } - if (what == "ALL" || what == "FEEBCLK") - { - for (auto bcliter : m_FEEBclkMap) - { - std::cout << "FEE" << bcliter.first << " bclk: 0x" - << std::hex << bcliter.second << std::dec << std::endl; - } - } - if (what == "ALL" || what == "STACK") - { - for (auto iter : m_BclkStack) - { - std::cout << "stacked bclk: 0x" << std::hex << iter << std::dec << std::endl; - } - } -} - -bool SingleStreamingInputv2::CheckPoolDepth(const uint64_t bclk) -{ - // if (m_FEEBclkMap.size() < 10) - // { - // std::cout << "not all FEEs in map: " << m_FEEBclkMap.size() << std::endl; - // return true; - // } - for (auto iter : m_FEEBclkMap) - { - if (Verbosity() > 2) - { - std::cout << "my bclk 0x" << std::hex << iter.second - << " req: 0x" << bclk << std::dec << std::endl; - } - if (iter.second < bclk) - { - if (Verbosity() > 1) - { - std::cout << "FEE " << iter.first << " beamclock 0x" << std::hex << iter.second - << " smaller than req bclk: 0x" << bclk << std::dec << std::endl; - } - return true; - } - } - return false; -} - -void SingleStreamingInputv2::ClearCurrentEvent() -{ - // called interactively, to get rid of the current event - uint64_t currentbclk = *m_BclkStack.begin(); - std::cout << "clearing bclk 0x" << std::hex << currentbclk << std::dec << std::endl; - CleanupUsedPackets(currentbclk); - m_BclkStack.erase(currentbclk); - m_BeamClockFEE.erase(currentbclk); - return; -} diff --git a/offline/framework/rawbcolumi/SingleStreamingInputv2.h b/offline/framework/rawbcolumi/SingleStreamingInputv2.h deleted file mode 100644 index 184fe6923f..0000000000 --- a/offline/framework/rawbcolumi/SingleStreamingInputv2.h +++ /dev/null @@ -1,114 +0,0 @@ -#ifndef RAWBCOLUMI_SINGLESTREAMINGINPUTV2_H -#define RAWBCOLUMI_SINGLESTREAMINGINPUTV2_H - -#include -#include - -#include // for uint64_t -#include -#include -#include - -class Eventiterator; -class Fun4AllEvtInputPoolManager; -class Fun4AllStreamingInputManager; -class Fun4AllStreamingLumiCountingInputManager; -class PHCompositeNode; - -class SingleStreamingInputv2 : public Fun4AllBase, public InputFileHandler -{ - public: - explicit SingleStreamingInputv2(const std::string &name); - ~SingleStreamingInputv2() override; - virtual Eventiterator *GetEventIterator() { return m_EventIterator; } - virtual void FillPool(const uint64_t) { return; } - virtual void FillPool(const unsigned int = 1) { return; } - virtual void RunNumber(const int runno) { m_RunNumber = runno; } - virtual int RunNumber() const { return m_RunNumber; } - virtual int fileopen(const std::string &filename) override; - virtual int fileclose() override; - virtual int AllDone() const { return m_AllDone; } - virtual void AllDone(const int i) { m_AllDone = i; } - virtual void EventNumberOffset(const int i) { m_EventNumberOffset = i; } - virtual void Print(const std::string &what = "ALL") const override; - virtual void CleanupUsedPackets(const uint64_t) { return; } - virtual bool CheckPoolDepth(const uint64_t bclk); - virtual void ClearCurrentEvent(); - virtual Eventiterator *GetEventiterator() const { return m_EventIterator; } - virtual Fun4AllStreamingInputManager *StreamingInputManager() { return m_StreamingInputMgr; } - virtual void StreamingInputManager(Fun4AllStreamingInputManager *in) { m_StreamingInputMgr = in; } - // virtual void StreamingInputManager(Fun4AllStreamingLumiCountingInputManager *in) { m_StreamingLumiInputMgr = in; } - virtual Fun4AllStreamingLumiCountingInputManager *StreamingLumiInputManager() { return m_StreamingLumiInputMgr; } - virtual void StreamingLumiInputManager(Fun4AllStreamingLumiCountingInputManager *in) { m_StreamingLumiInputMgr = in; } - virtual void CreateDSTNode(PHCompositeNode *) { return; } - virtual void ConfigureStreamingInputManager() { return; } - virtual void SubsystemEnum(const int id) { m_SubsystemEnum = id; } - virtual int SubsystemEnum() const { return m_SubsystemEnum; } - void MaxBclkDiff(uint64_t ui) { m_MaxBclkSpread = ui; } - uint64_t MaxBclkDiff() const { return m_MaxBclkSpread; } - virtual const std::map> &BclkStackMap() const { return m_BclkStackPacketMap; } - virtual const std::set &BclkStack() const { return m_BclkStack; } - virtual const std::map> &BeamClockFEE() const { return m_BeamClockFEE; } - void setHitContainerName(const std::string &name) { m_rawHitContainerName = name; } - const std::string &getHitContainerName() const { return m_rawHitContainerName; } - const std::map> &getFeeGTML1BCOMap() const { return m_FeeGTML1BCOMap; } - - void clearPacketBClkStackMap(const int &packetid, const uint64_t &bclk) - { - std::set to_erase; - auto set = m_BclkStackPacketMap.find(packetid)->second; - for (auto &bclk_to_erase : set) - { - if (bclk_to_erase <= bclk) - { - to_erase.insert(bclk_to_erase); - } - } - for (auto &bclk_to_erase : to_erase) - { - set.erase(bclk_to_erase); - } - } - - void clearFeeGTML1BCOMap(const uint64_t &bclk) - { - std::set toerase; - for (auto &[key, set] : m_FeeGTML1BCOMap) - { - for (auto &ll1bclk : set) - { - if (ll1bclk <= bclk) - { - // to avoid invalid reads - toerase.insert(ll1bclk); - } - } - for (auto &bclk_to_erase : toerase) - { - set.erase(bclk_to_erase); - } - } - } - - protected: - std::map> m_BclkStackPacketMap; - std::map> m_FeeGTML1BCOMap; - std::string m_rawHitContainerName = ""; - - private: - Eventiterator *m_EventIterator{nullptr}; - // Fun4AllEvtInputPoolManager *m_InputMgr {nullptr}; - Fun4AllStreamingInputManager *m_StreamingInputMgr{nullptr}; - Fun4AllStreamingLumiCountingInputManager *m_StreamingLumiInputMgr{nullptr}; - uint64_t m_MaxBclkSpread{1000000}; - unsigned int m_EventNumberOffset{1}; // packet event counters start at 0 but we start with event number 1 - int m_RunNumber{0}; - int m_EventsThisFile{0}; - int m_AllDone{0}; - int m_SubsystemEnum{0}; - std::map> m_BeamClockFEE; - std::map m_FEEBclkMap; - std::set m_BclkStack; -}; - -#endif diff --git a/offline/framework/rawbcolumi/autogen.sh b/offline/framework/rawbcolumi/autogen.sh deleted file mode 100755 index dea267bbfd..0000000000 --- a/offline/framework/rawbcolumi/autogen.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -srcdir=`dirname $0` -test -z "$srcdir" && srcdir=. - -(cd $srcdir; aclocal -I ${OFFLINE_MAIN}/share;\ -libtoolize --force; automake -a --add-missing; autoconf) - -$srcdir/configure "$@" diff --git a/offline/framework/rawbcolumi/configure.ac b/offline/framework/rawbcolumi/configure.ac deleted file mode 100644 index 301b8f12e5..0000000000 --- a/offline/framework/rawbcolumi/configure.ac +++ /dev/null @@ -1,17 +0,0 @@ -AC_INIT(rawbcolumi,[2.00]) -AC_CONFIG_SRCDIR([configure.ac]) - -AM_INIT_AUTOMAKE -AC_PROG_CXX(CC g++) - -LT_INIT([disable-static]) - -dnl no point in suppressing warnings people should -dnl at least see them, so here we go for g++: -Wall -if test $ac_cv_prog_gxx = yes; then - CXXFLAGS="$CXXFLAGS -Wall -Wextra -Wshadow -Werror" -fi - - -AC_CONFIG_FILES([Makefile]) -AC_OUTPUT