Skip to content

Add time calibration to reco digis - #2030

Merged
michaelmackenzie merged 9 commits into
Mu2e:mainfrom
giro94:dev
Oct 13, 2026
Merged

michaelmackenzie merged 9 commits into
Mu2e:mainfrom
giro94:dev

Conversation

@giro94

@giro94 giro94 commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

No time calibration was applied to reco digis.
Also, added energy and time calibration via proditions to online/trigger modules

@giro94
giro94 requested a review from bechenard October 8, 2026 16:40
@FNALbuild

Copy link
Copy Markdown
Collaborator

Hi @giro94,
You have proposed changes to files in these packages:

  • CaloReco

which require these tests: build.

@Mu2e/fnalbuild-users, @Mu2e/write have access to CI actions on main.

⌛ The following tests have been triggered for bec92d2: build (Build queue - API unavailable)

About FNALbuild. Code review on Mu2e/Offline.

@oksuzian oksuzian left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

PR Review Summary — #2030

Reviewed at head bec92d2048e3178c59e599d1fdf92f43ed1f8c3c. first pass

Decision

  • 🟡 comment only, for now. The code is ready to approve: the per-SiPM time offset from CalCalib is now applied to the reco-digi time, with the sign that the calibration producing the table assumes. No FNALbuild run exists at this head, so I'm triggering one and will approve once it is green.

Scope understood

  • CaloRecoDigiMaker reads calCalib.timeoffset(SiPMID) and subtracts it from each reco-digi time: time = waveformProcessor_->time(i) - pbtOffset - timeOffset. Until now CalCalib::timeoffset() had no caller in Offline, so the loaded CalTimeCalib values never reached any calo time.
  • One file, +2/−1, on main after #2029.

Findings

  1. 🟡 [S2] The trigger and online hit makers do not apply the offset, and the online one would add it

    • Evidence:
      • CaloHitMakerFast (trigger) has no CalCalib at all.
      • DAQ/src/CaloHitsFromDTCEvents_module.cc:329 and :404 add timeCalib_[SiPMID] to the hit time. That array is set to 0 at :131 and never filled.
    • Impact: none today, because every table in use is zero (see the 🟢 below). Once real offsets are loaded, offline reco times, trigger times and online times will differ per channel. If timeCalib_ were filled from the same table, it would also have the opposite sign.
    • Suggested fix: a follow-up that gives CaloHitMakerFast the same subtraction and either fills timeCalib_ from CalCalib with a minus sign or removes it. Not needed for this PR.
  2. ⚪ [S3] Two small items:

    • The PR description is empty. One line on intent, plus "offsets are all zero in current tables, so no output change today", would help the next reader.
    • The edit drops the comment // correct to time since protons from the time line. Consider keeping it, and documenting the sign next to it, for example // minus per-SiPM offset (CalTimeCalib::tcorr).

🟢 Verified at this head:

  • Sign. CaloCalibration's cosmic T0 alignment (CosmicsCalib/src/caloT0alig_module.cc:367,404) forms corrected channel times as recoDigi->time() - Tcor[SiPMID], and its last iteration writes Tcor as the table to upload. Subtracting tcorr therefore matches how the constants are derived. The correction is indexed by SiPMID on both sides.
  • Applied per SiPM, before the two SiPMs are merged. CaloHitMaker merges reco digis by time() within time4Merge (6 ns). So a relative offset between the two SiPMs of a crystal is corrected before that comparison, not after.
  • No output change with the tables in use today.
    • MC and default reco use CalCalib from fcl: useDb: false, timeoffset: 0.0 in CaloConditions/fcl/prolog.fcl.
    • The only configurations that set calCalib.useDb : true are PassN Combined_Pass1.fcl and Calo/Calo_CRR_pass1.fcl. Both load CaloConditions/data/TimeCalib_example.txt, which has 2720 rows, all 0.
    • So every current reco time is unchanged; the change takes effect when a measured table is loaded.
  • Compiles. g++ -std=c++20 -fsyntax-only of CaloRecoDigiMaker_module.cc at this head passes. Script: claude-scratch/pr2030_review/syntax.sh.

Validation check

  • Build/tests run:
    • Locally: -fsyntax-only only.
    • FNALbuild: no run at this head.
    • No events run. With all-zero offsets, ceSimReco and PassN output should be identical to main.
  • Config contract check: pass. No fcl change; the accessor already existed.
  • Cross-repo consistency: pass. The table format is unchanged.

Residual risk

  • Not checked: whether any private or DB-hosted cal.timecalib set with non-zero values is already in use. If so, its reco times shift by tcorr per SiPM with this change, which is the intent.

Author follow-ups

  1. Add a one-line description (finding 2).
  2. Consider the follow-up for the trigger and online hit makers (finding 1).

@oksuzian

oksuzian commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator

@FNALbuild run build test

@FNALbuild

Copy link
Copy Markdown
Collaborator

❌ Those tests have already run or are running for bec92d2 (build)

@FNALbuild

Copy link
Copy Markdown
Collaborator

☀️ The build tests passed at bec92d2.

Test Result Details
test with ✅ Command did not list any other PRs to include
merge ✅ Merged bec92d2 at 24a1aa5
build (prof) ✅ Log file. Build time: 09 min 05 sec
ceSimReco ✅ Log file.
g4test_03MT ✅ Log file.
transportOnly ✅ Log file.
POT ✅ Log file.
g4study ✅ Log file.
cosmicSimReco ✅ Log file.
cosmicOffSpill ✅ Log file.
ceSteps ✅ Log file.
ceDigi ✅ Log file.
muDauSteps ✅ Log file.
ceMix ✅ Log file.
rootOverlaps ✅ Log file.
g4surfaceCheck ✅ Log file.
trigger ❌ Log file. Return Code 2.
check_cmake ✅ Log file.
FIXME, TODO ✅ TODO (0) FIXME (0) in 1 files
clang-tidy ➡️ 1 errors 12 warnings
whitespace check ✅ no whitespace errors found

N.B. These results were obtained from a build of this Pull Request at bec92d2 after being merged into the base branch at 24a1aa5.

For more information, please check the job page here.
Build artifacts are deleted after 5 days. If this is not desired, select Keep this build forever on the job page.

@oksuzian oksuzian left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

PR Review Summary — #2030

Reviewed at head bec92d2048e3178c59e599d1fdf92f43ed1f8c3c. first pass

Decision

  • 🟢 approve. The per-SiPM time offset from CalCalib is now applied to the reco-digi time, with the sign that the calibration producing the table assumes. FNALbuild passes at this head.

Scope understood

  • CaloRecoDigiMaker reads calCalib.timeoffset(SiPMID) and subtracts it from each reco-digi time: time = waveformProcessor_->time(i) - pbtOffset - timeOffset. Until now CalCalib::timeoffset() had no caller in Offline, so the loaded CalTimeCalib values never reached any calo time.
  • One file, +2/−1, on main after #2029.

Findings

  1. 🟡 [S2] The trigger and online hit makers do not apply the offset, and the online one would add it

    • Evidence:
      • CaloHitMakerFast (trigger) has no CalCalib at all.
      • DAQ/src/CaloHitsFromDTCEvents_module.cc:329 and :404 add timeCalib_[SiPMID] to the hit time. That array is set to 0 at :131 and never filled.
    • Impact: none today, because every table in use is zero (see the 🟢 below). Once real offsets are loaded, offline reco times, trigger times and online times will differ per channel. If timeCalib_ were filled from the same table, it would also have the opposite sign.
    • Suggested fix: a follow-up that gives CaloHitMakerFast the same subtraction and either fills timeCalib_ from CalCalib with a minus sign or removes it. Not needed for this PR.
  2. ⚪ [S3] Two small items:

    • The PR description is empty. One line on intent, plus "offsets are all zero in current tables, so no output change today", would help the next reader.
    • The edit drops the comment // correct to time since protons from the time line. Consider keeping it, and documenting the sign next to it, for example // minus per-SiPM offset (CalTimeCalib::tcorr).

🟢 Verified at this head:

  • Sign. CaloCalibration's cosmic T0 alignment (CosmicsCalib/src/caloT0alig_module.cc:367,404) forms corrected channel times as recoDigi->time() - Tcor[SiPMID], and its last iteration writes Tcor as the table to upload. Subtracting tcorr therefore matches how the constants are derived. The correction is indexed by SiPMID on both sides.
  • Applied per SiPM, before the two SiPMs are merged. CaloHitMaker merges reco digis by time() within time4Merge (6 ns). So a relative offset between the two SiPMs of a crystal is corrected before that comparison, not after.
  • No output change with the tables in use today.
    • MC and default reco use CalCalib from fcl: useDb: false, timeoffset: 0.0 in CaloConditions/fcl/prolog.fcl.
    • The only configurations that set calCalib.useDb : true are PassN Combined_Pass1.fcl and Calo/Calo_CRR_pass1.fcl. Both load CaloConditions/data/TimeCalib_example.txt, which has 2720 rows, all 0.
    • So every current reco time is unchanged; the change takes effect when a measured table is loaded.
  • Compiles. g++ -std=c++20 -fsyntax-only of CaloRecoDigiMaker_module.cc at this head passes. Script: claude-scratch/pr2030_review/syntax.sh.

Validation check

  • Build/tests run:
    • Locally: -fsyntax-only only.
    • FNALbuild at this head: passed. trigger fails with return code 2, as it has on #2021, #2026 and #2029 since before this change, so it does not come from this PR.
    • No events run. With all-zero offsets, ceSimReco and PassN output should be identical to main.
  • Config contract check: pass. No fcl change; the accessor already existed.
  • Cross-repo consistency: pass. The table format is unchanged.

Residual risk

  • Not checked: whether any private or DB-hosted cal.timecalib set with non-zero values is already in use. If so, its reco times shift by tcorr per SiPM with this change, which is the intent.

Author follow-ups

  1. Add a one-line description (finding 2).
  2. Consider the follow-up for the trigger and online hit makers (finding 1).

@oksuzian oksuzian mentioned this pull request Oct 10, 2026
@giro94

giro94 commented Oct 13, 2026

Copy link
Copy Markdown
Collaborator Author

@FNALbuild run build test

@FNALbuild

Copy link
Copy Markdown
Collaborator

⌛ The following tests have been triggered for 5c0bc8e: build (Build queue - API unavailable)

@giro94

giro94 commented Oct 13, 2026

Copy link
Copy Markdown
Collaborator Author

@FNALbuild run build test

@FNALbuild

Copy link
Copy Markdown
Collaborator

⌛ The following tests have been triggered for 80044dc: build (Build queue - API unavailable)

@FNALbuild

Copy link
Copy Markdown
Collaborator

☔ The build tests failed for 80044dc.

Test Result Details
test with ✅ Command did not list any other PRs to include
merge ✅ Merged 80044dc at 24a1aa5
build (prof) ✅ Log file. Build time: 04 min 27 sec
ceSimReco ✅ Log file.
g4test_03MT ✅ Log file.
transportOnly ✅ Log file.
POT ✅ Log file.
g4study ✅ Log file.
cosmicSimReco ✅ Log file.
cosmicOffSpill ❌ Log file. Return Code 9.
ceSteps ✅ Log file.
ceDigi ❌ Log file. Return Code 9.
muDauSteps ✅ Log file.
ceMix ❌ Log file. Return Code 9.
rootOverlaps ✅ Log file.
g4surfaceCheck ✅ Log file.
trigger ❌ Log file. Return Code 2.
check_cmake ✅ Log file.
FIXME, TODO ➡️ TODO (0) FIXME (1) in 3 files
clang-tidy ➡️ 3 errors 81 warnings
whitespace check ✅ no whitespace errors found

N.B. These results were obtained from a build of this Pull Request at 80044dc after being merged into the base branch at 24a1aa5.

For more information, please check the job page here.
Build artifacts are deleted after 5 days. If this is not desired, select Keep this build forever on the job page.

@FNALbuild

Copy link
Copy Markdown
Collaborator

☀️ The build tests passed at 5c0bc8e.

Test Result Details
test with ✅ Command did not list any other PRs to include
merge ✅ Merged 5c0bc8e at 24a1aa5
build (prof) ✅ Log file. Build time: 11 min 18 sec
ceSimReco ✅ Log file.
g4test_03MT ✅ Log file.
transportOnly ✅ Log file.
POT ✅ Log file.
g4study ✅ Log file.
cosmicSimReco ✅ Log file.
cosmicOffSpill ✅ Log file.
ceSteps ✅ Log file.
ceDigi ✅ Log file.
muDauSteps ✅ Log file.
ceMix ✅ Log file.
rootOverlaps ✅ Log file.
g4surfaceCheck ✅ Log file.
trigger ❌ Log file. Return Code 2.
check_cmake ✅ Log file.
FIXME, TODO ➡️ TODO (0) FIXME (1) in 3 files
clang-tidy ➡️ 3 errors 81 warnings
whitespace check ✅ no whitespace errors found

N.B. These results were obtained from a build of this Pull Request at 5c0bc8e after being merged into the base branch at 24a1aa5.

For more information, please check the job page here.
Build artifacts are deleted after 5 days. If this is not desired, select Keep this build forever on the job page.

@giro94

giro94 commented Oct 13, 2026

Copy link
Copy Markdown
Collaborator Author

@FNALbuild run build test with Mu2e/mu2e-trig-config#174

@FNALbuild

Copy link
Copy Markdown
Collaborator

⌛ The following tests have been triggered for 80044dc: build (Build queue - API unavailable)

@FNALbuild

Copy link
Copy Markdown
Collaborator

☀️ The build tests passed at 80044dc.

Test Result Details
test with ✅ Included Mu2e/mu2e-trig-config#174 @ 996a8890cbb328be8b9e3b07ae5941e06a8e51cc by merge
merge ✅ Merged 80044dc at 24a1aa5
build (prof) ✅ Log file. Build time: 04 min 27 sec
ceSimReco ✅ Log file.
g4test_03MT ✅ Log file.
transportOnly ✅ Log file.
POT ✅ Log file.
g4study ✅ Log file.
cosmicSimReco ✅ Log file.
cosmicOffSpill ✅ Log file.
ceSteps ✅ Log file.
ceDigi ✅ Log file.
muDauSteps ✅ Log file.
ceMix ✅ Log file.
rootOverlaps ✅ Log file.
g4surfaceCheck ✅ Log file.
trigger ❌ Log file. Return Code 2.
check_cmake ✅ Log file.
FIXME, TODO ➡️ TODO (0) FIXME (1) in 3 files
clang-tidy ➡️ 3 errors 81 warnings
whitespace check ✅ no whitespace errors found

N.B. These results were obtained from a build of this Pull Request at 80044dc after being merged into the base branch at 24a1aa5.

For more information, please check the job page here.
Build artifacts are deleted after 5 days. If this is not desired, select Keep this build forever on the job page.

@giro94

giro94 commented Oct 13, 2026

Copy link
Copy Markdown
Collaborator Author

@bechenard @rlcee just letting you know I have expanded the use of proditions

@oksuzian this is ready to be merged

const ProtonBunchTime& pbt(*pbtH);
double pbtOffset = pbt.pbtime_;
CalCalib const& calCalib = calCalibHandle_.get(event.id());

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.

AArgh, the better style is obviously const CalCalib&....

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Totally agree, I copied the style somewhere...
Will fix once for all

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

grep "const&" */*/*.cc | wc -l
2825

No I will not

@michaelmackenzie
michaelmackenzie merged commit fd9bfbd into Mu2e:main Oct 13, 2026
14 checks passed
@michaelmackenzie

Copy link
Copy Markdown
Contributor

I merged this to restore the trigger and Offline CI functionality

@rlcee rlcee mentioned this pull request Oct 14, 2026
@oksuzian oksuzian mentioned this pull request Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants