Commit Graph
1029 Commits
Author SHA1 Message Date
suter_aandClaude Opus 4.8 4af5606efb PMsrHandler: escape '?' to avoid trigraph warning in date placeholder
The fallback date placeholder string contained the sequence '??-', which
the compiler interprets as a trigraph for '~' (-Wtrigraphs warning).
Escape the question marks (\?) so the literal string is unchanged while
the warning is silenced.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-23 09:32:50 +02:00
suter_aandClaude Opus 4.8 64a2d29c68 PStartupHandler: replace TObjArray/TObjString with PStringUtils
Replace the ROOT TString::Tokenize()/TObjArray/TObjString machinery used
for parsing the RGB color code in OnCharacters() with the C++17
PStringUtils helpers (Split/IsInt/ToInt). Drops the manual heap cleanup
and the <TObjArray.h>/<TObjString.h> includes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-23 09:32:38 +02:00
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 e3096036b5 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 09:31:09 +02:00
suter_aandClaude Opus 4.8 3f5765fe46 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 09:30:23 +02:00
suter_aandClaude Opus 4.8 a6c887e059 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 08:13:25 +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_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 9178b5ef0e work on cleaner cmake. 2026-04-21 10:17:33 +02:00
suter_a 30c17e5431 suppress warning missing deadtime correction if not relevant. 2026-03-03 08:58:21 +01:00
suter_aandClaude Sonnet 4.6 8619865dde fix linker errors: add HDF5 C++ lib and FFTW3 include paths
- 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>
2026-03-03 08:58:11 +01:00
suter_a 8cb7da2e2a adopted to new hdf4/5 approach of NeXus. 2026-03-02 13:46:47 +01:00
suter_a c0ad630740 add musrfitConfig.cmake, etc. for musrfit. 2026-03-02 11:07:56 +01:00
suter_a cce7366799 fixed an index by one offset issue. 2026-03-02 11:06:33 +01:00
suter_a 9ec28171c8 make sure that the requested pointer is not a nullptr. 2026-03-02 11:06:24 +01:00
suter_a b1bce70d63 fix Boost_INCLUDE_DIR -> Boost_INCLUDE_DIRS 2026-03-02 11:06:04 +01:00
suter_a 17fcaa7c69 adopted the PNeXus lib such that the class naming scheme is self-consistent. 2026-03-02 10:55:43 +01:00
suter_a ee3fc2e42a warning that deadtime correction estimate is not yet implemented. I am not even sure this would be a good feature. 2026-03-02 10:49:45 +01:00
suter_a 3727190efa full implementation of the deadtime correction from file for PRunAsymmetryRRF. 2026-03-02 10:49:34 +01:00
suter_a 16f88b17e4 full implementation of the deadtime correction from file. 2026-03-02 10:47:52 +01:00
suter_a e432a26b4c added a warning if deadtime correction cannot be carried out (missing parameters, etc.) 2026-03-02 10:47:40 +01:00
suter_a 36168dc3a1 add DeadTimeCorrection to PRunAsymmetry - no ADDRUN handling yet. 2026-03-02 10:47:28 +01:00
suter_a 85eba63ed9 PRunSingleHistoRRF: add DeadTimeCorrection, and improve ADDRUN readability 2026-03-02 10:47:15 +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 8f5b48f013 proper TDirectory handling for the histos. 2026-02-13 14:00:59 +01:00
suter_a 9a48487220 updated the copyright info. 2026-02-13 13:59:49 +01:00
suter_a 1e60d92814 spirit classic/qi -> x3. Increase musrfit and library version to 1.9.10/1.7.0. 2026-01-16 10:01:33 +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 25205875de add missing header files for install for cmake. 2026-01-16 10:00:56 +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 32d9970659 adopted from AFS to NFS. 2026-01-16 09:59:45 +01:00
suter_a b3ee2000ed perform Fourier phase checks only if a Fourier block is present and not set to power spectra. 2025-12-22 16:10:56 +01:00
suter_a c27e4e1a33 adopt PFitter to ROOT v6-38-00 and make sure it is backwards compatible. 2025-11-27 15:58:54 +01:00
suter_a f26adc47fd add missing #include<cmath> to make some compilers happy. 2025-11-27 15:58:40 +01:00
suter_a a30ab1b0b9 add PSI/VMS to the musrfit_startup.xml. 2025-11-26 18:20:00 +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 ecb6a4e063 fixed a AI glich in the docu. 2025-11-26 18:01:12 +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 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