Skip to content

Conversation

@MartijnLaarhoven
Copy link
Contributor

Adding the option to remap dead channels to their mirrored images. The standard is off. This fills the amplitude of 9 dead channels by their mirrored image

Adding the option to reject the inner of the outer part of the FT0 detectors
Adding option to reject part of the FT0 detectors
Adding the option to remap dead channels to their mirrored image. The standard is off. This fills the amplitude of 9 dead channels by their mirrored image
@github-actions
Copy link

github-actions bot commented Jan 7, 2026

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

@github-actions github-actions bot changed the title Martijn laarhoven patch 3 [PWGCF] Martijn laarhoven patch 3 Jan 7, 2026
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 optional functionality to remap 9 dead detector channels in the FT0A and FT0C detectors to their mirrored live channels. The feature is disabled by default and controlled by two new configuration flags.

Key changes:

  • Added two configuration options to enable remapping of dead channels for FT0A and FT0C detectors
  • Introduced mirroring constants enum to define the offset values for channel mapping
  • Implemented logic to fill dead channel histograms with amplitude data from their corresponding live mirror channels

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

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.
} else if (id >= 144 && id <= 147) {
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.
if (id == 115) {
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.
Comment on lines +689 to +690
ampl = ampl / cstFT0RelGain[iCh];
registry.fill(HIST("FT0AmpCorrect"), dead_id, ampl);
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.
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")
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.
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