Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@
O2_DEFINE_CONFIGURABLE(cfgLocalEfficiency, bool, false, "Use local efficiency object")
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
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.
struct : ConfigurableGroup {
O2_DEFINE_CONFIGURABLE(cfgMultCentHighCutFunction, std::string, "[0] + [1]*x + [2]*x*x + [3]*x*x*x + [4]*x*x*x*x + 10.*([5] + [6]*x + [7]*x*x + [8]*x*x*x + [9]*x*x*x*x)", "Functional for multiplicity correlation cut");
O2_DEFINE_CONFIGURABLE(cfgMultCentLowCutFunction, std::string, "[0] + [1]*x + [2]*x*x + [3]*x*x*x + [4]*x*x*x*x - 3.*([5] + [6]*x + [7]*x*x + [8]*x*x*x + [9]*x*x*x*x)", "Functional for multiplicity correlation cut");
Expand Down Expand Up @@ -639,12 +641,16 @@
id = ft0.channelC()[iCh];
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))))

Check failure on line 644 in PWGCF/TwoParticleCorrelations/Tasks/longRangeDihadronCor.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
ampl = 0.;
Comment on lines +644 to +645
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.
Comment on lines 642 to +645
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
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
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.
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 >= 31 && id <= 96) || (id >= 143 && id <= 208))) || (cfgRejectOutsideDetectors && ((id >= 0 && id <= 30) || (id >= 97 && id <= 142))))

Check failure on line 652 in PWGCF/TwoParticleCorrelations/Tasks/longRangeDihadronCor.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
ampl = 0.;
registry.fill(HIST("FT0Amp"), id, ampl);
ampl = ampl / cstFT0RelGain[iCh];
registry.fill(HIST("FT0AmpCorrect"), id, ampl);
Expand Down
Loading