Skip to content

Conversation

@MartijnLaarhoven
Copy link
Contributor

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

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
@github-actions
Copy link

github-actions bot commented Dec 12, 2025

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

@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
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 introduces configurable options to reject inner or outer detector rings of the FT0 detector without using magic numbers. It adds two boolean configurables (cfgRejectInsideDetectors and cfgRejectOutsideDetectors) and defines an enum (DetectorChannels) to replace hardcoded channel range values.

Key changes:

  • Added enum constants for FT0A and FT0C inner/outer ring channel ranges
  • Introduced two configurables to selectively reject detector ring events
  • Implemented rejection logic by setting amplitude to 0 for matching channels

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

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.

Both cfgRejectInsideDetectors and cfgRejectOutsideDetectors can be enabled simultaneously, which would reject all FT0 channels (both inner and outer rings). The code should validate that these options are mutually exclusive, or document that enabling both is intentional and will reject all channels.

Copilot uses AI. Check for mistakes.
Comment on lines +654 to +655
if ((cfgRejectInsideDetectors && ((id >= kFT0AInnerRingMin && id <= kFT0AInnerRingMax) || (id >= kFT0CInnerRingMin && id <= kFT0CInnerRingMax))) || (cfgRejectOutsideDetectors && ((id >= kFT0AOuterRingMin && id <= kFT0AOuterRingMax) || (id >= kFT0COuterRingMin && id <= kFT0COuterRingMax))))
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 checks both FT0A and FT0C ranges when processing FT0C channels. However, since FT0C channel IDs are offset by 96 (line 652), they will never match the FT0A inner/outer ring ranges (0-31 and 32-95). The condition should only check FT0C ranges (kFT0CInnerRingMin/Max and kFT0COuterRingMin/Max) when fitType is kFT0C.

Copilot uses AI. Check for mistakes.
Comment on lines +654 to 666
if ((cfgRejectInsideDetectors && ((id >= kFT0AInnerRingMin && id <= kFT0AInnerRingMax) || (id >= kFT0CInnerRingMin && id <= kFT0CInnerRingMax))) || (cfgRejectOutsideDetectors && ((id >= kFT0AOuterRingMin && id <= kFT0AOuterRingMax) || (id >= kFT0COuterRingMin && id <= kFT0COuterRingMax))))
ampl = 0.;
registry.fill(HIST("FT0Amp"), id, ampl);
ampl = ampl / cstFT0RelGain[iCh];
registry.fill(HIST("FT0AmpCorrect"), id, ampl);
} else if (fitType == kFT0A) {
id = ft0.channelA()[iCh];
ampl = ft0.amplitudeA()[iCh];
if ((cfgRejectInsideDetectors && ((id >= kFT0AInnerRingMin && id <= kFT0AInnerRingMax) || (id >= kFT0CInnerRingMin && id <= kFT0CInnerRingMax))) || (cfgRejectOutsideDetectors && ((id >= kFT0AOuterRingMin && id <= kFT0AOuterRingMax) || (id >= kFT0COuterRingMin && id <= kFT0COuterRingMax))))
ampl = 0.;
registry.fill(HIST("FT0Amp"), id, ampl);
ampl = ampl / cstFT0RelGain[iCh];
registry.fill(HIST("FT0AmpCorrect"), id, ampl);
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 logic is duplicated between the FT0C and FT0A branches (lines 654-655 and 662-663). Consider extracting the rejection logic into a helper function that takes the detector type as a parameter to avoid duplication and make the code more maintainable.

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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