Skip to content

Conversation

@MartijnLaarhoven
Copy link
Contributor

Added option to reject the inside or the outside of the detector ring of FT0

Added option to reject the inside or the outside of the detector ring of FT0
Copilot AI review requested due to automatic review settings December 12, 2025 14:09
@github-actions github-actions bot added the pwgcf label Dec 12, 2025
@github-actions github-actions bot changed the title Added option to reject the inside or the outside of the detector ring of FT0 [PWGCF] Added option to reject the inside or the outside of the detector ring of FT0 Dec 12, 2025
@github-actions
Copy link

O2 linter results: ❌ 2 errors, ⚠️ 0 warnings, 🔕 0 disabled

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 adds configuration options to selectively reject signals from inside or outside rings of the FT0 detector in the long-range dihadron correlation analysis. The implementation introduces two boolean flags that control whether to zero out amplitudes from specific channel ID ranges.

Key changes:

  • Added two new configurables: cfgRejectOutsideDetectors and cfgRejectInsideDetectors to control ring rejection
  • Implemented channel rejection logic in the getChannel() function for both FT0A and FT0C detector sections
  • Rejection is performed by setting amplitude to 0 for channels in specific ID ranges

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

Comment on lines +644 to +645
if ((cfgRejectInsideDetectors && ((id >= 31 && id <= 96) || (id >= 143 && id <= 208))) || (cfgRejectOutsideDetectors && ((id >= 0 && id <= 30) || (id >= 97 && id <= 142))))
ampl = 0.;
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

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

There's no validation to prevent both cfgRejectInsideDetectors and cfgRejectOutsideDetectors from being enabled simultaneously. If both are true, this would reject all channels, which may not be the intended behavior. Consider adding mutual exclusivity validation or documenting the expected behavior when both are enabled.

Copilot uses AI. Check for mistakes.
O2_DEFINE_CONFIGURABLE(cfgUseEventWeights, bool, false, "Use event weights for mixed event")
O2_DEFINE_CONFIGURABLE(cfgDrawEtaPhiDis, bool, false, "draw eta-phi distribution for detectors in used")
O2_DEFINE_CONFIGURABLE(cfgRejectOutsideDetectors, bool, false, "Rejection of outside ring events of the FT0 detector")
O2_DEFINE_CONFIGURABLE(cfgRejectInsideDetectors, bool, false, "Rejection of inside ring events of the FT0 detector")
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

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

The description says "Rejection of inside ring events of the FT0 detector" but the implementation rejects channels (by setting amplitude to 0), not events. The description should clarify that this rejects signals from specific channels/rings rather than entire events.

Suggested change
O2_DEFINE_CONFIGURABLE(cfgRejectInsideDetectors, bool, false, "Rejection of inside ring events of the FT0 detector")
O2_DEFINE_CONFIGURABLE(cfgRejectInsideDetectors, bool, false, "Rejection of signals from inside ring channels of the FT0 detector")

Copilot uses AI. Check for mistakes.
Comment on lines +110 to +111
O2_DEFINE_CONFIGURABLE(cfgRejectOutsideDetectors, bool, false, "Rejection of outside ring events of the FT0 detector")
O2_DEFINE_CONFIGURABLE(cfgRejectInsideDetectors, bool, false, "Rejection of inside ring events of the FT0 detector")
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

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

The configurable name "cfgRejectOutsideDetectors" is ambiguous and could be misunderstood as rejecting multiple detectors. Consider renaming to "cfgRejectFT0OutsideRing" to be more specific and consistent with the description mentioning "FT0 detector".

Suggested change
O2_DEFINE_CONFIGURABLE(cfgRejectOutsideDetectors, bool, false, "Rejection of outside ring events of the FT0 detector")
O2_DEFINE_CONFIGURABLE(cfgRejectInsideDetectors, bool, false, "Rejection of inside ring events of the FT0 detector")
O2_DEFINE_CONFIGURABLE(cfgRejectFT0OutsideRing, bool, false, "Reject events in the outside ring of the FT0 detector")
O2_DEFINE_CONFIGURABLE(cfgRejectFT0InsideRing, bool, false, "Reject events in the inside ring of the FT0 detector")

Copilot uses AI. Check for mistakes.
Comment on lines 642 to +645
id = id + Ft0IndexA;
ampl = ft0.amplitudeC()[iCh];
if ((cfgRejectInsideDetectors && ((id >= 31 && id <= 96) || (id >= 143 && id <= 208))) || (cfgRejectOutsideDetectors && ((id >= 0 && id <= 30) || (id >= 97 && id <= 142))))
ampl = 0.;
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

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

The rejection logic appears to have a bug for FT0C channels. After adding Ft0IndexA (96) to the channel ID on line 642, the id range becomes 96-207. However, the rejection ranges include (0-30) which would never match FT0C channels, and (31-96) which would only match id=96. This suggests the rejection logic was designed for FT0A channel IDs (0-95) but is being incorrectly applied to FT0C after the offset is added. The rejection logic should be applied before adding the offset, or the ranges should be adjusted to account for the offset.

Suggested change
id = id + Ft0IndexA;
ampl = ft0.amplitudeC()[iCh];
if ((cfgRejectInsideDetectors && ((id >= 31 && id <= 96) || (id >= 143 && id <= 208))) || (cfgRejectOutsideDetectors && ((id >= 0 && id <= 30) || (id >= 97 && id <= 142))))
ampl = 0.;
ampl = ft0.amplitudeC()[iCh];
// Apply rejection logic to raw FT0C channel ID (before offset)
if ((cfgRejectInsideDetectors && ((id >= 31 && id <= 96) || (id >= 143 && id <= 208))) || (cfgRejectOutsideDetectors && ((id >= 0 && id <= 30) || (id >= 97 && id <= 142))))
ampl = 0.;
id = id + Ft0IndexA;

Copilot uses AI. Check for mistakes.
Comment on lines +644 to +645
if ((cfgRejectInsideDetectors && ((id >= 31 && id <= 96) || (id >= 143 && id <= 208))) || (cfgRejectOutsideDetectors && ((id >= 0 && id <= 30) || (id >= 97 && id <= 142))))
ampl = 0.;
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

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

This rejection logic is duplicated in both FT0C (lines 644-645) and FT0A (lines 652-653) sections. The identical conditional expression should be extracted into a helper function or applied before the if-else branch to improve code maintainability and reduce duplication.

Copilot uses AI. Check for mistakes.
Comment on lines +644 to +645
if ((cfgRejectInsideDetectors && ((id >= 31 && id <= 96) || (id >= 143 && id <= 208))) || (cfgRejectOutsideDetectors && ((id >= 0 && id <= 30) || (id >= 97 && id <= 142))))
ampl = 0.;
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

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

The complex conditional expression with multiple OR and AND operators is difficult to read and verify. Consider breaking this into intermediate boolean variables with descriptive names (e.g., isInsideRing, isOutsideRing) or extracting it into a separate helper function to improve code clarity.

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

Development

Successfully merging this pull request may close these issues.

1 participant