Skip to content

gspl2root: fix graph point count, PDF plots by default, document -n/-x - #561

Open
nusense wants to merge 1 commit into
GENIE-MC:masterfrom
nusense:rhatcher/xml2root_pdf
Open

nusense wants to merge 1 commit into
GENIE-MC:masterfrom
nusense:rhatcher/xml2root_pdf

Conversation

@nusense

@nusense nusense commented Nov 10, 2026

Copy link
Copy Markdown
Member

gspl2root: consistent graph point count, PDF plots, document -n/-x

Problem

Since f4d8e0ebf, the two point counts in gSplineXml2Root.cxx disagree by one, in opposite directions depending on -n:

ROOT-file TGraphs (kNSplineP) -w plots (kNP)
default max knots max knots − 1
-n N N − 1 N

So -n 100 writes 99-point graphs, and -n 2 divides by zero in the energy step. -n and -x are also undocumented.

Changes (src/Apps/gSplineXml2Root.cxx only)

  • Point count: kNP and kNSplineP are set identically: the max spline knot count by default, or N with -n N (minimum 2). This restores the ddb79cd48 behaviour, where (with -l and a matching -e range) the points fall on the spline knots.
  • Plots: -w now writes xsec-splines-<probe>-<target>.pdf via TPDF; --ps gives the previous PostScript output. Drawing code is unchanged (TVirtualPS). An old build ignores --ps.
  • -x <interpolation> (added in f4d8e0ebf): documented in the header and PrintSyntax() — TSpline3 (default), TSpline5, LINEAR, POLYNOMIAL, CSPLINE, AKIMA. Notes that intervals next to a zero-valued knot are always linear. *_PERIODIC types are now rejected with a fatal error, as they are not meaningful for cross sections.
  • Warning: the unused xcls in the neutrino DIS-sum loop (its only use, the charm skip, was commented out in b09a22022) is commented out alongside it. No C++17 attribute is used.

Not changed

Since b09a22022 the neutrino dis_* sums include charm, while the charged-lepton dis_em_p/dis_em_n sums still exclude it. Flagged here; left for a separate decision.

Testing

  • Compiles with no warnings (clang, -Wall -W -Wshadow).
  • gspl2root run on a spline file: point counts with and without -n, -w PDF vs -w --ps pages, -x AKIMA_PERIODIC exits.

🤖 Generated with Claude Code

- kNP and kNSplineP are now set identically: the max spline knot count
  by default, or N with -n N (minimum 2). f4d8e0e had made them differ
  by one, so -n 100 gave 99-point TGraphs in the ROOT file.
- -w now writes the plots as PDF (TPDF); --ps keeps PostScript.
- Document -n and -x (interpolation) in the header and PrintSyntax();
  reject the *_PERIODIC interpolation types.
- Comment out the unused xcls in the neutrino DIS sums (its only use,
  the charm skip, was commented out in b09a220) to silence a warning.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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