Skip to content

Add ADC bins histograms for QA - #4451

Merged
osbornjd merged 1 commit into
sPHENIX-Collaboration:masterfrom
pedroanietom:TpcAdcHistQA
Sep 23, 2026
Merged

osbornjd merged 1 commit into
sPHENIX-Collaboration:masterfrom
pedroanietom:TpcAdcHistQA

Conversation

@pedroanietom

@pedroanietom pedroanietom commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

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, ...)

TODOs (if applicable)

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

Motivation

Add QA monitoring for the number of ADC bins per event in TPC raw-hit data. This is a new, non-breaking diagnostic.

Key changes

  • Add the h_nadc_bins_event histogram member.
  • Register nadc_bins_event.
  • Count ADC iterator entries for each event.
  • Fill the histogram for events with raw hits.

Potential risk areas

  • No IO format or reconstruction changes are indicated.
  • The added counting introduces minimal processing overhead.
  • No thread-safety concerns are indicated.
  • Test results are unavailable.

Possible future improvements

  • Add tests for empty events and events with multiple raw hits.
  • Document the histogram definition and expected range.

AI-generated summaries can contain errors. The source changes remain the final reference.

@coderabbitai

coderabbitai Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

📝 Walkthrough

Walkthrough

Changes

TpcRawHitQA event ADC-bin tracking

Layer / File(s) Summary
Event histogram registration and storage
offline/QA/Tpc/TpcRawHitQA.h, offline/QA/Tpc/TpcRawHitQA.cc
TpcRawHitQA stores and retrieves h_nadc_bins_event. createHistos registers a 2,500-bin histogram spanning 0 to 1,000,000 ADC bins per event.
Per-event ADC-bin counting
offline/QA/Tpc/TpcRawHitQA.cc
process_event resets the counter, increments it for each ADC iterator entry before threshold filtering, and fills the histogram when raw hits are present.

Priority: ⬇️ Low

Merge Risk: 🟡 Moderate · up to b6cdd

Valid multi-container events can be absent from the new ADC-bin QA histogram, producing incomplete QA data. Accumulate raw hits across the event before merging.


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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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: sPHENIX-Collaboration/coresoftware/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 03d6a34b-2ce6-4213-8365-4ac88012835c

📥 Commits

Reviewing files that changed from the base of the PR and between e17a9aa and b6cddec.

📒 Files selected for processing (2)
  • offline/QA/Tpc/TpcRawHitQA.cc
  • offline/QA/Tpc/TpcRawHitQA.h

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.

return Fun4AllReturnCodes::EVENT_OK;
}

h_nadc_bins_event->Fill(nadc_bins_event);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

sed -n '110,275p' offline/QA/Tpc/TpcRawHitQA.cc

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 4782


Use an event-level raw-hit count before filling the histogram.

raw_hit_num is overwritten for each container. If the final container is empty, the early return skips h_nadc_bins_event->Fill(...) even when an earlier container contributed ADC bins. Accumulate the hit count across containers before applying the event-level guard.

Suggested fix
-  unsigned int raw_hit_num = 0;
+  unsigned int raw_hit_num_event = 0;
   unsigned int nadc_bins_event = 0;

   for (TpcRawHitContainer *&rawhitcont : rawhitcont_vec)
     {
-      raw_hit_num = rawhitcont->get_nhits();
-      for (unsigned int i = 0; i < raw_hit_num; i++)
+      const unsigned int raw_hit_num = rawhitcont->get_nhits();
+      raw_hit_num_event += raw_hit_num;
+      for (unsigned int i = 0; i < raw_hit_num; i++)
...
-  if (raw_hit_num == 0)
+  if (raw_hit_num_event == 0)

@sphenix-jenkins-ci

Copy link
Copy Markdown

Build & test report

Report for commit b6cddec6f79d5b99970ae48e890579314e6b0969:
Jenkins passed


Automatically generated by sPHENIX Jenkins continuous integration
sPHENIX             jenkins.io

@osbornjd
osbornjd merged commit d0f1b06 into sPHENIX-Collaboration:master Sep 23, 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.

2 participants