Skip to content

Remove calopacketcontainer trigger - #4502

Merged
pinkenburg merged 4 commits into
sPHENIX-Collaboration:masterfrom
pinkenburg:remove-calopacketcontainer-trigger
Oct 26, 2026
Merged

pinkenburg merged 4 commits into
sPHENIX-Collaboration:masterfrom
pinkenburg:remove-calopacketcontainer-trigger

Conversation

@pinkenburg

@pinkenburg pinkenburg commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • [X ] 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, ...)

This PR removed the obsolete CaloPacketContainer class from the trigger emulators

TODOs (if applicable)

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

Motivation

Remove obsolete CaloPacketContainer use from the calorimeter and MBD trigger emulators. The change replaces container access with individual CaloPacket lookup. The supplied context states that offline packets must not be deleted.

Key changes

  • The calorimeter emulator retrieves EMCAL, HCALOUT, and HCALIN packets directly by packet ID.
  • The MBD emulator retrieves packets 1001 and 1002 individually.
  • The MBD waveform path reads these packets without deleting them. The raw path retains its packet deletion behavior.
  • The calorimeter emulator removes its empty Init method. Both emulators remove m_useoffline.

Potential risk areas

  • Packet availability controls whether the emulators use waveform or raw processing. This may affect reconstruction behavior for events with missing packets.
  • The available information does not establish changes to IO formats, thread-safety, or performance.
  • Test results and current review findings were not provided.

Possible future improvements

  • Add tests for packet lookup, missing-packet behavior, and packet ownership.
  • Validate the processing paths with representative offline and raw data.

AI-generated summaries can contain mistakes. Verify these details against the implementation and use scientific judgment before relying on them.

@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Walkthrough

The calorimeter and MBD trigger emulators no longer use CaloPacketContainer inputs. They retrieve individual packets and use updated conditions to select waveform or raw processing.

Changes: Trigger emulator packet inputs

Layer / File(s) Summary
Calorimeter packet lookup and processing
offline/packages/trigger/CaloTriggerEmulator.h, offline/packages/trigger/CaloTriggerEmulator.cc
The emulator removes CaloPacketContainer members and the empty Init method. It retrieves EMCAL, HCALOUT, and HCALIN packets by ID. For data, offline processing is selected when m_use_individual_packets is set.
MBD packet lookup and processing
offline/packages/trigger/MBDTriggerEmulator.h, offline/packages/trigger/MBDTriggerEmulator.cc
GetNodes retrieves packets 1001 and 1002 individually. Waveform processing uses the retrieved packets when either is present, and falls back to PRDF packets only when both are absent. The raw path uses a separate packet array and retains deletion of its retrieved packets.

Possibly related PRs

Priority: Low

Merge Risk: Moderate · up to cc2e5

MBD trigger emulation can throw on events where only one of the two waveform packets is present, which is a new failure path from this change. Handle partial packet sets before primitive processing before merging.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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
Commits

Reviewing files that changed from the base of the PR and between fd705f9 and cc2e506.

Files selected for processing: 4
  • offline/packages/trigger/CaloTriggerEmulator.cc
  • offline/packages/trigger/CaloTriggerEmulator.h
  • offline/packages/trigger/MBDTriggerEmulator.cc
  • offline/packages/trigger/MBDTriggerEmulator.h
Files with no reviewable changes: 1
  • offline/packages/trigger/CaloTriggerEmulator.h

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

}

if (!m_waveforms_mbd)
if (!dstp[0] && !dstp[1])

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.

Major · Stability & Availability · Quick win

🔎 Supported by static analysis

Script executed:

git diff fd705f9f2368d9e22a5154df23f0d563491bbe53..cc2e50635f0f18a1ec9e880e4a7d4ce9be518602 -- offline/packages/trigger/MBDTriggerEmulator.cc

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 4050


Script executed:

sed -n '270,460p' offline/packages/trigger/MBDTriggerEmulator.cc

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 5129


Script executed:

set -e
file=offline/packages/trigger/MBDTriggerEmulator.cc
printf '%s\n' '--- declarations, event flow, GetNodes ---'
rg -n -F -- 'dstp' "$file"
rg -n -F -e 'GetNodes(' -e 'process_event(' -e 'process_waveforms(' -e 'process_primitives(' "$file"
sed -n '1,180p' "$file"
sed -n '180,275p' "$file"
sed -n '450,620p' "$file"
sed -n '760,835p' "$file"
printf '%s\n' '--- base process and declarations ---'
git show fd705f9f2368d9e22a5154df23f0d563491bbe53:"$file" | sed -n '1,180p'
git show fd705f9f2368d9e22a5154df23f0d563491bbe53:"$file" | sed -n '180,275p'
git show fd705f9f2368d9e22a5154df23f0d563491bbe53:"$file" | sed -n '450,620p'
git show fd705f9f2368d9e22a5154df23f0d563491bbe53:"$file" | sed -n '760,835p'

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 27867


Script executed:

set -e
printf '%s\n' '--- header declarations and pointer initialization ---'
sed -n '1,240p' offline/packages/trigger/MBDTriggerEmulator.h
printf '%s\n' '--- MBDPackets and packet-node producers/consumers ---'
rg -n -F -e 'MBDPackets' -e 'CaloPacket>(topNode' -e 'CaloPacket *' offline framework | head -240
printf '%s\n' '--- relevant producer definitions ---'
rg -l -F -e 'MBDPackets' -e 'new CaloPacket' offline framework | while read -r f; do
  echo "### $f"
  rg -n -F -C 8 -e 'MBDPackets' -e 'new CaloPacket' "$f"
done

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 11418


Script executed:

set -e
printf '%s\n' '--- all MBDPackets references ---'
rg -n -F --hidden --glob '!*.root' --glob '!build/**' --glob '!dist/**' 'MBDPackets' .
printf '%s\n' '--- packet-container construction and insertion ---'
rg -n -F --hidden --glob '!*.root' --glob '!build/**' --glob '!dist/**' -e 'CaloPacketContainerv1' -e 'AddPacket(' -e 'new PHIODataNode' -e 'getPacketbyId' .

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 40799


Handle incomplete packet sets before primitive processing.

When only one of packets 1001 or 1002 exists, the current ||-equivalent waveform selection enters process_waveforms(). The missing packet contributes no entries to m_peak_sub_ped_mbd, but process_primitives() unconditionally reads those entries with .at(is), which can throw on a fresh event.

Route partial packet sets to the existing incomplete-event path:

Suggested fix
--- "a/offline/packages/trigger/MBDTriggerEmulator.cc"
+++ "b/offline/packages/trigger/MBDTriggerEmulator.cc"
@@ -291,7 +291,7 @@
     std::cout << __FILE__ << "::" << __FUNCTION__ << ":: Processing waveforms" << std::endl;
   }
 
-  if (!dstp[0] && !dstp[1])
+  if (!dstp[0] || !dstp[1])
   {
     return process_raw();
   }

The individual packet nodes can be created for only the packets present in an event. The pre-PR MBDPackets path supplied both packets before primitive processing, so this PR introduces the partial-set failure. GetNodes() refreshes both pointers on every event, so stale pointers are not the cause.

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (!dstp[0] && !dstp[1])
if (!dstp[0] || !dstp[1])

@sphenix-jenkins-ci

Copy link
Copy Markdown

Build & test report

Report for commit cc2e50635f0f18a1ec9e880e4a7d4ce9be518602:
Jenkins on fire


Automatically generated by sPHENIX Jenkins continuous integration
sPHENIX             jenkins.io

@pinkenburg
pinkenburg merged commit 0c50905 into sPHENIX-Collaboration:master Oct 26, 2026
18 of 22 checks passed
@pinkenburg
pinkenburg deleted the remove-calopacketcontainer-trigger branch October 26, 2026 20:11
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.

1 participant