getValues()/getErrors() return a std::vector by value, but the QVector was
built from begin() of one call and end() of a second call -> iterators into
two distinct temporaries -> UB and a segfault in getValues(). Bind the result
to a single local before taking begin()/end(). Same in getPosErr/getNegErr.
This surfaced reliably when plotting a <python>-generated variable added via
the GUI (the script path was unaffected as it reads getValues() only once).
Also fix check() to validate the actually selected collections
(GetCollection(idx[i]) instead of GetCollection(i)).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Use the new coll[]/collErr[] interface so sigmaSC-vs-temp-py.txt computes both
SigmaSC_10 and SigmaSC_150 in one block instead of one block per collection.
Collection 0 is addressed by index (coll[0]) and collection 1 by name
(coll['...Tscan.db']) to show both addressing modes. Output is unchanged.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
A <python> variable block previously saw only the parameters of the single
collection the variable is linked to via 'col', injected as bare names plus
par[]/parErr[]. To compute variables for several collections one therefore
needed a separate block per collection.
Now every loaded collection is additionally injected as coll[]/collErr[]
dictionaries, addressable both by integer index (matching 'col <idx>' /
'select <idx>') and by collection name; index and name keys reference the same
per-parameter dict. A single block placed after all 'var = python' declarations
can thus compute - and combine - variables for any collection, e.g.
coll[0]['Sigma'] or coll['NAME.db']['Sigma'].
The bound-collection bare names / par[] / parErr[] are unchanged, so existing
scripts and GUI variables keep working. The collection list is threaded through
PmuppScript::var_cmd and the GUI add()/check() paths into PVarHandler.
Verified: a one-block script using both an index key and a name key reproduces
the numeric output of the equivalent two-block script bit-for-bit.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
getPythonBlock() always returned the first <python> ... </python>
entry of the script, so when several 'var X = python' declarations
each had their own block, every declaration after the first one
re-ran the first block and the read-back of the requested variable
failed. Thread the script index through var_cmd into getPythonBlock,
which now scans from that position onwards. Each declaration is
paired with the next block in script order.
Previously only y-errors were rendered. The IPC data file format now
includes x-errors per point (x, xPosErr, xNegErr, y, yPosErr, yNegErr,
...). Both the live canvas (PMuppCanvas) and the ROOT macro exports
(GUI and script path) propagate x-errors to TGraphAsymmErrors;
x-errors default to 0.0 when the parameter carries none.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Variables can now be computed by an embedded Python3 interpreter in addition
to the Boost.Spirit X3 expression engine. A <python> ... </python> block
receives all collection parameters as per-run lists (bare names, plus
par[]/parErr[] dictionaries as a fallback for names that are not valid Python
identifiers such as 'lambda') and must assign <name> and <name>Err; errors are
user supplied. Works both in the GUI variable dialog and in scripts.
The feature is optional and only enabled when ROOT is built with TPython
(CMake target ROOT::ROOTTPython); otherwise it compiles out. See MUPP_PY.README
for ROOT configure requirements and usage.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Add ${HDF5_LIBRARIES} to PMusr link dependencies so HDF5 C++ symbols
(H5::DataType, H5::PredType, etc.) used in PRunDataHandler.cpp resolve.
- Add ${FFTW3_INCLUDE} to musrRootValidation and write_musrRoot_runHeader
include paths; both pull in PMusr.h which transitively includes fftw3.h.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add a Python-based test script that runs musrfit -c on each example
msr-file, extracts the maxLH or chisq value, and checks it against
a reference value with a relative tolerance of 1e-4. Covers all 13
example msr-files (single histogram and asymmetry fits).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>