-
Notifications
You must be signed in to change notification settings - Fork 613
[PWGCF] Adding the option to reject the inner or the outer ring of the FT0 detectors. Also adding the option to remap the dead channels of the FT0 detectors and fill them with the amplitudes of the mirrored channels of the detector #14265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
making the rejection of the rejection of part of the detector more distinctive
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
O2 linter results: ❌ 9 errors, |
There was a problem hiding this 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 functionality to handle dead channels in the FT0A and FT0C detectors and to reject specific detector rings in long-range dihadron correlation analysis. The changes introduce configuration options for ring rejection and dead channel remapping, along with an enum defining the channel ranges for inner and outer rings.
Key Changes
- Added 6 new configurable boolean flags to control rejection of inner/outer rings and remapping of dead channels for FT0A and FT0C detectors
- Introduced
DetectorChannelsenum to define the channel ID ranges for inner and outer rings of both FT0A and FT0C - Implemented conditional logic in
getChannel()method to remap dead channels to mirror channels and to zero out amplitudes for rejected rings
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (cfgRemapFT0ADeadChannels) { | ||
| if (id == 60) | ||
| ampl = ft0.amplitudeA()[92]; | ||
| else if (id == 61) | ||
| ampl = ft0.amplitudeA()[93]; | ||
| else if (id == 62) | ||
| ampl = ft0.amplitudeA()[94]; | ||
| else if (id == 63) | ||
| ampl = ft0.amplitudeA()[95]; | ||
| } |
Copilot
AI
Dec 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to the FT0C remapping, this code uses hard-coded magic numbers without explanation. Consider defining named constants for the dead channel IDs (60, 61, 62, 63) and the source channel indices (92, 93, 94, 95), along with comments explaining the rationale for the remapping. This will improve code maintainability and readability.
| if ((cfgRejectFT0CInside && (id >= kFT0CInnerRingMin && id <= kFT0CInnerRingMax)) || (cfgRejectFT0COutside && (id >= kFT0COuterRingMin && id <= kFT0COuterRingMax))) | ||
| ampl = 0.; |
Copilot
AI
Dec 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rejection logic sets amplitude to 0 for channels in the rejected rings, but this happens after the dead channel remapping. This order of operations means that if a dead channel is in a rejected ring, it will first be remapped to a mirror channel's amplitude, and then that amplitude will be set to 0.
Consider whether the intended behavior is:
- Current: Remap dead channels first, then reject rings (dead channels in rejected rings use mirror amplitudes which are then zeroed)
- Alternative: Reject rings first, then remap only dead channels that are not in rejected rings
If the current order is intentional, please add a comment explaining this behavior. If not, swap the order of these operations.
| if ((cfgRejectFT0AInside && (id >= kFT0AInnerRingMin && id <= kFT0AInnerRingMax)) || (cfgRejectFT0AOutside && (id >= kFT0AOuterRingMin && id <= kFT0AOuterRingMax))) | ||
| ampl = 0.; |
Copilot
AI
Dec 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as the FT0C case: the rejection logic sets amplitude to 0 after the dead channel remapping. Consider whether this order of operations is intentional and add a clarifying comment, or swap the order if the rejection should happen before remapping.
| 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, "Remap FT0A channels 60, 61, 62, 63 to amplitudes from 28,30,29,31 respectively") |
Copilot
AI
Dec 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The configuration description states that FT0A channels 60, 61, 62, 63 should be remapped to amplitudes from channels 28, 30, 29, 31 respectively. However, the implementation remaps them to channels 92, 93, 94, 95. This inconsistency between the documentation and implementation will confuse users. Please verify which channel mapping is correct and update either the code or the description accordingly.
| if (cfgRemapFT0CDeadChannels) { | ||
| if (id == 177) | ||
| ampl = ft0.amplitudeC()[145]; | ||
| else if (id == 176) | ||
| ampl = ft0.amplitudeC()[144]; | ||
| else if (id == 178) | ||
| ampl = ft0.amplitudeC()[146]; | ||
| else if (id == 179) | ||
| ampl = ft0.amplitudeC()[147]; | ||
| else if (id == 139) | ||
| ampl = ft0.amplitudeC()[115]; | ||
| } |
Copilot
AI
Dec 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The remapping logic for FT0C dead channels appears to have a bug. The variable 'id' is computed as 'ft0.channelC()[iCh] + Ft0IndexA' (line 656), so id values are offset by 96. However, when checking conditions like 'id == 177', the code then accesses 'ft0.amplitudeC()[145]', which uses 145 as a direct array index. This is problematic because:
- If the intention is to access channel 145, it should be accessed as 'ft0.amplitudeC()[145 - Ft0IndexA]' or by finding the index where 'ft0.channelC()[index] == 145'.
- The current logic likely accesses incorrect array indices, causing incorrect remapping behavior.
The same issue affects all the remapping conditions in this block (lines 659-668). Please verify the intended remapping logic and ensure array indices are correctly calculated.
| if (cfgRemapFT0ADeadChannels) { | ||
| if (id == 60) | ||
| ampl = ft0.amplitudeA()[92]; | ||
| else if (id == 61) | ||
| ampl = ft0.amplitudeA()[93]; | ||
| else if (id == 62) | ||
| ampl = ft0.amplitudeA()[94]; | ||
| else if (id == 63) | ||
| ampl = ft0.amplitudeA()[95]; | ||
| } |
Copilot
AI
Dec 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to the FT0C remapping, the FT0A remapping logic appears to access array indices directly without accounting for the potential mismatch between channel IDs and array indices. The code checks 'id' values (60-63) and then directly accesses 'ft0.amplitudeA()[92]', 'ft0.amplitudeA()[93]', etc.
If 'ft0.channelA()[iCh]' returns channel IDs that may not be contiguous or 0-indexed, then accessing 'ft0.amplitudeA()[92]' may not correspond to channel 92. Please verify that the array indices used (92, 93, 94, 95) correctly correspond to the intended source channels for remapping.
| if (cfgRemapFT0CDeadChannels) { | ||
| if (id == 177) | ||
| ampl = ft0.amplitudeC()[145]; | ||
| else if (id == 176) | ||
| ampl = ft0.amplitudeC()[144]; | ||
| else if (id == 178) | ||
| ampl = ft0.amplitudeC()[146]; | ||
| else if (id == 179) | ||
| ampl = ft0.amplitudeC()[147]; | ||
| else if (id == 139) | ||
| ampl = ft0.amplitudeC()[115]; | ||
| } |
Copilot
AI
Dec 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The remapping logic uses hard-coded magic numbers (channel IDs and array indices) without explanation or named constants. This makes the code difficult to understand and maintain. Consider:
- Defining named constants for the dead channel IDs (e.g., 'kFT0CDeadChannel1 = 177')
- Defining named constants for the source channel IDs used for remapping
- Adding comments explaining why these specific channels are dead and why these particular mirror channels were chosen
This will improve code readability and make it easier to update the channel mapping if needed.
Adding the option to reject the inner or the outer ring of the FT0 detectors. Also adding the option to remap the dead channels of the FT0 detectors and fill them with the amplitudes of the mirrored channels of the detector