Commit Graph
406 Commits
Author SHA1 Message Date
suter_aandClaude Opus 4.8 60f7e270d7 PStringUtils::IsInt: accept an optional leading sign
IsInt now recognises (possibly signed) integers such as "-5" or "+42",
making it slightly more permissive than TString::IsDigit(). A lone sign,
a double sign, or a sign following a digit are still rejected. strToNum
test expectations updated accordingly.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-23 09:32:24 +02:00
suter_aandClaude Opus 4.8 57fa059fed PStringUtils::ToDouble: signal conversion errors like ToInt
ToDouble() had the same shortcoming as ToInt(): wrapping strtod() with a
nullptr endptr made a failed conversion indistinguishable from a
legitimate 0.0. Add an optional `bool *ok` out-parameter that reports
success. strtod() (with endptr + errno) is kept instead of
std::from_chars so the accepted input set stays identical to
TString::Atof() (leading whitespace skipped, leading '+' honoured,
trailing characters ignored); ok is set false on a non-numeric string or
an ERANGE overflow. The parameter defaults to nullptr, so existing call
sites keep compiling unchanged.

Convert the IsFloat-guarded ToDouble call sites in PMsrHandler to the
single-parse ToDouble(token, &ok) form (replacing the IsFloat() guard +
separate ToDouble() that parsed every token twice). All downstream
>=0 / <=0 / range checks are preserved, and push_back sites only append
on success so no spurious 0.0 is stored on error. Number-vs-keyword
discriminators (pos.error/boundary "none", rrf_phase/fourier-phase parX)
are restructured so the keyword branch is taken when ok is false.

As a side effect this fixes a latent gap in the GLOBAL rrf_freq handler,
where a non-numeric frequency previously slipped through with a stale
value instead of raising an error.

The IsFloat-guarded ToInt fit-range offsets (fgb/lgb) are intentionally
left untouched, as there the guard type differs from the conversion.

All 85 integration tests pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-23 07:46:59 +02:00
suter_aandClaude Opus 4.8 a22b9cb5c2 PStringUtils::ToInt: signal conversion errors via from_chars
ToInt() previously wrapped strtol() with a nullptr endptr, so a failed
conversion was indistinguishable from a legitimate 0 (matching the old
TString::Atoi() behaviour). Switch the implementation to std::from_chars
and add an optional `bool *ok` out-parameter that reports success: it is
set to false on a non-numeric string or an out-of-range value, true
otherwise. Leading whitespace is skipped and trailing characters are
ignored, preserving the Atoi-like prefix semantics. The parameter
defaults to nullptr, so existing call sites keep compiling unchanged.

Convert the parse-validation call sites in PMsrHandler to the single
-parse ToInt(token, &ok) form, replacing the IsInt() guard + separate
ToInt() (which parsed every token twice). All downstream >0 / >=0 /
range / enum checks are preserved.

Left untouched the call sites where IsInt() acts as a structural
discriminator rather than a numeric validator (write path, xy-data
index-vs-label, fParamInUse usage scans) and the IsFloat-guarded ToInt
offsets, where switching to ToInt(&ok) would change parsing semantics.

All 85 integration tests pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-23 07:46:39 +02:00
suter_aandClaude Opus 4.8 cc652aed00 PMsrHandler: replace ROOT tokenizer machinery with C++17 PStringUtils
Reduce the ROOT footprint of the MSR parser by removing the pervasive
TString::Tokenize / TObjArray / TObjString / dynamic_cast pattern (28
tokenize sites, 14 TObjArray, 106 TObjString) used to split lines into
tokens, together with the manual `delete tokens` cleanup.

Add a new dependency-free C++17 utility class PStringUtils (Split, IsInt,
IsFloat, ToInt, ToDouble, IsEqualNoCase, ContainsNoCase, BeginsWithNoCase)
that replicates the relevant TString semantics exactly, so it can be reused
elsewhere in the suite. IsInt/IsFloat tolerate surrounding whitespace to
match TString::IsDigit/IsFloat (needed for tokens split on ',' / ';' only).

The public API and the PMusr.h data structures keep TString unchanged; only
the internal tokenizing logic is rewritten. Net -451 lines in
PMsrHandler.cpp. All 85 integration tests pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-23 07:46:11 +02:00
suter_a bb6af7b632 fix of wrong cherry-pick. 2026-07-15 10:47:43 +02:00
suter_a e2a42eadd5 add Red/Green mode handling for NeXus HDF5 IDF V2. See also the musrfit docu. 2026-07-15 10:34:59 +02:00
suter_aandClaude Sonnet 4.6 c4929ccc4c guard all any_cast attribute reads in ReadNexusFileIdf1 against bad_any_cast
Uncaught std::bad_any_cast calls terminated the program when an HDF4
attribute's stored type didn't match the expected type (e.g. vector<int>
instead of int, or a non-string units attribute). Wrap all eight attribute
casts with try/catch so type mismatches produce a warning rather than a crash.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-15 10:33:00 +02:00
suter_aandClaude Sonnet 4.6 b90d0d9e8b Fix macOS 26 CLING runtime dictionary errors caused by Homebrew/SDK header conflicts
macOS 26 (Darwin 25.5.0) introduced stricter Clang module map rules in
DarwinFoundation1.modulemap: the '_c_standard_library_obsolete' module
now requires the 'found_incompatible_headers__check_search_paths' feature,
which CLING's runtime interpreter does not set. When fftw3.h (from
/opt/homebrew/include) was parsed by CLING via the inlined PStartupHandler
dictionary payload, it triggered this module map error, causing all
PStartupHandler signal/slot connections to fail.

Two fixes:
- PMusr.h: guard '#include "fftw3.h"' with '#ifndef __CLING__'. No fftw
  types appear in PMusr.h class definitions, so CLING does not need it
  for reflection. This is the primary runtime fix.
- CMakeLists.txt (src/classes and all src/external libs): replace
  '-I${FFTW3_INCLUDE}', '-I${Boost_INCLUDE_DIRS}', '-I${GSL_INCLUDE_DIRS}',
  and '-I${ROOT_INCLUDE_DIRS}' with '-isystem' in all root_generate_dictionary
  OPTIONS blocks, and change 'include_directories(${FFTW3_INCLUDE})' to
  'include_directories(SYSTEM ...)'. Internal project paths (MUSRFIT_INC,
  BMW_TOOLS_INC, NONLOCAL_INC, CMAKE_CURRENT_SOURCE_DIR, etc.) keep '-I'.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-15 10:29:43 +02:00
suter_a 8cb7da2e2a adopted to new hdf4/5 approach of NeXus. 2026-03-02 13:46:47 +01:00
suter_a 7d102a2604 move DeadTimeCorrection to PRunBase. Make ADDRUN part in PrepareData more readable. 2026-03-02 10:46:39 +01:00
suter_a 9a48487220 updated the copyright info. 2026-02-13 13:59:49 +01:00
suter_a 70da2f83ea replace 'nil' by 'leer' since 'nil' leads to conflict with macOS. 2026-01-16 10:01:07 +01:00
suter_a 19362bd088 add missing header file PFunctionsAst.h 2026-01-16 10:00:47 +01:00
suter_a 4cd4b7878f modernize musrfit function handling using spirit x3 instead of spirit classic now. 2026-01-16 10:00:36 +01:00
suter_a c53e0725f1 improve the doxygen docu of PUserFcn.* and PUserFcnBase.* 2025-11-26 18:10:50 +01:00
suter_a 8e2949e7a9 improve the doxygen docu of PTheory.* 2025-11-26 18:10:29 +01:00
suter_a 9452d7ec6b improve the doxygen docu of PStartupHandler.* 2025-11-26 18:09:09 +01:00
suter_a 736c96c66e improve the doxygen docu of PRunSingleHistoRRF.* 2025-11-26 18:01:26 +01:00
suter_a 06056db491 improve the doxygen docu of PRunSingleHisto.* 2025-11-26 18:00:58 +01:00
suter_a 27b3b317ba improve the doxygen docu of PRunNonMusr.* 2025-11-26 18:00:44 +01:00
suter_a 707736b8d4 improve the doxygen docu of PRunMuMinus.* 2025-11-26 18:00:31 +01:00
suter_a 9b98294311 improve the doxygen docu of PRunListCollection.* 2025-11-26 17:59:38 +01:00
suter_a 7cb21e3307 improve the doxygen docu of PRunDataHandler.h 2025-11-26 17:54:54 +01:00
suter_a 111f17e3dc improve the doxygen docu of PRunBase.* 2025-11-26 17:53:18 +01:00
suter_a 0f2736ba30 improve the doxygen docu of PRunAsymmetryRRF.* 2025-11-26 17:50:41 +01:00
suter_a 0816440463 improve the doxygen docu of PRunAsymmetry.*. 2025-11-26 17:50:27 +01:00
suter_a 7a3a5b1ee5 improve doxygen documentation of PRunAsymmetryBNMR.* 2025-11-26 17:50:12 +01:00
suter_a 019a16e1aa improve doxygen documentation of PRgeHandler.* 2025-11-26 17:49:45 +01:00
suter_a 8de507441c improve doxygen documentation of PPrepFourier.* 2025-11-26 17:49:28 +01:00
suter_a e900bd547a improve doxygen documentation of PMusrT0.* 2025-11-26 17:49:11 +01:00
suter_a 368957b46f improve doxygen documentation of PMusrCanvas.* 2025-11-26 17:48:10 +01:00
suter_a 7762f69c24 improve doxygen documentation of PMsrHandler.* 2025-11-26 17:43:48 +01:00
suter_a 41b39ab2ab improve doxygen documentation of PMsr2Data.* 2025-11-26 17:40:42 +01:00
suter_a 91e76d56df improve doxygen documentation of PMsgBox.* 2025-11-26 17:40:25 +01:00
suter_a d685eeb54f improve doxygen documentation of PFunction.* and PFunctionGrammar.h 2025-11-26 17:40:10 +01:00
suter_a 93c9e3ab80 improve the doxygen docu. 2025-11-26 17:39:55 +01:00
suter_a cf9ea89326 improve the doxygen docu with the help of Claude AI. 2025-11-26 17:38:14 +01:00
suter_a e01cfdd5da make sure that the comment content is not confused with end of comment. 2025-11-26 17:30:25 +01:00
suter_a 4d70c7baa9 use Claude ai to generate doxygen documentation. 2025-11-26 17:27:10 +01:00
suter_a 71fb4c9435 add TDirectory option to any2many. 2025-10-03 16:21:14 +02:00
suter_a 332681362f improved rounding handling to get a more consistent expected chisq after fitting compared to pure chisq estimate of musrfit. Essentially get rid of rounding issues. 2025-07-03 09:59:56 +02:00
suter_a b692b78cac added a feature which brings up a error message box, if there was any issue with the msr-file when starting musrview from musredit. 2025-06-29 14:37:09 +02:00
suter_a 4da145d674 (i) make most internal checking functions in the msr handler private. (ii) improved checking of real Fourier for consistency. 2025-06-23 16:06:32 +02:00
suter_a 28054377f7 changed theory functionc abbriviation 'if' to 'ifld'. 2025-06-10 14:37:43 +02:00
suter_a e891f0489a 1st full Gauss/Lorentz LF. Still room for optimization, and further testing. 2025-06-10 14:33:37 +02:00
suter_a ea776016b4 add simple F-mu-F to the standard theory functions. 2025-06-10 14:33:00 +02:00
suter_a 7a923d2f01 start adding more standard theory functions. Not all ready yet. 2025-06-10 14:32:45 +02:00
suter_a bf75b5ef14 add title to PRawRunDataSet. 2025-03-19 12:21:24 +01:00
suter_a 44821cb8cd updated the copyright info. 2025-01-30 12:00:49 +01:00
suter_a c6fda693a3 add a new tag PMUSR_UNSUPPORTED_FEATURE 2025-01-28 12:54:23 +01:00