Commit Graph
39 Commits
Author SHA1 Message Date
suter_a 40769be238 Implemented OpenMP parallelization of the independent-transform loops in both files, following the existing #ifdef HAVE_GOMP / #pragma omp parallel for pattern already used elsewhere in the codebase:
- src/musrFT.cpp: the timed Transform() loop over all PFourier objects is now parallelized. Added OpenMP::OpenMP_CXX linkage to the musrFT CMake target (it wasn't linked before).
  - src/classes/PMusrCanvas.cpp (HandleFourier() and HandleDifferenceFourier()): split each loop into three phases — serial PFourier construction (FFTW plan creation isn't thread-safe), a parallel Transform()
    loop (pure FFTW compute, safe to parallelize), and serial ROOT histogram creation/styling (ROOT globals aren't thread-safe). PMusr already links OpenMP, so only the #include <omp.h> and the pragma were
    needed.
2026-08-25 10:00:41 +02:00
suter_aandClaude Opus 5 f7191a2907 fix musrview ctest failures on macOS: RGB order and path buffers
Three unrelated issues made the musrview_check tests fail on macOS while
passing on Linux.

1. Unspecified argument evaluation order

   TColor::GetColor(rand.Integer(255), rand.Integer(255), rand.Integer(255))

   evaluates its (side-effecting) arguments in an unspecified order: clang
   goes left-to-right, gcc right-to-left, so the same seed yielded RGB on
   one platform and BGR on the other. Visible whenever more runs are
   plotted than the startup xml colour list provides, e.g.
   test-histo-HAL9500.msr with 16 runs against 10 colours.

   The rgb values are now drawn into separate variables first. This keeps
   the clang result and changes gcc to match, hence the regenerated
   reference PNG for musrview-histo-HAL9500 (99.94% of the differing
   pixels were exact R<->B swaps).

   Fixed in PMusrCanvas, PFourierCanvas and both mupp PMuppCanvas copies.

2. Fixed size path buffers

   char fileName[128] plus strncpy(dst, src, sizeof(dst)) truncates *and*
   leaves the buffer unterminated once the path reaches the buffer size.
   musrview then failed on a 132 character msr-path in doc/examples/ViewOpts.
   musrFT and musrt0 were worse: an unbounded strcpy of the startup file
   path into char startup_path_name[128], i.e. a stack buffer overflow.

   All path/filename buffers in the drivers are now std::string:
   musrview, musrFT, musrt0, musrfit, any2many, addRun, dump_header.
   PMusrCanvas::SaveGraphicsAndQuit() takes const Char_t* accordingly.

   Along the way in the same files:
   - msr2msr_replace() wrote a 256 byte line into char temp[128]
   - msr2msr assembled "cp"/"rm" shell commands from paths in a 256 byte
     buffer; replaced by std::filesystem
   - msr2msr and addRun read lines with getline(buf, N), which silently
     abandons the rest of the file on the first over-long line
   - addRun: bound the unbounded sscanf "%s" to "%255s"
   - dropped scratch buffers that only held a string literal, in favour of
     TString::ReplaceAll(const char*, const char*)

3. musrview_check.py left its PNGs behind on failure

   The two early error returns skipped the cleanup, and since generated
   PNGs were identified by "not in the pre-run snapshot", one leftover file
   permanently masked the real output of that test: musrview overwrites the
   stale PNG, so it was there, just filtered out. One failure thus poisoned
   every later run (30 of the 37 observed failures) after a 15 s poll each.

   Cleanup now runs in a finally block on every exit path, and generated
   PNGs are detected by mtime instead, which sees rewritten leftovers while
   staying safe for a sibling test running concurrently under ctest -j.
   Also dropped the MUSRVIEW_PNG_DIR env var and its tmp-dir fallback: it
   is read nowhere in src/, so the fallback was dead code that guaranteed
   the full 15 s poll before every "no PNGs found" failure.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-01 14:49:17 +02:00
suter_aandClaude Opus 4.8 b378ca5f25 musrFT: replace TObjArray/TObjString with PStringUtils
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-23 09:35:41 +02:00
suter_a 9a48487220 updated the copyright info. 2026-02-13 13:59:49 +01:00
suter_a 44821cb8cd updated the copyright info. 2025-01-30 12:00:49 +01:00
suter_a 258f248e99 make sure that 'ASCII', 'DAT', and 'DB' is rejected from musrFT. 2025-01-28 12:52:41 +01:00
ext-mcfadd_r 1a1e756d77 fix segfault
This patch provides a memory-safe alternative to the changes introduced in commit 418adfde67, which causes a segfault when the "batch mode" flag is required (i.e., for ascii/graphic export).

Note: the program name (i.e., argv[0]) has been added the list arguments passed to ROOT's TApplication. This ensures that the TApplication name matches that of the program (see https://github.com/root-project/root/blob/542b98b2ccca760fd83117b750b89d81b8e9b926/core/base/src/TApplication.cxx#L179-L180).
2024-06-18 12:55:10 +02:00
suter_a 6a7178b3a9 propagate only necessary root flags to TApplication. 2024-06-06 10:04:03 +02:00
suter_a 17339e191d updated copyright info. 2024-02-07 15:29:08 +01:00
suter_a 1c8c1a8d0f get rid of raw pointers for PFourierCanvas where it makes sense. 2023-10-25 10:01:28 +02:00
suter_a 18f077c6e7 removed obsolate clean up. 2023-10-25 09:56:24 +02:00
suter_a f9d0d7f18f more work to get rid of raw pointers. 2023-10-25 09:12:10 +02:00
suter_a c54bc5c0dc replaced raw pointers by smart pointers for musrFT.cpp. 2023-10-25 09:04:36 +02:00
suter_a a356534e6a updated the copyright info. 2023-01-05 11:04:42 +01:00
suter_a d3d55f8719 make sure that git repo info is only added if the musrfit project source is indeed a git repo, and not e.g. a download. 2021-07-12 16:46:10 +02:00
suter_a aa2766bbaf add info on how musrfit is compiled Debug or Release. 2021-05-21 08:02:37 +02:00
suter_a 2a531bd58d add ROOT version information for better diagnostics. 2021-04-09 16:03:04 +02:00
suter_a a7b540cfdb update of the copyright info. 2021-03-29 08:30:43 +02:00
suter_a b6dba8965b update of the copyright info. 2020-04-30 17:46:10 +02:00
suter_a 9b2a01db2d modernized code to C++11 and newer -- cleanup. 2019-04-24 17:53:18 +02:00
suter_a c64c74dbf8 modernized code to C++11 and newer.
This allows to analyze the code by external code analyzers. Since a lot is adopted,
the version is changed to 1.4.3

Conflicts:
	src/classes/PFitter.cpp
	src/classes/PFourier.cpp
	src/classes/PMsrHandler.cpp
	src/classes/PMusrCanvas.cpp
	src/classes/PRunAsymmetry.cpp
	src/classes/PRunAsymmetryRRF.cpp
	src/classes/PRunListCollection.cpp
	src/classes/PRunSingleHisto.cpp
	src/classes/PRunSingleHistoRRF.cpp
	src/classes/PStartupHandler.cpp
	src/include/PFourier.h
	src/include/PRunListCollection.h
	src/musrFT.cpp
2019-04-24 17:44:58 +02:00
suter_a 1729055385 merged from root6. Compiles but has issues with DKS linking yet. 2017-05-15 21:30:42 +02:00
suter_a fca13283e1 changed generation of git-revision.h which allows to keep it up-to-date. Aditionally git-branch info has been added. 2017-02-22 09:42:07 +01:00
suter_a 38c4293d58 resolved merge conflicts with master 2016-12-23 14:16:22 +01:00
suter_a 63516fc499 added a first version of a optimized phase correction for the real Fourier transform 2016-12-18 10:37:50 +01:00
suter_a b157d01506 merge into master 2016-03-04 13:23:12 +01:00
suter_a f58cbf1874 added a yet experimental feature of a phase 'optimized' real Fourier transform. 2015-09-24 15:33:47 +02:00
suter_a 6ac3cdd798 corrected size for noOfFourierBins, and made switching between FFTW and DKS more coherent 2015-04-14 16:49:33 +02:00
suter_a a2601348cf first working FFT including DKS. 2015-04-13 17:21:27 +02:00
suter_a 8cc07318eb some more bug fixing for average per data set. 2015-02-26 13:15:29 +01:00
suter_a 59525a787e added missing background range from msr-file 2015-02-24 10:32:59 +01:00
suter_a 78d98f7652 separated PSI-BIN and PSI-MDU file format 2015-02-24 10:02:04 +01:00
suter_a c938589286 implemented an average-per-data-set option for musrFT. 2015-02-23 16:30:14 +01:00
suter_a 741a9e7e48 fixed typos in the usage output. 2015-02-17 13:14:07 +01:00
suter_a ca48941deb bug fixing towards a musrFT feature complete state. 2015-02-17 12:46:30 +01:00
suter_a f9197cb815 removed outdated help information. 2015-02-13 17:04:50 +01:00
suter_a 2d2594c903 first almost feature complete version of musrFT 2015-02-13 16:56:19 +01:00
suter_a d4ba2f6d81 more work towards a standalone Fourier (mainly for HAL-9500). Add msr-file support. Still some severe flaws. 2015-02-11 15:35:14 +01:00
suter_a c6900030c7 first partial implementation for a standalone Fourier transform calculator/plotter. Mainly meant for HAL-9500. Much more to come ... 2015-02-02 15:52:51 +01:00