-
Notifications
You must be signed in to change notification settings - Fork 221
refactor: bco counting code #3996
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; | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| if (Verbosity() > 2) | ||||||||||||||||||||||||
| { | ||||||||||||||||||||||||
| if (m_alldone_flag) | ||||||||||||||||||||||||
| { | ||||||||||||||||||||||||
| std::cout << "gl1 all done is true" << std::endl; | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| // else{std::cout<<"gl1 all done is false"<<std::endl;} | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
| // else{std::cout<<"gl1 all done is false"<<std::endl;} |
Copilot
AI
Dec 13, 2025
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 underflow issue: subtracting m_negative_bco_window (default 20) from bco_trim could underflow if bco_trim is less than 20, since both are unsigned integers. This could result in a very large value wrapping around. Consider adding a check or casting to signed integers before subtraction, or ensuring bco_trim is always larger than m_negative_bco_window.
| m_BCOWindows[bco_trim] = std::make_pair(bco_trim - m_negative_bco_window, bco_trim + m_positive_bco_window); | |
| uint64_t bco_window_lower = (bco_trim >= m_negative_bco_window) ? (bco_trim - m_negative_bco_window) : 0; | |
| m_BCOWindows[bco_trim] = std::make_pair(bco_window_lower, bco_trim + m_positive_bco_window); |
Copilot
AI
Dec 13, 2025
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.
Commented-out debug code should be removed rather than left in the production codebase. If this output is needed for debugging, consider using the Verbosity() mechanism already in place throughout this file.
| // std::cout<<"BCO "<< m_BCOWindows.begin()->first<<" left "<<m_BCOWindows.begin()->second.first<<" right "<< m_BCOWindows.begin()->second.second<<std::endl; | |
| if (Verbosity() > 2) | |
| { | |
| std::cout << "BCO " << bco_trim | |
| << " left " << m_BCOWindows[bco_trim].first | |
| << " right " << m_BCOWindows[bco_trim].second | |
| << std::endl; | |
| } |
Copilot
AI
Dec 13, 2025
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.
The flags are reset here after being potentially set on lines 79-83, but only for events at multiples of 5000. This creates inconsistent behavior where the flags are set at line 79-83 for all events divisible by 5000, then immediately reset at line 201-205 for the same events. The logic for setting and resetting these flags should be clarified and potentially consolidated to avoid this confusing pattern.
| if (evt->getEvtSequence() % 5000 == 0) | |
| { | |
| m_alldone_flag = false; | |
| m_lastevent_flag = false; | |
| } | |
| // Removed resetting of m_alldone_flag and m_lastevent_flag here to avoid inconsistent behavior. | |
| // if (evt->getEvtSequence() % 5000 == 0) | |
| // { | |
| // m_alldone_flag = false; | |
| // m_lastevent_flag = false; | |
| // } |
| 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; | ||||||||||
|
Comment on lines
+36
to
+37
|
||||||||||
| int m_total_event = std::numeric_limits<int>::max(); | ||||||||||
|
||||||||||
| bool m_alldone_flag = {false}; | ||||||||||
| bool m_lastevent_flag = {false}; | ||||||||||
|
Comment on lines
+39
to
+40
|
||||||||||
| bool m_alldone_flag = {false}; | |
| bool m_lastevent_flag = {false}; | |
| bool m_AllDoneFlag = {false}; | |
| bool m_LastEventFlag = {false}; |
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.
The logic here sets the done flags every 5000 events, but this condition will be true multiple times (events 5000, 10000, 15000, etc.). The condition should likely use modulo with a specific check or a different approach. If the intent is to only set flags at specific event intervals, consider using a more precise condition or documenting why flags are set repeatedly.