Skip to content

SBND Timing Reconstruction Refactor#637

Open
VCLanNguyen wants to merge 4 commits intodevelopfrom
feature/frame_shift_refactor_v10_14_02
Open

SBND Timing Reconstruction Refactor#637
VCLanNguyen wants to merge 4 commits intodevelopfrom
feature/frame_shift_refactor_v10_14_02

Conversation

@VCLanNguyen
Copy link
Copy Markdown
Contributor

@VCLanNguyen VCLanNguyen commented Mar 4, 2026

Description

  • Timing reconstruction is refactored in this PR, affecting the decode/reconstruction workflow of CRT/PMT/XA.
  • After the refactoring, the @FrameShiftModule@ runs first in the decode chain, outputs timing products to be used at PMT/XA decoder and CRTStrip reconstruction.
  • Relevant PMT reconstruction modules at Reco1/Reco2 are updated.
  • The timing correction applied at CAFMakeer is undone. This should ressolve this issue: Converge timing correction in CAFMaker for SBND and ICARUS #567
  • Details and validation plots can before in the linked docdb.

Link(s) to docdb describing changes (optional)

https://sbn-docdb.fnal.gov/cgi-bin/sso/ShowDocument?docid=45982

Relevant PR links (optional)

This PR needs the XA decoder PR in sbndcode to go in first:
SBNSoftware/sbndcode#847

This PR needs to be merged together with this group of PRs:

Checklists

  • Have you added a label? (bug/enhancement/physics etc.)
  • Have you assigned at least 1 reviewer?
  • Is this PR related to an open issue / project?
  • Does this PR affect CAF data format? If so, please assign a CAF maintainer as additional reviewer.
  • Does this PR require merging another PR in a different repository (such as sbnanobj/sbnobj etc.)? If so, please link it in the description.
  • Are you submitting this PR on behalf of someone else who made the code changes? If so, please mention them in the description.

@VCLanNguyen VCLanNguyen changed the title Feature/frame shift refactor v10 14 02 SBND Timing Reconstruction Refactor Mar 4, 2026
@VCLanNguyen VCLanNguyen self-assigned this Mar 4, 2026
@VCLanNguyen VCLanNguyen added breaking change dependent An issue or PR depending on another labels Mar 4, 2026
@VCLanNguyen VCLanNguyen requested a review from JosiePaton April 21, 2026 18:04
@VCLanNguyen
Copy link
Copy Markdown
Contributor Author

@JosiePaton @PetrilloAtWork can you guys review for CAF?

Copy link
Copy Markdown
Member

@PetrilloAtWork PetrilloAtWork left a comment

Choose a reason for hiding this comment

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

Ops... added the comment for a different PR here.
This PR is actually fine, although I would appreciate you considering the changes I mentioned below (in particular, the bit-wise & operator is semantically wrong there, even if it works as it should).
Re-request the review of this PR after considering these, for quick approval.


double diff_ts = std::numeric_limits<double>::max();

if ((triggerInfo.global_trigger_time != std::numeric_limits<uint64_t>::max()) & (triggerInfo.beam_gate_time_abs != std::numeric_limits<uint64_t>::max())){
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
if ((triggerInfo.global_trigger_time != std::numeric_limits<uint64_t>::max()) & (triggerInfo.beam_gate_time_abs != std::numeric_limits<uint64_t>::max())){
if ((triggerInfo.global_trigger_time != std::numeric_limits<uint64_t>::max()) && (triggerInfo.beam_gate_time_abs != std::numeric_limits<uint64_t>::max())){

diff_ts = triggerInfo.global_trigger_time - triggerInfo.beam_gate_time_abs;
}
else{
diff_ts = (triggerInfo.beam_gate_time_abs - triggerInfo.global_trigger_time)*(double)-1;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It can also go as

Suggested change
diff_ts = (triggerInfo.beam_gate_time_abs - triggerInfo.global_trigger_time)*(double)-1;
diff_ts = -1.0 * (triggerInfo.beam_gate_time_abs - triggerInfo.global_trigger_time);

Comment on lines +2659 to +2663
//// Legacy code: Timing correction is now done at decoding/reconstruction level
////shift reference frame for CRT objects: crt trk, crt sp, crt sp match, crt trk match
//SBNDShiftCRTReference(rec, rec.sbnd_frames.frameApplyAtCaf);
////shift reference frame for PMT objects: opflash, opt0
//SBNDShiftPMTReference(rec, rec.sbnd_frames.frameApplyAtCaf);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I recommend to remove this completely, but if you feel strongly about keeping it, make these non-Doxygen comments (//// starts a Doxygen comment). For example:

Suggested change
//// Legacy code: Timing correction is now done at decoding/reconstruction level
////shift reference frame for CRT objects: crt trk, crt sp, crt sp match, crt trk match
//SBNDShiftCRTReference(rec, rec.sbnd_frames.frameApplyAtCaf);
////shift reference frame for PMT objects: opflash, opt0
//SBNDShiftPMTReference(rec, rec.sbnd_frames.frameApplyAtCaf);
#if 0
// Legacy code: Timing correction is now done at decoding/reconstruction level
//shift reference frame for CRT objects: crt trk, crt sp, crt sp match, crt trk match
SBNDShiftCRTReference(rec, rec.sbnd_frames.frameApplyAtCaf);
//shift reference frame for PMT objects: opflash, opt0
SBNDShiftPMTReference(rec, rec.sbnd_frames.frameApplyAtCaf);
#endif // 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change dependent An issue or PR depending on another

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants