-
Notifications
You must be signed in to change notification settings - Fork 0
Bco counting refactor #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,6 +1,7 @@ | ||||||||||||||||
| #include "SingleGl1PoolInput.h" | ||||||||||||||||
|
|
||||||||||||||||
| #include "Fun4AllStreamingInputManager.h" | ||||||||||||||||
| #include "Fun4AllStreamingLumiCountingInputManager.h" | ||||||||||||||||
| #include "InputManagerType.h" | ||||||||||||||||
|
|
||||||||||||||||
| #include <ffarawobjects/Gl1Packetv3.h> | ||||||||||||||||
|
|
@@ -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; | ||||||||||||||||
| } | ||||||||||||||||
|
Comment on lines
+79
to
+83
|
||||||||||||||||
| if (evt->getEvtSequence() % 5000 == 0) | |
| { | |
| m_alldone_flag = true; | |
| m_lastevent_flag = true; | |
| } |
Copilot
AI
Jan 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential unsigned integer underflow. When bco_trim is less than m_negative_bco_window (default 20), the subtraction will wrap around to a very large uint64_t value. While this might be intentional behavior for handling BCO wraparound scenarios, it could lead to unexpected results. Consider adding a check or a comment explaining this is intentional if wraparound behavior is expected.
| m_BCOWindows[bco_trim] = std::make_pair(bco_trim - m_negative_bco_window, bco_trim + m_positive_bco_window); | |
| uint64_t window_start = 0; | |
| if (bco_trim >= static_cast<uint64_t>(m_negative_bco_window)) | |
| { | |
| window_start = bco_trim - static_cast<uint64_t>(m_negative_bco_window); | |
| } | |
| m_BCOWindows[bco_trim] = std::make_pair(window_start, bco_trim + m_positive_bco_window); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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<int>::max(); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing required header for Line 38 uses 🔎 Proposed fixAdd the missing include near the top of the file: #include <cstdint>
+#include <limits>
#include <list>
🤖 Prompt for AI Agents
|
||
| bool m_alldone_flag = {false}; | ||
| bool m_lastevent_flag = {false}; | ||
| //! map bco to packet | ||
| std::map<unsigned int, uint64_t> m_packet_bco; | ||
|
|
||
| std::map<uint64_t, std::pair<uint64_t, uint64_t>> m_BCOWindows; | ||
| std::map<uint64_t, int> m_BCOBunchNumber; | ||
| std::map<uint64_t, std::vector<Gl1Packet *>> m_Gl1RawHitMap; | ||
| std::set<uint64_t> m_FEEBclkMap; | ||
| std::set<uint64_t> m_BclkStack; | ||
|
|
||
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential integer underflow if evt->getEvtSequence() returns 0 or 1. The expression
evt->getEvtSequence() - 2could underflow since getEvtSequence() likely returns an unsigned type. Consider checking if the value is >= 2 before performing the subtraction, or explicitly cast to a signed type if negative values are intended.