Skip to content

Conversation

@blackcathj
Copy link

@blackcathj blackcathj commented Jan 6, 2026

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work for users)
  • Requiring change in macros repository (Please provide links to the macros pull request in the last section)
  • I am a member of GitHub organization of sPHENIX Collaboration, EIC, or ECCE (contact Chris Pinkenburg to join)

What kind of change does this PR introduce? (Bug fix, feature, ...)

TODOs (if applicable)

Links to other PRs in macros and calibration repositories (if applicable)

Summary by CodeRabbit

  • Refactor

    • Consolidated GL1 streaming input classes by migrating to base SingleStreamingInput type, improving type consistency across input management.
    • Integrated lumi-counting manager support into the core streaming input framework for enhanced event tracking.
  • Chores

    • Removed deprecated rawbcolumi library and associated build configurations.
    • Added new configuration methods for BCO window parameters and event count settings.

✏️ Tip: You can customize this high-level summary in your review settings.

Copilot AI review requested due to automatic review settings January 6, 2026 15:47
@coderabbitai
Copy link

coderabbitai bot commented Jan 6, 2026

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

📥 Commits

Reviewing files that changed from the base of the PR and between c705f95 and 45a96b5.

📒 Files selected for processing (13)
  • offline/framework/fun4allraw/Fun4AllStreamingLumiCountingInputManager.cc
  • offline/framework/fun4allraw/Fun4AllStreamingLumiCountingInputManager.h
  • offline/framework/fun4allraw/Makefile.am
  • offline/framework/fun4allraw/SingleGl1PoolInput.cc
  • offline/framework/fun4allraw/SingleGl1PoolInput.h
  • offline/framework/fun4allraw/SingleStreamingInput.h
  • offline/framework/rawbcolumi/Makefile.am
  • offline/framework/rawbcolumi/SingleGl1PoolInputv2.cc
  • offline/framework/rawbcolumi/SingleGl1PoolInputv2.h
  • offline/framework/rawbcolumi/SingleStreamingInputv2.cc
  • offline/framework/rawbcolumi/SingleStreamingInputv2.h
  • offline/framework/rawbcolumi/autogen.sh
  • offline/framework/rawbcolumi/configure.ac
 __________________________________________
< Duck and cover! I'm reviewing your code. >
 ------------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).

Tip

You can disable the changed files summary in the walkthrough.

Disable the reviews.changed_files_summary setting in your project's settings in CodeRabbit to disable the changed files summary in the walkthrough.

✨ Finishing touches
  • 📝 Docstrings were successfully generated.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai
Copy link

coderabbitai bot commented Jan 6, 2026

Note

Docstrings generation - SUCCESS
Generated docstrings for this pull request at #8

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI Agents
In @offline/framework/fun4allraw/SingleGl1PoolInput.h:
- Line 38: The file declares m_total_event initialized with
std::numeric_limits<int>::max() but does not include the <limits> header; add an
#include <limits> near the top of SingleGl1PoolInput.h (before the declaration
of m_total_event) so that std::numeric_limits is defined and the initialization
of m_total_event compiles correctly.
🧹 Nitpick comments (2)
offline/framework/fun4allraw/SingleGl1PoolInput.h (2)

30-31: Consider aligning setter behavior with InputManager.

These setters use direct assignment, while Fun4AllStreamingLumiCountingInputManager::SetNegativeWindow and SetPositiveWindow use std::max() to ensure the window is never reduced. If multiple components configure these windows, the direct assignment here may inadvertently shrink the window, breaking synchronization.

🔎 Proposed alignment with InputManager behavior
-  void SetNegativeWindow(const unsigned int value) { m_negative_bco_window = value; }
-  void SetPositiveWindow(const unsigned int value) { m_positive_bco_window = value; }
+  void SetNegativeWindow(const unsigned int value) { m_negative_bco_window = std::max(value, m_negative_bco_window); }
+  void SetPositiveWindow(const unsigned int value) { m_positive_bco_window = std::max(value, m_positive_bco_window); }

36-40: Consider documenting BCO window defaults and standardizing initialization.

The hardcoded values 20 and 325 for BCO windows lack inline comments explaining their physical or operational meaning. Additionally, the initialization syntax is inconsistent: line 38 uses = while lines 39-40 use brace initialization {false} (the braces are redundant for simple scalar types).

🔎 Suggested improvements
-  unsigned int m_negative_bco_window = 20;
-  unsigned int m_positive_bco_window = 325;
+  unsigned int m_negative_bco_window = 20;   // Default backward BCO window
+  unsigned int m_positive_bco_window = 325;  // Default forward BCO window
   int m_total_event = std::numeric_limits<int>::max();
-  bool m_alldone_flag = {false};
-  bool m_lastevent_flag = {false};
+  bool m_alldone_flag = false;
+  bool m_lastevent_flag = false;
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c705f95 and 45a96b5.

📒 Files selected for processing (13)
  • offline/framework/fun4allraw/Fun4AllStreamingLumiCountingInputManager.cc
  • offline/framework/fun4allraw/Fun4AllStreamingLumiCountingInputManager.h
  • offline/framework/fun4allraw/Makefile.am
  • offline/framework/fun4allraw/SingleGl1PoolInput.cc
  • offline/framework/fun4allraw/SingleGl1PoolInput.h
  • offline/framework/fun4allraw/SingleStreamingInput.h
  • offline/framework/rawbcolumi/Makefile.am
  • offline/framework/rawbcolumi/SingleGl1PoolInputv2.cc
  • offline/framework/rawbcolumi/SingleGl1PoolInputv2.h
  • offline/framework/rawbcolumi/SingleStreamingInputv2.cc
  • offline/framework/rawbcolumi/SingleStreamingInputv2.h
  • offline/framework/rawbcolumi/autogen.sh
  • offline/framework/rawbcolumi/configure.ac
💤 Files with no reviewable changes (7)
  • offline/framework/rawbcolumi/SingleStreamingInputv2.cc
  • offline/framework/rawbcolumi/SingleStreamingInputv2.h
  • offline/framework/rawbcolumi/Makefile.am
  • offline/framework/rawbcolumi/autogen.sh
  • offline/framework/rawbcolumi/SingleGl1PoolInputv2.h
  • offline/framework/rawbcolumi/configure.ac
  • offline/framework/rawbcolumi/SingleGl1PoolInputv2.cc
🧰 Additional context used
🧬 Code graph analysis (4)
offline/framework/fun4allraw/SingleGl1PoolInput.cc (1)
offline/framework/fun4allraw/Fun4AllStreamingLumiCountingInputManager.h (2)
  • m_negative_bco_window (66-66)
  • m_positive_bco_window (67-67)
offline/framework/fun4allraw/Fun4AllStreamingLumiCountingInputManager.h (1)
offline/framework/fun4allraw/Fun4AllStreamingLumiCountingInputManager.cc (2)
  • registerStreamingInput (176-214)
  • registerStreamingInput (176-176)
offline/framework/fun4allraw/SingleStreamingInput.h (2)
offline/framework/fun4allraw/Fun4AllStreamingLumiCountingInputManager.cc (2)
  • Fun4AllStreamingLumiCountingInputManager (38-47)
  • Fun4AllStreamingLumiCountingInputManager (49-66)
offline/framework/fun4allraw/Fun4AllStreamingLumiCountingInputManager.h (1)
  • Fun4AllStreamingLumiCountingInputManager (20-44)
offline/framework/fun4allraw/SingleGl1PoolInput.h (2)
offline/framework/fun4allraw/Fun4AllStreamingLumiCountingInputManager.cc (4)
  • SetNegativeWindow (502-505)
  • SetNegativeWindow (502-502)
  • SetPositiveWindow (507-510)
  • SetPositiveWindow (507-507)
offline/framework/fun4allraw/Fun4AllStreamingLumiCountingInputManager.h (2)
  • m_negative_bco_window (66-66)
  • m_positive_bco_window (67-67)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Agent
🔇 Additional comments (12)
offline/framework/fun4allraw/SingleGl1PoolInput.h (1)

44-45: The memory concern does not apply—these maps are properly cleaned up.

Both m_BCOWindows and m_BCOBunchNumber are explicitly erased in CleanupUsedPackets() at lines 271–272 of SingleGl1PoolInput.cc. Entries are removed when their BCO values become older than the reference BCO passed to the cleanup method, preventing unbounded growth in long-running processes.

Likely an incorrect or invalid review comment.

offline/framework/fun4allraw/SingleGl1PoolInput.cc (6)

4-4: LGTM!

The include for the Lumi counting input manager is correctly added to support the new functionality.


73-91: Verify the 5000-event batching logic.

The code sets m_alldone_flag and m_lastevent_flag every 5000 events (line 79-83), then clears them after processing (lines 201-205). This creates a periodic end-of-event signal that triggers output file writing in the Lumi counting manager (see line 465-497 in Fun4AllStreamingLumiCountingInputManager.cc).

Confirm this batching behavior is intentional and that 5000 events is the desired batch size for Lumi counting output.


122-131: LGTM!

Proper null pointer check for StreamingLumiInputManager() before invoking its methods. The handling of a null packet 14001 by setting end-of-event flags is appropriate.


192-200: LGTM!

Proper null pointer check before invoking StreamingLumiInputManager() methods. The propagation of BCO windows, bunch numbers, event flags, and window settings to the Lumi counting manager is correctly implemented.


201-205: LGTM!

The flag reset (lines 201-205) complements the periodic flag setting, completing the 5000-event batching logic.

The cleanup logic (lines 270-272) correctly uses the trimmed 40-bit BCO to erase associated Lumi counting state from m_BCOWindows and m_BCOBunchNumber, maintaining consistency with the trimming applied at line 140.

Also applies to: 270-272


140-143: All flagged concerns are not valid issues in the code.

  • Member variable declarations: Both m_BCOWindows (line 44) and m_BCOBunchNumber (line 45) are properly declared in the header file as private members.

  • Window variable initialization: m_negative_bco_window and m_positive_bco_window are not uninitialized—they have default values of 20 and 325 respectively (lines 36–37 in the header). They can be optionally overridden via SetNegativeWindow() and SetPositiveWindow() setters.

  • 40-bit BCO mask: The mask 0xFFFFFFFFFFU is correct and follows established convention throughout the codebase (confirmed in SingleInttPoolInput.cc, Fun4AllStreamingInputManager.cc, and documented in comments as "40 bit clock").

Likely an incorrect or invalid review comment.

offline/framework/fun4allraw/Fun4AllStreamingLumiCountingInputManager.cc (2)

4-4: LGTM!

The include statement correctly updated from the deprecated v2 variant to the base SingleStreamingInput class.


176-176: LGTM!

The function signature correctly migrated from SingleStreamingInputv2* to SingleStreamingInput*, consistent with the type refactoring across the codebase.

offline/framework/fun4allraw/Makefile.am (1)

21-21: LGTM!

Build configuration correctly updated to export the Fun4AllStreamingLumiCountingInputManager header and compile its implementation, making the Lumi counting manager publicly available.

Also applies to: 79-79

offline/framework/fun4allraw/Fun4AllStreamingLumiCountingInputManager.h (1)

14-14: LGTM!

Type migration from SingleStreamingInputv2 to SingleStreamingInput is correctly applied across:

  • Forward declaration (line 14)
  • Method signature (line 37)
  • Member variable type (line 79)

The changes are consistent with the refactoring to remove the v2 variant.

Also applies to: 37-37, 79-79

offline/framework/fun4allraw/SingleStreamingInput.h (1)

15-15: LGTM!

The API extension cleanly integrates the Lumi counting manager:

  • Forward declaration added (line 15)
  • Accessor/mutator pair follows the existing pattern used for StreamingInputManager (lines 49-50)
  • Private member properly initialized to nullptr (line 123)

The design is consistent and maintains encapsulation.

Also applies to: 51-52, 123-124


unsigned int m_negative_bco_window = 20;
unsigned int m_positive_bco_window = 325;
int m_total_event = std::numeric_limits<int>::max();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Missing required header for std::numeric_limits.

Line 38 uses std::numeric_limits<int>::max() but the header does not include <limits>, which will cause a compilation error.

🔎 Proposed fix

Add the missing include near the top of the file:

 #include <cstdint>
+#include <limits>
 #include <list>

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In @offline/framework/fun4allraw/SingleGl1PoolInput.h at line 38, The file
declares m_total_event initialized with std::numeric_limits<int>::max() but does
not include the <limits> header; add an #include <limits> near the top of
SingleGl1PoolInput.h (before the declaration of m_total_event) so that
std::numeric_limits is defined and the initialization of m_total_event compiles
correctly.

coderabbitai bot added a commit that referenced this pull request Jan 6, 2026
Docstrings generation was requested by @blackcathj.

* #7 (comment)

The following files were modified:

* `offline/framework/fun4allraw/Fun4AllStreamingLumiCountingInputManager.cc`
* `offline/framework/fun4allraw/Fun4AllStreamingLumiCountingInputManager.h`
* `offline/framework/fun4allraw/SingleGl1PoolInput.cc`
* `offline/framework/fun4allraw/SingleGl1PoolInput.h`
* `offline/framework/fun4allraw/SingleStreamingInput.h`
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the BCO (Beam Clock) counting infrastructure by consolidating functionality from the rawbcolumi directory into the existing fun4allraw directory. The changes eliminate the SingleStreamingInputv2 classes and integrate luminosity counting features directly into the base SingleStreamingInput class.

Key Changes

  • Removed the entire rawbcolumi directory including SingleStreamingInputv2 and SingleGl1PoolInputv2 classes
  • Extended SingleStreamingInput base class with luminosity counting manager support
  • Enhanced SingleGl1PoolInput with BCO window tracking, bunch number management, and event control flags
  • Updated Fun4AllStreamingLumiCountingInputManager to work with the base SingleStreamingInput class instead of the v2 variant

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
offline/framework/rawbcolumi/configure.ac Deleted autoconf configuration for removed rawbcolumi library
offline/framework/rawbcolumi/autogen.sh Deleted autogen script for removed rawbcolumi library
offline/framework/rawbcolumi/SingleStreamingInputv2.h Deleted v2 header, functionality migrated to base class
offline/framework/rawbcolumi/SingleStreamingInputv2.cc Deleted v2 implementation, functionality migrated to base class
offline/framework/rawbcolumi/SingleGl1PoolInputv2.h Deleted v2 header, functionality migrated to base class
offline/framework/rawbcolumi/SingleGl1PoolInputv2.cc Deleted v2 implementation, functionality migrated to base class
offline/framework/rawbcolumi/Makefile.am Deleted build configuration for removed rawbcolumi library
offline/framework/fun4allraw/SingleStreamingInput.h Added lumi counting manager pointer and accessor methods
offline/framework/fun4allraw/SingleGl1PoolInput.h Added BCO window controls, bunch number tracking, and event control flags
offline/framework/fun4allraw/SingleGl1PoolInput.cc Implemented BCO window calculation, bunch number tracking, and integration with lumi counting manager
offline/framework/fun4allraw/Makefile.am Added Fun4AllStreamingLumiCountingInputManager to build
offline/framework/fun4allraw/Fun4AllStreamingLumiCountingInputManager.h Changed to use SingleStreamingInput base class instead of v2
offline/framework/fun4allraw/Fun4AllStreamingLumiCountingInputManager.cc Updated registration to use SingleStreamingInput base class

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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))
Copy link

Copilot AI Jan 6, 2026

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() - 2 could 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.

Suggested change
(m_total_event != 0 && evt->getEvtSequence() - 2 == m_total_event))
(m_total_event != 0 && evt->getEvtSequence() >= 2 &&
evt->getEvtSequence() - 2 == m_total_event))

Copilot uses AI. Check for mistakes.

unsigned int m_negative_bco_window = 20;
unsigned int m_positive_bco_window = 325;
int m_total_event = std::numeric_limits<int>::max();
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing include for std::numeric_limits. Line 38 uses std::numeric_limits::max() but the header does not include . This will cause a compilation error. Add #include <limits> to the header file.

Copilot uses AI. Check for mistakes.
Comment on lines +79 to +83
if (evt->getEvtSequence() % 5000 == 0)
{
m_alldone_flag = true;
m_lastevent_flag = true;
}
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confusing logic that sets flags every 5000 events regardless of other conditions. Lines 79-83 set m_alldone_flag and m_lastevent_flag to true whenever the event sequence is a multiple of 5000, but then lines 201-205 immediately reset these flags back to false for the same condition. This creates inconsistent behavior where the flags are briefly set to true but then reset, which may not achieve the intended behavior. Consider clarifying the logic or removing this if-statement.

Suggested change
if (evt->getEvtSequence() % 5000 == 0)
{
m_alldone_flag = true;
m_lastevent_flag = true;
}

Copilot uses AI. Check for mistakes.
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);
Copy link

Copilot AI Jan 6, 2026

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.

Suggested change
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);

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants