Skip to content

Conversation

@sungbinoh
Copy link
Contributor

@sungbinoh sungbinoh commented Nov 14, 2025

Description

  • Adding global tag feature to summarize tags of calibration DB tables

    • Referring to icaruscode for the same feature
    • A new directory sbndcode/Calibration/configurations/ for this purpose.
    • We can manage tags of all different calibration DB tables in this directory.
    • Now sbndcode/Calibration/PDSDatabaseInterface/pmtcalibrationdatabase_sbnd.fcl refers to this directory to collect PMTCalibrationDatabaseTag and DatabaseTimeStamp.
  • Adding time dependent etau correction for data

    • Setting sbnd_calorimetryalgdata.CaloDoLifeTimeCorrection: false not to apply etau correction in larreco.
    • Then, adding @local::driftnorm_sql to sbnd_calonormtoolsdata so that etau correction could be made by normtool.
    • The sbndcode/Calibration/TPCCalorimetry/NormalizeDriftSQLite_tool.cc performs etau correction. This module collects etau for each TPC and apply it to the corresponding side of the TPC.
    • I have validated it using multiple data reco1 files
lar -c reco2_data.fcl -s root://fndcadoor.fnal.gov:1094/pnfs/fnal.gov/usr/sbn/data_add/sbn_nd/poms_production/data/MCP2025B_noPOT/v10_10_03_01/FullRun1_RollingDev/reco1/bnblight/d3/reco1_filtered_decoded-raw_filtered_data_EventBuilder3_p2_art2_run18306_10_strmBNBLight_20250308T232959-d323d2a1-41c0-5f6c-ecc2-10dd0aadddcd.root -n 1
...
NormalizeDriftSQLite Tool -- Lifetime Data:
TPC East: 67.769
TPC West: 61.8949
...
NormalizeDriftSQLite Tool -- Norm factor: 1.00381 at TPC: 0 Cryo: 0 Time: 0.257529 Track T0: 0, x: -161.693
...
lar -c reco2_data.fcl -s root://fndcadoor.fnal.gov:1094/pnfs/fnal.gov/usr/sbn/data_add/sbn_nd/poms_production/data/MCP2025B_noPOT/v10_10_03_01/FullRun1_RollingDev/reco1/bnblight/e0/reco1_filtered_decoded-raw_filtered_data_EventBuilder5_art1_run18412_18_strmBNBLight_20250410T024835-e0e0fc77-b089-3d97-ecb3-506cf9e2db83.root
...
NormalizeDriftSQLite Tool -- Lifetime Data:
TPC East: 51.1139
TPC West: 43.6863
...

Checklist

  • Added at least 1 label from available labels.
  • Assigned at least 1 reviewer under Reviewers,
  • Assigned all contributers including yourself under Assignees
  • Linked any relevant issues under Developement
  • Does this PR affect CAF data format? If so, please assign a CAF maintainer (PetrilloAtWork or JosiePaton) as additional reviewer.
  • Does this affect the standard workflow?
  • Is this PR a patch for the ongoing production? If so, separate PR must also be made for production/v10_06_00 branch!

Relevant PR links (optional)

Does this PR require merging another PR in a different repository (such as sbnanobj/sbnobj etc.)?

Link(s) to docdb describing changes (optional)

Is there a docdb describing the issue this solves or the feature added?

@sungbinoh sungbinoh self-assigned this Nov 14, 2025
@sungbinoh sungbinoh added reco1/reco2 Reconstruction data features for data processing labels Nov 14, 2025
if (cryo == 0 && tpc == 1) thiselifetime = runelifetime.tau_W;

// Get the hit time
double thit = hit.PeakTime()/2000. - 0.2 - t0;
Copy link
Contributor Author

@sungbinoh sungbinoh Nov 14, 2025

Choose a reason for hiding this comment

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

Hi @henrylay97 , if you get a chance, could you please check if this hit time reconstruction part looks okay? Thank you!

Copy link
Member

Choose a reason for hiding this comment

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

So this should be replaced with values taken from fClockData. At the moment you set it up but don't use it, that will be much better than hard coding the values. You can take inspiration from the lifetime correction in the CalorimetryAlg. Units can sometime be a problem so it's worth sanity checking the outputs.

service_provider: "PMTCalibrationDatabaseService"
CorrectionTags: {
PMTCalibrationDatabaseTag: "v1r1"
PMTCalibrationDatabaseTag: @local::SBND_Calibration_GlobalTags.PMTCalibrationDatabaseTag
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @asanchezcastillo , if you get a chance, could you please check if this update is okay for you? thank you!

CorrectionTags: {
PMTCalibrationDatabaseTag: "v1r1"
PMTCalibrationDatabaseTag: @local::SBND_Calibration_GlobalTags.PMTCalibrationDatabaseTag
DatabaseTimeStamp: 1757601071000000000
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
DatabaseTimeStamp: 1757601071000000000
DatabaseTimeStamp: @local::SBND_Calibration_GlobalTags.DatabaseTimeStamp

Copy link
Contributor

Choose a reason for hiding this comment

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

Following the previous suggestions, the timestamp should be read from the configuration file.

@asanchezcastillo
Copy link
Contributor

Hi @sungbinoh ! Thanks for the extremely useful work. Overall the PR looks good to me. Once the suggested configuration changes are committed we can move on and merge. I will update #863 to include these changes as well.

Copy link
Contributor

@linyan-w linyan-w left a comment

Choose a reason for hiding this comment

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

Approve once the timestamp is updated!

@sungbinoh
Copy link
Contributor Author

sungbinoh commented Nov 17, 2025

Hi @sungbinoh ! Thanks for the extremely useful work. Overall the PR looks good to me. Once the suggested configuration changes are committed we can move on and merge. I will update #863 to include these changes as well.

Hi @asanchezcastillo , thank you the review and comments!
I have updated the time stamp part following the comment.

As a sanity check, in the dumped reco2_sbnd.fcl with this update, I see

IPMTCalibrationDatabaseService: {
      CorrectionTags: {
         DatabaseTimeStamp: 1.757601071e18
         PMTCalibrationDatabaseTag: "v1r1"
         SERLength: 550
         TableName: "pds_calibration"
      }
      Verbose: false
      service_provider: "PMTCalibrationDatabaseService"
   }

Copy link
Member

@henrylay97 henrylay97 left a comment

Choose a reason for hiding this comment

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

Hi Sungbin! Thanks for this it looks like a significant chunk of work. I have a couple of suggestions on implementation. As discussed offline I also think it would be great to have some kind of validation of this, any simple mistake (e.g. typo) here will throw off all of our data calorimetry in the next production.

BEGIN_PROLOG

SBND_Calibration_GlobalTags: {
@table::TPC_CalibrationTags_Nov2025
Copy link
Member

Choose a reason for hiding this comment

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

So we also have a CRT calib table currently in an approved PR. Depending on what gets merged first we should make sure the CRT implementation get's swept into this more generic setup :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure!

Copy link
Member

Choose a reason for hiding this comment

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

This is now merged, would you have time today to look at how to ensure consistency with this? If not I can look in the morning my time!

double sbnd::calo::NormalizeDriftSQLite::Normalize(double dQdx, const art::Event &e,
const recob::Hit &hit, const geo::Point_t &location, const geo::Vector_t &direction, double t0) {

assert(fClockData);
Copy link
Member

Choose a reason for hiding this comment

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

I believe assert only works in debug builds? Do we want to change this so an exception would be thrown in production mode if the clock data was invalid?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the assert line to an if condition to throw exception when fClockData is not valid.

if (cryo == 0 && tpc == 1) thiselifetime = runelifetime.tau_W;

// Get the hit time
double thit = hit.PeakTime()/2000. - 0.2 - t0;
Copy link
Member

Choose a reason for hiding this comment

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

So this should be replaced with values taken from fClockData. At the moment you set it up but don't use it, that will be much better than hard coding the values. You can take inspiration from the lifetime correction in the CalorimetryAlg. Units can sometime be a problem so it's worth sanity checking the outputs.

Comment on lines 138 to 139
// TODO: what to do if no lifetime is found? throw an exception??
else {}
Copy link
Member

Choose a reason for hiding this comment

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

I would say so. We don't want a mix of corrected & uncorrected values. Theoretically it shouldn't be a problem for any run 1 data right? So it is a good sign to us if it is.

Copy link
Contributor

Choose a reason for hiding this comment

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

Echo that. In the code throw an exception. In the db use the nearest available value or set a default value.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated thit to use clockdata.

  double thit = fClockData->TPCTick2TrigTime(hit.PeakTime()) - t0;
  thit = thit * 1.e-3;

Also, updating the line 139 to throw exception if etau is invalid (negative).

else {
    std::cout << "sbnd::calo::NormalizeDriftSQLite::Normalize electron lifetime is not found for run " << e.id().runID().run() << std::endl;
    throw cet::exception("Electron lifetime is not found");
  }

@linyan-w
Copy link
Contributor

Hi Sungbin! Thanks for this it looks like a significant chunk of work. I have a couple of suggestions on implementation. As discussed offline I also think it would be great to have some kind of validation of this, any simple mistake (e.g. typo) here will throw off all of our data calorimetry in the next production.

Validation II will serve as a validation...!

@sungbinoh
Copy link
Contributor Author

Hi Sungbin! Thanks for this it looks like a significant chunk of work. I have a couple of suggestions on implementation. As discussed offline I also think it would be great to have some kind of validation of this, any simple mistake (e.g. typo) here will throw off all of our data calorimetry in the next production.

Hi @henrylay97 , thanks a lot for the review!
I have made updates following the comments.
For details, please have a look to response for each comment.

Copy link
Member

@henrylay97 henrylay97 left a comment

Choose a reason for hiding this comment

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

Thanks for sorting the hardcoding Sungbin! I have one lingering comment relating to the changes in develop since this PR was made. Other than that I am happy for this to go in!

BEGIN_PROLOG

SBND_Calibration_GlobalTags: {
@table::TPC_CalibrationTags_Nov2025
Copy link
Member

Choose a reason for hiding this comment

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

This is now merged, would you have time today to look at how to ensure consistency with this? If not I can look in the morning my time!

@nathanielerowe nathanielerowe moved this from Waiting on Reviewer to Reviewer Approved in SBND 2025 Fall Production Nov 19, 2025
@sungbinoh
Copy link
Contributor Author

sungbinoh commented Nov 20, 2025

Thanks for sorting the hardcoding Sungbin! I have one lingering comment relating to the changes in develop since this PR was made. Other than that I am happy for this to go in!

Hi @henrylay97 , there will be no consistency issue with CRT's side.
This PR only includes TPC etau and PMT tags for now.

Making a separate PR that merges CRT table info into the global tag feature would be good.
I will make that PR once this PR is merged!

@nathanielerowe
Copy link
Contributor

trigger build LArSoft/lar*@LARSOFT_SUITE_v10_12_02 SBNSoftware/sbndaq-artdaq-core@v1_10_06 SBNSoftware/sbn*@SBN_SUITE_v10_12_02

@FNALbuild
Copy link
Collaborator

✔️ CI build for LArSoft Succeeded on slf7 for c14:prof -- details available through the CI dashboard

@FNALbuild
Copy link
Collaborator

❌ CI build for SBND Failed at phase build SBND on slf7 for c14:prof -- details available through the CI dashboard

🚨 For more details about the failed phase, check the build SBND phase logs

parent CI build details are available through the CI dashboard

@FNALbuild
Copy link
Collaborator

✔️ CI build for LArSoft Succeeded on slf7 for e26:prof -- details available through the CI dashboard

@FNALbuild
Copy link
Collaborator

⚠️ CI build for SBND Warning at phase ci_tests SBND on slf7 for e26:prof -- details available through the CI dashboard

🚨 For more details about the warning phase, check the ci_tests SBND phase logs

parent CI build details are available through the CI dashboard

@nathanielerowe
Copy link
Contributor

approved

@nathanielerowe nathanielerowe moved this from Reviewer Approved to RM Approved in SBND 2025 Fall Production Nov 20, 2025
@nathanielerowe nathanielerowe merged commit 25494d7 into SBNSoftware:develop Nov 21, 2025
@nathanielerowe nathanielerowe moved this from RM Approved to In tagged release in SBND 2025 Fall Production Nov 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

data features for data processing reco1/reco2 Reconstruction

Projects

Status: In tagged release

Development

Successfully merging this pull request may close these issues.

6 participants