Skip to content

[Gen2] CAF beam-quality fields: -999 for missing values (CAF default pattern) - #687

Merged
hgreenlee merged 1 commit into
production/sbnd-gen2from
fix/bnb-fom-defaults-gen2
Nov 11, 2026
Merged

hgreenlee merged 1 commit into
production/sbnd-gen2from
fix/bnb-fom-defaults-gen2

Conversation

@jzennamo

@jzennamo jzennamo commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Description

Follow-up to Gianluca's review of SBNSoftware/sbnanaobj#201 and #203. The CAF convention is that NaN marks a data member that was never set, and -999 one that was set to an invalid value. The beam-quality fields in the CAF now follow it.

  • makeSRBNBInfo() (CAFMaker/FillExposure.cxx): a missing FOM_best, tor_used, beam position, angle or width at the target, or bunch-rotation setting is stored as -999 instead of NaN. The input value -999 and non-finite inputs both count as missing. fom_source (-1), fom_status and fom_version are unchanged. A cut 0.98 < FOM_best <= 1 still rejects spills without a FOM.
  • update_flatcafs.py: writes missing values as -999, as CAFMaker does.
  • dump_bnb_quality.py: reads -999 in these fields as NaN, and also the NaN of flat CAFs updated by the earlier version. The analysis tools downstream (bnb_fom*.py, fom_fixups.py, neighbor_fill.py, logger_fill.py) keep using NaN internally and are unchanged.
  • README and the bunch_rotation.py docstring are updated.

The spillbnbinfo of a record with no matching spill is left default-constructed (NaN): it was never set.

Testing

  • Build: mrb build on production/sbnd-gen2 head (larsoft v10_14_02_06; sbnobj, sbnanaobj, sbnalg and sbncode 10.14.02.10, with the companion PRs). No warnings, and the class-version checks pass.
  • Unit test of makeSRBNBInfo(): compiled stand-alone with -Wall -Wextra, no warnings. All checks pass for:
    • a default BNBSpillInfo (input made before the beam-quality result): every field -999, fom_source -1, fom_version 0;
    • NaN and inf inputs: -999;
    • valid values: passed through unchanged.
  • update_flatcafs.py on the run 18490 BNBLight flat CAF (442 spills, 50 triggered), compared with the previous version's output:
    • all 11 beam-quality fields of bnbinfo and spillbnbinfo are identical after NaN → -999, and no NaN is left;
    • dump_bnb_quality.py reads the new file and the old (NaN) file to the same values.

Companions: SBNSoftware/sbnanaobj#208 and SBNSoftware/sbnobj#183. develop: SBNSoftware/sbnobj#184, SBNSoftware/sbnanaobj#209, #688.

Joseph Zennamo (with Claude Code)

🤖 Generated with Claude Code

CAF convention (review of SBNSoftware/sbnanaobj#201, #203): NaN is for a data
member that was never set, -999 for one that was set to an invalid value.
- makeSRBNBInfo() stores a missing FOM_best, tor_used, position, angle, width
  or bunch-rotation setting as -999 instead of NaN; a cut
  0.98 < FOM_best <= 1 still rejects spills without a FOM.
- update_flatcafs.py writes missing values as -999.
- dump_bnb_quality.py reads -999 (and the NaN of flat CAFs updated before
  this change) as NaN, which the analysis tools use for "missing".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@PetrilloAtWork PetrilloAtWork left a comment

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.

Looks good!

@hgreenlee
hgreenlee merged commit d2e6e13 into production/sbnd-gen2 Nov 11, 2026
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.

3 participants