Skip to content

sEPD Q Vector Calibration (Generation): Charge Clamping and Ring 0 Exclusion#4245

Merged
pinkenburg merged 4 commits intosPHENIX-Collaboration:masterfrom
Steepspace:sEPD-EP-Calib
Apr 12, 2026
Merged

sEPD Q Vector Calibration (Generation): Charge Clamping and Ring 0 Exclusion#4245
pinkenburg merged 4 commits intosPHENIX-Collaboration:masterfrom
Steepspace:sEPD-EP-Calib

Conversation

@Steepspace
Copy link
Copy Markdown
Contributor

@Steepspace Steepspace commented Apr 11, 2026

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work for users)
  • Requiring change in macros repository (Please provide links to the macros pull request in the last section)
  • I am a member of GitHub organization of sPHENIX Collaboration, EIC, or ECCE (contact Chris Pinkenburg to join)

What kind of change does this PR introduce? (Bug fix, feature, ...)

  • Removal of Status-Based Filtering: The code no longer uses the isHot criteria or radial Z-score analysis to exclude individual "bad" channels.
  • Implemented Charge Clamping: Introduced a saturation cap (defaulting to 50) to clamp high-charge channel signals rather than discarding them.
  • Mandatory Ring 0 Exclusion: Explicitly skip Ring 0 to mitigate unreliable data from beam background.
  • Adjusted Noise Thresholds: The default noise floor for sEPD channels has been increased to 0.5.

TODOs (if applicable)

Links to other PRs in macros and calibration repositories (if applicable)

sEPD Q-Vector Calibration Refactoring: Charge Clamping and Ring 0 Exclusion

Motivation

This PR refactors the sEPD event-plane calibration strategy to replace status-based per-channel filtering with a simpler, more robust approach that better handles detector imperfections and beam-background effects in the innermost detector region.

Key Changes

QVecCalib.cc/h:

  • Removed bad-channel identification workflow: Deleted process_bad_channels() function, per-channel status mapping, and SEPD_HotMap CDB generation. Channels are no longer classified as Dead/Hot/Cold based on charge thresholds and radial z-scores.
  • Implemented charge clamping: High-charge signals are now capped at a configurable threshold (default: 50) instead of being discarded, preserving the detector's response for saturated channels.
  • Mandatory Ring 0 exclusion: Innermost ring channels (rbin == 0) are explicitly skipped unconditionally to mitigate unreliable beam-background-affected data.
  • Simplified noise filtering: Replaced multi-criteria per-channel filtering with a single global noise floor threshold (default: 0.5). Channels with charge ≤ m_sEPD_noise_threshold are excluded.
  • Added event-plane resolution metric: During the ApplyFlattening pass, a new TProfile hEP_res_{n} histogram is created to measure per-harmonic resolution via normalized dot product of corrected Q-vectors from South and North detectors.
  • New configuration setters: set_charge_threshold(double) and set_noise_threshold(double) allow runtime customization of selection thresholds.
  • CDB output simplification: Only write_cdb_EventPlane() is now called; bad-towers CDB is no longer produced.

sEPD_TreeGen.cc/h:

  • Made the input node name configurable via set_inputNode(const std::string&) setter, replacing the hardcoded "TOWERINFO_CALIB_SEPD" string with a m_inputNode member (default: "TOWERINFO_CALIB_SEPD").

Potential Risk Areas

IO Format Changes:

  • CDB output structure changes (bad-towers CDB removal). Downstream code relying on bad-towers CDB will fail; migration to the new workflow is required.

Reconstruction Behavior:

  • Charge clamping at 50 may alter the response of high-energetic channels. This represents a trade-off: preserving detector information vs. robustness against saturation effects.
  • Ring 0 exclusion reduces the active detector area (~5–10% depending on ring definition), potentially affecting coverage and requiring recalibration/validation studies.
  • Noise threshold increase (0.5) may reject additional low-energy signals; impact depends on background conditions.

Configuration Sensitivity:

  • Calibration results now depend critically on charge and noise thresholds. Incorrect threshold values could degrade or invalidate the event-plane reconstruction.

Notes for Reviewers

  • AI-generated summaries in the PR description may contain inaccuracies; use this summary in conjunction with direct code review.
  • Validation against prior calibration results and comparison with alternate threshold choices is recommended before production deployment.

- Use default sEPD node: `TOWERINFO_CALIB_SEPD`
- Allow for changing it if needed on macro side
Updated the QVecCalib module to align with the new sEPD calibration strategy. Following QA analysis that indicated a lack of persistent hot channels, the per-channel status mapping has been deprecated.

Key modifications:
- Removed bad channel identification and `SEPD_HotMap` CDB generation.
- Implemented mandatory Ring 0 exclusion to mitigate beam background interference.
- Added charge clamping (default 50) to handle channel saturation or extreme outliers without discarding data.
- Updated the noise floor to 0.5 and added setters for the new charge and noise thresholds.
- Simplified `process_sEPD` to use global thresholds instead of individual channel status lookups.
Copilot AI review requested due to automatic review settings April 11, 2026 19:25
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 11, 2026

📝 Walkthrough

Walkthrough

Removed sEPD bad-channel detection and bad-towers CDB output; introduced configurable charge/noise thresholds for channel selection, clamp behavior, and skipping innermost ring; added per-harmonic event-plane resolution profiles computed from corrected Q-vectors; made TowerInfo node lookup configurable.

Changes

Cohort / File(s) Summary
Event-plane calibration core
calibrations/sepd/sepd_eventplanecalib/QVecCalib.cc, calibrations/sepd/sepd_eventplanecalib/QVecCalib.h
Deleted bad-channel processing and write_cdb_BadTowers() (no bad-towers CDB). Added set_charge_threshold() and set_noise_threshold() with members m_sEPD_charge_threshold (default 50) and m_sEPD_noise_threshold (default 0.5). Allocate per-harmonic hEP_res_{n} profiles when applying flattening and fill them from corrected Q-vector normalized dot products. Changed sEPD channel selection: skip channels below noise threshold, clamp to charge threshold when positive, compute rbin and skip innermost ring.
Tree generator input configuration
calibrations/sepd/sepd_eventplanecalib/sEPD_TreeGen.cc, calibrations/sepd/sepd_eventplanecalib/sEPD_TreeGen.h
Replaced hard-coded node name with configurable m_inputNode and added set_inputNode(); error messages/reporting use m_inputNode when TowerInfoContainer is missing.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

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 adjusts the sEPD event-plane Q-vector calibration workflow to reduce sensitivity to problematic channel behavior by switching from channel exclusion to signal shaping (charge clamping), explicitly excluding Ring 0 contributions, and updating default noise handling. It also adds configurability for the input sEPD tower node.

Changes:

  • Add configurable input node name for sEPD_TreeGen tower retrieval.
  • Remove status/Z-score based “bad channel” filtering and associated CDB payload output in QVecCalib.
  • Introduce per-channel charge clamping, a higher default noise threshold, Ring 0 exclusion, and an additional EP resolution profile.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
calibrations/sepd/sepd_eventplanecalib/sEPD_TreeGen.h Adds configurable input node member and setter for tower container lookup.
calibrations/sepd/sepd_eventplanecalib/sEPD_TreeGen.cc Uses the configurable input node when fetching the sEPD tower container and updates the missing-node message.
calibrations/sepd/sepd_eventplanecalib/QVecCalib.h Adds setters for clamping/noise thresholds; removes bad-channel state and related declarations; adds EP resolution profile pointer in flattening hist struct.
calibrations/sepd/sepd_eventplanecalib/QVecCalib.cc Removes bad-channel processing and CDB hotmap writing; implements noise cut, clamping, Ring 0 exclusion, and EP resolution histogram fill/registration.

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

Comment thread calibrations/sepd/sepd_eventplanecalib/sEPD_TreeGen.h
Comment thread calibrations/sepd/sepd_eventplanecalib/QVecCalib.h
Comment on lines 833 to +841
unsigned int key = TowerInfoDefs::encode_epd(channel);
unsigned int arm = TowerInfoDefs::get_epd_arm(key);
int rbin = TowerInfoDefs::get_epd_rbin(key);

// Skip Innermost Ring
if (rbin == 0)
{
continue;
}
Copy link

Copilot AI Apr 11, 2026

Choose a reason for hiding this comment

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

Ring 0 is excluded from the Q-vector accumulation here, but Ring 0 still contributes to EventPlaneData::sepd_totalcharge (set upstream) which is used by process_event_check() and the QA-derived charge thresholds. If the intent is to mitigate Ring 0 beam-background effects, the event-selection charge (and/or the QA histogram used to derive its bounds) should be computed with the same Ring 0 exclusion (and clamping/noise definition) as the Q-vector loop.

Copilot uses AI. Check for mistakes.
Comment thread calibrations/sepd/sepd_eventplanecalib/QVecCalib.cc Outdated
Comment thread calibrations/sepd/sepd_eventplanecalib/QVecCalib.h
- Add <algorithm> to header for use of std::max so QVecCalib.h is self-contained.
- hEP_res_{n} histograms are only used during m_pass == Pass::ApplyFlattening
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: d1907aee-4416-4bc7-8854-142bcb151693

📥 Commits

Reviewing files that changed from the base of the PR and between 19956d8 and 169c06b.

📒 Files selected for processing (2)
  • calibrations/sepd/sepd_eventplanecalib/QVecCalib.cc
  • calibrations/sepd/sepd_eventplanecalib/QVecCalib.h
🚧 Files skipped from review as they are similar to previous changes (1)
  • calibrations/sepd/sepd_eventplanecalib/QVecCalib.cc

Comment thread calibrations/sepd/sepd_eventplanecalib/QVecCalib.h
@sphenix-jenkins-ci
Copy link
Copy Markdown

Build & test report

Report for commit 19956d803ad99b9dee39d643e8aa2414aa7cffdd:
Jenkins passed


Automatically generated by sPHENIX Jenkins continuous integration
sPHENIX             jenkins.io

@sphenix-jenkins-ci
Copy link
Copy Markdown

Build & test report

Report for commit 169c06b61ed2537a2766eb213db8a5e0fb1c43e2:
Jenkins passed


Automatically generated by sPHENIX Jenkins continuous integration
sPHENIX             jenkins.io

@pinkenburg pinkenburg merged commit 4679c69 into sPHENIX-Collaboration:master Apr 12, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants