Compare commits

...

88 Commits

Author SHA1 Message Date
ecec59c8a3 1st full Gauss/Lorentz LF. Still room for optimization, and further testing. 2025-06-06 10:21:09 +02:00
66af890157 add new functions to musredit select. 2025-06-05 11:19:48 +02:00
eb98c9727c add simple F-mu-F to the standard theory functions. 2025-06-05 10:41:12 +02:00
079baa3edf start adding more standard theory functions. Not all ready yet. 2025-06-04 17:39:02 +02:00
7df47a05f3 create src dir if not present. Needed for git-revision.h 2025-06-03 12:58:00 +02:00
15c5b02c8b more docu. 2025-05-28 13:48:57 +02:00
37f099542a stripped CMakeLists.txt to the bare minimum. 2025-05-28 13:48:05 +02:00
c2fb166d3b add necessary docu for the Gaussian Lorentzian approach. 2025-05-28 12:47:20 +02:00
e8806c3e72 changed the integral approximation approach for Gaussian/Lorentzian. 2025-05-28 12:46:37 +02:00
91a45cad90 added ZF, LF geometry, dynamic approximation width/hopp << 1. 2025-05-27 15:59:58 +02:00
d1f025a8c2 improved GL integration. 2025-05-27 15:59:08 +02:00
e525abe614 simplify git-revision.h generation. 2025-05-19 13:29:54 +02:00
005b33c379 added missing MACOSX_BUNDLE_GUI_IDENTIFIER for mupp. 2025-05-14 18:10:51 +02:00
3bcc382679 allow to define Tmax from the cmd line. 2025-05-13 16:08:23 +02:00
249d6ff97c add missing header. 2025-05-12 20:25:40 +02:00
69ab03d5ae first LGKT_LF. Might need to slightly improve Simpson. 2025-05-12 16:36:37 +02:00
819d209863 proper class for GKT LF. 2025-05-12 10:58:53 +02:00
bcc1597e30 add LF Gaussian/Lorentzian testing code. 2025-05-09 16:02:04 +02:00
9fa90c24fb start populating nfs4 path rather than afs in the musrfit_startup.xml. 2025-05-06 15:33:13 +02:00
236a702d36 needed to add an additional header (stdbool.h, libCuba) to make clang happy. 2025-05-03 15:13:26 +02:00
09f9782a31 comment outdated typedef in libCuba. 2025-05-02 19:18:43 +02:00
f99f71a8db slight improvement on mud.h needed that it doesn't crash on macos15.4 m3pro. 2025-04-09 17:11:14 +02:00
6e60013037 updated mud.h (thanks to Donald Arseneau). Makes modern compiler happy again. 2025-04-08 17:00:04 +02:00
e38fa47961 add skeleton for MusrRoot which will handle TDirectoryFile rather than TFolder. 2025-04-04 18:37:42 +02:00
764cdf4e51 start implementing TDirectoryFile instead of TFolder, since TFolder is depricated. First I added the necessary parts on the validator. The read/write are still missing. 2025-04-04 16:58:57 +02:00
e5ff0fa743 switched from raw to QScopedPointer pointer in mupp.cpp. 2025-04-01 14:10:59 +02:00
e26fa4eea2 removed my quick and dirty fix. It doesn't work for all compilers. Reported bug to triumf and wait for a fix. 2025-03-31 07:54:25 +02:00
5648757389 back ported some qt6 recent file handling. 2025-03-30 18:14:04 +02:00
Andreas Suter
c3b4c7c3b1 improved recent file handling for macos. 2025-03-30 17:09:04 +02:00
e233c860d1 slight improvement in handling of the recent msr-files. 2025-03-30 15:30:46 +02:00
c230bfb1bc updated the icon switching by adding the missing View2Dat. 2025-03-29 22:36:48 +01:00
5119b1cd13 fixed typo and added necessary update for the theme flags. 2025-03-29 21:48:23 +01:00
d937324885 improved dark theme handling on mupp for qt5. 2025-03-29 20:54:03 +01:00
f7e5c53879 improved dark theme handling on mupp for qt6. 2025-03-29 20:17:28 +01:00
3796925e93 needed to adopt mud.h to make it gcc15.0.1 ready. 2025-03-26 17:05:16 +01:00
d5343a0073 activate the status bar. 2025-03-25 15:35:10 +01:00
bb99482461 add a user interface option to export data from a msr-file view (single- or multiple files) - qt6. 2025-03-24 20:28:57 +01:00
f0869935d1 add a user interface option to export data from a msr-file view (single- or multiple files). 2025-03-24 20:10:01 +01:00
0f95551200 add necessary increment for unique cropped name for PSI-BIN. 2025-03-19 16:24:56 +01:00
b8ce741534 make sure that for PSI-BIN export the 4 char detector names are unique. 2025-03-19 09:45:16 +01:00
4b6654ca2a add title to PRawRunDataSet. 2025-03-19 09:44:13 +01:00
38d4ec1806 read 'Sample Orientation' from ROOT file, since it might be needed by any2many. 2025-03-18 12:51:40 +01:00
4231d26604 make sure that the 'selected' object is present. 2025-02-24 20:22:20 +01:00
a28650f017 this is a workaround which should prevent that the key event is executed if a text/latex is written into the canvas. 2025-02-17 17:53:39 +01:00
9a23c4f241 fix of a copy/paste error. 2025-02-15 10:41:02 +01:00
5f7f79e46d header of exported data adopted for easier read in with pandas. 2025-02-14 09:06:55 +01:00
4a20d805dd updated the copyright info. 2025-01-30 11:15:42 +01:00
10cfe3f863 Merge branch 'root6' of https://git.psi.ch/nemu/musrfit into root6 2025-01-29 08:05:29 +01:00
0828d1b8d4 proper handling of comments and descriptions in the RUN block. 2025-01-29 08:04:48 +01:00
75785d2c0e add switch to enable/disable HDF4 support for NeXus. 2025-01-28 21:40:58 +01:00
e4b84b12df make sure that 'ASCII', 'DAT', and 'DB' is rejected from musrFT. 2025-01-27 18:00:32 +01:00
124a31386c add a new tag PMUSR_UNSUPPORTED_FEATURE 2025-01-27 17:58:42 +01:00
ebdb0feb7f path-run-name in RUN block of the msr-file can now handle spaces. 2025-01-18 13:35:08 +01:00
Ryan M. L. McFadden
e67d92fc05 Merged in mnstrategy (pull request #19)
Explicit passing of MnStrategy during minimizer initialization

Approved-by: Suter Andreas
2025-01-10 10:00:30 +00:00
Ryan M. L. McFadden
ead1674b13 Explicit passing of MnStrategy during minimizer initialization
This patch fixes compilation errors that arise with recent ROOT versions (e.g., 6.34.02),
which require a ROOT::Minuit2::MnStrategy object to be passed when initializing the
ROOT::Minuit2::MnX (X = Migrad, Simplex, Minimize) minimizers (i.e., instead of the integer
representing the "strategy").
2025-01-09 11:38:33 -08:00
fd22884ce8 slightly re-ordered the default files for mupp in the open dialog. 2024-12-16 07:41:24 +01:00
20dd08fbef changed default ROOT color kGreen to kGreen+2. 2024-12-14 14:54:17 +01:00
3e66760c26 adopted for custom button handling qt5. 2024-12-11 14:06:32 +01:00
d6bcdf52b8 adopted for custom button handling. 2024-12-11 13:58:11 +01:00
30bd2b2876 added missing enum tag. 2024-12-11 09:36:57 +01:00
9f8f89db6d make the theme handling in musredit more flexible. At the same time adopted some part to more modern c++. 2024-12-11 09:25:28 +01:00
458913ca31 update of the ChangeLog 2024-12-03 18:13:02 +01:00
5c3accc6ed added jump to block feature. 2024-12-02 20:05:50 +01:00
6f8b0a2341 center edit widget for find. This gives a better user experience. 2024-12-02 17:06:02 +01:00
4febdb42b4 make sure that for non-muSR data errors are not = 0. Will set it to 1, and issue a warning. This prevents chisq to crash. 2024-10-14 12:22:25 +02:00
ae95a5dc1c implemented unary operator for metaData in functions. 2024-10-11 16:34:49 +02:00
c3f531e0d5 fixed a bug for out-of-repo build to generate git-info. 2024-10-11 08:19:54 +02:00
0b61130e28 adopted OpenMP handling for libZFRelaxation. 2024-09-23 09:41:20 +02:00
d1cd63dcb0 fixed a bug in the mupp gui refresh of a collection. 2024-09-21 13:02:31 +02:00
7838901fbe make sure that the run template number has at least 4 digits before proceeding. 2024-09-17 16:27:04 +02:00
00b012d0dd Merge https://bitbucket.org/muonspin/musrfit into root6 2024-09-12 09:29:03 +02:00
Ryan M. L. McFadden
d2984d8923 Merged in avg (pull request #18)
fix batch mode averaged output

Approved-by: Andreas Suter
2024-09-12 07:28:15 +00:00
Ryan M. L. McFadden
58889614e5 fix batch mode averaged output
closes issue #63
2024-09-10 13:52:30 -07:00
c9fc373862 improved dat-file reading for mupp. 2024-07-02 09:26:44 +02:00
ebefcf7af9 updated the docu. 2024-06-24 09:44:07 +02:00
64d3b6192b added the option to write the content of the MINUIT2.OUTPUT ascii file as yaml. This extends the previous commit from Ryan M.L. McFadden. 2024-06-18 11:16:15 +02:00
6bcb26f9d5 Merge branch 'root6' of https://bitbucket.org/muonspin/musrfit into root6 2024-06-18 08:19:01 +02:00
Ryan M. L. McFadden
6b865efd3b Merged in ignore (pull request #17)
ignore all files generated from an in-repo build

Approved-by: Andreas Suter
2024-06-18 06:18:56 +00:00
Ryan M. L. McFadden
caccfb175a Merged in yaml (pull request #16)
write the fit results to an easy-to-read/parse yaml file

Approved-by: Andreas Suter
2024-06-18 06:18:31 +00:00
Ryan M. L. McFadden
1845b5c176 Merged in segfault (pull request #15)
fix segfault

Approved-by: Andreas Suter
2024-06-18 06:18:14 +00:00
Ryan M. L. McFadden
8821112927 ignore all files generated from an in-repo build 2024-06-17 13:07:06 -03:00
Ryan M. L. McFadden
833171c712 write the fit results to an easy-to-read/parse yaml file
This patch adds routines for writing a comprehensive set of fit results (i.e., parameter values, parabolic errors, asymmetric errors, covariances, correlation coefficients, etc.) for an individual `.msr` file to an easy-to-read/parse `.yaml` file.

The main motivation for the code addition is to provide users with easy access to the fit's covariance matrix without the need for "extra" manual effort (e.g., parsing the contents of `MINUIT2.OUTPUT` or `MINUIT2.root`). The other fit quantities are also included for completeness.

Reading/accessing the output is trivial using, for example, the PyYAML Python library (https://github.com/yaml/pyyaml):

```python
import yaml

with open("2125_tf_histo.yaml", "r") as fh:
	results = yaml.load(fh, Loader=yaml.SafeLoader)

cov = results["covariance"]["Field_1"]["Sigma_1"]
```

Note: the naming conventions chosen for the blocks in the `.yaml` output closely follow those used by the iminuit Python library (https://github.com/scikit-hep/iminuit).
2024-06-17 12:51:04 -03:00
Ryan M. L. McFadden
61749b91c4 fix segfault
This patch provides a memory-safe alternative to the changes introduced in commit 418adfde670b8d911a6a313e11a2ee4fc98feeee, 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 542b98b2cc/core/base/src/TApplication.cxx (L179-L180)).
2024-06-17 10:52:14 -03:00
3d92e2eefb add CPU info to the configure process. 2024-06-09 17:45:02 +02:00
b71dce9291 remove more accidently added file. 2024-06-08 16:39:57 +02:00
1aa4ce0a99 remove accidentely added file. 2024-06-08 16:36:54 +02:00
425ed02e22 update of the docu. 2024-06-08 09:23:36 +02:00
a36abfc461 updated version info, due to the macOS OpenMP support. 2024-06-08 09:17:05 +02:00
388 changed files with 4803 additions and 1494 deletions

BIN
.DS_Store vendored

Binary file not shown.

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# ignore all files generated from an in-repo build
build/

View File

@ -1,7 +1,7 @@
# - musrfit
cmake_minimum_required(VERSION 3.17)
project(musrfit VERSION 1.9.3 LANGUAGES C CXX)
project(musrfit VERSION 1.9.8 LANGUAGES C CXX)
#--- musrfit specific options -------------------------------------------------
option(nexus "build optional NeXus support. Needed for ISIS" OFF)
@ -200,8 +200,10 @@ endif (qt_based_tools)
#--- if NeXus check also for HDF4, HDF5, and MXML -----------------------------
if (nexus)
find_package(HDF5 COMPONENTS CXX REQUIRED )
find_package(HDF4 REQUIRED)
find_package(HDF5 COMPONENTS CXX REQUIRED)
if (HAVE_HDF4)
find_package(HDF4 REQUIRED)
endif (HAVE_HDF4)
find_package(NEXUS REQUIRED)
add_definitions(-DPNEXUS_ENABLED)
endif (nexus)
@ -222,6 +224,19 @@ else ()
set(IS_GIT_REPO 0)
endif ()
#--- start create git-revision.h ----------------------------------------------
if (IS_GIT_REPO)
execute_process(COMMAND sh ${CMAKE_SOURCE_DIR}/src/git_revision.sh)
set(HAVE_GIT_REV_H "-DHAVE_GIT_REV_H")
set(GIT_REV_H "git-revision.h")
else (IS_GIT_REPO)
set(HAVE_GIT_REV_H "")
set(GIT_REV_H "")
endif (IS_GIT_REPO)
#--- end create git-revision.h ------------------------------------------------
#--- rpath related things -----------------------------------------------------
# use, i.e. don't skip the full RPATH for the build tree
set(CMAKE_SKIP_BUILD_RPATH FALSE)
@ -249,6 +264,8 @@ set(CMAKE_INSTALL_RPATH "${rpath}")
add_subdirectory(src)
#--- write summary of the installation
cmake_host_system_information(RESULT PROCESSOR QUERY PROCESSOR_DESCRIPTION)
message("")
message("|-----------------------------------------------------------------------|")
message("| |")
@ -256,8 +273,9 @@ message("| Summary
message("| |")
message("|-----------------------------------------------------------------------|")
message("")
message(" System: ${CMAKE_HOST_SYSTEM_NAME} ${CMAKE_SYSTEM_PROCESSOR} - ${CMAKE_HOST_SYSTEM_VERSION}")
message(" -------")
message(" System: ${CMAKE_HOST_SYSTEM_NAME} ${CMAKE_SYSTEM_PROCESSOR} - ${CMAKE_HOST_SYSTEM_VERSION}")
message(" Processor: ${PROCESSOR} (${CMAKE_SYSTEM_PROCESSOR})")
message(" ----------")
message("")
message(" musrfit Version: ${musrfit_VERSION}")
message(" ----------------")
@ -283,7 +301,11 @@ endif (OpenMP_FOUND)
if (nexus)
message("")
message(" HDF4 found in ${HDF4_INCLUDE_DIRS}")
if (HAVE_HDF4)
message(" HDF4 found in ${HDF4_INCLUDE_DIRS}")
else (HAVE_HDF4)
message(" HDF4 not present.")
endif (HAVE_HDF4)
message(" HDF5 found in ${HDF5_INCLUDE_DIRS}, Version: ${HDF5_VERSION}")
message(" NeXus found in ${NEXUS_INCLUDE_DIR}, Version: ${NEXUS_VERSION_STRING}")
endif (nexus)

View File

@ -12,6 +12,32 @@ or
https://bitbucket.org/muonspin/musrfit/commits/all
Release of V1.9.8, 2025/03/24
=============================
add a user interface option to export data from a msr-file view (single- or multiple files).
Release of V1.9.7, 2025/01/18
=============================
allow spaces in RUN block path-filename
Release of V1.9.6, 2024/12/02
=============================
added jump to block feature in musredit.
Release of V1.9.5, 2024/06/24
=============================
yaml export of ALL fit-parameters, as initiated by R.M.L. McFadden.
Release of V1.9.4, 2024/06/08
=============================
enable OpenMP for macOS.
Release of V1.9.3, 2024/04/19
=============================

View File

@ -1,30 +0,0 @@
# configure_musrfit_version_file.cmake.in:
set(SRC_DIR "@CMAKE_SOURCE_DIR@")
set(BIN_DIR "@CMAKE_CURRENT_BINARY_DIR@")
# Set variables
set(CMAKE_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@")
set(MUSRFIT_VERSION "@MUSRFIT_VERSION@")
# Get the current working branch
execute_process(
COMMAND git rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# Get the latest abbreviated commit hash of the working branch
execute_process(
COMMAND git log -1 --pretty="%h, %ci"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_CURRENT_SHA1
OUTPUT_STRIP_TRAILING_WHITESPACE
)
configure_file(
${SRC_DIR}/cmake/git-revision.h.in
${BIN_DIR}/git-revision.h
@ONLY
)
# EOF

BIN
doc/.DS_Store vendored

Binary file not shown.

BIN
doc/examples/.DS_Store vendored

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2024 by Andreas Suter *
* Copyright (C) 2007-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2021 by Andreas Suter *
* Copyright (C) 2007-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 28c8d31b3d0d7429fcebb7bd0074bdd3
config: 1c72e3ac8764a6fbfdf66c0cdf797d3d
tags: 645f666f9bcd5a90fca523b33c5a78b7

View File

@ -1,6 +1,6 @@
var DOCUMENTATION_OPTIONS = {
URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'),
VERSION: '1.9.3',
VERSION: '1.9.5',
LANGUAGE: 'None',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Acknowledgements &mdash; musrfit 1.9.3 documentation</title>
<title>Acknowledgements &mdash; musrfit 1.9.5 documentation</title>
@ -201,7 +201,7 @@ extremely competent way to deal with his projects as well as to deal with the ch
<div role="contentinfo">
<p>
&copy; Copyright 2023, Andreas Suter.
Last updated on Apr 23, 2024.
Last updated on Jun 24, 2024.
</p>
</div>
@ -223,7 +223,7 @@ extremely competent way to deal with his projects as well as to deal with the ch
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'1.9.3',
VERSION:'1.9.5',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>any2many - a Universal μSR-file-format converter &mdash; musrfit 1.9.3 documentation</title>
<title>any2many - a Universal μSR-file-format converter &mdash; musrfit 1.9.5 documentation</title>
@ -191,7 +191,7 @@ For a detailed description see <a class="reference internal" href="user-manual.h
<div role="contentinfo">
<p>
&copy; Copyright 2023, Andreas Suter.
Last updated on Apr 23, 2024.
Last updated on Jun 24, 2024.
</p>
</div>
@ -213,7 +213,7 @@ For a detailed description see <a class="reference internal" href="user-manual.h
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'1.9.3',
VERSION:'1.9.5',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Bugtracking &mdash; musrfit 1.9.3 documentation</title>
<title>Bugtracking &mdash; musrfit 1.9.5 documentation</title>
@ -189,7 +189,7 @@ or send an e-mail to A. Suter at PSI.</p>
<div role="contentinfo">
<p>
&copy; Copyright 2023, Andreas Suter.
Last updated on Apr 23, 2024.
Last updated on Jun 24, 2024.
</p>
</div>
@ -211,7 +211,7 @@ or send an e-mail to A. Suter at PSI.</p>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'1.9.3',
VERSION:'1.9.5',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>How to Cite musrfit? &mdash; musrfit 1.9.3 documentation</title>
<title>How to Cite musrfit? &mdash; musrfit 1.9.5 documentation</title>
@ -203,7 +203,7 @@
<div role="contentinfo">
<p>
&copy; Copyright 2023, Andreas Suter.
Last updated on Apr 23, 2024.
Last updated on Jun 24, 2024.
</p>
</div>
@ -225,7 +225,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'1.9.3',
VERSION:'1.9.5',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Short description and references to the supported file-formats &mdash; musrfit 1.9.3 documentation</title>
<title>Short description and references to the supported file-formats &mdash; musrfit 1.9.5 documentation</title>
@ -503,7 +503,7 @@ Between detectors, there will be an empty line.</p>
<div role="contentinfo">
<p>
&copy; Copyright 2023, Andreas Suter.
Last updated on Apr 23, 2024.
Last updated on Jun 24, 2024.
</p>
</div>
@ -525,7 +525,7 @@ Between detectors, there will be an empty line.</p>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'1.9.3',
VERSION:'1.9.5',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -9,7 +9,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Index &mdash; musrfit 1.9.3 documentation</title>
<title>Index &mdash; musrfit 1.9.5 documentation</title>
@ -753,7 +753,7 @@
<div role="contentinfo">
<p>
&copy; Copyright 2023, Andreas Suter.
Last updated on Apr 23, 2024.
Last updated on Jun 24, 2024.
</p>
</div>
@ -775,7 +775,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'1.9.3',
VERSION:'1.9.5',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Welcome to the musrfit documentation! &mdash; musrfit 1.9.3 documentation</title>
<title>Welcome to the musrfit documentation! &mdash; musrfit 1.9.5 documentation</title>
@ -285,7 +285,7 @@
<div role="contentinfo">
<p>
&copy; Copyright 2023, Andreas Suter.
Last updated on Apr 23, 2024.
Last updated on Jun 24, 2024.
</p>
</div>
@ -307,7 +307,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'1.9.3',
VERSION:'1.9.5',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>msr2data - A Program for Automatically Processing Multiple musrfit msr Files &mdash; musrfit 1.9.3 documentation</title>
<title>msr2data - A Program for Automatically Processing Multiple musrfit msr Files &mdash; musrfit 1.9.5 documentation</title>
@ -518,7 +518,7 @@ fit serves as template for the second and so on. The template field stays empty
<div role="contentinfo">
<p>
&copy; Copyright 2023, Andreas Suter.
Last updated on Apr 23, 2024.
Last updated on Jun 24, 2024.
</p>
</div>
@ -540,7 +540,7 @@ fit serves as template for the second and so on. The template field stays empty
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'1.9.3',
VERSION:'1.9.5',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>mupp - μSR Parameter Plotter &mdash; musrfit 1.9.3 documentation</title>
<title>mupp - μSR Parameter Plotter &mdash; musrfit 1.9.5 documentation</title>
@ -408,7 +408,7 @@ SCRIPT COMMANDS:
<div role="contentinfo">
<p>
&copy; Copyright 2023, Andreas Suter.
Last updated on Apr 23, 2024.
Last updated on Jun 24, 2024.
</p>
</div>
@ -430,7 +430,7 @@ SCRIPT COMMANDS:
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'1.9.3',
VERSION:'1.9.5',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>MusrRoot - an Extensible Open File Format for μSR &mdash; musrfit 1.9.3 documentation</title>
<title>MusrRoot - an Extensible Open File Format for μSR &mdash; musrfit 1.9.5 documentation</title>
@ -1007,7 +1007,7 @@ the entry has been added. The last token, <code class="docutils literal notransl
<div role="contentinfo">
<p>
&copy; Copyright 2023, Andreas Suter.
Last updated on Apr 23, 2024.
Last updated on Jun 24, 2024.
</p>
</div>
@ -1029,7 +1029,7 @@ the entry has been added. The last token, <code class="docutils literal notransl
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'1.9.3',
VERSION:'1.9.5',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>musredit: the GUI Based Interface to musrfit &mdash; musrfit 1.9.3 documentation</title>
<title>musredit: the GUI Based Interface to musrfit &mdash; musrfit 1.9.5 documentation</title>
@ -634,7 +634,7 @@ the corresponding fit parameter value, except the phases where the step will be
<div role="contentinfo">
<p>
&copy; Copyright 2023, Andreas Suter.
Last updated on Apr 23, 2024.
Last updated on Jun 24, 2024.
</p>
</div>
@ -656,7 +656,7 @@ the corresponding fit parameter value, except the phases where the step will be
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'1.9.3',
VERSION:'1.9.5',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Search &mdash; musrfit 1.9.3 documentation</title>
<title>Search &mdash; musrfit 1.9.5 documentation</title>
@ -185,7 +185,7 @@
<div role="contentinfo">
<p>
&copy; Copyright 2023, Andreas Suter.
Last updated on Apr 23, 2024.
Last updated on Jun 24, 2024.
</p>
</div>
@ -207,7 +207,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'1.9.3',
VERSION:'1.9.5',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

File diff suppressed because one or more lines are too long

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Setting up musrfit / DKS: High Speed Fitting with GPUs &mdash; musrfit 1.9.3 documentation</title>
<title>Setting up musrfit / DKS: High Speed Fitting with GPUs &mdash; musrfit 1.9.5 documentation</title>
@ -408,7 +408,7 @@ The only thing you need <code class="docutils literal notranslate"><span class="
<div role="contentinfo">
<p>
&copy; Copyright 2023, Andreas Suter.
Last updated on Apr 23, 2024.
Last updated on Jun 24, 2024.
</p>
</div>
@ -430,7 +430,7 @@ The only thing you need <code class="docutils literal notranslate"><span class="
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'1.9.3',
VERSION:'1.9.5',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Setting up musrfit on Different Platforms &mdash; musrfit 1.9.3 documentation</title>
<title>Setting up musrfit on Different Platforms &mdash; musrfit 1.9.5 documentation</title>
@ -264,7 +264,7 @@ Currently the <code class="docutils literal notranslate"><span class="pre">MXML<
<p>If <em>optionally</em> the editor and graphical user interface <code class="docutils literal notranslate"><span class="pre">musrgui</span></code> / <code class="docutils literal notranslate"><span class="pre">musredit</span></code> is going to be installed there is one further requirement:</p>
<dl class="docutils" id="index-11">
<dt><strong>Qt</strong></dt>
<dd>A cross-platform application and user interface framework. <em>Required version ≥ 4.6</em> (musredit) (see <a class="reference external" href="http://qt.io/">Qt</a>). Currently the <strong>Qt5</strong> is the main development part. Qt6 just kicked in, but is not widely available yet.</dd>
<dd>A cross-platform application and user interface framework. <em>Required version ≥ 4.6</em> (musredit) (see <a class="reference external" href="http://qt.io/">Qt</a>). Currently the <strong>Qt5</strong> is still supported since some older distributions are not yet supporting Qt6. <strong>Qt6</strong> is the <em>main</em> development part. Should be available on all new major distributions.</dd>
</dl>
<p>Each of the following sections focusing on the installation of <code class="docutils literal notranslate"><span class="pre">musrfit</span></code> on the different operating systems will also give a brief introduction on the installation of the requirements before the actual musrfit installation is described.</p>
</div>
@ -273,9 +273,8 @@ Currently the <code class="docutils literal notranslate"><span class="pre">MXML<
<p>Before the installation procedure will be described, please note the following restrictions:</p>
<dl class="docutils">
<dt><strong>GNU/Linux</strong></dt>
<dd>No serious problems are currently known. Tested distributions: <a class="reference external" href="https://www.redhat.com/de/technologies/linux-platforms/enterprise-linux">RHEL</a>, <a class="reference external" href="https://getfedora.org/">Fedora</a>,
<a class="reference external" href="https://www.debian.org/">Debian</a>, <a class="reference external" href="https://www.ubuntu.com/">Ubuntu</a>, <a class="reference external" href="https://linuxmint.com/">Mint</a>, <a class="reference external" href="https://en.opensuse.org/Main_Page">openSUSE</a>,
and <cite>manjaro &lt;https://de.manjaro.org/&gt;</cite>.</dd>
<dd>No serious problems are currently known. Tested distributions: <a class="reference external" href="https://www.redhat.com/de/technologies/linux-platforms/enterprise-linux">RHEL</a> (also <a class="reference external" href="https://almalinux.org/">Alma</a>, <a class="reference external" href="https://rockylinux.org/">Rocky</a>), <a class="reference external" href="https://getfedora.org/">Fedora</a>,
<a class="reference external" href="https://www.debian.org/">Debian</a>, <a class="reference external" href="https://www.ubuntu.com/">Ubuntu</a>, <a class="reference external" href="https://linuxmint.com/">Mint</a>, <a class="reference external" href="https://en.opensuse.org/Main_Page">openSUSE</a>, and <a class="reference external" href="https://de.manjaro.org/">Manjaro</a>.</dd>
<dt><strong>Mac OS X/macOS</strong></dt>
<dd>No serious problems are currently known for macOS ≥ 10.6. <code class="docutils literal notranslate"><span class="pre">musrfit</span></code> is ARM M1 ready.</dd>
<dt><strong>MS Windows</strong></dt>
@ -307,11 +306,11 @@ from the shell will do the trick (never type the $ it is the shell prompt
<p>For <strong>Qt5/Qt6</strong>:</p>
<blockquote>
<div><div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ yum install epel-release
$ yum install git cmake boost-devel gsl-devel fftw-devel libxml2-devel qt5-qtbase-devel qt5-qtsvg-devel
$ yum install git cmake boost-devel gsl-devel fftw-devel libxml2-devel qt6-qtbase-devel qt6-qtsvg-devel
</pre></div>
</div>
</div></blockquote>
<p>If using <code class="docutils literal notranslate"><span class="pre">Qt6</span></code> replace <code class="docutils literal notranslate"><span class="pre">qt5-qtbase-devel</span> <span class="pre">qt5-qtsvg-devel</span></code> by <code class="docutils literal notranslate"><span class="pre">qt6-qtbase-devel</span> <span class="pre">qt6-qtsvg-devel</span></code></p>
<p>If using <code class="docutils literal notranslate"><span class="pre">Qt5</span></code>, since e.g. Qt6 is not available, replace <code class="docutils literal notranslate"><span class="pre">qt6-qtbase-devel</span> <span class="pre">qt6-qtsvg-devel</span></code> by <code class="docutils literal notranslate"><span class="pre">qt5-qtbase-devel</span> <span class="pre">qt5-qtsvg-devel</span></code></p>
<p>When dealing with a distribution that uses the dpkg/apt package manager like <a class="reference external" href="https://www.debian.org/">Debian</a> or <a class="reference external" href="https://www.ubuntu.com/">Ubuntu</a>
the installation would look like:</p>
<p>For <strong>Qt4</strong> (deprecated):</p>
@ -322,11 +321,11 @@ the installation would look like:</p>
</div></blockquote>
<p>For <strong>Qt5/Qt6</strong>:</p>
<blockquote>
<div><div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ apt-get install git cmake libboost-dev libboost-filesystem-dev libboost-system-dev libgsl-dev libfftw3-dev libxml2-dev qt5-default qtbase5-dev libqt5svg5-dev
<div><div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ apt-get install git cmake libboost-dev libboost-filesystem-dev libboost-system-dev libgsl-dev libfftw3-dev libxml2-dev qt6-base-dev qt6-svg-dev
</pre></div>
</div>
</div></blockquote>
<p>If using <code class="docutils literal notranslate"><span class="pre">Qt6</span></code> replace <code class="docutils literal notranslate"><span class="pre">qt5-default</span> <span class="pre">qtbase5-dev</span> <span class="pre">libqt5svg5-dev</span></code> by <code class="docutils literal notranslate"><span class="pre">qt6-default</span> <span class="pre">qtbase6-dev</span> <span class="pre">libqt6svg6-dev</span></code></p>
<p>If using <code class="docutils literal notranslate"><span class="pre">Qt5</span></code>, since e.g. Qt6 is not available, replace <code class="docutils literal notranslate"><span class="pre">qt6-base-dev</span> <span class="pre">qt6-svg-dev</span></code> by <code class="docutils literal notranslate"><span class="pre">qtbase5-dev</span> <span class="pre">libqt5svg5-dev</span></code></p>
<p>Everyone should know best himself which is the way to install distribution software on the chosen distribution.</p>
<p>In case the distribution does not include the required software it has to be compiled from the source files. This means either to download
the source code from the corresponding website, or to clone the git repo. If you need to follow this line, please check the install details of the corresponding package.</p>
@ -366,8 +365,8 @@ $ mkdir build
$ <span class="nb">cd</span> build
$ cmake -DENABLE_HDF5<span class="o">=</span><span class="m">1</span> -DENABLE_HDF4<span class="o">=</span><span class="m">1</span> -DENABLE_MXML<span class="o">=</span><span class="m">0</span> ../code
$ cmake --build ./ --clean-first
$ <span class="c1"># make install needs either to be carried out as root or sudo depending on your linux flavour.</span>
$ sudo make install
$ <span class="c1"># install needs either to be carried out as root or sudo depending on your linux flavour.</span>
$ sudo cmake --install ./
</pre></div>
</div>
</div>
@ -412,7 +411,7 @@ $ <span class="c1"># calling it with the option -j &lt;number&gt;, where &lt;num
$ <span class="c1"># e.g. cmake --build ./ --clean-first -- -j8</span>
$ cmake --build ./ --clean-first
$ <span class="c1"># as a last step of the ROOT build process we need to install it</span>
$ make install
$ cmake --install ./
</pre></div>
</div>
<p>What is still missing is that the system should be told where to find the <code class="docutils literal notranslate"><span class="pre">ROOT</span></code> installation, therefore the following is suggested:</p>
@ -471,7 +470,7 @@ $ git pull
$ <span class="nb">cd</span> build
$ xargs rm &lt; install_manifest.txt
$ cmake --build ./ --clean-first
$ make install
$ cmake --install ./
</pre></div>
</div>
<p>As an alternative (if git is not available), the source code can also be downloaded from the following web-page: <a class="reference external" href="https://bitbucket.org/muonspin/musrfit/downloads">musrfit at bitbucket</a></p>
@ -511,7 +510,7 @@ $ <span class="nb">cd</span> build
$ cmake ../ -DCMAKE_INSTALL_PREFIX<span class="o">=</span><span class="nv">$ROOTSYS</span> -Dnexus<span class="o">=</span><span class="m">1</span>
<span class="c1"># below it is assumed that multiple cores are present, hence the -j8 option</span>
$ cmake --build ./ --clean-first -- -j8
$ make install
$ cmake --install ./
$ /sbin/ldconfig <span class="c1"># (as superuser)</span>
</pre></div>
</div>
@ -657,7 +656,7 @@ add a new line pointing to your local copy, <em>e.g.</em></p>
</ol>
<p>Then the MacPorts system should be set up and can be used to install additional software.</p>
<p>The installation of the software mentioned above is then done in the terminal:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ sudo port -v install pkgconfig autoconf automake libtool cmake fftw-3 fftw-3-single gsl boost libxml2 qt6 qt6-qtsvg
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ sudo port -v install pkgconfig autoconf automake libtool cmake libomp fftw-3 fftw-3-single gsl boost libxml2 qt6 qt6-qtsvg
</pre></div>
</div>
<p>With <code class="docutils literal notranslate"><span class="pre">Qt6</span></code>, <code class="docutils literal notranslate"><span class="pre">musredit</span></code> will be installed. If it happens that you used <code class="docutils literal notranslate"><span class="pre">musrgui</span></code> in the past,
@ -668,6 +667,7 @@ please change over to <code class="docutils literal notranslate"><span class="pr
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ sudo port -v install hdf4 hdf5
</pre></div>
</div>
<p><em>hdf4</em> is likely not available anymore.</p>
<p><strong>Only NeXus Version ≥ 4.4 is support!</strong></p>
<p>To get things compiled do:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ <span class="c1"># get and install NeXus</span>
@ -678,9 +678,12 @@ $ <span class="c1"># next we will build NeXus out-of-source</span>
$ <span class="nb">cd</span> nexus
$ mkdir build
$ <span class="nb">cd</span> build
$ <span class="c1"># in case hdf4 is present</span>
$ cmake -DENABLE_HDF5<span class="o">=</span><span class="m">1</span> -DENABLE_HDF4<span class="o">=</span><span class="m">1</span> -DENABLE_MXML<span class="o">=</span><span class="m">0</span> ../code
$ make
$ sudo make install
$ <span class="c1"># in case hdf4 is **not** present</span>
$ cmake -DENABLE_HDF5<span class="o">=</span><span class="m">1</span> -DENABLE_HDF4<span class="o">=</span><span class="m">0</span> -DENABLE_MXML<span class="o">=</span><span class="m">0</span> ../code
$ cmake --build ./
$ sudo cmake --install ./
</pre></div>
</div>
</div>
@ -728,7 +731,7 @@ $ <span class="c1"># make with the option -j &lt;number&gt;, where &lt;number&gt
$ <span class="c1"># e.g. make -j8</span>
$ cmake --build ./ --clean-first -- -j8
$ <span class="c1"># make will take quite a while</span>
$ make install
$ cmake --install ./
</pre></div>
</div>
<p>For further details see <a class="reference external" href="https://root.cern.ch/building-root">Installing ROOT from Source</a>.</p>
@ -816,10 +819,11 @@ install it.</dd>
</dl>
<p>After installing the <code class="docutils literal notranslate"><span class="pre">Xcode</span></code> tools go to the <a class="reference external" href="https://brew.sh/">Homebrew</a> page, and follow the installation instructions there.</p>
<p>The essential packages (called formulae) which you will need to install are</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">cmake</span> <span class="n">boost</span> <span class="n">gsl</span> <span class="n">fftw</span> <span class="n">qt6</span> <span class="n">root</span>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">cmake</span> <span class="n">libomp</span> <span class="n">boost</span> <span class="n">gsl</span> <span class="n">fftw</span> <span class="n">qt6</span> <span class="p">(</span><span class="n">root</span><span class="p">)</span>
</pre></div>
</div>
<p>For example to install <code class="docutils literal notranslate"><span class="pre">cmake</span></code> this is done the following way:</p>
<p>The preferred installation of root would be from source (see below), hence it is set here in parenthesis.
For example to install <code class="docutils literal notranslate"><span class="pre">cmake</span></code> this is done the following way:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ brew install cmake
</pre></div>
</div>
@ -842,7 +846,7 @@ $ mkdir build
$ <span class="nb">cd</span> build
$ cmake ../code -DENABLE_HDF5<span class="o">=</span><span class="m">1</span> -DENABLE_HDF4<span class="o">=</span><span class="m">0</span> -DENABLE_MXML<span class="o">=</span><span class="m">0</span>
$ cmake --build ./ --clean-first -- -j8
$ sudo make install
$ sudo cmake --install ./
</pre></div>
</div>
</div>
@ -880,7 +884,7 @@ $ <span class="c1"># make with the option -j &lt;number&gt;, where &lt;number&gt
$ <span class="c1"># e.g. make -j8</span>
$ cmake --build ./ --clean-first -- -j8
$ <span class="c1"># make will take quite a while</span>
$ make install
$ cmake --install ./
</pre></div>
</div>
<p>For further details see <a class="reference external" href="https://root.cern.ch/building-root">Installing ROOT from Source</a>.</p>
@ -993,7 +997,16 @@ If the value is set to <code class="docutils literal notranslate"><span class="p
<dd>Will check if <code class="docutils literal notranslate"><span class="pre">OpenMP</span></code> support is possible, and if yes use it. The default is enabled</dd>
</dl>
<p>Normally it should not be necessary to make use of any of the options except for specifying the installation path with <code class="docutils literal notranslate"><span class="pre">-DCMAKE_INSTALL_PREFIX</span></code>.
<code class="docutils literal notranslate"><span class="pre">musrfit</span></code> build with <code class="docutils literal notranslate"><span class="pre">cmake</span></code> takes the <code class="docutils literal notranslate"><span class="pre">out-of-source</span></code> approach. Therefore a typical configuration / make / install process including
<code class="docutils literal notranslate"><span class="pre">musrfit</span></code> build with <code class="docutils literal notranslate"><span class="pre">cmake</span></code> takes the <code class="docutils literal notranslate"><span class="pre">out-of-source</span></code> approach.</p>
<p>In order to have <strong>OpenMP</strong> available, which allows parallel processing of the fitter, you will need to guide <code class="docutils literal notranslate"><span class="pre">cmake</span></code> to where it can find it. For a <code class="docutils literal notranslate"><span class="pre">Homebrew</span></code> installation, this would be</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ <span class="nb">export</span> <span class="nv">OpenMP_ROOT</span><span class="o">=</span><span class="k">$(</span>brew --prefix<span class="k">)</span>/opt/libomp
</pre></div>
</div>
<p>and for a <code class="docutils literal notranslate"><span class="pre">MacPorts</span></code> installation, something like</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ <span class="nb">export</span> <span class="nv">OpenMP_ROOT</span><span class="o">=</span>/opt/local/include/libomp
</pre></div>
</div>
<p>Therefore a typical configuration / make / install process including
<code class="docutils literal notranslate"><span class="pre">NeXus</span></code> support would look like</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ <span class="nb">cd</span> <span class="nv">$HOME</span>/Apps/musrfit
$ mkdir build
@ -1001,7 +1014,24 @@ $ <span class="nb">cd</span> build
$ cmake ../ -DCMAKE_INSTALL_PREFIX<span class="o">=</span><span class="nv">$ROOTSYS</span> -Dnexus<span class="o">=</span><span class="m">1</span>
<span class="c1"># below it is assumed that multiple cores are present, hence the -j8 option</span>
$ cmake --build ./ --clean-first -- -j8
$ make install
$ cmake --install ./
$ /sbin/ldconfig <span class="c1"># (as superuser)</span>
</pre></div>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">If you use <code class="docutils literal notranslate"><span class="pre">MacPorts</span></code> you will likely need to guide cmake where to find <code class="docutils literal notranslate"><span class="pre">qt6</span></code>.
You will need to provide the path to the necessary <code class="docutils literal notranslate"><span class="pre">cmake</span></code> files. This is done
from the command line via the switch <code class="docutils literal notranslate"><span class="pre">CMAKE_PREFIX_PATH</span></code>.
The configuration, build, and install process might look like this:</p>
</div>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ <span class="nb">cd</span> <span class="nv">$HOME</span>/Apps/musrfit
$ mkdir build
$ <span class="nb">cd</span> build
$ cmake ../ -DCMAKE_INSTALL_PREFIX<span class="o">=</span><span class="nv">$ROOTSYS</span> -Dnexus<span class="o">=</span><span class="m">1</span> -DCMAKE_PREFIX_PATH<span class="o">=</span>/opt/local/libexec/qt6/lib/cmake
<span class="c1"># below it is assumed that multiple cores are present, hence the -j8 option</span>
$ cmake --build ./ --clean-first -- -j8
$ cmake --install ./
$ /sbin/ldconfig <span class="c1"># (as superuser)</span>
</pre></div>
</div>
@ -1095,7 +1125,7 @@ $ musrview test-histo-ROOT-NPP.msr
<div role="contentinfo">
<p>
&copy; Copyright 2023, Andreas Suter.
Last updated on Apr 23, 2024.
Last updated on Jun 24, 2024.
</p>
</div>
@ -1117,7 +1147,7 @@ $ musrview test-histo-ROOT-NPP.msr
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'1.9.3',
VERSION:'1.9.5',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Tutorial for musrfit &mdash; musrfit 1.9.3 documentation</title>
<title>Tutorial for musrfit &mdash; musrfit 1.9.5 documentation</title>
@ -527,7 +527,7 @@ For a complete description please refer to the manuals of <a class="reference in
<div role="contentinfo">
<p>
&copy; Copyright 2023, Andreas Suter.
Last updated on Apr 23, 2024.
Last updated on Jun 24, 2024.
</p>
</div>
@ -549,7 +549,7 @@ For a complete description please refer to the manuals of <a class="reference in
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'1.9.3',
VERSION:'1.9.5',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Documentation of user libs (user functions) &mdash; musrfit 1.9.3 documentation</title>
<title>Documentation of user libs (user functions) &mdash; musrfit 1.9.5 documentation</title>
@ -875,7 +875,7 @@ K(m)&amp;=\int_0^{\pi/2}\frac{\mathrm d\varphi}{\sqrt{1-m^2\sin^2{\varphi}}},\en
<div role="contentinfo">
<p>
&copy; Copyright 2023, Andreas Suter.
Last updated on Apr 23, 2024.
Last updated on Jun 24, 2024.
</p>
</div>
@ -897,7 +897,7 @@ K(m)&amp;=\int_0^{\pi/2}\frac{\mathrm d\varphi}{\sqrt{1-m^2\sin^2{\varphi}}},\en
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'1.9.3',
VERSION:'1.9.5',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>User manual &mdash; musrfit 1.9.3 documentation</title>
<title>User manual &mdash; musrfit 1.9.5 documentation</title>
@ -257,6 +257,26 @@
<dt><strong>-u, use-no-of-threads &lt;number&gt;</strong></dt>
<dd>&lt;number&gt;: number of threads to be used (OpenMP). Needs to be &lt;= max. number of cores.
If OpenMP is enable, the maximal number of cores is used, if it is not limited by this option.</dd>
<dt><strong>-r, reset</strong></dt>
<dd><p class="first">reset startup <code class="docutils literal notranslate"><span class="pre">musrfit_startup.xml</span></code>, i.e. rewrite a default, and quit.
The order of which <code class="docutils literal notranslate"><span class="pre">musrfit_startup.xml</span></code> is reset is:</p>
<blockquote class="last">
<div><ol class="arabic simple">
<li>if present in the current dir.</li>
<li>if present under <code class="docutils literal notranslate"><span class="pre">$HOME/.musrfit/</span></code></li>
<li>if present under <code class="docutils literal notranslate"><span class="pre">$MUSRFITPATH/</span></code></li>
<li>if present under <code class="docutils literal notranslate"><span class="pre">$ROOTSYS/</span></code></li>
</ol>
</div></blockquote>
</dd>
<dt><strong>-y, yaml</strong></dt>
<dd><p class="first">write fit results (<code class="docutils literal notranslate"><span class="pre">MINUIT2.OUTPUT</span></code>) into a yaml-file. Output <code class="docutils literal notranslate"><span class="pre">&lt;msr-file&gt;.yaml</span></code>.</p>
<p class="last">The motivation for storing parameter information in this (hierarchical) manner is to provide easy access to details that are cumbersome
to store/access in tabular formats (e.g., <code class="docutils literal notranslate"><span class="pre">CSV</span></code> or <code class="docutils literal notranslate"><span class="pre">TSV</span></code>). This is especially true for the parameter covariance/correlation matrices.
The advantage is evident when processing the contents of the <code class="docutils literal notranslate"><span class="pre">.yaml</span></code> output, which can be easily accomplished using one of the
YAML parsers implemented in your favourite programming language (see, e.g., <a class="reference external" href="https://yaml.org/">https://yaml.org/</a> for a list of options). As an example,
this can be achieved in <code class="docutils literal notranslate"><span class="pre">Python</span></code> using the <code class="docutils literal notranslate"><span class="pre">PyYAML</span></code>.</p>
</dd>
<dt><strong>dump &lt;type&gt;</strong></dt>
<dd>is writing a data file with the fit data and the theory; &lt;type&gt; can be ascii (data in columns) or root (data in ROOT histograms).</dd>
<dt><strong>timeout &lt;timeout_tag&gt;</strong></dt>
@ -2874,7 +2894,7 @@ The syntax here is attribute driven</li>
<div role="contentinfo">
<p>
&copy; Copyright 2023, Andreas Suter.
Last updated on Apr 23, 2024.
Last updated on Jun 24, 2024.
</p>
</div>
@ -2896,7 +2916,7 @@ The syntax here is attribute driven</li>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'1.9.3',
VERSION:'1.9.5',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -22,38 +22,6 @@ if (nexus)
endif (nexus)
set(MUSRFIT_LIBS ${MUSRFIT_LIBS} PMusr)
#--- start create git-revision.h ----------------------------------------------
if (IS_GIT_REPO)
configure_file(
${CMAKE_SOURCE_DIR}/cmake/configure_musrfit_version_file.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/configure_musrfit_version_file.cmake
@ONLY
)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/git-revision.h
COMMAND ${CMAKE_COMMAND} -P
${CMAKE_CURRENT_BINARY_DIR}/configure_musrfit_version_file.cmake
DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/configure_musrfit_version_file.cmake
${CMAKE_SOURCE_DIR}/cmake/git-revision.h.in
COMMENT "Configuring git-revision.h"
VERBATIM
)
add_custom_target(
configure_musrfit_version ALL
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/git-revision.h
)
set(HAVE_GIT_REV_H "-DHAVE_GIT_REV_H")
set(GIT_REV_H "git-revision.h")
else (IS_GIT_REPO)
set(HAVE_GIT_REV_H "")
set(GIT_REV_H "")
endif (IS_GIT_REPO)
#--- end create git-revision.h ------------------------------------------------
#--- add all executables ------------------------------------------------------
add_executable(addRun ${GIT_REV_H} addRun.cpp)
target_compile_options(addRun BEFORE PRIVATE "-DHAVE_CONFIG_H" "${HAVE_GIT_REV_H}")

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2024 by Andreas Suter *
* Copyright (C) 2007-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2024 by Andreas Suter *
* Copyright (C) 2007-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2024 by Andreas Suter *
* Copyright (C) 2007-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2024 by Andreas Suter *
* Copyright (C) 2007-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *
@ -39,9 +39,10 @@
#include <iomanip>
#include <fstream>
#include <limits>
#include <cmath>
#include <boost/variant/variant.hpp>
#include <sys/time.h>
#include "Minuit2/FunctionMinimum.h"
@ -54,6 +55,7 @@
#include "Minuit2/MnPrint.h"
#include "Minuit2/MnScan.h"
#include "Minuit2/MnSimplex.h"
#include "Minuit2/MnStrategy.h"
#include "Minuit2/MnUserParameterState.h"
#include "Minuit2/MinosError.h"
@ -264,8 +266,8 @@ UInt_t PSectorChisq::GetNDF(UInt_t idx)
* \param runListCollection pointer of the run list collection (pre-processed historgrams)
* \param chisq_only flag: true=calculate chisq only (no fitting)
*/
PFitter::PFitter(PMsrHandler *runInfo, PRunListCollection *runListCollection, Bool_t chisq_only) :
fChisqOnly(chisq_only), fRunInfo(runInfo), fRunListCollection(runListCollection)
PFitter::PFitter(PMsrHandler *runInfo, PRunListCollection *runListCollection, Bool_t chisq_only, Bool_t yaml_out) :
fChisqOnly(chisq_only), fYamlOut(yaml_out), fRunInfo(runInfo), fRunListCollection(runListCollection)
{
// initialize variables
fIsScanOnly = true;
@ -1762,7 +1764,7 @@ Bool_t PFitter::ExecuteMigrad()
// create migrad object
// strategy is by default = 'default'
ROOT::Minuit2::MnMigrad migrad((*fFitterFcn), fMnUserParams, fStrategy);
ROOT::Minuit2::MnMigrad migrad((*fFitterFcn), fMnUserParams, ROOT::Minuit2::MnStrategy{fStrategy});
// minimize
// maxfcn is MINUIT2 Default maxfcn
@ -1838,7 +1840,7 @@ Bool_t PFitter::ExecuteMinimize()
// create minimizer object
// strategy is by default = 'default'
ROOT::Minuit2::MnMinimize minimize((*fFitterFcn), fMnUserParams, fStrategy);
ROOT::Minuit2::MnMinimize minimize((*fFitterFcn), fMnUserParams, ROOT::Minuit2::MnStrategy{fStrategy});
// minimize
// maxfcn is MINUIT2 Default maxfcn
@ -2473,6 +2475,122 @@ Bool_t PFitter::ExecuteSave(Bool_t firstSave)
ccorr->Write("ccorr", TObject::kOverwrite, sizeof(ccorr));
hcorr->Write("hcorr", TObject::kOverwrite, sizeof(hcorr));
ff.Close();
if (fYamlOut) {
// write the fit results to an easy-to-read/parse yaml file
// note: the block names follow those used by Python library iminuit
// https://github.com/scikit-hep/iminuit
// dynamically name the yaml output file
// https://stackoverflow.com/a/25389052
std::string yaml_filename(fRunInfo->GetFileName().Data());
const std::string msr_ext(".msr");
yaml_filename.replace(yaml_filename.find(msr_ext), msr_ext.length(),
".yaml");
// define yaml's 2-space indentation
const std::string yaml_indent(" ");
// open the yaml file for writing
std::ofstream yaml_file(yaml_filename);
// number formatting of the output
yaml_file << std::scientific << std::setprecision(16);
// write the parameter values
yaml_file << "values:\n";
for (unsigned int i = 0; i < fParams.size(); ++i) {
yaml_file << yaml_indent << fParams[i].fName.Data() << ": "
<< fParams[i].fValue << "\n";
}
// write the parabolic errors
yaml_file << "errors:\n";
for (unsigned int i = 0; i < fParams.size(); ++i) {
yaml_file << yaml_indent << fParams[i].fName.Data() << ": "
<< fMnUserParams.Error(i) << "\n";
}
// write the minos errors
yaml_file << "mnerrors:\n";
for (unsigned int i = 0; i < fParams.size(); ++i) {
// use boost's implementation of a variant, which can be streamed by
// default - see: https://stackoverflow.com/q/47168477
boost::variant<double, std::string> positive_error, negative_error;
if (fParams[i].fPosErrorPresent) {
positive_error = fParams[i].fPosError;
negative_error = fParams[i].fStep;
} else {
positive_error = "null";
negative_error = "null";
}
yaml_file << yaml_indent << fParams[i].fName.Data() << ":\n";
yaml_file << yaml_indent << yaml_indent
<< "positive: " << positive_error << "\n";
yaml_file << yaml_indent << yaml_indent
<< "negative: " << negative_error << "\n";
}
// write the parameter limits
yaml_file << "limits:\n";
for (unsigned int i = 0; i < fParams.size(); ++i) {
// use boost's implementation of a variant, which can be streamed by
// default - see: https://stackoverflow.com/q/47168477
boost::variant<double, std::string> upper_limit, lower_limit;
if (fParams[i].fLowerBoundaryPresent) {
lower_limit = fParams[i].fLowerBoundary;
} else {
lower_limit = "null";
}
if (fParams[i].fUpperBoundaryPresent) {
upper_limit = fParams[i].fUpperBoundary;
} else {
upper_limit = "null";
}
yaml_file << yaml_indent << fParams[i].fName.Data() << ":\n";
yaml_file << yaml_indent << yaml_indent << "lower: " << lower_limit
<< "\n";
yaml_file << yaml_indent << yaml_indent << "upper: " << upper_limit
<< "\n";
}
// write if the parameter is fixed
yaml_file << "fixed:\n";
for (unsigned int i = 0; i < fParams.size(); ++i) {
std::string is_fixed = fParams[i].fStep == 0.0 ? "true" : "false";
yaml_file << yaml_indent << fParams[i].fName.Data() << ": " << is_fixed
<< "\n";
}
// write the covariance matrix (omitting fixed parameters)
yaml_file << "covariance:\n";
for (unsigned int i = 0; i < cov.Nrow(); ++i) {
yaml_file << yaml_indent << mnState.Name(parNo[i]) << ":\n";
for (unsigned int j = 0; j < cov.Nrow(); ++j) {
yaml_file << yaml_indent << yaml_indent << mnState.Name(parNo[j])
<< ": " << cov(i, j) << "\n";
}
}
// write the correlation matrix (omitting fixed parameters)
yaml_file << "correlation:\n";
for (unsigned int i = 0; i < cov.Nrow(); ++i) {
yaml_file << yaml_indent << mnState.Name(parNo[i]) << ":\n";
for (unsigned int j = 0; j < cov.Nrow(); ++j) {
double correlation =
i == j ? 1.0
: cov(i, j) / (fMnUserParams.Error(parNo[i]) *
fMnUserParams.Error(parNo[j]));
yaml_file << yaml_indent << yaml_indent << mnState.Name(parNo[j])
<< ": " << correlation << "\n";
}
}
// close the yaml file
yaml_file.close();
}
}
parNo.clear(); // clean up
} else {
@ -2539,7 +2657,7 @@ Bool_t PFitter::ExecuteSimplex()
// create minimizer object
// strategy is by default = 'default'
ROOT::Minuit2::MnSimplex simplex((*fFitterFcn), fMnUserParams, fStrategy);
ROOT::Minuit2::MnSimplex simplex((*fFitterFcn), fMnUserParams, ROOT::Minuit2::MnStrategy{fStrategy});
// minimize
// maxfcn is 10*MINUIT2 Default maxfcn

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2024 by Andreas Suter *
* Copyright (C) 2007-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2024 by Andreas Suter *
* Copyright (C) 2007-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2024 by Andreas Suter *
* Copyright (C) 2007-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2024 by Andreas Suter *
* Copyright (C) 2007-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *
@ -188,13 +188,28 @@ void PFunction::FillFuncEvalTree(iter_t const& i, PFuncTreeNode &node)
node.fID = PFunctionGrammar::constGammaMuID; // keep the ID
node.fDvalue = GAMMA_BAR_MUON; // keep the value
} else if (i->value.id() == PFunctionGrammar::constFieldID) { // handle constant field from meta data
str = std::string(i->value.begin(), i->value.end()); // get string
boost::algorithm::trim(str);
if (strstr(str.c_str(), "-"))
node.fSign = true;
node.fID = PFunctionGrammar::constFieldID; // keep the ID
} else if (i->value.id() == PFunctionGrammar::constEnergyID) { // handle constant energy from meta data
str = std::string(i->value.begin(), i->value.end()); // get string
boost::algorithm::trim(str);
if (strstr(str.c_str(), "-"))
node.fSign = true;
node.fID = PFunctionGrammar::constEnergyID; // keep the ID
} else if (i->value.id() == PFunctionGrammar::constTempID) { // handle constant temperature from meta data
str = std::string(i->value.begin(), i->value.end()); // get string
boost::algorithm::trim(str);
status = sscanf(str.c_str(), "T%d", &ivalue); // convert string to temperature index
std::string pstr;
if (strstr(str.c_str(), "-")) {
node.fSign = true;
pstr = "-T%d";
} else {
pstr = "T%d";
}
status = sscanf(str.c_str(), pstr.c_str(), &ivalue); // convert string to temperature index
node.fID = PFunctionGrammar::constTempID; // keep the ID
node.fIvalue = ivalue; // Temp idx
} else if (i->value.id() == PFunctionGrammar::parameterID) { // handle parameter number
@ -432,21 +447,30 @@ Double_t PFunction::EvalNode(PFuncTreeNode &node)
} else if (node.fID == PFunctionGrammar::constGammaMuID) {
return node.fDvalue;
} else if (node.fID == PFunctionGrammar::constFieldID) {
return fMetaData.fField;
Double_t dval = fMetaData.fField;
if (node.fSign)
dval *= -1.0;
return dval;
} else if (node.fID == PFunctionGrammar::constEnergyID) {
if (fMetaData.fEnergy == PMUSR_UNDEFINED) {
std::cerr << std::endl << "**PANIC ERROR**: PFunction::EvalNode: energy meta data not available." << std::endl;
std::cerr << std::endl;
exit(0);
}
return fMetaData.fEnergy;
Double_t dval = fMetaData.fEnergy;
if (node.fSign)
dval *= -1.0;
return dval;
} else if (node.fID == PFunctionGrammar::constTempID) {
if (node.fIvalue >= fMetaData.fTemp.size()) {
std::cerr << std::endl << "**PANIC ERROR**: PFunction::EvalNode: Temp idx=" << node.fIvalue << " requested which is >= #Temp(s)=" << fMetaData.fTemp.size() << " available." << std::endl;
std::cerr << std::endl;
exit(0);
}
return fMetaData.fTemp[node.fIvalue];
Double_t dval = fMetaData.fTemp[node.fIvalue];
if (node.fSign)
dval *= -1.0;
return dval;
} else if (node.fID == PFunctionGrammar::parameterID) {
Double_t dval;
if (node.fSign)
@ -609,10 +633,10 @@ void PFunction::EvalTreeForStringExpression(iter_t const& i, bool funcFlag)
fFuncString += "Pi";
} else if (i->value.id() == PFunctionGrammar::constGammaMuID) {
fFuncString += "gamma_mu";
} else if (i->value.id() == PFunctionGrammar::constFieldID) {
fFuncString += "B";
} else if (i->value.id() == PFunctionGrammar::constFieldID) {
fFuncString += boost::algorithm::trim_copy(std::string(i->value.begin(), i->value.end())).c_str();
} else if (i->value.id() == PFunctionGrammar::constEnergyID) {
fFuncString += "EN";
fFuncString += boost::algorithm::trim_copy(std::string(i->value.begin(), i->value.end())).c_str();
} else if (i->value.id() == PFunctionGrammar::constTempID) {
assert(i->children.size() == 0);
fFuncString += boost::algorithm::trim_copy(std::string(i->value.begin(), i->value.end())).c_str();

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2024 by Andreas Suter *
* Copyright (C) 2007-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2009-2024 by Bastian M. Wojek / Andreas Suter *
* Copyright (C) 2009-2025 by Bastian M. Wojek / Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *
@ -140,29 +140,32 @@ int PMsr2Data::DetermineRunNumberDigits(unsigned int runNo, bool normalMode) con
strLine.str(line);
strLine >> firstOnLine;
if (!to_lower_copy(firstOnLine).compare("run")) {
firstOnLine.clear();
strLine >> firstOnLine;
std::string::size_type loc = firstOnLine.rfind(tempRunNumber.str());
if ( loc != std::string::npos ) {
while ( loc > 0 ) {
if (isdigit(firstOnLine.at(--loc))) {
++fRunNumberDigits;
} else {
break;
// for path-names with spaces
std::string::size_type loc{0};
while (!strLine.eof()) {
firstOnLine.clear();
strLine >> firstOnLine;
loc = firstOnLine.rfind(tempRunNumber.str());
if ( loc != std::string::npos ) {
while ( loc > 0 ) {
if (isdigit(firstOnLine.at(--loc))) {
++fRunNumberDigits;
} else {
break;
}
}
in->close();
fRunVectorIter = fRunVector.begin(); // set back the runlist-iterator which might have changed during the search for the correct file
return 0;
}
in->close();
fRunVectorIter = fRunVector.begin(); // set back the runlist-iterator which might have changed during the search for the correct file
return 0;
} else {
std::cerr << std::endl << ">> msr2data: **ERROR** The first processed run file number does not match the \"file index\"!";
std::cerr << std::endl << ">> msr2data: **ERROR** The number of digits to be used for formatting the run numbers cannot be determined!";
std::cerr << std::endl << ">> msr2data: **ERROR** Please check the first msr-file that should be processed;";
std::cerr << std::endl << ">> msr2data: **ERROR** this is either some template or the first existing file from the run list.";
std::cerr << std::endl;
in->close();
return -2;
}
std::cerr << std::endl << ">> msr2data: **ERROR** The first processed run file number does not match the \"file index\"!";
std::cerr << std::endl << ">> msr2data: **ERROR** The number of digits to be used for formatting the run numbers cannot be determined!";
std::cerr << std::endl << ">> msr2data: **ERROR** Please check the first msr-file that should be processed;";
std::cerr << std::endl << ">> msr2data: **ERROR** this is either some template or the first existing file from the run list.";
std::cerr << std::endl;
in->close();
return -2;
}
}
std::cerr << std::endl << ">> msr2data: **ERROR** Please check the first msr-file that should be processed;";
@ -558,11 +561,23 @@ bool PMsr2Data::PrepareNewInputFile(unsigned int tempRun, bool calledFromGlobalM
strLine.str(line);
strLine >> firstOnLine;
if (!to_lower_copy(firstOnLine).compare("run")) {
strLine >> firstOnLine;
std::string::size_type loc = firstOnLine.rfind(tempRunNumber.str());
if ( loc != std::string::npos ) {
firstOnLine.replace(loc, fRunNumberDigits, newRunNumber.str());
} else {
// needed for path-fln with spaces
std::string::size_type loc;
std::string sstr{""};
firstOnLine.clear();
while (!strLine.eof()) {
strLine >> sstr;
if (firstOnLine.empty())
firstOnLine = sstr;
else
firstOnLine += " " + sstr;
loc = firstOnLine.rfind(tempRunNumber.str());
if ( loc != std::string::npos ) {
firstOnLine.replace(loc, fRunNumberDigits, newRunNumber.str());
break;
}
}
if (strLine.eof()) {
std::cerr << std::endl << ">> msr2data: **WARNING** The template run file number does not match the \"file index\"";
std::cerr << std::endl << ">> msr2data: **WARNING** Unexpected things will happen... (for sure)";
std::cerr << std::endl;
@ -694,9 +709,16 @@ bool PMsr2Data::PrepareGlobalInputFile(unsigned int tempRun, const std::string &
msrParamList->at(i).fIsGlobal = true;
++fNumGlobalParam;
}
// std::cout << "debug> " << msrParamList->at(i).fNo << ": " << msrParamList->at(i).fName.Data() << " is global: " << msrParamList->at(i).fIsGlobal << std::endl;
}
// there should be at least one run specific parameter, otherwise the GLOBAL option doesn't make sense
if (fNumSpecParam == 0) {
std::cout << ">> msr2data: **ERROR** found NO run specific parameter, hence the GLOBAL option doesn't make sense." << std::endl;
std::cout << ">> msr2data: Could it be, that your run specific labling is < 4 digits? Please check your msr-Input-File." << std::endl;
return false;
}
// check if parameters have been sorted correctly from the beginning
bool wasSorted(true);
for (unsigned int i(0); i < fNumGlobalParam; ++i) {
@ -1793,6 +1815,9 @@ int PMsr2Data::WriteOutput(const std::string &outfile, const std::vector<unsigne
rawRunData = fDataHandler->GetRunData((*msrRunList)[0].GetRunName()->Data());
}
if (rawRunData == nullptr)
return -1;
switch (rawRunData->GetNoOfTemperatures()) {
case 1:
dataParamNames.push_back("dataT");

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2024 by Andreas Suter *
* Copyright (C) 2007-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *
@ -3245,6 +3245,9 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines)
// remove potential comment at the end of lines
str = iter->fLine;
Ssiz_t idx = str.Index("#");
if (idx != -1)
str.Remove(idx);
idx = str.Index("(");
if (idx != -1)
str.Remove(idx);
@ -3274,23 +3277,29 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines)
}
// get run name, beamline, institute, and file-format
// the path/filename could potentially contain spaces! Hence the run name needs to be reconstructed from the parsing
if (tokens->GetEntries() < 5) {
error = true;
} else {
// run name
ostr = dynamic_cast<TObjString*>(tokens->At(1));
str = ostr->GetString();
str = TString("");
for (Int_t i=1; i<tokens->GetEntries()-3; i++) {
ostr = dynamic_cast<TObjString*>(tokens->At(i));
str += ostr->GetString();
if (i<tokens->GetEntries()-4)
str += TString(" ");
}
param.SetRunName(str);
// beamline
ostr = dynamic_cast<TObjString*>(tokens->At(2));
ostr = dynamic_cast<TObjString*>(tokens->At(tokens->GetEntries()-3));
str = ostr->GetString();
param.SetBeamline(str);
// institute
ostr = dynamic_cast<TObjString*>(tokens->At(3));
ostr = dynamic_cast<TObjString*>(tokens->At(tokens->GetEntries()-2));
str = ostr->GetString();
param.SetInstitute(str);
// data file format
ostr = dynamic_cast<TObjString*>(tokens->At(4));
ostr = dynamic_cast<TObjString*>(tokens->At(tokens->GetEntries()-1));
str = ostr->GetString();
param.SetFileFormat(str);
}

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2024 by Andreas Suter *
* Copyright (C) 2007-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *
@ -260,6 +260,7 @@ PRawRunDataSet::PRawRunDataSet()
*/
void PRawRunDataSet::Clear()
{
fTitle = TString("n/a");
fName = TString("n/a");
fHistoNo = -1;
fTimeZeroBin = 0.0;

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2024 by Andreas Suter *
* Copyright (C) 2007-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *
@ -935,10 +935,18 @@ void PMusrCanvas::Done(Int_t status)
void PMusrCanvas::HandleCmdKey(Int_t event, Int_t x, Int_t y, TObject *selected)
{
if (event != kKeyPress)
return;
return;
// this is a workaround which should prevent that the key event is executed if
// a text/latex is written into the canvas.
if (selected) {
if (!strcmp(selected->GetTitle(), "dataTheoryPad"))
return;
}
if (fBatchMode) {
if (fStartWithAvg) { // this is needed to get the averaging in the batch mode
fAveragedView = fStartWithAvg;
HandleAverage();
PlotAverage(true);
}
@ -1928,9 +1936,8 @@ void PMusrCanvas::ExportData(const Char_t *fileName)
case PV_DATA:
if (fAveragedView) {
fout << "% from averaged view" << std::endl;
fout << "% x, diff, errDiff" << std::endl;
fout << "x, diff, errDiff" << std::endl;
} else {
fout << "% ";
for (UInt_t i=0; i<dumpVector.size()-1; i++) {
fout << "x" << i << " , diff" << i << ", errDiff" << i << ", ";
}
@ -1940,9 +1947,8 @@ void PMusrCanvas::ExportData(const Char_t *fileName)
case PV_FOURIER_REAL:
if (fAveragedView) {
fout << "% from averaged view" << std::endl;
fout << "% x, F_diffRe" << std::endl;
fout << "x, F_diffRe" << std::endl;
} else {
fout << "% ";
for (UInt_t i=0; i<dumpVector.size()-1; i++) {
fout << "freq" << i << ", F_diffRe" << i << ", ";
}
@ -1952,9 +1958,8 @@ void PMusrCanvas::ExportData(const Char_t *fileName)
case PV_FOURIER_IMAG:
if (fAveragedView) {
fout << "% from averaged view" << std::endl;
fout << "% x, F_diffIm" << std::endl;
fout << "x, F_diffIm" << std::endl;
} else {
fout << "% ";
for (UInt_t i=0; i<dumpVector.size()-1; i++) {
fout << "freq" << i << ", F_diffIm" << i << ", ";
}
@ -1964,9 +1969,8 @@ void PMusrCanvas::ExportData(const Char_t *fileName)
case PV_FOURIER_REAL_AND_IMAG:
if (fAveragedView) {
fout << "% from averaged view" << std::endl;
fout << "% x, F_diffRe, F_diffIm" << std::endl;
fout << "x, F_diffRe, F_diffIm" << std::endl;
} else {
fout << "% ";
for (UInt_t i=0; i<dumpVector.size()/2; i++) {
fout << "freq" << i << ", F_diffRe" << i << ", ";
}
@ -1979,9 +1983,8 @@ void PMusrCanvas::ExportData(const Char_t *fileName)
case PV_FOURIER_PWR:
if (fAveragedView) {
fout << "% from averaged view" << std::endl;
fout << "% x, F_diffPwr" << std::endl;
fout << "x, F_diffPwr" << std::endl;
} else {
fout << "% ";
for (UInt_t i=0; i<dumpVector.size()-1; i++) {
fout << "freq" << i << ", F_diffPwr" << i << ", ";
}
@ -1991,9 +1994,8 @@ void PMusrCanvas::ExportData(const Char_t *fileName)
case PV_FOURIER_PHASE:
if (fAveragedView) {
fout << "% from averaged view" << std::endl;
fout << "% x, F_diffPhase" << std::endl;
fout << "x, F_diffPhase" << std::endl;
} else {
fout << "% ";
for (UInt_t i=0; i<dumpVector.size()-1; i++) {
fout << "freq" << i << ", F_diffPhase" << i << ", ";
}
@ -2042,24 +2044,22 @@ void PMusrCanvas::ExportData(const Char_t *fileName)
fout << "% from averaged view" << std::endl;
fout << "% xData, data, errData, xTheory, theory" << std::endl;
} else {
fout << "% ";
for (UInt_t i=0; i<dumpVector.size(); i++) {
if (i % 2 == 0)
fout << "xData" << i/2 << " , data" << i/2 << ", errData" << i/2 << ", ";
fout << "xData" << i/2 << ", data" << i/2 << ", errData" << i/2 << ", ";
else
if (i == dumpVector.size()-1)
fout << "xTheory" << (i-1)/2 << " , theory" << (i-1)/2 << std::endl;
fout << "xTheory" << (i-1)/2 << ", theory" << (i-1)/2 << std::endl;
else
fout << "xTheory" << (i-1)/2 << " , theory" << (i-1)/2 << ", ";
fout << "xTheory" << (i-1)/2 << ", theory" << (i-1)/2 << ", ";
}
}
break;
case PV_FOURIER_REAL:
if (fAveragedView) {
fout << "% from averaged view" << std::endl;
fout << "% freq, F_Re, freqTheo, F_theoRe" << std::endl;
fout << "freq, F_Re, freqTheo, F_theoRe" << std::endl;
} else {
fout << "% ";
for (UInt_t i=0; i<dumpVector.size(); i++) {
if (i % 2 == 0)
fout << "freq" << i/2 << ", F_Re" << i/2 << ", ";
@ -2074,7 +2074,7 @@ void PMusrCanvas::ExportData(const Char_t *fileName)
case PV_FOURIER_IMAG:
if (fAveragedView) {
fout << "% from averaged view" << std::endl;
fout << "% freq, F_Im, freqTheo, F_theoIm" << std::endl;
fout << "freq, F_Im, freqTheo, F_theoIm" << std::endl;
} else {
fout << "% ";
for (UInt_t i=0; i<dumpVector.size(); i++) {
@ -2091,9 +2091,8 @@ void PMusrCanvas::ExportData(const Char_t *fileName)
case PV_FOURIER_REAL_AND_IMAG:
if (fAveragedView) {
fout << "% from averaged view" << std::endl;
fout << "% freq, F_Re, freqTheo, F_theoRe, freq, F_Im, freqTheo, F_theoIm" << std::endl;
fout << "freq, F_Re, freqTheo, F_theoRe, freq, F_Im, freqTheo, F_theoIm" << std::endl;
} else {
fout << "% ";
for (UInt_t i=0; i<dumpVector.size(); i++) {
if (i % 4 == 0)
fout << "freq" << i/4 << ", F_Re" << i/4 << ", ";
@ -2112,9 +2111,8 @@ void PMusrCanvas::ExportData(const Char_t *fileName)
case PV_FOURIER_PWR:
if (fAveragedView) {
fout << "% from averaged view" << std::endl;
fout << "% freq, F_Pwr, freqTheo, F_theoPwr" << std::endl;
fout << "freq, F_Pwr, freqTheo, F_theoPwr" << std::endl;
} else {
fout << "% ";
for (UInt_t i=0; i<dumpVector.size(); i++) {
if (i % 2 == 0)
fout << "freq" << i/2 << ", F_Pwr" << i/2 << ", ";
@ -2129,9 +2127,8 @@ void PMusrCanvas::ExportData(const Char_t *fileName)
case PV_FOURIER_PHASE:
if (fAveragedView) {
fout << "% from averaged view" << std::endl;
fout << "% freq, F_Phase, freqTheo, F_theoPhase" << std::endl;
fout << "freq, F_Phase, freqTheo, F_theoPhase" << std::endl;
} else {
fout << "% ";
for (UInt_t i=0; i<dumpVector.size(); i++) {
if (i % 2 == 0)
fout << "freq" << i/2 << ", F_Phase" << i/2 << ", ";

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2024 by Andreas Suter *
* Copyright (C) 2007-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2024 by Andreas Suter *
* Copyright (C) 2007-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2024 by Andreas Suter *
* Copyright (C) 2007-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2024 by Andreas Suter *
* Copyright (C) 2007-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -9,7 +9,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2018-2024 by Zaher Salman *
* Copyright (C) 2018-2025 by Zaher Salman *
* zaher.salman@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2024 by Andreas Suter *
* Copyright (C) 2007-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2024 by Andreas Suter *
* Copyright (C) 2007-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2024 by Andreas Suter *
* Copyright (C) 2007-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *
@ -1891,6 +1891,10 @@ Bool_t PRunDataHandler::ReadRootFile()
}
}
header->Get("RunInfo/Sample Orientation", str, ok);
if (ok)
runData.SetOrientation(str);
// check further for LEM specific stuff in RunInfo
header->Get("RunInfo/Moderator HV", prop, ok);
@ -2051,11 +2055,15 @@ Bool_t PRunDataHandler::ReadRootFile()
}
dataSet.Clear();
dataSet.SetName(histo->GetTitle());
dataSet.SetTitle(histo->GetTitle());
dataSet.SetHistoNo(redGreenOffsets[i]+j+1);
// get detector info
path.Form("DetectorInfo/Detector%03d/", redGreenOffsets[i]+j+1);
pathName = path + "Name";
header->Get(pathName, str, ok);
if (ok)
dataSet.SetName(str);
pathName = path + "Time Zero Bin";
header->Get(pathName, dval, ok);
if (ok)
@ -3697,6 +3705,8 @@ Bool_t PRunDataHandler::ReadAsciiFile()
{
Bool_t success = true;
std::cout << "as35> in ReadAsciiFile() ..." << std::endl;
// open file
std::ifstream f;
@ -3848,7 +3858,14 @@ Bool_t PRunDataHandler::ReadAsciiFile()
break;
}
ey = ostr->GetString().Atof();
if (ey == 0) {
std::cerr << std::endl << ">> PRunDataHandler::ReadAsciiFile **WARNING** line no " << lineNo << ": error y = 0 which doesn't make sense. Will set it to 1.0. Please check!!";
std::cerr << std::endl;
ey = 1.0;
}
} else {
std::cerr << std::endl << ">> PRunDataHandler::ReadAsciiFile **WARNING** line no " << lineNo << ": error y = 0 which doesn't make sense. Will set it to 1.0. Please check!!";
std::cerr << std::endl;
ey = 1.0;
}
@ -4357,7 +4374,7 @@ Bool_t PRunDataHandler::ReadDatFile()
// open file
std::ifstream f;
// open db-file
// open dat-file
f.open(fRunPathName.Data(), std::ifstream::in);
if (!f.is_open()) {
std::cerr << std::endl << ">> PRunDataHandler::ReadDatFile **ERROR** Couldn't open data file (" << fRunPathName.Data() << ") for reading, sorry ...";
@ -4456,6 +4473,12 @@ Bool_t PRunDataHandler::ReadDatFile()
idx++;
} else { // error value
if (isData[i-1] == 1) { // Err or PosErr hence keep it
if (dval == 0.0) {
std::cout << std::endl << ">> PRunDataHandler::ReadDatFile **WARNING** found Err value = 0. Doesn't make sense! Will set it to 1. Please check!";
std::cerr << std::endl << ">> in line: " << lineNo;
std::cerr << std::endl;
dval = 1.0;
}
runData.fDataNonMusr.AppendSubErrData(idx-1, dval);
}
}
@ -4470,11 +4493,11 @@ Bool_t PRunDataHandler::ReadDatFile()
f.close();
// got through all the data sets and if there is NO error vector set it to '0.0'
// got through all the data sets and if there is NO error vector set it to '1.0'
for (UInt_t i=0; i<noOfDataSets; i++) {
if (runData.fDataNonMusr.GetErrData()->at(i).size() == 0) {
for (UInt_t j=0; j<runData.fDataNonMusr.GetData()->at(i).size(); j++) {
runData.fDataNonMusr.AppendSubErrData(i, 0.0);
runData.fDataNonMusr.AppendSubErrData(i, 1.0);
}
}
}
@ -5563,6 +5586,30 @@ Bool_t PRunDataHandler::WritePsiBinFile(TString fln)
Int_t ival = 0;
PRawRunDataSet *dataSet;
UInt_t size = fData[0].GetNoOfHistos();
// collect histo names in order to see if they are still unique after cropping to 4 char.
PStringVector hName, hNCrop;
TString sCrop;
for (UInt_t i=0; i<size; i++) {
dataSet = fData[0].GetDataSet(i, false); // i.e. the false means, that i is the index and NOT the histo number
// detector name
str = dataSet->GetName();
hName.push_back(str);
sCrop = str;
sCrop.Remove(4);
hNCrop.push_back(sCrop);
}
// check cropped for uniqueness
ival = 1;
for (UInt_t i=0; i<size; i++) {
for (UInt_t j=i+1; j<size; j++) {
if (hNCrop[i] == hNCrop[j]) {
std::string nn = std::to_string(ival);
hNCrop[j][3] = nn[0];
ival++;
}
}
}
// handle rest of the detectors
for (UInt_t i=0; i<size; i++) {
dataSet = fData[0].GetDataSet(i, false); // i.e. the false means, that i is the index and NOT the histo number
if (dataSet == nullptr) { // something is really wrong
@ -5572,10 +5619,7 @@ Bool_t PRunDataHandler::WritePsiBinFile(TString fln)
}
// detector name
str = dataSet->GetName();
if (!str.CompareTo("n/a"))
str.Form("Detector%3d", i+1);
psibin.PutNameHisto(str.Data(), i);
psibin.PutNameHisto(hNCrop[i].Data(), i);
// time zero bin
ival = static_cast<Int_t>(dataSet->GetTimeZeroBin()/fAny2ManyInfo->rebin);
psibin.PutT0Int(i, ival);

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2024 by Andreas Suter *
* Copyright (C) 2007-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2024 by Andreas Suter *
* Copyright (C) 2007-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2024 by Andreas Suter *
* Copyright (C) 2007-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2024 by Andreas Suter *
* Copyright (C) 2007-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2024 by Andreas Suter *
* Copyright (C) 2007-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2024 by Andreas Suter *
* Copyright (C) 2007-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *
@ -661,6 +661,7 @@ Bool_t PStartupHandler::WriteDefaultStartupFile(bool reset_startup_file)
fout << " <comment>" << std::endl;
fout << " Defines default settings for the musrfit package" << std::endl;
fout << " </comment>" << std::endl;
fout << " <data_path>/psi.ch/group/lmu/public/data/lem/his</data_path>" << std::endl;
fout << " <data_path>/afs/psi.ch/project/nemu/data/his</data_path>" << std::endl;
fout << " <data_path>/afs/psi.ch/project/nemu/data/wkm</data_path>" << std::endl;
fout << " <data_path>/afs/psi.ch/project/bulkmusr/data/misc</data_path>" << std::endl;
@ -765,7 +766,7 @@ Bool_t PStartupHandler::WriteDefaultStartupFile(bool reset_startup_file)
fout << " <!-- Color as RGB coded string -->" << std::endl;
fout << " <color>0,0,0</color> <!-- kBlack -->" << std::endl;
fout << " <color>255,0,0</color> <!-- kRed -->" << std::endl;
fout << " <color>0,255,0</color> <!-- kGreen -->" << std::endl;
fout << " <color>0,153,0</color> <!-- kGreen+2 -->" << std::endl;
fout << " <color>0,0,255</color> <!-- kBlue -->" << std::endl;
fout << " <color>255,0,255</color> <!-- kMagenta -->" << std::endl;
fout << " <color>0,255,255</color> <!-- kCyan -->" << std::endl;

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2024 by Andreas Suter *
* Copyright (C) 2007-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *
@ -29,6 +29,7 @@
#include <iostream>
#include <vector>
#include <cmath>
#include <TObject.h>
#include <TString.h>
@ -425,6 +426,15 @@ Double_t PTheory::Func(Double_t t, const PDoubleVector& paramValues, const PDoub
case THEORY_DYNAMIC_LORENTZ_KT_LF:
return DynamicLorentzKTLF(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues) +
fAdd->Func(t, paramValues, funcValues);
case THEORY_DYNAMIC_GAULOR_FAST_KT_ZF:
return DynamicGauLorKTZFFast(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues) +
fAdd->Func(t, paramValues, funcValues);
case THEORY_DYNAMIC_GAULOR_FAST_KT_LF:
return DynamicGauLorKTLFFast(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues) +
fAdd->Func(t, paramValues, funcValues);
case THEORY_DYNAMIC_GAULOR_KT_LF:
return DynamicGauLorKTLF(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues) +
fAdd->Func(t, paramValues, funcValues);
case THEORY_COMBI_LGKT:
return CombiLGKT(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues) +
fAdd->Func(t, paramValues, funcValues);
@ -462,16 +472,19 @@ Double_t PTheory::Func(Double_t t, const PDoubleVector& paramValues, const PDoub
return SkewedGauss(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues) +
fAdd->Func(t, paramValues, funcValues);
case THEORY_STATIC_ZF_NK:
return StaticNKZF (t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues) +
return StaticNKZF(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues) +
fAdd->Func(t, paramValues, funcValues);
case THEORY_STATIC_TF_NK:
return StaticNKTF (t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues) +
return StaticNKTF(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues) +
fAdd->Func(t, paramValues, funcValues);
case THEORY_DYNAMIC_ZF_NK:
return DynamicNKZF (t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues) +
return DynamicNKZF(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues) +
fAdd->Func(t, paramValues, funcValues);
case THEORY_DYNAMIC_TF_NK:
return DynamicNKTF (t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues) +
return DynamicNKTF(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues) +
fAdd->Func(t, paramValues, funcValues);
case THEORY_F_MU_F:
return FmuF(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues) +
fAdd->Func(t, paramValues, funcValues);
case THEORY_POLYNOM:
return Polynom(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues) +
@ -511,6 +524,12 @@ Double_t PTheory::Func(Double_t t, const PDoubleVector& paramValues, const PDoub
return StaticLorentzKTLF(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues);
case THEORY_DYNAMIC_LORENTZ_KT_LF:
return DynamicLorentzKTLF(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues);
case THEORY_DYNAMIC_GAULOR_FAST_KT_ZF:
return DynamicGauLorKTZFFast(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues);
case THEORY_DYNAMIC_GAULOR_FAST_KT_LF:
return DynamicGauLorKTLFFast(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues);
case THEORY_DYNAMIC_GAULOR_KT_LF:
return DynamicGauLorKTLF(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues);
case THEORY_COMBI_LGKT:
return CombiLGKT(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues);
case THEORY_STR_KT:
@ -545,6 +564,8 @@ Double_t PTheory::Func(Double_t t, const PDoubleVector& paramValues, const PDoub
return DynamicNKTF (t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues);
case THEORY_MU_MINUS_EXP:
return MuMinusExpTF(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues);
case THEORY_F_MU_F:
return FmuF(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues);
case THEORY_POLYNOM:
return Polynom(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues);
case THEORY_USER_FCN:
@ -580,6 +601,12 @@ Double_t PTheory::Func(Double_t t, const PDoubleVector& paramValues, const PDoub
return StaticLorentzKTLF(t, paramValues, funcValues) + fAdd->Func(t, paramValues, funcValues);
case THEORY_DYNAMIC_LORENTZ_KT_LF:
return DynamicLorentzKTLF(t, paramValues, funcValues) + fAdd->Func(t, paramValues, funcValues);
case THEORY_DYNAMIC_GAULOR_FAST_KT_ZF:
return DynamicGauLorKTZFFast(t, paramValues, funcValues) + fAdd->Func(t, paramValues, funcValues);
case THEORY_DYNAMIC_GAULOR_FAST_KT_LF:
return DynamicGauLorKTLFFast(t, paramValues, funcValues) + fAdd->Func(t, paramValues, funcValues);
case THEORY_DYNAMIC_GAULOR_KT_LF:
return DynamicGauLorKTLF(t, paramValues, funcValues) + fAdd->Func(t, paramValues, funcValues);
case THEORY_COMBI_LGKT:
return CombiLGKT(t, paramValues, funcValues) + fAdd->Func(t, paramValues, funcValues);
case THEORY_STR_KT:
@ -614,6 +641,8 @@ Double_t PTheory::Func(Double_t t, const PDoubleVector& paramValues, const PDoub
return DynamicNKTF (t, paramValues, funcValues) + fAdd->Func(t, paramValues, funcValues);
case THEORY_MU_MINUS_EXP:
return MuMinusExpTF(t, paramValues, funcValues) + fAdd->Func(t, paramValues, funcValues);
case THEORY_F_MU_F:
return FmuF(t, paramValues, funcValues) + fAdd->Func(t, paramValues, funcValues);
case THEORY_POLYNOM:
return Polynom(t, paramValues, funcValues) + fAdd->Func(t, paramValues, funcValues);
case THEORY_USER_FCN:
@ -647,6 +676,12 @@ Double_t PTheory::Func(Double_t t, const PDoubleVector& paramValues, const PDoub
return StaticLorentzKTLF(t, paramValues, funcValues);
case THEORY_DYNAMIC_LORENTZ_KT_LF:
return DynamicLorentzKTLF(t, paramValues, funcValues);
case THEORY_DYNAMIC_GAULOR_FAST_KT_ZF:
return DynamicGauLorKTZFFast(t, paramValues, funcValues);
case THEORY_DYNAMIC_GAULOR_FAST_KT_LF:
return DynamicGauLorKTLFFast(t, paramValues, funcValues);
case THEORY_DYNAMIC_GAULOR_KT_LF:
return DynamicGauLorKTLF(t, paramValues, funcValues);
case THEORY_COMBI_LGKT:
return CombiLGKT(t, paramValues, funcValues);
case THEORY_STR_KT:
@ -681,6 +716,8 @@ Double_t PTheory::Func(Double_t t, const PDoubleVector& paramValues, const PDoub
return DynamicNKTF(t, paramValues, funcValues);
case THEORY_MU_MINUS_EXP:
return MuMinusExpTF(t, paramValues, funcValues);
case THEORY_F_MU_F:
return FmuF(t, paramValues, funcValues);
case THEORY_POLYNOM:
return Polynom(t, paramValues, funcValues);
case THEORY_USER_FCN:
@ -1633,6 +1670,220 @@ Double_t PTheory::DynamicLorentzKTLF(Double_t t, const PDoubleVector& paramValue
}
//--------------------------------------------------------------------------
/**
* <p>Local Gaussian, global Lorentzian approximation in the limit
* \f[ \nu_c \gg \gamma_\mu \Delta_{\rm L} \f] in ZF.
* For details see "Muon Spin Rotation, Relaxation, and Resonance",
* A. Yaouanc and P. Dalmas Sec. 6.4, Eq.(6.89).
*
* @param t time in \f$(\mu\mathrm{s})\f$, or x-axis value for non-muSR fit
* @param paramValues parameter values
* @param funcValues vector with the functions (i.e. functions of the parameters)
*
* @return Polarization value of this function
*/
Double_t PTheory::DynamicGauLorKTZFFast(Double_t t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const
{
// expected parameters: damping hopping [tshift]
Double_t val[3];
assert(fParamNo.size() <= 3);
// check if FUNCTIONS are used
for (UInt_t i=0; i<fParamNo.size(); i++) {
if (fParamNo[i] < MSR_PARAM_FUN_OFFSET) { // parameter or resolved map
val[i] = paramValues[fParamNo[i]];
} else { // function
val[i] = funcValues[fParamNo[i]-MSR_PARAM_FUN_OFFSET];
}
}
Double_t tt;
if (fParamNo.size() == 2) // no tshift
tt = t;
else // tshift present
tt = t-val[2];
Double_t nut = val[1]*tt;
return exp(-sqrt(4.0*pow(val[0]/val[1], 2.0)*(exp(-nut)-1.0+nut)));
}
//--------------------------------------------------------------------------
/**
* <p>Local Gaussian, global Lorentzian approximation in the limit
* \f[ \nu_c \gg \gamma_\mu \Delta_{\rm L} \f] in LF.
* For details see "Muon Spin Rotation, Relaxation, and Resonance",
* A. Yaouanc and P. Dalmas Sec. 6.4, Eq.(6.93).
*
* @param t time in \f$(\mu\mathrm{s})\f$, or x-axis value for non-muSR fit
* @param paramValues parameter values
* @param funcValues vector with the functions (i.e. functions of the parameters)
*
* @return Polarization value of this function
*/
Double_t PTheory::DynamicGauLorKTLFFast(Double_t t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const
{
// expected parameters: frequency damping hopping [tshift]
Double_t val[4];
assert(fParamNo.size() <= 4);
// check if FUNCTIONS are used
for (UInt_t i=0; i<fParamNo.size(); i++) {
if (fParamNo[i] < MSR_PARAM_FUN_OFFSET) { // parameter or resolved map
val[i] = paramValues[fParamNo[i]];
} else { // function
val[i] = funcValues[fParamNo[i]-MSR_PARAM_FUN_OFFSET];
}
}
Double_t tt;
if (fParamNo.size() == 3) // no tshift
tt = t;
else // tshift present
tt = t-val[3];
Double_t w0 = TMath::TwoPi()*val[0];
Double_t w0_2 = w0*w0;
Double_t nu_2 = val[2]*val[2];
Double_t nu_t = val[2]*tt;
Double_t w0_t = w0*tt;
Double_t Gamma_t = ((w0_2+nu_2)*nu_t+(w0_2-nu_2)*(1.0-exp(-nu_t)*cos(w0_t))-2.0*val[2]*w0*exp(-nu_t)*sin(w0_t))/pow(w0_2+nu_2,2.0);
if (Gamma_t < 0.0)
Gamma_t = 0.0;
return exp(-sqrt(4.0*val[1]*val[1]*Gamma_t));
}
//--------------------------------------------------------------------------
/**
* <p>Local Gaussian, global Lorentzian in LF.
* For details see "Muon Spin Rotation, Relaxation, and Resonance",
* A. Yaouanc and P. Dalmas Sec. 6.4, Eq.(6.86).
*
* @param t time in \f$(\mu\mathrm{s})\f$, or x-axis value for non-muSR fit
* @param paramValues parameter values
* @param funcValues vector with the functions (i.e. functions of the parameters)
*
* @return Polarization value of this function
*/
Double_t PTheory::DynamicGauLorKTLF(Double_t t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const
{
// expected parameters: frequency damping hopping [tshift]
Double_t val[4];
assert(fParamNo.size() <= 4);
// check if FUNCTIONS are used
for (UInt_t i=0; i<fParamNo.size(); i++) {
if (fParamNo[i] < MSR_PARAM_FUN_OFFSET) { // parameter or resolved map
val[i] = paramValues[fParamNo[i]];
} else { // function
val[i] = funcValues[fParamNo[i]-MSR_PARAM_FUN_OFFSET];
}
}
Double_t tt;
if (fParamNo.size() == 3) // no tshift
tt = t;
else // tshift present
tt = t-val[3];
// check if the parameter values have changed, and if yes recalculate DynamicGaussKTLF
Bool_t newParam = false;
for (UInt_t i=0; i<3; i++) {
if (val[i] != fPrevParam[i]) {
newParam = true;
break;
}
}
if (newParam) { // new parameters found, hence calculate DynamicGauLorKTLF
// keep parameters
for (UInt_t i=0; i<3; i++)
fPrevParam[i] = val[i];
// reset GL LF polarzation vector
fDyn_GL_LFFuncValue.clear();
fDyn_GL_LFFuncValue.resize(20000); // Tmax=20us, dt=1ns
PDoubleVector rr={0.2, 0.4, 0.6, 0.8, 1.0, 1.25, 1.5, 1.75, 2.0, 2.5, 3.0, 4.0, 5.0, 7.5, 10.0,
12.8125, 15.625, 18.4375, 21.25, 26.875, 32.5, 43.75, 55.0, 77.5, 100.0};
Double_t par[3] = {val[0], val[1], val[2]};
Double_t sqrtTwoInv = 1.0/sqrt(2.0);
Bool_t isOneVec{false};
Bool_t useKeren{false};
Double_t scale, up{0.0}, low{-1.0};
for (UInt_t i=0; i<rr.size(); i++) {
useKeren = false;
isOneVec = false;
// Delta_G = rr * Delta_L
par[1] = rr[i] * val[1];
// check if all parameters == 0
if ((par[0] == 0.0) && (par[1] == 0.0) && (par[2] == 0.0)) {
isOneVec = true;
}
// make sure that damping and hopping are positive definite
if (par[1] < 0.0)
par[1] = -par[1];
if (par[2] < 0.0)
par[2] = -par[2];
// check that Delta != 0, if not (i.e. stupid parameter) return 1, which is the correct limit
if (fabs(par[1]) < 1.0e-6) {
isOneVec = true;
}
// check if Keren approximation can be used
if (par[2]/par[1] > 5.0) // nu/Delta > 5.0
useKeren = true;
if (!useKeren && !isOneVec) {
CalculateDynKTLF(par, 0); // 0 means Gauss
}
// calculate polarization vector for the given parameters
up = -std::erf(sqrtTwoInv/rr[i]);
scale = up - low;
low = up;
const Double_t dt=0.001;
for (UInt_t i=0; i<20000; i++) {
if (isOneVec) {
fDyn_GL_LFFuncValue[i] += scale;
} else if (useKeren && !isOneVec) {// see PRB50, 10039 (1994)
Double_t wL = TWO_PI * par[0];
Double_t wL2 = wL*wL;
Double_t nu2 = par[2]*par[2];
Double_t Gamma_t = 2.0*par[1]*par[1]/((wL2+nu2)*(wL2+nu2))*
((wL2+nu2)*val[2]*i*dt
+ (wL2-nu2)*(1.0 - TMath::Exp(-val[2]*i*dt)*TMath::Cos(wL*i*dt))
- 2.0*val[2]*wL*TMath::Exp(-val[2]*i*dt)*TMath::Sin(wL*i*dt));
fDyn_GL_LFFuncValue[i] += scale*TMath::Exp(-Gamma_t);
} else if (!useKeren && !isOneVec) {
fDyn_GL_LFFuncValue[i] += scale*GetDynKTLFValue(i*dt);
}
}
}
}
// get the proper value from the look-up table
Double_t result{1.0};
if (tt>=0)
result=GetDyn_GL_KTLFValue(tt);
return result;
}
//--------------------------------------------------------------------------
/**
* <p> theory function: dynamic Lorentzain Kubo-Toyabe in longitudinal applied field
@ -2461,6 +2712,49 @@ Double_t PTheory::DynamicNKTF(Double_t t, const PDoubleVector& paramValues, cons
return result;
}
//--------------------------------------------------------------------------
/**
* <p>F-\f$\mu\f-F polaritation function.
* For details see e.g. "Muon Spectroscopy - An Introduction", S. Blundell, etal.
*
* @param t time in \f$(\mu\mathrm{s})\f$, or x-axis value for non-muSR fit
* @param paramValues parameter values
* @param funcValues vector with the functions (i.e. functions of the parameters)
* @return Polarization value of this function
*/
Double_t PTheory::FmuF(Double_t t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const
{
// expected paramters: w_d [0], [tshift [1]]
Double_t val[2];
assert(fParamNo.size() <= 2);
if (t < 0.0)
return 1.0;
// check if FUNCTIONS are used
for (UInt_t i=0; i<fParamNo.size(); i++) {
if (fParamNo[i] < MSR_PARAM_FUN_OFFSET) { // parameter or resolved map
val[i] = paramValues[fParamNo[i]];
} else { // function
val[i] = funcValues[fParamNo[i]-MSR_PARAM_FUN_OFFSET];
}
}
Double_t tt;
if (fParamNo.size() == 1) // no tshift
tt = t;
else // tshift present
tt = t-val[1];
const Double_t sqrt3 = sqrt(3.0);
const Double_t wd_t = val[0]*tt;
return (3.0+cos(sqrt3*wd_t)+(1.0-1.0/sqrt3)*cos(((3.0-sqrt3)/2.0)*wd_t)+(1.0+1.0/sqrt3)*cos(((3.0 + sqrt3)/2.0)*wd_t))/6.0;
}
//--------------------------------------------------------------------------
/**
* <p> theory function: polynom
@ -2843,19 +3137,44 @@ void PTheory::CalculateDynKTLF(const Double_t *val, Int_t tag) const
Double_t PTheory::GetDynKTLFValue(const Double_t t) const
{
if (t < 0.0)
return 0.0;
return 1.0;
UInt_t idx = static_cast<UInt_t>(t/fDynLFdt);
if (idx + 2 > fDynLFFuncValue.size())
return fDynLFFuncValue.back();
// linearly interpolate between the two relvant function bins
// linearly interpolate between the two relevant function bins
Double_t df = (fDynLFFuncValue[idx+1]-fDynLFFuncValue[idx])*(t/fDynLFdt-static_cast<Double_t>(idx));
return fDynLFFuncValue[idx]+df;
}
//--------------------------------------------------------------------------
/**
* <p>Gets value of the dynamic local Gauss / global Lorentzian Kubo-Toyabe LF function.
*
* <b>return:</b> function value
*
* \param t time in (usec)
*/
Double_t PTheory::GetDyn_GL_KTLFValue(const Double_t t) const
{
if (t < 0.0)
return 1.0;
const Double_t dt=0.001; // 1ns
UInt_t idx = static_cast<UInt_t>(t/dt);
if (idx + 2 > fDyn_GL_LFFuncValue.size())
return fDyn_GL_LFFuncValue.back();
// linearly interpolate between the two relevant function bins
Double_t df = (fDyn_GL_LFFuncValue[idx+1]-fDyn_GL_LFFuncValue[idx])*(t/dt-static_cast<Double_t>(idx));
return fDyn_GL_LFFuncValue[idx]+df;
}
//--------------------------------------------------------------------------
/**
* <p> theory function: MuMinusExpTF

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2024 by Andreas Suter *
* Copyright (C) 2007-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2024 by Andreas Suter *
* Copyright (C) 2007-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2024 by Andreas Suter *
* Copyright (C) 2007-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -11,7 +11,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2024 by Andreas Suter, Bastian M. Wojek *
* Copyright (C) 2007-2025 by Andreas Suter, Bastian M. Wojek *
* *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -11,7 +11,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2024 by Andreas Suter, Bastian M. Wojek *
* Copyright (C) 2007-2025 by Andreas Suter, Bastian M. Wojek *
* *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2013-2024 by Andreas Suter *
* Copyright (C) 2013-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2013-2024 by Andreas Suter *
* Copyright (C) 2013-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2009-2024 by Andreas Suter *
* Copyright (C) 2009-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2013-2024 by Andreas Suter *
* Copyright (C) 2013-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2013-2024 by Andreas Suter *
* Copyright (C) 2013-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2009-2024 by Andreas Suter *
* Copyright (C) 2009-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

52
src/external/LF_GL/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,52 @@
# - LF GL ---------------------------------------------------------------------
cmake_minimum_required(VERSION 3.17)
project(lf_gl VERSION 1.0 LANGUAGES C CXX)
#--- set a default build type if none was specified ---------------------------
set(default_build_type "Release")
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif ()
#--- write summary of the installation
cmake_host_system_information(RESULT PROCESSOR QUERY PROCESSOR_DESCRIPTION)
message("")
message("|-----------------------------------------------------------------------|")
message("| |")
message("| Summary |")
message("| |")
message("|-----------------------------------------------------------------------|")
message("")
message(" System: ${CMAKE_HOST_SYSTEM_NAME} ${CMAKE_SYSTEM_PROCESSOR} - ${CMAKE_HOST_SYSTEM_VERSION}")
message(" Processor: ${PROCESSOR} (${CMAKE_SYSTEM_PROCESSOR})")
message(" ----------")
message("")
message(" lf_gl Version: ${lf_gl_VERSION}")
message(" --------------")
message("")
message(" Build Type: ${CMAKE_BUILD_TYPE}")
message("")
message("-------------------------------------------------------------------------")
message("")
add_executable(lf_gl
main.cpp
PGKT_LF.cpp
PLGKT_LF.cpp
)
set_property(TARGET lf_gl PROPERTY CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
target_include_directories(lf_gl
BEFORE PRIVATE
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}>
)
target_link_libraries(lf_gl -lm)

264
src/external/LF_GL/PGKT_LF.cpp vendored Normal file
View File

@ -0,0 +1,264 @@
/***************************************************************************
PGKT_LF.cpp
Author: Andreas Suter
e-mail: andreas.suter@psi.ch
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <iostream>
#include <cmath>
#include <numbers>
#include "PGKT_LF.h"
//-----------------------------------------------------------------------------
/**
* <p>CTOR
*
* @param param param[0]=field (G), param[1]=width (1/us), param[2]=hopp (1/us)
* @param tmax maxium of time to be used in (us).
*/
PGKT_LF::PGKT_LF(std::vector<double> &param, const double tmax) : fParam(param), fTmax(tmax)
{
fParam[0] *= fGammaMu;
if (DynamicGaussKTLF() == 0)
fValid = true;
}
//-----------------------------------------------------------------------------
/**
* <p>Calculate GKT LF polarization values.
*
* @return 0 on success, >0 otherwise
*/
int PGKT_LF::DynamicGaussKTLF()
{
bool useKeren{false};
// check if there is an empty time vector, if yes create one, otherwise use the given one
if (fTime.size() == 0) {
double t = 0.0;
do {
t += 1.0e-4; // 100ps steps
fTime.push_back(t);
} while (t < fTmax);
}
fPol.resize(fTime.size());
if (fParam[2]/fParam[1] > 5.0) // hopp/width = nu/Delta > 5.0
useKeren=true;
unsigned int i{0};
if (useKeren) {
double wL = fParam[0];
double wL2 = wL*wL;
double nu2 = fParam[2]*fParam[2];
double Gamma_t{0.0};
for (auto t : fTime) {
Gamma_t = 2.0*fParam[1]*fParam[1]/((wL2+nu2)*(wL2+nu2))* ((wL2+nu2)*fParam[2]*t
+ (wL2-nu2)*(1.0 - exp(-fParam[2]*t)*cos(wL*t))
- 2.0*fParam[2]*wL*exp(-fParam[2]*t)*sin(wL*t));
fPol[i++] = exp(-Gamma_t);
}
} else {
CalculateDynKTLF();
for (auto t : fTime) {
fPol[i++] = GetDynKTLFValue(t);
}
}
return 0;
}
//-----------------------------------------------------------------------------
/**
* <p>Calculate GKT LF polarization values, where the Keren approximation fails.
*/
void PGKT_LF::CalculateDynKTLF()
{
double tmax = 20.0; // 20 us
if (tmax < fTmax)
tmax = fTmax;
unsigned int N = static_cast<unsigned int>(16.0*tmax*fParam[0]);
// check if width is very high
if (fParam[1] > 0.1) {
double tmin = 20.0;
tmin = fabs(sqrt(3.0)/fParam[1]);
unsigned int Nrate = static_cast<unsigned int>(25.0 * tmax / tmin);
if (Nrate > N) {
N = Nrate;
}
}
if (N < 300) // if too few points, i.e. hopp very small, take 300 points
N = 300;
if (N>1e6) // make sure that N is not too large to prevent memory overflow
N = 1e6;
fDynLFFuncValue.resize(N);
CalculateGaussLFIntegral();
// calculate the P^(0)(t) exp(-nu t) vector
std::vector<double> p0exp(N);
double t = 0.0;
double dt = tmax/N;
double nu = fParam[0] / (2.0*std::numbers::pi_v<double>);
fDynLFdt = dt; // keep it since it is needed in GetDynKTLFValue()
for (unsigned int i=0; i<N; i++) {
if (nu < 0.02) { // if smaller 20kHz ~ 0.27G use zero field formula
double sigma_t_2 = t*t*fParam[1]*fParam[1];
p0exp[i] = 0.333333333333333 * (1.0 + 2.0*(1.0 - sigma_t_2)*exp(-0.5*sigma_t_2));
} else if (fParam[1]/nu > 79.5775) { // check if Delta/w0 > 500.0, in which case the ZF formula is used
double sigma_t_2 = t*t*fParam[1]*fParam[1];
p0exp[i] = 0.333333333333333 * (1.0 + 2.0*(1.0 - sigma_t_2)*exp(-0.5*sigma_t_2));
} else {
double width = fParam[1];
double w0 = fParam[0];
p0exp[i] = 1.0 - 2.0*pow(width/w0,2.0)*(1.0 - exp(-0.5*pow(width*t, 2.0))*cos(w0*t)) + GetLFIntegralValue(t);
}
p0exp[i] *= exp(-fParam[2]*t);
t += dt;
}
// solve the volterra equation (trapezoid integration)
fDynLFFuncValue[0]=p0exp[0];
double sum;
double a;
double preFactor = dt*fParam[2];
for (unsigned int i=1; i<N; i++) {
sum = p0exp[i];
sum += 0.5*preFactor*p0exp[i]*fDynLFFuncValue[0];
for (unsigned int j=1; j<i; j++) {
sum += preFactor*p0exp[i-j]*fDynLFFuncValue[j];
}
a = 1.0-0.5*preFactor*p0exp[0];
fDynLFFuncValue[i]=sum/a;
}
}
//-----------------------------------------------------------------------------
/**
* <p>Calculate static LF integral.
*/
void PGKT_LF::CalculateGaussLFIntegral()
{
// fParam[0] = omega (field), fParam[1] = width
double nu = fParam[0] / (2.0*std::numbers::pi_v<double>);
if (fParam[0] == 0.0) // field == 0
return;
double dt=0.001; // all times in usec
double t, ft;
double w0 = fParam[0];
double width = fParam[1];
double preFactor = 2.0*pow(width, 4.0) / pow(w0, 3.0);
// check if the time resolution needs to be increased
const unsigned int samplingPerPeriod = 20;
const unsigned int samplingOnExp = 3000;
if ((width <= w0) && (1.0/nu < 20.0)) { // makes sure that the frequency sampling is fine enough
if (1.0/nu/samplingPerPeriod < 0.001) {
dt = 1.0/nu/samplingPerPeriod;
}
} else if ((width > w0) && (width <= 10.0)) {
if (width/w0 > 10.0) {
dt = 0.00005;
}
} else if ((width > w0) && (width > 10.0)) { // makes sure there is a fine enough sampling for large Delta's
if (1.0/width/samplingOnExp < 0.001) {
dt = 1.0/width/samplingOnExp;
}
}
fSamplingTime = dt;
fLFIntegral.clear();
// calculate integral
t = 0.0;
fLFIntegral.push_back(0.0); // start value of the integral
ft = 0.0;
double step = 0.0, lastft = 1.0, diff = 0.0;
do {
t += dt;
step = 0.5*dt*preFactor*(exp(-0.5*pow(width * (t-dt), 2.0))*sin(w0*(t-dt))+
exp(-0.5*pow(width * t, 2.0))*sin(w0*t));
ft += step;
diff = fabs(fabs(lastft)-fabs(ft));
lastft = ft;
fLFIntegral.push_back(ft);
} while ((t <= 20.0) && (diff > 1.0e-10));
}
//-----------------------------------------------------------------------------
/**
* <p>Gets value of the non-analytic static LF integral.
*
* @param t time in (usec)
*
* @return interpolated LF integral value
*/
double PGKT_LF::GetLFIntegralValue(const double t) const
{
unsigned int idx = static_cast<unsigned int>(t/fSamplingTime);
if (idx + 2 > fLFIntegral.size())
return fLFIntegral.back();
// linearly interpolate between the two relevant function bins
double df = (fLFIntegral[idx+1]-fLFIntegral[idx])*(t/fSamplingTime-static_cast<double>(idx));
return fLFIntegral[idx]+df;
}
//-----------------------------------------------------------------------------
/**
* <p><p>Gets value of the dynamic Kubo-Toyabe LF function.
*
* @param t time (usec)
*
* @return interpolated LF value.
*/
double PGKT_LF::GetDynKTLFValue(const double t) const
{
unsigned int idx = static_cast<unsigned int>(t/fDynLFdt);
if (idx + 2 > fDynLFFuncValue.size())
return fDynLFFuncValue.back();
// linearly interpolate between the two relvant function bins
double df = (fDynLFFuncValue[idx+1]-fDynLFFuncValue[idx])*(t/fDynLFdt-static_cast<double>(idx));
return fDynLFFuncValue[idx]+df;
}

65
src/external/LF_GL/PGKT_LF.h vendored Normal file
View File

@ -0,0 +1,65 @@
/***************************************************************************
PGKT_LF.h
Author: Andreas Suter
e-mail: andreas.suter@psi.ch
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef _PGKT_LF_
#define _PGKT_LF_
#include <vector>
class PGKT_LF
{
public:
PGKT_LF(std::vector<double> &param, const double tmax);
int DynamicGaussKTLF();
bool IsValid() { return fValid; }
std::vector<double> GetTime() { return fTime; }
std::vector<double> GetPol() { return fPol; }
private:
const double fGammaMu=8.5161545577e-2;
std::vector<double> fDynLFFuncValue;
std::vector<double> fLFIntegral;
double fSamplingTime{0.0001};
double fDynLFdt{0.0001};
bool fValid{false};
double fTmax{10.0};
std::vector<double> fParam;
std::vector<double> fTime;
std::vector<double> fPol;
void CalculateDynKTLF();
void CalculateGaussLFIntegral();
double GetLFIntegralValue(const double t) const;
double GetDynKTLFValue(const double t) const;
};
#endif // _PGKT_LF_

116
src/external/LF_GL/PLGKT_LF.cpp vendored Normal file
View File

@ -0,0 +1,116 @@
/***************************************************************************
PLGKT_LF.cpp
Author: Andreas Suter
e-mail: andreas.suter@psi.ch
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <iostream>
#include <cmath>
#include <algorithm>
#include <numbers>
#include <chrono>
#include "PLGKT_LF.h"
#include "PGKT_LF.h"
//-----------------------------------------------------------------------------
/**
* <p>CTOR
*
* @param param [0] field (G), [1] width (1/us), [2] hopp (1/us)
* @param tmax maximal time to be used, default = 10 us
*/
PLGKT_LF::PLGKT_LF(std::vector<double> &param, const double tmax) : fParam(param), fTmax(tmax)
{
if (DynamicLGKTLF() == 0)
fValid = true;
}
//-----------------------------------------------------------------------------
/**
* <p>The weight density \f$\rho_{\Delta_{\rm L}}(\Delta_{\rm G}) dG_{\rm G} =
* \sqrt{\frac{2}{\pi}} \frac{1}{r^2} \exp\left(-\frac{1}{2 r^2}\right) dr\f$, with
* \f$r = \frac{\Delta_{\rm G}}{\Delta_{\rm L}}\f$
* (see A. Yaouanc and P. Dalmas de Reotier, ``Muon Spin Rotation, Relaxation, and Resonance'', p.129)
*
* <p>Integration method is described in the docu directory.
*
* @return 0 on success, >0 otherwise
*/
int PLGKT_LF::DynamicLGKTLF()
{
std::vector<double> rr={0.2, 0.4, 0.6, 0.8, 1.0, 1.25, 1.5, 1.75, 2.0, 2.5, 3.0, 4.0, 5.0, 7.5, 10.0, 12.8125, 15.625, 18.4375, 21.25, 26.875, 32.5, 43.75, 55.0, 77.5, 100.0};
std::vector<double> pp={fParam[0], 0.0, fParam[2]};
std::vector<double> pol;
double scale, up{0.0}, low{-1.0};
fTime.clear();
fPol.clear();
if ((fParam[0] < 0.5) && (fParam[2] == 0.0)) { // very close to ZF -> use ZF
// generate time vector
double t = 0.0;
do {
t += 1.0e-4; // 100ps steps
fTime.push_back(t);
} while (t < fTmax);
// generate polarization vector
for (auto tt : fTime) {
fPol.push_back(0.333333333333 + 0.666666666667 * (1.0 - fParam[1]*tt) * exp(-fParam[1]*tt));
}
return 0;
}
auto t_start = std::chrono::high_resolution_clock::now();
double sqrtTwoInv = 1.0/sqrt(2.0);
for (unsigned int i=0; i<rr.size(); i++) {
pp[1] = rr[i] * fParam[1];
PGKT_LF gkt_lf(pp, fTmax);
if (!gkt_lf.IsValid()) {
std::cout << "**ERROR** in Gaussian LF calculation" << std::endl;
return 2;
}
if (fTime.size()==0) {
fTime = gkt_lf.GetTime();
fPol.resize(fTime.size());
}
up = -std::erf(sqrtTwoInv/rr[i]);
scale = up - low;
low = up;
pol.clear();
pol = gkt_lf.GetPol();
for (unsigned int j=0; j<fPol.size(); j++)
fPol[j] += scale*pol[j];
}
auto t_end = std::chrono::high_resolution_clock::now();
std::cout << ">> time used: " << std::chrono::duration<double, std::milli>(t_end-t_start).count() << " ms." << std::endl;
return 0;
}

53
src/external/LF_GL/PLGKT_LF.h vendored Normal file
View File

@ -0,0 +1,53 @@
/***************************************************************************
PLGKT_LF.h
Author: Andreas Suter
e-mail: andreas.suter@psi.ch
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef _PLGKT_LF_
#define _PLGKT_LF_
#include <vector>
class PLGKT_LF {
public:
PLGKT_LF(std::vector<double> &param, const double tmax);
int DynamicLGKTLF();
bool IsValid() { return fValid; }
std::vector<double> GetTime() { return fTime; }
std::vector<double> GetPol() { return fPol; }
private:
bool fValid{false};
double fTmax{10.0};
std::vector<double> fParam;
std::vector<double> fTime;
std::vector<double> fPol;
};
#endif // _PLGKT_LF_

View File

@ -0,0 +1,62 @@
@Article{ Hayano79,
title = "Zero- and low-field spin relaxation studied by positive muons",
author = "R. S. Hayano and Y. J. Uemura and J. Imazato and N. Nishida and T. Yamazaki and R. Kubo",
journal = "Phys. Rev. B",
volume = "20",
year = "1979",
pages = "850"
}
@Article{ Uemura85,
title = "Muon-spin relaxation in \emph{AuFe} and \emph{CuMn} spin glasses",
author = "Y. J. Uemura and T. Yamazaki and D. R. Harshman and M. Senba and E. J. Ansaldo",
journal = "Phys. Rev. B",
volume = "31",
year = "1985",
pages = "546"
}
@Article{ DalmasDeReotier92,
title = "Quantum calculation of the muon depolarization function: effect of spin dynamics in nuclear dipole systems",
author = "P. {Dalams de R\'{e}otier} and A. Yaouanc",
journal = "J. Phys.: Condens. Matter",
volume = "4",
year = "1992",
pages = "4533"
}
@Article{ Keren94,
title = "Generalization of the Abragam relaxation function to a longitudinal field",
author = "A. Keren",
journal = "Phys. Rev. B",
volume = "50",
year = "1994",
pages = "10039"
}
@Article{ Larkin00,
title = "Exponential field distribution in $\mathrm{Sr(Cu_{1-x}Zn_x)_2O_3}$",
author = "M. I. Larkin and Y. Fudamoto and I. M. Gat and A. Kinkhabwala and K. M. Kojima and G. M. Luke and J. Merrin and B. Nachumi and Y. J. Uemura and M. Azuma and T. Saito and M. Takano",
journal = "Physica B",
volume = "289-290",
year = "00",
pages = "153"
}
@Article{ McMullen78,
title = "Positive-muon spin depolarization in solids",
author = "T. McMullen and E. Zaremba",
journal = "Phys. Rev. B",
volume = "18",
year = "1978",
pages = "3026"
}
@Book { Yaouanc11,
title = "Muon Spin Rotation, Relaxation, and Resonance",
author = "A. Yaouanc and P. Dalmas de R\'{e}otier",
year = 2011,
publisher = "Oxford University Press",
address = "Oxford"
}

BIN
src/external/LF_GL/docu/dynamicGL_LF.pdf vendored Normal file

Binary file not shown.

135
src/external/LF_GL/docu/dynamicGL_LF.tex vendored Normal file
View File

@ -0,0 +1,135 @@
\documentclass[twoside]{article}
\usepackage[english]{babel}
\usepackage{a4}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage{array}
\usepackage{float}
\usepackage{hyperref}
\usepackage{xspace}
\usepackage{rotating}
\usepackage{dcolumn}
\setlength{\topmargin}{10mm}
\setlength{\topmargin}{-13mm}
% \setlength{\oddsidemargin}{0.5cm}
% \setlength{\evensidemargin}{0cm}
\setlength{\oddsidemargin}{1cm}
\setlength{\evensidemargin}{1cm}
\setlength{\textwidth}{14.5cm}
\setlength{\textheight}{23.8cm}
\pagestyle{fancyplain}
\addtolength{\headwidth}{0.6cm}
\fancyhead{}%
\fancyhead[RE,LO]{\bf Static and Dynamic LF Functions}%
\fancyhead[LE,RO]{\thepage}
\cfoot{--- Andreas Suter -- \today ---}
\rfoot{\includegraphics[width=2cm]{psi_01_sp.pdf}}
\DeclareMathAlphabet{\bi}{OML}{cmm}{b}{it}
\newcommand{\mean}[1]{\langle #1 \rangle}
\newcommand{\lem}{LE-$\mu$SR\xspace}
\newcommand{\musr}{$\mu$SR\xspace}
\newcommand{\etal}{\emph{et al.\xspace}}
\newcolumntype{d}[1]{D{.}{.}{#1}}
\DeclareMathOperator\erf{erf}
\begin{document}
% Header info --------------------------------------------------
\thispagestyle{empty}
\noindent
\begin{tabular}{@{\hspace{-0.7cm}}l@{\hspace{6cm}}r}
\noindent\includegraphics[width=3.4cm]{psi_01_sp.pdf} &
{\Huge\sf Memorandum}
\end{tabular}
%
\vskip 1cm
%
\begin{tabular}{@{\hspace{-0.5cm}}ll@{\hspace{4cm}}ll}
Datum: & \today & & \\[3ex]
Von: & Andreas Suter & An: & \\
Telefon: & +41\, (0)56\, 310\, 4238 & & \\
Raum: & WLGA / 119 & cc: & \\
e-mail: & \verb?andreas.suter@psi.ch? & & \\
\end{tabular}
%
\vskip 0.3cm
\noindent\hrulefill
\vskip 1cm
%
\section*{Dynamic Gaussian-Lorentzian LF}
For details about the Gaussian-, and Lorentzian dynamics in LF see \cite{Hayano79,Uemura85,DalmasDeReotier92,Keren94,Yaouanc11}.
Here, the focus is only on the strong collision model, where the local dynamics is given by a Gaussian distribution. The system, however, is dilute so that the overall distribution is Lorentzian. This has been discussed the first time in the context of spin-glasses \cite{Uemura85}, where a Laplace approach has been followed. This approach is unfavorable numerically.
Here I follow the approach given in \cite{Yaouanc11}, Chapter 6.4.
The measured macroscopic longitudinal polarization function is given as
\begin{equation}\label{eq:P_ZL}
P_Z^{\rm L}(t, \Delta_{\rm L, ZF}, B, \nu) = \int_0^\infty P_Z^{\rm G}(t, \underbrace{r \cdot \Delta_{\rm L, ZF} }_{\Delta_{\rm G, ZF}}, B, \nu) \cdot \underbrace{\sqrt{\frac{2}{\pi}} \, \frac{1}{r^2}\, \exp\left(-\frac{1}{2 r^2}\right)}_{=: f(r)}\, dr,
\end{equation}
\noindent where $P_Z^{\rm G}(t, \Delta_{\rm G, ZF}, B, \nu)$ is the ``local'' Gaussian dynamic LF function, $B$ the applied LF-field, $\nu$ the hopping frequency, and
$$
r = \frac{\Delta_{\rm G, ZF}}{\Delta_{\rm L, ZF}}.
$$
\noindent The function $P_Z^{\rm L}(t, \Delta_{\rm L, ZF}, B=0, \nu=0)$ can exactly be calculated and the resulting ZF function is
\begin{equation}
P_Z^{\rm L}(t, \Delta_{\rm L, ZF}, B=0, \nu=0) = \frac{1}{3} + \frac{2}{3} \left( 1 - \gamma_\mu \Delta_{\rm L, ZF}\cdot t \right) \cdot \exp(-\gamma_\mu \Delta_{\rm L, ZF}\cdot t ),
\end{equation}
whereas $P_Z^{\rm G}(t, \Delta_{\rm L, ZF}, B=0, \nu=0)$ is
\begin{equation}
P_Z^{\rm G}(t, \Delta_{\rm G, ZF}, B=0, \nu=0) = \frac{1}{3} + \frac{2}{3} \left( 1 - \left[\gamma_\mu \Delta_{\rm G, ZF}\cdot t\right]^2 \right) \cdot \exp(-1/2\, (\gamma_\mu \Delta_{\rm G, ZF}\cdot t)^2 ).
\end{equation}
\noindent In its general form $P_Z^{\rm G}(t, \Delta_{\rm G, ZF}, B, \nu)$ cannot be calculated analytically. The numerical evaluation used in \texttt{musrfit} is following the time domain approach as given in \cite{DalmasDeReotier92}
\noindent Eq.(\ref{eq:P_ZL}) can be written as a generalized Riemann sum as
\begin{equation}\label{eq:P_ZL_Riemann}
P_Z^{\rm L}(t, \Delta_{\rm L, ZF}, B, \nu) \simeq \sum_k P_Z^{\rm G}(t, r_k \cdot \Delta_{\rm L, ZF}, B, \nu) \cdot
\sqrt{\frac{2}{\pi}} \, \frac{1}{r_k^2}\, \exp\left(-\frac{1}{2 r_k^2}\right)\, \Delta r_k,
\end{equation}
where $\Delta r_k$ are \emph{non}-equidistant sampling intervals. $r_k$ are values somewhere within a sampling interval $\Delta r_k$.
\noindent To understand the following it is useful to have a look at $f(r)$ (see Eq.(\ref{eq:P_ZL}) and Fig.(\ref{fig:f_r})).
\newpage
\begin{figure}[h]
\centering
\includegraphics[width=0.7\textwidth]{f_r.pdf}
\caption{}\label{fig:f_r}
\end{figure}
\noindent This shows, that it will be important to have narrow enough $r$-intervals in the region from $0.2$ and $5.0$. The chosen sampling is given by the $r$-points
\begin{eqnarray*}
\vec{r} &=& (0.0, 0.2, 0.4, 0.6, 0.8, 1.0, 1.25, 1.5, 1.75, 2.0, 2.5, 3.0, 4.0, 5.0, 7.5, 10.0, \\
& & 12.8125, 15.625, 18.4375, 21.25, 26.875, 32.5, 43.75, 55.0, 77.5, 100.0).
\end{eqnarray*}
The intervals are given by
$$
\Delta r_k = \vec{r}(k+1) - \vec{r}(k).
$$
\noindent The calculation of $P_Z^{\rm G}(t, r \cdot \Delta_{\rm L, ZF}, B, \nu)$ is quite costly, and hence the following approach has been chosen. Within an $\Delta r_k$-Interval we approximate Eq.(\ref{eq:P_ZL_Riemann}) by
\begin{eqnarray}\label{eq:P_ZL_num}
P_Z^{\rm L}(t, \Delta_{\rm L, ZF}, B, \nu) &\simeq& \sum_k P_Z^{\rm G}(t, r_k \cdot \Delta_{\rm L, ZF}, B, \nu) \cdot
\sqrt{\frac{2}{\pi}} \, \int_{\vec{r}(k)}^{\vec{r}(k+1)} \frac{1}{r^2}\, \exp\left(-\frac{1}{2 r^2}\right)\, dr \nonumber \\
&=& \sum_k P_Z^{\rm G}(t, r_k \cdot \Delta_{\rm L, ZF}, B, \nu) \cdot \left[ \erf\left(\frac{1}{\sqrt{2}\, \vec{r}(k)}\right) - \erf\left(\frac{1}{\sqrt{2}\, \vec{r}(k+1)}\right) \right],
\end{eqnarray}
where $\erf(\cdot)$ is the Gaussian error function.
\bibliographystyle{unsrt}
\bibliography{dynamicGL_LF.bib}
\end{document}

19
src/external/LF_GL/docu/f_r.C vendored Normal file
View File

@ -0,0 +1,19 @@
void f_r()
{
TCanvas *c1 = new TCanvas("c1", "c1", 800, 600);
TF1 *fr = new TF1("fr", "TMath::Sqrt(2.0/TMath::Pi())*1.0/TMath::Power(x, 2.0)*TMath::Exp(-0.5/TMath::Power(x, 2.0))", 0.0, 10);
fr->SetNpx(1500);
fr->GetXaxis()->SetTitle("#it{r}");
fr->GetXaxis()->SetTitleSize(0.05);
fr->GetXaxis()->SetTitleOffset(0.8);
fr->GetXaxis()->CenterTitle(kTRUE);
fr->GetYaxis()->SetTitle("#it{f(r)}");
fr->GetYaxis()->SetTitleSize(0.05);
fr->GetYaxis()->SetTitleOffset(0.8);
fr->GetYaxis()->CenterTitle(kTRUE);
fr->SetTitle("");
fr->SetLineColor(4);
fr->Draw();
c1->SetGrid();
}

BIN
src/external/LF_GL/docu/f_r.pdf vendored Normal file

Binary file not shown.

BIN
src/external/LF_GL/docu/psi_01_sp.pdf vendored Normal file

Binary file not shown.

298
src/external/LF_GL/main.cpp vendored Normal file
View File

@ -0,0 +1,298 @@
#include <iostream>
#include <fstream>
#include <string>
#include <cstring>
#include <vector>
#include <cmath>
#include <numbers>
#include "PGKT_LF.h"
#include "PLGKT_LF.h"
// ----------------------------------------------------------------------------
void lf_gl_syntax()
{
std::cout << std::endl;
std::cout << "usage lg_gl [[-p field width hopp | -a width hopp] [-t tmax] -g [1|0] -o flnOut] | [-h]" << std::endl;
std::cout << " -p: field in (G)" << std::endl;
std::cout << " width in (1/us)" << std::endl;
std::cout << " hopp in (1/us)" << std::endl;
std::cout << " -a: width in (1/us)" << std::endl;
std::cout << " hopp in (1/us)" << std::endl;
std::cout << " -t: tmax in (us). Default: tmax=10 (us)." << std::endl;
std::cout << " -g: 1=Gaussian LF data, 0=Gaussian averaged -> Lorentz LF data" << std::endl;
std::cout << " -o: flnOut = output file name." << std::endl;
std::cout << " -h: this help" << std::endl;
std::cout << std::endl;
}
// ----------------------------------------------------------------------------
/**
* <p>ZF Approximation for dynamic (LF geometry).
* Gaussian approximation: Abragam function, A. Yaouanc and P. Dalmas, p. 123, Eq. (6.62)
* Lorentzian approximation: A. Yaouanc and P. Dalmas, p. 130, Eq. (6.89)
*
* @param gaussian if true, Gaussian approximation, otherwise Lorentzian
* @param param [0]: field = 0, [1]: width (1/us), [2]: hopp (1/us)
* @param tmax calculate upto tmax
* @param tt time vector
* @param pol polarization vector
*/
void lf_zf_approx(const bool gaussian, const std::vector<double> &param,
const double tmax, std::vector<double> &tt, std::vector<double> &pol)
{
tt.clear();
pol.clear();
double t=0, dval;
do {
tt.push_back(t);
t += 0.001;
if (gaussian) {
dval = exp(-2.0*pow(param[1]/param[2], 2.0)*(exp(-param[2]*t)-1.0+param[2]*t));
} else {
dval = exp(-sqrt(4.0*pow(param[1]/param[2], 2.0)*(exp(-param[2]*t)-1.0+param[2]*t)));
}
pol.push_back(dval);
} while (t <= tmax);
}
// ----------------------------------------------------------------------------
/**
* <p>write the polarization data to an ascii output file.
*
* @param fln filename
* @param zf_approx true for ZF approximation functions, otherwise full integration
* @param gaussian_only true for Gaussian, otherwise Gaussian/Lorentzian
* @param param [0] field (G), [1] width (1/us), [2] hopp (1/us)
* @param tt time vector
* @param pol polarization vector
*
* @return 0 on success, > 0 otherwise
*/
int lf_gl_write(const std::string fln, const bool zf_approx,
const bool gaussian_only,
const std::vector<double> &param,
const std::vector<double> &tt, const std::vector<double> &pol)
{
std::ofstream fout(fln, std::ofstream::out);
if (zf_approx)
fout << "# ZF Approximation." << std::endl;
if (gaussian_only)
fout << "# Gaussian only" << std::endl;
else
fout << "# Gaussian/Lorentzian" << std::endl;
fout << "# field=" << param[0] << " (G), width=" << param[1] << " (1/us), hopp=" << param[2] << " (1/us)" << std::endl;
fout << "# t (us), pol" << std::endl;
for (unsigned int i=0; i<tt.size(); i++) {
fout << tt[i] << ", " << pol[i] << std::endl;
}
fout.close();
return 0;
}
// ----------------------------------------------------------------------------
int main(int argc, char *argv[])
{
std::vector<double> param{0.0, 0.0, 0.0};
double tmax{10.0};
bool gaussian_only = false;
bool zf_approx = false;
std::string flnOut="";
if (argc < 8) {
lf_gl_syntax();
return 0;
}
double dval;
std::size_t pos{0};
for (int i=1; i<argc; i++) {
if (!strcmp(argv[i], "-p")) {
if (i+3 >= argc) {
std::cout << std::endl;
std::cout << "**ERROR** in handling parameters '-p'. Not enough input present." << std::endl;
lf_gl_syntax();
return 1;
}
try {
dval = std::stod(argv[i+1], &pos);
} catch (...) {
std::cout << std::endl;
std::cout << "**ERROR** in handling of field: '" << argv[i+1] << "'" << std::endl;
lf_gl_syntax();
return 1;
}
if (pos != strlen(argv[i+1])) {
std::cout << std::endl;
std::cout << "**ERROR** in handling of field: '" << argv[i+1] << "'" << std::endl;
lf_gl_syntax();
return 1;
}
param[0] = dval;
try {
dval = std::stod(argv[i+2], &pos);
} catch (...) {
std::cout << std::endl;
std::cout << "**ERROR** in handling of width." << std::endl;
lf_gl_syntax();
return 1;
}
if (pos != strlen(argv[i+2])) {
std::cout << std::endl;
std::cout << "**ERROR** in handling of field: '" << argv[i+1] << "'" << std::endl;
lf_gl_syntax();
return 1;
}
param[1] = dval;
try {
dval = std::stod(argv[i+3], &pos);
} catch (...) {
std::cout << std::endl;
std::cout << "**ERROR** in handling of hopp." << std::endl;
lf_gl_syntax();
return 1;
}
if (pos != strlen(argv[i+3])) {
std::cout << std::endl;
std::cout << "**ERROR** in handling of field: '" << argv[i+1] << "'" << std::endl;
lf_gl_syntax();
return 1;
}
param[2] = dval;
i += 3;
} else if (!strcmp(argv[i], "-a")) {
if (i+2 >= argc) {
std::cout << std::endl;
std::cout << "**ERROR** in handling parameters for '-a'. Not enough input present." << std::endl;
lf_gl_syntax();
return 1;
}
param[0] = 0; // ZF approximation
try {
dval = std::stod(argv[i+1], &pos);
} catch (...) {
std::cout << std::endl;
std::cout << "**ERROR** in handling of width." << std::endl;
lf_gl_syntax();
return 1;
}
if (pos != strlen(argv[i+1])) {
std::cout << std::endl;
std::cout << "**ERROR** in handling of field: '" << argv[i+1] << "'" << std::endl;
lf_gl_syntax();
return 1;
}
param[1] = dval;
try {
dval = std::stod(argv[i+2], &pos);
} catch (...) {
std::cout << std::endl;
std::cout << "**ERROR** in handling of hopp." << std::endl;
lf_gl_syntax();
return 1;
}
if (pos != strlen(argv[i+2])) {
std::cout << std::endl;
std::cout << "**ERROR** in handling of field: '" << argv[i+1] << "'" << std::endl;
lf_gl_syntax();
return 1;
}
param[2] = dval;
i += 2;
zf_approx = true;
} else if (!strcmp(argv[i], "-t")) {
if (i+1 >= argc) {
std::cout << std::endl;
std::cout << "**ERROR** in handling option -g. Not enough input present." << std::endl;
lf_gl_syntax();
return 1;
}
try {
dval = std::stod(argv[i+1], &pos);
} catch (...) {
std::cout << std::endl;
std::cout << "**ERROR** in handling of tmax." << std::endl;
lf_gl_syntax();
return 1;
}
if (pos != strlen(argv[i+1])) {
std::cout << std::endl;
std::cout << "**ERROR** in handling of field: '" << argv[i+1] << "'" << std::endl;
lf_gl_syntax();
return 1;
}
tmax = dval;
i++;
} else if (!strcmp(argv[i], "-g")) {
if (i+1 >= argc) {
std::cout << std::endl;
std::cout << "**ERROR** in handling option -g. Not enough input present." << std::endl;
lf_gl_syntax();
return 1;
}
if (!strcmp(argv[i+1], "1")) {
gaussian_only = true;
} else if (!strcmp(argv[i+1], "0")) {
gaussian_only = false;
} else {
std::cout << std::endl;
std::cout << "**ERROR** in handling option -g." << std::endl;
lf_gl_syntax();
return 1;
}
i++;
} else if (!strcmp(argv[i], "-o")) {
if (i+1 >= argc) {
std::cout << std::endl;
std::cout << "**ERROR** in handling option -o. file name missing?" << std::endl;
lf_gl_syntax();
return 1;
}
flnOut = std::string(argv[i+1]);
}
}
if (flnOut == "") {
std::cout << std::endl;
std::cout << "**ERROR** missing output file name." << std::endl;
lf_gl_syntax();
return 1;
}
std::cout << "param: " << param[0] << ", " << param[1] << ", " << param[2] << std::endl;
if (gaussian_only)
std::cout << "Gaussian LF only" << std::endl;
else
std::cout << "Gaussian averaged -> Lorentz LF" << std::endl;
std::cout << "ZF Approx: " << zf_approx << std::endl;
std::cout << "flnOut: " << flnOut << std::endl;
std::vector<double> tt;
std::vector<double> pol;
if (zf_approx) {
lf_zf_approx(gaussian_only, param, tmax, tt, pol);
} else { // full calculation
if (gaussian_only) {
PGKT_LF gkt_lf(param, tmax);
if (!gkt_lf.IsValid()) {
std::cout << "**ERROR** in Gaussian LF calculation" << std::endl;
return 2;
}
tt = gkt_lf.GetTime();
pol = gkt_lf.GetPol();
} else {
PLGKT_LF lgkt_lf(param, tmax);
if (!lgkt_lf.IsValid()) {
std::cout << "**ERROR** in Gaussian/Lorentzian LF calculation" << std::endl;
return 2;
}
tt = lgkt_lf.GetTime();
pol = lgkt_lf.GetPol();
}
}
lf_gl_write(flnOut, zf_approx, gaussian_only, param, tt, pol);
return 0;
}

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2011-2024 by Andreas Suter *
* Copyright (C) 2011-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2011-2024 by Andreas Suter *
* Copyright (C) 2011-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2011-2024 by Andreas Suter *
* Copyright (C) 2011-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2011-2024 by Andreas Suter *
* Copyright (C) 2011-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -10,7 +10,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2011-2024 by Andreas Suter *
* Copyright (C) 2011-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2009-2024 by Andreas Suter *
* Copyright (C) 2009-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2011-2024 by Andreas Suter *
* Copyright (C) 2011-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -22,7 +22,7 @@ set(prefix "${CMAKE_INSTALL_PREFIX}")
set(exec_prefix "\$\{prefix\}")
set(libdir "\$\{exec_prefix\}/lib")
set(includedir "\$\{prefix\}/include")
set(MUSR_ROOT_VERSION "1.0.0")
set(MUSR_ROOT_VERSION "1.1.0")
set(MUSR_ROOT_LIBRARY_NAME "TMusrRunHeader")
configure_file("TMusrRunHeader.pc.in" "TMusrRunHeader.pc" @ONLY)

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2024 by Andreas Suter *
* Copyright (C) 2007-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *
@ -395,6 +395,23 @@ Bool_t TMusrRunHeader::FillFolder(TFolder *folder)
return true;
}
//--------------------------------------------------------------------------
// FillDirectory (public)
//--------------------------------------------------------------------------
/**
* <p>Fills the RunHeader directory. This is needed to write it to a ROOT file.
* It walks through all information and attaches it to the directory or replaces
* it, if it is already present.
*
* \param dir to be filled
*/
Bool_t TMusrRunHeader::FillDirectory(TDirectoryFile *dir)
{
// NOT YET IMPLEMENTED
return true;
}
//--------------------------------------------------------------------------
// GetTypeOfPath (public)
//--------------------------------------------------------------------------
@ -873,6 +890,22 @@ Bool_t TMusrRunHeader::ExtractAll(TFolder *folder)
return true;
}
//--------------------------------------------------------------------------
// ExtractAll (public)
//--------------------------------------------------------------------------
/**
* <p>Reads all data from an open ROOT-file structure and feeds all the necessary
* internal data objects.
*
* \param dir
*/
Bool_t TMusrRunHeader::ExtractAll(TDirectoryFile *dir)
{
// NOT YET IMPLEMENTED
return true;
}
//--------------------------------------------------------------------------
// ExtractHeaderInformation (public)
//--------------------------------------------------------------------------

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2024 by Andreas Suter *
* Copyright (C) 2007-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *
@ -38,6 +38,7 @@
#include <TObjString.h>
#include <TObjArray.h>
#include <TFolder.h>
#include <TDirectoryFile.h>
#define MRH_UNDEFINED -9.99e99
@ -129,8 +130,10 @@ public:
virtual TString GetFileName() { return fFileName; }
virtual Bool_t FillFolder(TFolder *folder);
virtual Bool_t FillDirectory(TDirectoryFile *dir);
virtual Bool_t ExtractAll(TFolder *folder);
virtual Bool_t ExtractAll(TDirectoryFile *folder);
virtual Bool_t ExtractHeaderInformation(TObjArray *headerInfo, TString path);
virtual TString GetTypeOfPath(TString pathName);

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2024 by Andreas Suter *
* Copyright (C) 2007-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2009-2024 by Andreas Suter *
* Copyright (C) 2009-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2009-2024 by Andreas Suter *
* Copyright (C) 2009-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2009-2024 by Andreas Suter *
* Copyright (C) 2009-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2009-2024 by Andreas Suter *
* Copyright (C) 2009-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2009-2024 by Andreas Suter *
* Copyright (C) 2009-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2009-2024 by Andreas Suter *
* Copyright (C) 2009-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

Some files were not shown because too many files have changed in this diff Show More