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
29 changes: 29 additions & 0 deletions PWGCF/TwoParticleCorrelations/Tasks/longRangeDihadronCor.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@
O2_DEFINE_CONFIGURABLE(cfgRejectFT0AOutside, bool, false, "Rejection of outer ring channels of the FT0A detector")
O2_DEFINE_CONFIGURABLE(cfgRejectFT0CInside, bool, false, "Rejection of inner ring channels of the FT0C detector")
O2_DEFINE_CONFIGURABLE(cfgRejectFT0COutside, bool, false, "Rejection of outer ring channels of the FT0C detector")
O2_DEFINE_CONFIGURABLE(cfgRemapFT0ADeadChannels, bool, false, "If true, remap FT0A channels 60-63 to amplitudes from 92-95 respectively")
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

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

The configuration description states "remap FT0A channels 60-63 to amplitudes from 92-95 respectively", but the implementation does the opposite. The code at lines 686-687 maps channels 92-95 to channels 60-63 (by subtracting 32). The description should be corrected to match the implementation: "remap FT0A channels 92-95 to amplitudes from 60-63 respectively" or the implementation should be adjusted to match the description.

Suggested change
O2_DEFINE_CONFIGURABLE(cfgRemapFT0ADeadChannels, bool, false, "If true, remap FT0A channels 60-63 to amplitudes from 92-95 respectively")
O2_DEFINE_CONFIGURABLE(cfgRemapFT0ADeadChannels, bool, false, "If true, remap FT0A channels 92-95 to amplitudes from 60-63 respectively")

Copilot uses AI. Check for mistakes.
O2_DEFINE_CONFIGURABLE(cfgRemapFT0CDeadChannels, bool, false, "If true, remap FT0C channels 177->145, 176->144, 178->146, 179->147, 139->115")
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

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

The configuration description states "remap FT0C channels 177->145, 176->144, 178->146, 179->147, 139->115" but the implementation does the opposite mapping. The code at lines 670-671 maps channels 144-147 to 176-179 (adding 32), and line 666 maps channel 115 to 139 (adding 24). This is the reverse of what the description indicates. Either the description should be corrected to reflect the actual mapping direction (e.g., "115->139, 144->176, 145->177, 146->178, 147->179"), or the implementation needs to be adjusted to match the description.

Suggested change
O2_DEFINE_CONFIGURABLE(cfgRemapFT0CDeadChannels, bool, false, "If true, remap FT0C channels 177->145, 176->144, 178->146, 179->147, 139->115")
O2_DEFINE_CONFIGURABLE(cfgRemapFT0CDeadChannels, bool, false, "If true, remap FT0C channels 115->139, 144->176, 145->177, 146->178, 147->179")

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 @@ -250,6 +252,12 @@
kFT0COuterRingMin = 144,
kFT0COuterRingMax = 207
};
enum MirroringConstants {
kFT0AOuterMirror = 32,
kFT0AInnerMirror = 16,
kFT0COuterMirror = 32,
kFT0CInnerMirror = 24
};
std::array<float, 6> tofNsigmaCut;
std::array<float, 6> itsNsigmaCut;
std::array<float, 6> tpcNsigmaCut;
Expand Down Expand Up @@ -653,6 +661,19 @@
id = ft0.channelC()[iCh];
id = id + Ft0IndexA;
ampl = ft0.amplitudeC()[iCh];
if (cfgRemapFT0CDeadChannels) {
if (id == 115) {

Check failure on line 665 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.
int dead_id = id + kFT0CInnerMirror;
registry.fill(HIST("FT0Amp"), dead_id, ampl);
ampl = ampl / cstFT0RelGain[iCh];
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

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

The variable 'ampl' is modified at line 668 by applying gain correction before filling the dead channel histogram. This causes the subsequent fills for the original channel at lines 679-681 to use the already-corrected amplitude instead of the raw amplitude. As a result, line 679 fills FT0Amp with a gain-corrected value when it should receive the raw amplitude, and line 680 applies gain correction again, leading to double correction in the FT0AmpCorrect histogram. Consider using a separate variable for the corrected amplitude when filling the dead channel histograms to avoid modifying the 'ampl' variable that's used later.

Copilot uses AI. Check for mistakes.
registry.fill(HIST("FT0AmpCorrect"), dead_id, ampl);
} else if (id >= 144 && id <= 147) {

Check failure on line 670 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.
int dead_id = id + kFT0COuterMirror;
registry.fill(HIST("FT0Amp"), dead_id, ampl);
ampl = ampl / cstFT0RelGain[iCh];
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

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

The variable 'ampl' is modified at line 673 by applying gain correction before filling the dead channel histogram. This causes the subsequent fills for the original channel at lines 679-681 to use the already-corrected amplitude instead of the raw amplitude. As a result, line 679 fills FT0Amp with a gain-corrected value when it should receive the raw amplitude, and line 680 applies gain correction again, leading to double correction in the FT0AmpCorrect histogram. Consider using a separate variable for the corrected amplitude when filling the dead channel histograms to avoid modifying the 'ampl' variable that's used later.

Copilot uses AI. Check for mistakes.
registry.fill(HIST("FT0AmpCorrect"), dead_id, ampl);
}
}
if ((cfgRejectFT0CInside && (id >= kFT0CInnerRingMin && id <= kFT0CInnerRingMax)) || (cfgRejectFT0COutside && (id >= kFT0COuterRingMin && id <= kFT0COuterRingMax)))
ampl = 0.;
registry.fill(HIST("FT0Amp"), id, ampl);
Expand All @@ -661,6 +682,14 @@
} else if (fitType == kFT0A) {
id = ft0.channelA()[iCh];
ampl = ft0.amplitudeA()[iCh];
if (cfgRemapFT0ADeadChannels) {
if (id >= 92 && id <= 95) {

Check failure on line 686 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.
int dead_id = id - kFT0AOuterMirror;
registry.fill(HIST("FT0Amp"), dead_id, ampl);
ampl = ampl / cstFT0RelGain[iCh];
registry.fill(HIST("FT0AmpCorrect"), dead_id, ampl);
Comment on lines +689 to +690
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

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

The gain correction is applied inside the remapping block at line 689 before filling the FT0AmpCorrect histogram for the dead channel, but the same amplitude will be divided by cstFT0RelGain[iCh] again at line 696 for the original channel. This creates an inconsistency in how amplitudes are corrected. The gain correction at line 689 should be removed to maintain consistency with the rest of the function's logic where gain correction is applied once after all channel processing.

Copilot uses AI. Check for mistakes.
}
}
if ((cfgRejectFT0AInside && (id >= kFT0AInnerRingMin && id <= kFT0AInnerRingMax)) || (cfgRejectFT0AOutside && (id >= kFT0AOuterRingMin && id <= kFT0AOuterRingMax)))
ampl = 0.;
registry.fill(HIST("FT0Amp"), id, ampl);
Expand Down
Loading