Skip to content

Conversation

@MartijnLaarhoven
Copy link
Contributor

This PR adds functionality to optionally remap dead FT0 detector channels to their mirrored images, filling amplitude data from functioning channels. By default, the remapping is disabled.

Copilot AI review requested due to automatic review settings January 8, 2026 08:57
@github-actions github-actions bot added the pwgcf label Jan 8, 2026
@github-actions github-actions bot changed the title Add option to remap dead FT0 channels [PWGCF] Add option to remap dead FT0 channels Jan 8, 2026
@github-actions
Copy link

github-actions bot commented Jan 8, 2026

O2 linter results: ❌ 0 errors, ⚠️ 3 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 optional functionality to remap dead FT0 detector channels to their functioning mirrored counterparts, allowing amplitude data from working channels to be used in place of dead ones. The feature is controlled by two new configuration flags (disabled by default) for FT0A and FT0C detectors.

Key changes:

  • Added configuration options to enable dead channel remapping for FT0A and FT0C detectors
  • Implemented channel remapping logic that copies amplitude data from functioning channels to their mirrored dead channels
  • Added enum constants to define mirroring offsets and dead channel ranges

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

Comment on lines +257 to +260
kFT0AInnerMirror = 16,
kFT0COuterMirror = 32,
kFT0CInnerMirror = 24
};
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

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

The constant kFT0AInnerMirror is defined but never used in the code. Consider removing it if it's not needed, or add a comment explaining its purpose if it's reserved for future use.

Suggested change
kFT0AInnerMirror = 16,
kFT0COuterMirror = 32,
kFT0CInnerMirror = 24
};
kFT0COuterMirror = 32,
kFT0CInnerMirror = 24
};

Copilot uses AI. Check for mistakes.
Comment on lines +671 to +683
if (cfgRemapFT0CDeadChannels) {
if (id == kFT0CRemapChannelInnerRing) {
int dead_id = id + kFT0CInnerMirror;
registry.fill(HIST("FT0Amp"), dead_id, ampl);
ampl = ampl / cstFT0RelGain[iCh];
registry.fill(HIST("FT0AmpCorrect"), dead_id, ampl);
} else if (id >= kFT0CRemapChannelStart && id <= kFT0CRemapChannelEnd) {
int dead_id = id + kFT0COuterMirror;
registry.fill(HIST("FT0Amp"), dead_id, ampl);
ampl = ampl / cstFT0RelGain[iCh];
registry.fill(HIST("FT0AmpCorrect"), dead_id, ampl);
}
}
Copy link

Copilot AI Jan 8, 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 being applied using the wrong index. The code uses cstFT0RelGain[iCh], where iCh is the position in the FT0C channel array, but cstFT0RelGain is indexed by the global channel ID (0-207). For dead channels, you should use cstFT0RelGain[dead_id] instead of cstFT0RelGain[iCh] to apply the correct gain correction for the remapped dead channel.

Copilot uses AI. Check for mistakes.
Comment on lines +692 to +699
if (cfgRemapFT0ADeadChannels) {
if (id >= kFT0ARemapChannelStart && id <= kFT0ARemapChannelEnd) {
int dead_id = id - kFT0AOuterMirror;
registry.fill(HIST("FT0Amp"), dead_id, ampl);
ampl = ampl / cstFT0RelGain[iCh];
registry.fill(HIST("FT0AmpCorrect"), dead_id, ampl);
}
}
Copy link

Copilot AI Jan 8, 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 being applied using the wrong index. The code uses cstFT0RelGain[iCh], where iCh is the position in the FT0A channel array, but cstFT0RelGain is indexed by the global channel ID (0-207). For dead channels, you should use cstFT0RelGain[dead_id] instead of cstFT0RelGain[iCh] to apply the correct gain correction for the remapped dead channel.

Copilot uses AI. Check for mistakes.
Comment on lines +671 to +683
if (cfgRemapFT0CDeadChannels) {
if (id == kFT0CRemapChannelInnerRing) {
int dead_id = id + kFT0CInnerMirror;
registry.fill(HIST("FT0Amp"), dead_id, ampl);
ampl = ampl / cstFT0RelGain[iCh];
registry.fill(HIST("FT0AmpCorrect"), dead_id, ampl);
} else if (id >= kFT0CRemapChannelStart && id <= kFT0CRemapChannelEnd) {
int dead_id = id + kFT0COuterMirror;
registry.fill(HIST("FT0Amp"), dead_id, ampl);
ampl = ampl / cstFT0RelGain[iCh];
registry.fill(HIST("FT0AmpCorrect"), dead_id, ampl);
}
}
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

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

The interaction between the remapping and rejection features is potentially confusing. When remapping is enabled, dead channels receive amplitude data from functioning channels. However, if rejection is enabled for the ring containing the dead channels, those dead channels will still have non-zero amplitude (from remapping), while the functioning channels in the same ring are set to zero. Consider documenting this behavior or adding logic to also zero out remapped dead channels when their corresponding ring rejection is enabled.

Copilot uses AI. Check for mistakes.
Comment on lines +692 to +699
if (cfgRemapFT0ADeadChannels) {
if (id >= kFT0ARemapChannelStart && id <= kFT0ARemapChannelEnd) {
int dead_id = id - kFT0AOuterMirror;
registry.fill(HIST("FT0Amp"), dead_id, ampl);
ampl = ampl / cstFT0RelGain[iCh];
registry.fill(HIST("FT0AmpCorrect"), dead_id, ampl);
}
}
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

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

The interaction between the remapping and rejection features is potentially confusing. When remapping is enabled, dead channels receive amplitude data from functioning channels. However, if rejection is enabled for the ring containing the dead channels, those dead channels will still have non-zero amplitude (from remapping), while the functioning channels in the same ring are set to zero. Consider documenting this behavior or adding logic to also zero out remapped dead channels when their corresponding ring rejection is enabled.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator

@victor-gonzalez victor-gonzalez left a comment

Choose a reason for hiding this comment

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

Any reason for keeping Copilot enabled if you are not considering its suggestions?

@victor-gonzalez victor-gonzalez merged commit 0391f17 into AliceO2Group:master Jan 8, 2026
18 checks passed
sigurdnese pushed a commit to sigurdnese/O2Physics that referenced this pull request Jan 9, 2026
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.

2 participants