Compare commits
38 Commits
Author | SHA1 | Date | |
---|---|---|---|
0943f1f061 | |||
769a828a76 | |||
ecec59c8a3 | |||
66af890157 | |||
eb98c9727c | |||
079baa3edf | |||
7df47a05f3 | |||
15c5b02c8b | |||
37f099542a | |||
c2fb166d3b | |||
e8806c3e72 | |||
91a45cad90 | |||
d1f025a8c2 | |||
e525abe614 | |||
005b33c379 | |||
3bcc382679 | |||
249d6ff97c | |||
69ab03d5ae | |||
819d209863 | |||
bcc1597e30 | |||
9fa90c24fb | |||
236a702d36 | |||
09f9782a31 | |||
f99f71a8db | |||
6e60013037 | |||
e38fa47961 | |||
764cdf4e51 | |||
e5ff0fa743 | |||
e26fa4eea2 | |||
5648757389 | |||
c3b4c7c3b1 | |||
e233c860d1 | |||
c230bfb1bc | |||
5119b1cd13 | |||
d937324885 | |||
f7e5c53879 | |||
3796925e93 | |||
d5343a0073 |
@ -1,7 +1,7 @@
|
||||
# - musrfit
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
|
||||
project(musrfit VERSION 1.9.8 LANGUAGES C CXX)
|
||||
project(musrfit VERSION 1.9.9 LANGUAGES C CXX)
|
||||
|
||||
#--- musrfit specific options -------------------------------------------------
|
||||
option(nexus "build optional NeXus support. Needed for ISIS" OFF)
|
||||
@ -224,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)
|
||||
|
@ -12,6 +12,11 @@ or
|
||||
|
||||
https://bitbucket.org/muonspin/musrfit/commits/all
|
||||
|
||||
Release of V1.9.9, 2025/06/08
|
||||
=============================
|
||||
|
||||
add THEORY functions for local Gaussian / global Lorentzian, and a simple F-mu-F function.
|
||||
|
||||
Release of V1.9.8, 2025/03/24
|
||||
=============================
|
||||
|
||||
|
@ -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 ${SRC_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 ${SRC_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
|
@ -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}")
|
||||
|
@ -73,7 +73,7 @@ set(prefix "${CMAKE_INSTALL_PREFIX}")
|
||||
set(exec_prefix "\$\{prefix\}")
|
||||
set(libdir "\$\{exec_prefix\}/lib")
|
||||
set(includedir "\$\{prefix\}/include")
|
||||
set(MUSR_VERSION "1.4.0")
|
||||
set(MUSR_VERSION "1.5.0")
|
||||
set(MUSR_LIBRARY_NAME "PMusr")
|
||||
configure_file("PMusr.pc.in" "PMusr.pc" @ONLY)
|
||||
set(USERFCN_LIBRARY_NAME "PUserFcnBase")
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
52
src/external/LF_GL/CMakeLists.txt
vendored
Normal file
52
src/external/LF_GL/CMakeLists.txt
vendored
Normal 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
264
src/external/LF_GL/PGKT_LF.cpp
vendored
Normal 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> ¶m, 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
65
src/external/LF_GL/PGKT_LF.h
vendored
Normal 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> ¶m, 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
116
src/external/LF_GL/PLGKT_LF.cpp
vendored
Normal 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> ¶m, 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
53
src/external/LF_GL/PLGKT_LF.h
vendored
Normal 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> ¶m, 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_
|
62
src/external/LF_GL/docu/dynamicGL_LF.bib
vendored
Normal file
62
src/external/LF_GL/docu/dynamicGL_LF.bib
vendored
Normal 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
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
135
src/external/LF_GL/docu/dynamicGL_LF.tex
vendored
Normal 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
19
src/external/LF_GL/docu/f_r.C
vendored
Normal 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
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
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
298
src/external/LF_GL/main.cpp
vendored
Normal 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> ¶m,
|
||||
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> ¶m,
|
||||
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;
|
||||
}
|
2
src/external/MusrRoot/CMakeLists.txt
vendored
2
src/external/MusrRoot/CMakeLists.txt
vendored
@ -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)
|
||||
|
||||
|
33
src/external/MusrRoot/TMusrRunHeader.cpp
vendored
33
src/external/MusrRoot/TMusrRunHeader.cpp
vendored
@ -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)
|
||||
//--------------------------------------------------------------------------
|
||||
|
3
src/external/MusrRoot/TMusrRunHeader.h
vendored
3
src/external/MusrRoot/TMusrRunHeader.h
vendored
@ -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);
|
||||
|
3
src/external/libCuba/src/common/stddecl.h
vendored
3
src/external/libCuba/src/common/stddecl.h
vendored
@ -16,6 +16,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
@ -324,7 +325,7 @@ if( fail == 0 && (t)->statefile && KEEPFILE == 0 ) unlink((t)->statefile)
|
||||
#define Extern extern "C"
|
||||
#else
|
||||
#define Extern extern
|
||||
typedef enum { false, true } bool;
|
||||
//typedef enum { false, true } bool;
|
||||
#endif
|
||||
|
||||
typedef const char cchar;
|
||||
|
26
src/external/mud/src/mud.h
vendored
26
src/external/mud/src/mud.h
vendored
@ -4,7 +4,7 @@
|
||||
* mud.h Declarations for MUD
|
||||
* v1.3
|
||||
*
|
||||
* Copyright (C) 1994-2025 TRIUMF (Vancouver, Canada)
|
||||
* Copyright (C) 1994-2021 TRIUMF (Vancouver, Canada)
|
||||
*
|
||||
* Authors: T. Whidden, D. Arseneau, S. Daviel
|
||||
*
|
||||
@ -25,14 +25,13 @@
|
||||
* 25-Nov-2009 DJA 64-bit linux
|
||||
* 25-Jun-2017 DJA Allow use in C++ (ROOT); shared lib.
|
||||
* 14-Aug-2019 DJA Use stdint.h, casts in printf
|
||||
* 01-Jun-2021 DJA Add arm64 arch as little-endian
|
||||
* 26-Aug-2021 DJA Declare caddr_t in all Win.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#ifdef __CINT__
|
||||
typedef char* caddr_t;
|
||||
#endif /* __CINT __ */
|
||||
|
||||
/*
|
||||
* FORMAT IDs - Must be unique!
|
||||
@ -133,25 +132,25 @@ typedef int32_t INT32;
|
||||
typedef uint32_t UINT32;
|
||||
typedef float REAL32;
|
||||
typedef double REAL64;
|
||||
#else /*no stding.h */
|
||||
#else /*no stdint.h */
|
||||
typedef int STATUS;
|
||||
typedef char INT8;
|
||||
typedef unsigned char UINT8;
|
||||
typedef short INT16;
|
||||
typedef unsigned short UINT16;
|
||||
#if defined(__alpha) || defined(__linux) || defined(__MACH__) || defined(__arm64)
|
||||
#if defined(__alpha)||defined(__linux)||defined(__MACH__) || defined(__arm64)
|
||||
typedef int INT32;
|
||||
typedef unsigned int UINT32;
|
||||
#else
|
||||
typedef long INT32;
|
||||
typedef unsigned long UINT32;
|
||||
#endif /* __alpha || __linux || __MACH__*/
|
||||
#endif /* __alpha || __linux || __MACH__ || __arm64 */
|
||||
typedef float REAL32;
|
||||
typedef double REAL64;
|
||||
#if (defined(__alpha)&&defined(vms)) || defined(__BORLANDC__) || defined(__TURBOC__)
|
||||
#endif /* _STDINT_H */
|
||||
#if (defined(__alpha)&&defined(vms)) || defined( __CINT__ ) || defined(_WIN32)
|
||||
typedef char* caddr_t;
|
||||
#endif
|
||||
#endif /* _STDINT_HNOSTDINT */
|
||||
typedef UINT32 TIME;
|
||||
#ifndef BOOL_DEFINED
|
||||
#define BOOL_DEFINED
|
||||
@ -184,10 +183,10 @@ typedef UINT32 BOOL;
|
||||
/*
|
||||
* c_utils.h, Defines for C utilities
|
||||
*/
|
||||
#if defined(vms) || defined(__MSDOS__)
|
||||
#if defined(vms) || defined(__MSDOS__) || defined(_WIN32)
|
||||
#define bcopy( b1, b2, len ) memcpy(b2,b1,len)
|
||||
#define bzero( b, len ) memset(b,(char)0,len)
|
||||
#endif /* vms || __MSDOS__ */
|
||||
#endif /* vms || __MSDOS__ || _WIN32 */
|
||||
#ifndef _C_UTILS_H_ /* conflict with c_utils.h */
|
||||
#define _max( a, b ) ( ( (a) > (b) ) ? (a) : (b) )
|
||||
#define _min( a, b ) ( ( (a) < (b) ) ? (a) : (b) )
|
||||
@ -204,7 +203,6 @@ typedef UINT32 BOOL;
|
||||
#define strdup( s ) strcpy((char*)malloc(strlen(s)+1),s)
|
||||
#endif /* vms || mips&&!sgi */
|
||||
/*#endif */
|
||||
typedef int (*MUD_PROC)();
|
||||
|
||||
typedef enum {
|
||||
MUD_ENCODE = 0,
|
||||
@ -215,6 +213,8 @@ typedef enum {
|
||||
MUD_HEADS = 5
|
||||
} MUD_OPT;
|
||||
|
||||
typedef int (*MUD_PROC)(MUD_OPT, void *p1, void *p2);
|
||||
|
||||
typedef enum {
|
||||
MUD_ONE = 1,
|
||||
MUD_ALL = 2,
|
||||
@ -427,7 +427,7 @@ typedef struct {
|
||||
#define MUD_instanceID( pM ) (((MUD_SEC*)pM)->core.instanceID)
|
||||
|
||||
|
||||
#if defined(__MSDOS__) || defined(__i386__) || defined(__i586__) || defined(__i686__) || defined(vax) || defined(__alpha) || defined(__amd64) || defined(__arm64) || (defined(__mips)&&!defined(__sgi))
|
||||
#if defined(__MSDOS__) || defined(_WIN32) || defined(__i386__) || defined(__i586__) || defined(__i686__) || defined(vax) || defined(__alpha) || defined(__amd64) || defined(__arm64) || (defined(__mips)&&!defined(__sgi))
|
||||
#define MUD_LITTLE_ENDIAN 1
|
||||
#else
|
||||
#define MUD_BIG_ENDIAN 1
|
||||
|
@ -1,21 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "Generating header for git hash" $1 $2
|
||||
GIT_HEADER="$1/$2"
|
||||
if [ -z "$2" ]; then
|
||||
GIT_HEADER="$1/git-revision.h"
|
||||
fi
|
||||
echo "-- Generating header for git hash"
|
||||
GIT_HEADER="src/git-revision.h"
|
||||
[ -d src ] || mkdir src
|
||||
|
||||
GIT_BRANCH=`git rev-parse --abbrev-ref HEAD`
|
||||
|
||||
GIT_VERSION=`git log -n 1 --pretty=format:"%ad - %h"`
|
||||
if grep --quiet "$GIT_VERSION" $GIT_HEADER; then
|
||||
echo "No need to generate new $GIT_HEADER - git hash is unchanged"
|
||||
exit 0;
|
||||
if [ "$(grep -ics "$GIT_VERSION" $GIT_HEADER)" = 1 ]
|
||||
then
|
||||
echo "-- No need to generate new $GIT_HEADER - git hash is unchanged"
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
echo "git branch is : " $GIT_BRANCH
|
||||
echo "git version is : " $GIT_VERSION
|
||||
echo "-- git branch is : " $GIT_BRANCH
|
||||
echo "-- git version is : " $GIT_VERSION
|
||||
|
||||
echo "#ifndef GIT_VERSION_H" > $GIT_HEADER
|
||||
echo "#define GIT_VERSION_H" >> $GIT_HEADER
|
||||
@ -25,4 +24,4 @@ echo "#define GIT_CURRENT_SHA1 \"$GIT_VERSION\"" >> $GIT_HEADER
|
||||
echo "" >> $GIT_HEADER
|
||||
echo "#endif //GIT_VERSION_H" >> $GIT_HEADER
|
||||
|
||||
echo "file is generated into" $GIT_HEADER
|
||||
echo "-- file is generated into" $GIT_HEADER
|
||||
|
@ -54,25 +54,29 @@
|
||||
#define THEORY_STATIC_LORENTZ_KT 8
|
||||
#define THEORY_STATIC_LORENTZ_KT_LF 9
|
||||
#define THEORY_DYNAMIC_LORENTZ_KT_LF 10
|
||||
#define THEORY_COMBI_LGKT 11
|
||||
#define THEORY_STR_KT 12
|
||||
#define THEORY_SPIN_GLASS 13
|
||||
#define THEORY_RANDOM_ANISOTROPIC_HYPERFINE 14
|
||||
#define THEORY_ABRAGAM 15
|
||||
#define THEORY_TF_COS 16
|
||||
#define THEORY_INTERNAL_FIELD 17
|
||||
#define THEORY_INTERNAL_FIELD_KORNILOV 18
|
||||
#define THEORY_INTERNAL_FIELD_LARKIN 19
|
||||
#define THEORY_BESSEL 20
|
||||
#define THEORY_INTERNAL_BESSEL 21
|
||||
#define THEORY_SKEWED_GAUSS 22
|
||||
#define THEORY_STATIC_ZF_NK 23
|
||||
#define THEORY_STATIC_TF_NK 24
|
||||
#define THEORY_DYNAMIC_ZF_NK 25
|
||||
#define THEORY_DYNAMIC_TF_NK 26
|
||||
#define THEORY_MU_MINUS_EXP 27
|
||||
#define THEORY_POLYNOM 28
|
||||
#define THEORY_USER_FCN 29
|
||||
#define THEORY_DYNAMIC_GAULOR_FAST_KT_ZF 11
|
||||
#define THEORY_DYNAMIC_GAULOR_FAST_KT_LF 12
|
||||
#define THEORY_DYNAMIC_GAULOR_KT_LF 13
|
||||
#define THEORY_COMBI_LGKT 14
|
||||
#define THEORY_STR_KT 15
|
||||
#define THEORY_SPIN_GLASS 16
|
||||
#define THEORY_RANDOM_ANISOTROPIC_HYPERFINE 17
|
||||
#define THEORY_ABRAGAM 18
|
||||
#define THEORY_TF_COS 19
|
||||
#define THEORY_INTERNAL_FIELD 20
|
||||
#define THEORY_INTERNAL_FIELD_KORNILOV 21
|
||||
#define THEORY_INTERNAL_FIELD_LARKIN 22
|
||||
#define THEORY_BESSEL 23
|
||||
#define THEORY_INTERNAL_BESSEL 24
|
||||
#define THEORY_SKEWED_GAUSS 25
|
||||
#define THEORY_STATIC_ZF_NK 26
|
||||
#define THEORY_STATIC_TF_NK 27
|
||||
#define THEORY_DYNAMIC_ZF_NK 28
|
||||
#define THEORY_DYNAMIC_TF_NK 29
|
||||
#define THEORY_F_MU_F 30
|
||||
#define THEORY_MU_MINUS_EXP 31
|
||||
#define THEORY_POLYNOM 32
|
||||
#define THEORY_USER_FCN 33
|
||||
|
||||
// function parameter tags, i.e. how many parameters has a specific function
|
||||
// if there is a comment with a (tshift), the number of parameters is increased by one
|
||||
@ -87,6 +91,9 @@
|
||||
#define THEORY_PARAM_STATIC_LORENTZ_KT 1 // damping (tshift)
|
||||
#define THEORY_PARAM_STATIC_LORENTZ_KT_LF 2 // frequency, damping (tshift)
|
||||
#define THEORY_PARAM_DYNAMIC_LORENTZ_KT_LF 3 // frequency, damping, hop-rate (tshift)
|
||||
#define THEORY_PARAM_DYNAMIC_GAULOR_FAST_KT_ZF 2 // damping, hop-rate (tshift)
|
||||
#define THEORY_PARAM_DYNAMIC_GAULOR_FAST_KT_LF 3 // frequency, damping, hop-rate (tshift)
|
||||
#define THEORY_PARAM_DYNAMIC_GAULOR_KT_LF 3 // frequency, damping, hop-rate (tshift)
|
||||
#define THEORY_PARAM_COMBI_LGKT 2 // Lorentz rate, Gauss rate (tshift)
|
||||
#define THEORY_PARAM_STR_KT 2 // rate, exponent (tshift)
|
||||
#define THEORY_PARAM_SPIN_GLASS 3 // rate, hop-rate, order parameter (tshift)
|
||||
@ -103,10 +110,11 @@
|
||||
#define THEORY_PARAM_STATIC_TF_NK 4 // phase, frequency, damping D0, R_b=DGbG/D0 (tshift)
|
||||
#define THEORY_PARAM_DYNAMIC_ZF_NK 3 // damping D0, R_b=DGbG/D0, nu_c (tshift)
|
||||
#define THEORY_PARAM_DYNAMIC_TF_NK 5 // phase, frequency, damping D0, R_b=DGbG/D0, nu_c (tshift)
|
||||
#define THEORY_PARAM_F_MU_F 1 // frequency (tshift)
|
||||
#define THEORY_PARAM_MU_MINUS_EXP 6 // N0, tau, A, damping, phase, frequency (tshift)
|
||||
|
||||
// number of available user functions
|
||||
#define THEORY_MAX 30
|
||||
#define THEORY_MAX 34
|
||||
|
||||
// maximal number of parameters. Needed in the contents of LF
|
||||
#define THEORY_MAX_PARAM 10
|
||||
@ -171,6 +179,15 @@ static PTheoDataBase fgTheoDataBase[THEORY_MAX] = {
|
||||
{THEORY_DYNAMIC_LORENTZ_KT_LF, THEORY_PARAM_DYNAMIC_LORENTZ_KT_LF, true,
|
||||
"dynExpKTLF", "dektlf", "(frequency damping hopping-rate)", "(frequency damping hopping-rate tshift)"},
|
||||
|
||||
{THEORY_DYNAMIC_GAULOR_FAST_KT_ZF, THEORY_PARAM_DYNAMIC_GAULOR_FAST_KT_ZF, true,
|
||||
"dynGLKT_F_ZF", "dglktfzf", "(damping hopping-rate)", "(damping hopping-rate tshift)"},
|
||||
|
||||
{THEORY_DYNAMIC_GAULOR_FAST_KT_LF, THEORY_PARAM_DYNAMIC_GAULOR_FAST_KT_LF, true,
|
||||
"dynGLKT_F_LF", "dglktflf", "(frequency damping hopping-rate)", "(frequency damping hopping-rate tshift)"},
|
||||
|
||||
{THEORY_DYNAMIC_GAULOR_KT_LF, THEORY_PARAM_DYNAMIC_GAULOR_KT_LF, true,
|
||||
"dynGLKT_LF", "dglktlf", "(frequency damping hopping-rate)", "(frequency damping hopping-rate tshift)"},
|
||||
|
||||
{THEORY_COMBI_LGKT, THEORY_PARAM_COMBI_LGKT, false,
|
||||
"combiLGKT", "lgkt", "(lorentzRate gaussRate)", "(lorentzRate gaussRate tshift)"},
|
||||
|
||||
@ -219,6 +236,9 @@ static PTheoDataBase fgTheoDataBase[THEORY_MAX] = {
|
||||
{THEORY_DYNAMIC_TF_NK, THEORY_PARAM_DYNAMIC_TF_NK, false,
|
||||
"dynamicNKTF", "dnktf", "(phase frequency damping_D0 R_b nu_c)", "(phase frequency damping_D0 R_b nu_c tshift)"},
|
||||
|
||||
{THEORY_F_MU_F, THEORY_PARAM_F_MU_F, false,
|
||||
"F_mu_F", "fmuf", "(frequency)", "(frequency tshift)"},
|
||||
|
||||
{THEORY_MU_MINUS_EXP, THEORY_PARAM_MU_MINUS_EXP, false,
|
||||
"muMinusExpTF", "mmsetf", "(N0 tau A lambda phase nu)", "(N0 tau A lambda phase nu tshift)"},
|
||||
|
||||
@ -261,6 +281,9 @@ class PTheory
|
||||
virtual Double_t StaticLorentzKT(Double_t t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual Double_t StaticLorentzKTLF(Double_t t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual Double_t DynamicLorentzKTLF(Double_t t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual Double_t DynamicGauLorKTZFFast(Double_t t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual Double_t DynamicGauLorKTLFFast(Double_t t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual Double_t DynamicGauLorKTLF(Double_t t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual Double_t CombiLGKT(Double_t t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual Double_t StrKT(Double_t t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual Double_t SpinGlass(Double_t t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
@ -277,6 +300,7 @@ class PTheory
|
||||
virtual Double_t StaticNKTF(Double_t t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual Double_t DynamicNKZF(Double_t t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual Double_t DynamicNKTF(Double_t t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual Double_t FmuF(Double_t t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual Double_t MuMinusExpTF(Double_t t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual Double_t Polynom(Double_t t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual Double_t UserFcn(Double_t t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
@ -286,6 +310,7 @@ class PTheory
|
||||
virtual Double_t GetLFIntegralValue(const Double_t t) const;
|
||||
virtual void CalculateDynKTLF(const Double_t *val, Int_t tag) const;
|
||||
virtual Double_t GetDynKTLFValue(const Double_t t) const;
|
||||
virtual Double_t GetDyn_GL_KTLFValue(const Double_t t) const;
|
||||
|
||||
// variables
|
||||
Bool_t fValid; ///< flag to tell if the theory is valid
|
||||
@ -307,6 +332,7 @@ class PTheory
|
||||
mutable PDoubleVector fLFIntegral; ///< needed for LF. Keeps the non-analytic integral values
|
||||
mutable Double_t fDynLFdt; ///< needed for LF. Keeps the time step for the dynamic LF calculation, used in the integral equation approach
|
||||
mutable PDoubleVector fDynLFFuncValue; ///< needed for LF. Keeps the dynamic LF KT function values
|
||||
mutable PDoubleVector fDyn_GL_LFFuncValue; ///< needed for LF. Keeps the dynamic LF local Gauss/global Lorentzian KT function values
|
||||
};
|
||||
|
||||
#endif // _PTHEORY_H_
|
||||
|
@ -39,7 +39,9 @@
|
||||
#include "TString.h"
|
||||
#include "TFile.h"
|
||||
#include "TFolder.h"
|
||||
#include "TDirectoryFile.h"
|
||||
#include "TKey.h"
|
||||
#include "TList.h"
|
||||
#include "TObjArray.h"
|
||||
#include "TObjString.h"
|
||||
#include "TSystemFile.h"
|
||||
@ -73,7 +75,7 @@ class PMusrRoot2Xml
|
||||
virtual UInt_t GetNoOfDetectors() { return fNoOfDetectors; }
|
||||
|
||||
private:
|
||||
enum EFolderTag {eUnkown, eDecayAnaModule, eSlowControlAnaModule};
|
||||
enum fNodeTag {eUnkown, eDecayAnaModule, eSlowControlAnaModule};
|
||||
|
||||
std::vector<std::string> fXmlData; ///< keeps the XML structure dump of the ROOT file
|
||||
|
||||
@ -82,14 +84,15 @@ class PMusrRoot2Xml
|
||||
Bool_t fValid; ///< true if the conversion was fine
|
||||
TString fFileName; ///< file name of the ROOT file
|
||||
TString fXmlDumpFileName; ///< file name of the XML dump file
|
||||
EFolderTag fFolderTag; ///< switch indicating which kind of TFolder object is found
|
||||
fNodeTag fNodeTag; ///< switch indicating which kind of TFolder or TDirectoryFile object is found
|
||||
|
||||
UInt_t fNoOfDecayHistos; ///< number of decay histos in the DecayAnaModule
|
||||
UInt_t fNoOfHistos; ///< number of histos from run header
|
||||
UInt_t fNoOfRedGreenOffsets; ///< number of RedGreen offsets
|
||||
UInt_t fNoOfDetectors; ///< number of detector entries in the header
|
||||
UInt_t fNoOfDecayHistos{0}; ///< number of decay histos in the DecayAnaModule
|
||||
UInt_t fNoOfHistos{0}; ///< number of histos from run header
|
||||
UInt_t fNoOfRedGreenOffsets{0}; ///< number of RedGreen offsets
|
||||
UInt_t fNoOfDetectors{0}; ///< number of detector entries in the header
|
||||
|
||||
virtual void SortHistoFolders();
|
||||
virtual void DumpDirectory(TDirectoryFile *dir, UInt_t offset);
|
||||
virtual void DumpFolder(TFolder *folder, UInt_t offset);
|
||||
virtual void DumpObjArray(TObjArray *obj, UInt_t offset);
|
||||
virtual void DumpEntry(TObject *obj, UInt_t offset);
|
||||
@ -105,13 +108,9 @@ class PMusrRoot2Xml
|
||||
PMusrRoot2Xml::PMusrRoot2Xml(const char *fileName, bool quiet, bool keep) : fQuiet(quiet), fKeep(keep), fFileName(fileName)
|
||||
{
|
||||
fXmlDumpFileName = "__MusrRootXmlDump.xml";
|
||||
fFolderTag = eUnkown;
|
||||
fNodeTag = eUnkown;
|
||||
fValid = false;
|
||||
fXmlData.clear();
|
||||
fNoOfDecayHistos = 0;
|
||||
fNoOfHistos = 0;
|
||||
fNoOfRedGreenOffsets = 0;
|
||||
fNoOfDetectors = 0;
|
||||
|
||||
// read assumed MusrRoot file
|
||||
TFile f(fFileName.Data());
|
||||
@ -127,7 +126,8 @@ PMusrRoot2Xml::PMusrRoot2Xml(const char *fileName, bool quiet, bool keep) : fQui
|
||||
TIter next = f.GetListOfKeys();
|
||||
TKey *key;
|
||||
TFolder *folder;
|
||||
TString str, tag;
|
||||
TDirectoryFile *dir;
|
||||
TString str;
|
||||
|
||||
UInt_t offset = 2;
|
||||
|
||||
@ -137,6 +137,9 @@ PMusrRoot2Xml::PMusrRoot2Xml(const char *fileName, bool quiet, bool keep) : fQui
|
||||
if (str == "TFolder") {
|
||||
folder = dynamic_cast<TFolder*>(key->ReadObj());
|
||||
CheckClass(folder, str, offset);
|
||||
} else if (str == "TDirectoryFile") {
|
||||
dir = dynamic_cast<TDirectoryFile*>(key->ReadObj());
|
||||
CheckClass(dir, str, offset);
|
||||
}
|
||||
}
|
||||
if (!fQuiet) std::cout << std::endl;
|
||||
@ -226,6 +229,30 @@ void PMusrRoot2Xml::SortHistoFolders()
|
||||
temp_xml_data.clear();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Dump TDirectoryFile structure.
|
||||
*
|
||||
* \param dir TDirectoryFile object found in the ROOT file
|
||||
* \param offset needed to indent dump info
|
||||
*/
|
||||
void PMusrRoot2Xml::DumpDirectory(TDirectoryFile *dir, UInt_t offset)
|
||||
{
|
||||
TString offsetStr="";
|
||||
for (UInt_t i=0; i<offset; i++)
|
||||
offsetStr += " ";
|
||||
|
||||
TList *ll = dir->GetListOfKeys();
|
||||
TString str;
|
||||
TObject *oo;
|
||||
for (TObject *obj: *ll) {
|
||||
oo = static_cast<TKey*>(obj)->ReadObj();
|
||||
if (!fQuiet) std::cout << std::endl << offsetStr << "name: " << oo->GetName() << ", class name: " << oo->ClassName();
|
||||
str = oo->ClassName();
|
||||
CheckClass(oo, str, offset);
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Dump folder structure.
|
||||
@ -343,7 +370,7 @@ void PMusrRoot2Xml::DumpEntry(TObject *obj, UInt_t offset)
|
||||
offsetStr += " ";
|
||||
|
||||
TString nameTag(""), typeTag("");
|
||||
switch (fFolderTag) {
|
||||
switch (fNodeTag) {
|
||||
case eDecayAnaModule:
|
||||
nameTag = "HistoName";
|
||||
typeTag = "HistoType";
|
||||
@ -359,7 +386,7 @@ void PMusrRoot2Xml::DumpEntry(TObject *obj, UInt_t offset)
|
||||
break;
|
||||
}
|
||||
|
||||
if (fFolderTag == eDecayAnaModule)
|
||||
if (fNodeTag == eDecayAnaModule)
|
||||
fNoOfDecayHistos++;
|
||||
|
||||
TString str;
|
||||
@ -389,34 +416,37 @@ void PMusrRoot2Xml::CheckClass(TObject *obj, TString str, UInt_t offset)
|
||||
for (UInt_t i=0; i<offset; i++)
|
||||
offsetStr += " ";
|
||||
|
||||
if (str == "TFolder") {
|
||||
if ((str == "TFolder") || (str == "TDirectoryFile")) {
|
||||
TString xmlTagName(TString(obj->GetName()));
|
||||
|
||||
// set folder tag
|
||||
if (!xmlTagName.CompareTo("DecayAnaModule"))
|
||||
fFolderTag = eDecayAnaModule;
|
||||
fNodeTag = eDecayAnaModule;
|
||||
else if (!xmlTagName.CompareTo("SCAnaModule"))
|
||||
fFolderTag = eSlowControlAnaModule;
|
||||
fNodeTag = eSlowControlAnaModule;
|
||||
else if (!xmlTagName.CompareTo("SCAnaModule"))
|
||||
fFolderTag = eSlowControlAnaModule;
|
||||
fNodeTag = eSlowControlAnaModule;
|
||||
else
|
||||
fFolderTag = eUnkown;
|
||||
fNodeTag = eUnkown;
|
||||
|
||||
offset += 2;
|
||||
str = offsetStr + "<" + xmlTagName + ">";
|
||||
fXmlData.push_back(str.Data());
|
||||
TString sstr = offsetStr + "<" + xmlTagName + ">";
|
||||
fXmlData.push_back(sstr.Data());
|
||||
|
||||
DumpFolder(dynamic_cast<TFolder*>(obj), offset);
|
||||
if (str == "TFolder")
|
||||
DumpFolder(dynamic_cast<TFolder*>(obj), offset);
|
||||
else
|
||||
DumpDirectory(dynamic_cast<TDirectoryFile*>(obj), offset);
|
||||
|
||||
str = offsetStr + "</" + xmlTagName + ">";
|
||||
fXmlData.push_back(str.Data());
|
||||
sstr = offsetStr + "</" + xmlTagName + ">";
|
||||
fXmlData.push_back(sstr.Data());
|
||||
} else if (str == "TObjArray") {
|
||||
offset += 2;
|
||||
DumpObjArray(dynamic_cast<TObjArray*>(obj), offset);
|
||||
} else {
|
||||
// filter out the proper entry tag
|
||||
TString entryTag("");
|
||||
switch (fFolderTag) {
|
||||
switch (fNodeTag) {
|
||||
case eDecayAnaModule:
|
||||
entryTag = TString("DecayHistoEntry");
|
||||
break;
|
||||
|
@ -101,6 +101,7 @@ if (APPLE)
|
||||
MACOSX_BUNDLE_INFO_STRING "mupp is used to plot parameters from musrfit collections."
|
||||
MACOSX_BUNDLE_ICON_FILE "mupp.icns"
|
||||
MACOSX_BUNDLE_LONG_VERSION_STRING "${mupp_VERSION}"
|
||||
MACOSX_BUNDLE_GUI_IDENTIFIER "ch.psi.lmu.mupp"
|
||||
MACOSX_FRAMEWORK_IDENTIFIER ch.psi.mupp
|
||||
MACOSX_BUNDLE_COPYRIGHT "Andreas Suter"
|
||||
RESOURCE "${RESOURCE_FILES}"
|
||||
|
@ -156,8 +156,12 @@ bool PmuppAdminXMLParser::startElement()
|
||||
|
||||
if (qName == "path_file_name") {
|
||||
fKeyWord = eRecentFile;
|
||||
} else if (qName == "dark_theme") {
|
||||
fKeyWord = eDarkTheme;
|
||||
} else if (qName == "ignore_theme_auto_detection") {
|
||||
fKeyWord = eIgnoreThemeAutoDetection;
|
||||
} else if (qName == "dark_theme_icon_menu") {
|
||||
fKeyWord = eDarkThemeIconsMenu;
|
||||
} else if (qName == "dark_theme_icon_toolbar") {
|
||||
fKeyWord = eDarkThemeIconsToolbar;
|
||||
} else if (qName == "marker") {
|
||||
fKeyWord = eMarker;
|
||||
} else if (qName == "color") {
|
||||
@ -201,11 +205,23 @@ bool PmuppAdminXMLParser::characters()
|
||||
case eRecentFile:
|
||||
fAdmin->addRecentFile(QString(str.toLatin1()).trimmed());
|
||||
break;
|
||||
case eDarkTheme:
|
||||
if ((str == "yes") || (str == "1") || (str == "true"))
|
||||
fAdmin->setTheme(true);
|
||||
case eIgnoreThemeAutoDetection:
|
||||
if ((str == "yes") || (str == "y") || (str == "1") || (str == "true"))
|
||||
fAdmin->setIgnoreThemeAutoDetection(true);
|
||||
else
|
||||
fAdmin->setTheme(false);
|
||||
fAdmin->setIgnoreThemeAutoDetection(false);
|
||||
break;
|
||||
case eDarkThemeIconsMenu:
|
||||
if ((str == "yes") || (str == "y") || (str == "1") || (str == "true"))
|
||||
fAdmin->setThemeIconsMenu(true);
|
||||
else
|
||||
fAdmin->setThemeIconsMenu(false);
|
||||
break;
|
||||
case eDarkThemeIconsToolbar:
|
||||
if ((str == "yes") || (str == "y") || (str == "1") || (str == "true"))
|
||||
fAdmin->setThemeIconsToolbar(true);
|
||||
else
|
||||
fAdmin->setThemeIconsToolbar(false);
|
||||
break;
|
||||
case eMarker:
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
|
||||
@ -280,7 +296,7 @@ bool PmuppAdminXMLParser::endDocument()
|
||||
* <p>Initializes that PmuppAdmin object, and calls the XML parser which feeds
|
||||
* the object variables.
|
||||
*/
|
||||
PmuppAdmin::PmuppAdmin() : QObject(), fDarkTheme(false)
|
||||
PmuppAdmin::PmuppAdmin() : QObject()
|
||||
{
|
||||
// XML Parser part
|
||||
// 1st: check local directory
|
||||
|
@ -102,7 +102,9 @@ class PmuppAdminXMLParser
|
||||
virtual bool isValid() { return fValid; }
|
||||
|
||||
private:
|
||||
enum EAdminKeyWords {eEmpty, eRecentFile, eDarkTheme, eMarker, eColor};
|
||||
enum EAdminKeyWords {eEmpty, eRecentFile,
|
||||
eIgnoreThemeAutoDetection, eDarkThemeIconsMenu, eDarkThemeIconsToolbar,
|
||||
eMarker, eColor};
|
||||
|
||||
bool parse(QIODevice *device);
|
||||
bool startDocument();
|
||||
@ -145,18 +147,24 @@ class PmuppAdmin : public QObject
|
||||
void getColor(QString name, int &r, int &g, int &b);
|
||||
void getColor(int idx, int &r, int &g, int &b);
|
||||
|
||||
bool isDarkTheme() { return fDarkTheme; }
|
||||
bool getIgnoreThemeAutoDetection() { return fIgnoreThemeAutoDetection; }
|
||||
bool getDarkThemeIconsMenuFlag() { return fDarkThemeIconsMenu; }
|
||||
bool getDarkThemeIconsToolbarFlag() { return fDarkThemeIconsToolbar; }
|
||||
|
||||
void setTheme(bool theme) { fDarkTheme = theme; }
|
||||
void setMarker(int marker, double size);
|
||||
void setColor(int r, int g, int b, QString name="");
|
||||
void setIgnoreThemeAutoDetection(const bool theme) { fIgnoreThemeAutoDetection = theme; }
|
||||
void setThemeIconsMenu(const bool theme) { fDarkThemeIconsMenu = theme; }
|
||||
void setThemeIconsToolbar(const bool theme) { fDarkThemeIconsToolbar = theme; }
|
||||
void setMarker(const int marker, const double size);
|
||||
void setColor(const int r, const int g, const int b, QString name="");
|
||||
|
||||
private:
|
||||
friend class PmuppAdminXMLParser;
|
||||
|
||||
QVector<QString> fRecentFile; ///< keep vector of recent path-file names
|
||||
|
||||
bool fDarkTheme;
|
||||
bool fIgnoreThemeAutoDetection{false};
|
||||
bool fDarkThemeIconsMenu{false};
|
||||
bool fDarkThemeIconsToolbar{false};
|
||||
QVector<PmuppMarker> fMarker;
|
||||
QVector<PmuppColor> fColor;
|
||||
|
||||
|
@ -250,6 +250,9 @@ PmuppGui::PmuppGui(QStringList fln)
|
||||
readCmdHistory();
|
||||
|
||||
fAdmin = new PmuppAdmin();
|
||||
fIgnoreThemeAutoDetection = fAdmin->getIgnoreThemeAutoDetection();
|
||||
fDarkThemeIconsMenu = fAdmin->getDarkThemeIconsMenuFlag();
|
||||
fDarkThemeIconsToolbar = fAdmin->getDarkThemeIconsToolbarFlag();
|
||||
|
||||
fParamDataHandler = new PParamDataHandler();
|
||||
bool dataAtStartup = false;
|
||||
@ -270,7 +273,7 @@ PmuppGui::PmuppGui(QStringList fln)
|
||||
getTheme();
|
||||
|
||||
QString iconName("");
|
||||
if (fDarkTheme)
|
||||
if (fDarkThemeIconsMenu)
|
||||
iconName = QString(":/icons/mupp-dark.svg");
|
||||
else
|
||||
iconName = QString(":/icons/mupp-plain.svg");
|
||||
@ -514,7 +517,7 @@ void PmuppGui::setupFileActions()
|
||||
QAction *a;
|
||||
|
||||
QString iconName("");
|
||||
if (fDarkTheme)
|
||||
if (fDarkThemeIconsMenu)
|
||||
iconName = QString(":/icons/document-open-dark.svg");
|
||||
else
|
||||
iconName = QString(":/icons/document-open-plain.svg");
|
||||
@ -523,7 +526,7 @@ void PmuppGui::setupFileActions()
|
||||
a->setStatusTip( tr("Open a musrfit parameter file.") );
|
||||
connect( a, SIGNAL( triggered() ), this, SLOT( fileOpen() ) );
|
||||
menu->addAction(a);
|
||||
if (!fDarkToolBarIcon) { // tool bar icon is not dark, even though the theme is (ubuntu)
|
||||
if (!fDarkThemeIconsToolbar) { // tool bar icon is not dark, even though the theme is (ubuntu)
|
||||
iconName = QString(":/icons/document-open-plain.svg");
|
||||
a = new QAction( QIcon( QPixmap(iconName) ), tr( "&New..." ), this );
|
||||
connect( a, SIGNAL( triggered() ), this, SLOT( fileOpen() ) );
|
||||
@ -848,26 +851,32 @@ bool PmuppGui::eventFilter(QObject *o, QEvent *e)
|
||||
*/
|
||||
void PmuppGui::getTheme()
|
||||
{
|
||||
fDarkTheme = false; // true if theme is dark
|
||||
fDarkToolBarIcon = false; // needed for ubuntu dark since there the menu icons
|
||||
// are dark, however the toolbar icons are plain!
|
||||
if (fIgnoreThemeAutoDetection)
|
||||
return;
|
||||
|
||||
fDarkThemeIconsMenu = false; // true if theme is dark
|
||||
fDarkThemeIconsToolbar = false; // needed for ubuntu dark since there the menu icons
|
||||
// are dark, however the toolbar icons are plain!
|
||||
|
||||
QString str = QIcon::themeName();
|
||||
|
||||
if (str.isEmpty()) {
|
||||
if (fAdmin->isDarkTheme()) {
|
||||
fDarkTheme = true;
|
||||
fDarkToolBarIcon = true;
|
||||
}
|
||||
if (fAdmin->getDarkThemeIconsMenuFlag()) {
|
||||
fDarkThemeIconsMenu = true;
|
||||
}
|
||||
if (fAdmin->getDarkThemeIconsToolbarFlag()) {
|
||||
fDarkThemeIconsToolbar = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (str.contains("dark", Qt::CaseInsensitive)) {
|
||||
fDarkTheme = true;
|
||||
if (str.contains("ubuntu", Qt::CaseInsensitive)) {
|
||||
fDarkToolBarIcon = false;
|
||||
fDarkThemeIconsMenu = true;
|
||||
if (str.contains("ubuntu", Qt::CaseInsensitive) ||
|
||||
str.contains("xfce", Qt::CaseInsensitive)) {
|
||||
fDarkThemeIconsToolbar = false;
|
||||
} else {
|
||||
fDarkToolBarIcon = true;
|
||||
fDarkThemeIconsToolbar = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1316,7 +1325,7 @@ void PmuppGui::addVar()
|
||||
|
||||
// call variable dialog
|
||||
fVarDlg.reset();
|
||||
fVarDlg = std::make_unique<PVarDialog>(collection_list, fDarkTheme);
|
||||
fVarDlg = std::make_unique<PVarDialog>(collection_list, fDarkThemeIconsMenu);
|
||||
connect(fVarDlg.get(), SIGNAL(check_request(QString,QVector<int>)), this, SLOT(check(QString,QVector<int>)));
|
||||
connect(fVarDlg.get(), SIGNAL(add_request(QString,QVector<int>)), this, SLOT(add(QString,QVector<int>)));
|
||||
fVarDlg->show();
|
||||
|
@ -159,11 +159,12 @@ private:
|
||||
enum EAxis {kXaxis, kYaxis};
|
||||
|
||||
PmuppAdmin *fAdmin;
|
||||
bool fDarkTheme;
|
||||
bool fDarkToolBarIcon;
|
||||
bool fNormalize;
|
||||
bool fIgnoreThemeAutoDetection{false};
|
||||
bool fDarkThemeIconsMenu{false};
|
||||
bool fDarkThemeIconsToolbar{false};
|
||||
bool fNormalize{false};
|
||||
|
||||
uint fDatime;
|
||||
qint64 fDatime;
|
||||
uint fMuppInstance;
|
||||
|
||||
PParamDataHandler *fParamDataHandler;
|
||||
@ -179,11 +180,11 @@ private:
|
||||
QAction *fRecentFilesAction[MAX_RECENT_FILES]; ///< array of the recent file actions
|
||||
std::unique_ptr<QAction> fNormalizeAction;
|
||||
|
||||
std::unique_ptr<QBoxLayout> fBoxLayout_Main; // top->bottom (0)
|
||||
std::unique_ptr<QBoxLayout> fBoxLayout_Top; // left->right (1)
|
||||
std::unique_ptr<QGridLayout> fGridLayout_Left; // 2 columns, 3 rows
|
||||
std::unique_ptr<QGridLayout> fGridLayout_Right; // 2 columns, 6 rows
|
||||
std::unique_ptr<QBoxLayout> fBoxLayout_Cmd; // left->right (1)
|
||||
std::unique_ptr<QBoxLayout> fBoxLayout_Main; // top->bottom (0)
|
||||
std::unique_ptr<QBoxLayout> fBoxLayout_Top; // left->right (1)
|
||||
std::unique_ptr<QGridLayout> fGridLayout_Left; // 2 columns, 3 rows
|
||||
std::unique_ptr<QGridLayout> fGridLayout_Right; // 2 columns, 6 rows
|
||||
std::unique_ptr<QBoxLayout> fBoxLayout_Cmd; // left->right (1)
|
||||
|
||||
std::unique_ptr<QLabel> fColLabel;
|
||||
std::unique_ptr<QSplitter> fColParamSplitter;
|
||||
|
@ -5,7 +5,9 @@
|
||||
</comment>
|
||||
<recent_files>
|
||||
</recent_files>
|
||||
<dark_theme>no</dark_theme>
|
||||
<ignore_theme_auto_detection>n</ignore_theme_auto_detection>
|
||||
<dark_theme_icon_menu>n</dark_theme_icon_menu>
|
||||
<dark_theme_icon_toolbar>n</dark_theme_icon_toolbar>
|
||||
<root_settings>
|
||||
<marker_list>
|
||||
<!-- Root marker numbers -->
|
||||
|
@ -59,8 +59,12 @@ PAdminXMLParser::PAdminXMLParser(const QString& fln, PAdmin *admin) : fAdmin(adm
|
||||
fFunc = false;
|
||||
|
||||
QFile file(fln);
|
||||
if (!file.open(QFile::ReadOnly | QFile::Text)) {
|
||||
// warning and create default - STILL MISSING
|
||||
if (!file.open(QFile::ReadOnly | QFile::Text) || (file.size()==0)) {
|
||||
// warning and create default
|
||||
QMessageBox::StandardButton ret = QMessageBox::warning(nullptr, "WARNING", "The musredit_startup.xml is corrupted. Create a default one?", QMessageBox::Yes | QMessageBox::No);
|
||||
if (ret == QMessageBox::Yes) {
|
||||
fAdmin->createMusreditStartupFile();
|
||||
}
|
||||
}
|
||||
|
||||
fValid = parse(&file);
|
||||
@ -98,7 +102,7 @@ bool PAdminXMLParser::parse(QIODevice *device)
|
||||
if (fXml.hasError()) {
|
||||
QString msg;
|
||||
msg = QString("%1 Line %2, column %3").arg(fXml.errorString()).arg(fXml.lineNumber()).arg(fXml.columnNumber());
|
||||
QMessageBox::critical(0, "**ERROR**", msg, QMessageBox::Ok, QMessageBox::NoButton);
|
||||
QMessageBox::critical(nullptr, "**ERROR**", msg, QMessageBox::Ok, QMessageBox::NoButton);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -717,14 +721,14 @@ QString PAdminXMLParser::expandPath(const QString &str)
|
||||
token.remove('$');
|
||||
if (!procEnv.contains(token)) {
|
||||
msg = QString("Couldn't find '%1'. Some things might not work properly").arg(token);
|
||||
QMessageBox::warning(0, "**WARNING**", msg, QMessageBox::Ok, QMessageBox::NoButton);
|
||||
QMessageBox::warning(nullptr, "**WARNING**", msg, QMessageBox::Ok, QMessageBox::NoButton);
|
||||
newStr = "";
|
||||
break;
|
||||
}
|
||||
path = procEnv.value(token, "");
|
||||
if (path.isEmpty()) {
|
||||
msg = QString("Couldn't expand '%1'. Some things might not work properly").arg(token);
|
||||
QMessageBox::warning(0, "**WARNING**", msg, QMessageBox::Ok, QMessageBox::NoButton);
|
||||
QMessageBox::warning(nullptr, "**WARNING**", msg, QMessageBox::Ok, QMessageBox::NoButton);
|
||||
newStr = "";
|
||||
break;
|
||||
}
|
||||
@ -769,13 +773,13 @@ PAdmin::PAdmin() : QObject()
|
||||
|
||||
// XML Parser part
|
||||
// 1st: check local directory
|
||||
QString path = QString("./");
|
||||
QString path = QDir::currentPath();
|
||||
QString fln = QString("musredit_startup.xml");
|
||||
QString pathFln = path + fln;
|
||||
QProcessEnvironment procEnv = QProcessEnvironment::systemEnvironment();
|
||||
if (!QFile::exists(pathFln)) {
|
||||
// 2nd: check $HOME/.musrfit/musredit/musredit_startup.xml
|
||||
path = procEnv.value("HOME", "");
|
||||
path = QDir::homePath();
|
||||
pathFln = path + "/.musrfit/musredit/" + fln;
|
||||
if (!QFile::exists(pathFln)) {
|
||||
// 3rd: check $MUSRFITPATH/musredit_startup.xml
|
||||
@ -803,9 +807,9 @@ PAdmin::PAdmin() : QObject()
|
||||
QFileInfo info(str);
|
||||
if (info.exists()) {
|
||||
if (!info.isExecutable())
|
||||
QMessageBox::critical(0, "ERROR", "musrfit found but not recognized as executable.\nPlease check!");
|
||||
QMessageBox::critical(nullptr, "ERROR", "musrfit found but not recognized as executable.\nPlease check!");
|
||||
} else {
|
||||
QMessageBox::critical(0, "ERROR", "musrfit not found.\nHave you set the necessary system variables properly?\nPlease check the manual.\nBefore you can use musrfit, this needs to be fixed.");
|
||||
QMessageBox::critical(nullptr, "ERROR", "musrfit not found.\nHave you set the necessary system variables properly?\nPlease check the manual.\nBefore you can use musrfit, this needs to be fixed.");
|
||||
}
|
||||
|
||||
// check if system variables are set properly
|
||||
@ -823,19 +827,10 @@ PAdmin::PAdmin() : QObject()
|
||||
}
|
||||
if (sysVarMissing) {
|
||||
msg += "Please set this/these system variables.";
|
||||
QMessageBox::warning(0, "WARNING", msg);
|
||||
QMessageBox::warning(nullptr, "WARNING", msg);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Destructor
|
||||
*/
|
||||
PAdmin::~PAdmin()
|
||||
{
|
||||
saveRecentFiles();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>returns the help url corresponding the the tag.
|
||||
@ -903,13 +898,13 @@ int PAdmin::loadPrefs(QString fln)
|
||||
if (QFile::exists(fln)) { // administration file present
|
||||
PAdminXMLParser handler(fln, this);
|
||||
if (!handler.isValid()) {
|
||||
QMessageBox::critical(0, "**ERROR**",
|
||||
QMessageBox::critical(nullptr, "**ERROR**",
|
||||
"Error parsing musredit_startup.xml settings file.\nProbably a few things will not work porperly.\nPlease fix this first.",
|
||||
QMessageBox::Ok, QMessageBox::NoButton);
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
QMessageBox::critical(0, "**ERROR**",
|
||||
QMessageBox::critical(nullptr, "**ERROR**",
|
||||
"Couldn't find the musredit_startup.xml settings file.\nProbably a few things will not work porperly.\nPlease fix this first.",
|
||||
QMessageBox::Ok, QMessageBox::NoButton);
|
||||
return 0;
|
||||
@ -1054,7 +1049,7 @@ int PAdmin::savePrefs(QString pref_fln)
|
||||
file.close();
|
||||
} else {
|
||||
QString msg("Failed to write musredit_startup.xml. Neither a local nor a global copy found.");
|
||||
QMessageBox::warning(0, "WARNING", msg, QMessageBox::Ok, QMessageBox::NoButton);
|
||||
QMessageBox::warning(nullptr, "WARNING", msg, QMessageBox::Ok, QMessageBox::NoButton);
|
||||
}
|
||||
|
||||
return 1;
|
||||
@ -1128,7 +1123,7 @@ void PAdmin::saveRecentFiles()
|
||||
return;
|
||||
}
|
||||
i++;
|
||||
for (int j=0; j<fRecentFile.size(); j++) {
|
||||
for (int j=fRecentFile.size()-1; j>=0; j--) {
|
||||
str = " <path_file_name>" + fRecentFile[j] + "</path_file_name>";
|
||||
data.insert(i++, str);
|
||||
}
|
||||
@ -1148,7 +1143,7 @@ void PAdmin::saveRecentFiles()
|
||||
file.close();
|
||||
} else {
|
||||
QString msg("Failed to write musredit_startup.xml. Neither a local nor a global copy found.");
|
||||
QMessageBox::warning(0, "WARNING", msg, QMessageBox::Ok, QMessageBox::NoButton);
|
||||
QMessageBox::warning(nullptr, "WARNING", msg, QMessageBox::Ok, QMessageBox::NoButton);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1177,13 +1172,13 @@ void PAdmin::createMusreditStartupFile()
|
||||
QFile fres(":/musredit_startup.xml.in");
|
||||
if (!fres.exists()) {
|
||||
QString msg = QString("Neither couldn't find nor create musredit_startup.xml. Things are likely not to work.");
|
||||
QMessageBox::critical(0, "ERROR", msg);
|
||||
QMessageBox::critical(nullptr, "ERROR", msg);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!fres.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
QString msg = QString("Couldn't open internal resource file musredit_startup.xml.in. Things are likely not to work.");
|
||||
QMessageBox::critical(0, "ERROR", msg);
|
||||
QMessageBox::critical(nullptr, "ERROR", msg);
|
||||
return;
|
||||
}
|
||||
// text stream for fres
|
||||
|
@ -65,7 +65,6 @@ class PAdminXMLParser
|
||||
{
|
||||
public:
|
||||
PAdminXMLParser(const QString &fln, PAdmin*);
|
||||
virtual ~PAdminXMLParser() {}
|
||||
|
||||
virtual bool isValid() { return fValid; }
|
||||
|
||||
@ -113,7 +112,6 @@ class PAdmin : public QObject
|
||||
{
|
||||
public:
|
||||
PAdmin();
|
||||
virtual ~PAdmin();
|
||||
|
||||
int getTimeout() { return fTimeout; }
|
||||
QString getFontName() { return fFontName; }
|
||||
@ -173,6 +171,7 @@ class PAdmin : public QObject
|
||||
|
||||
int loadPrefs(QString fln);
|
||||
int savePrefs(QString pref_fln);
|
||||
void saveRecentFiles(); ///< save recent file list
|
||||
|
||||
protected:
|
||||
void setExecPath(const QString str) { fExecPath = str; }
|
||||
@ -228,7 +227,6 @@ class PAdmin : public QObject
|
||||
|
||||
QVector<PTheory> fTheory; ///< stores all known theories. Needed when generating theory blocks from within musredit.
|
||||
|
||||
void saveRecentFiles(); ///< save recent file list
|
||||
void createMusreditStartupFile(); ///< create default musredit_startup.xml
|
||||
};
|
||||
|
||||
|
@ -155,6 +155,8 @@ PTextEdit::PTextEdit( QWidget *parent )
|
||||
connect( fTabWidget.get(), SIGNAL( currentChanged(int) ), this, SLOT( applyFontSettings(int) ));
|
||||
|
||||
fLastDirInUse = fAdmin->getDefaultSavePath();
|
||||
|
||||
fStatusBar = this->statusBar();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@ -294,6 +296,7 @@ void PTextEdit::setupFileActions()
|
||||
|
||||
// Save Prefs
|
||||
a = new QAction( tr( "Save Prefs..." ), this );
|
||||
a->setStatusTip( tr("Save the preferences") );
|
||||
connect( a, SIGNAL( triggered() ), this, SLOT( fileSavePrefs() ) );
|
||||
menu->addAction(a);
|
||||
|
||||
@ -696,7 +699,7 @@ void PTextEdit::setupMusrActions()
|
||||
iconName = QString(":/icons/musrWiz-32x32.svg");
|
||||
a = new QAction( QIcon( QPixmap(iconName) ), tr( "musr&Wiz" ), this );
|
||||
a->setShortcut( tr("Alt+W") );
|
||||
a->setStatusTip( tr("Call musrWiz which helps to create msr-files") );
|
||||
a->setStatusTip( tr("Call musrWiz which helps to create msr-files - currently still very limited") );
|
||||
connect( a, SIGNAL( triggered() ), this, SLOT( musrWiz() ) );
|
||||
menu->addAction(a);
|
||||
fActions["musrWiz"] = a;
|
||||
@ -838,7 +841,7 @@ void PTextEdit::setupMusrActions()
|
||||
else
|
||||
iconName = QString(":/icons/musrview2dat-plain.svg");
|
||||
a = new QAction( QIcon( QPixmap(iconName) ), tr( "View2Dat" ), this );
|
||||
a->setStatusTip( tr("export musrview data") );
|
||||
a->setStatusTip( tr("Export musrview data from a collection of msr-files.") );
|
||||
connect( a, SIGNAL( triggered() ), this, SLOT( musrView2Dat() ) );
|
||||
menu->addAction(a);
|
||||
fActions["musrview2dat"] = a;
|
||||
@ -1032,7 +1035,7 @@ void PTextEdit::load( const QString &f, const int index )
|
||||
return;
|
||||
|
||||
// add file name to recent file names
|
||||
fAdmin->addRecentFile(f); // keep it in admin
|
||||
fAdmin->addRecentFile(QFileInfo(f).absoluteFilePath()); // keep it in admin
|
||||
fillRecentFiles(); // update menu
|
||||
|
||||
// add the msr-file to the file system watchersssss
|
||||
@ -1555,7 +1558,7 @@ void PTextEdit::fileClose(const bool check)
|
||||
int result = QMessageBox::warning(this, "**WARNING**",
|
||||
"Do you really want to close this file.\nChanges will be lost",
|
||||
"Close", "Cancel");
|
||||
if (result == 1) // Cancel
|
||||
if (result == QMessageBox::Cancel) // Cancel
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1585,7 +1588,7 @@ void PTextEdit::fileCloseAll()
|
||||
int result = QMessageBox::warning(this, "**WARNING**",
|
||||
"Do you really want to close all files.\nChanges of unsaved files will be lost",
|
||||
"Close", "Cancel");
|
||||
if (result == 1) // Cancel
|
||||
if (result == QMessageBox::Cancel) // Cancel
|
||||
return;
|
||||
break;
|
||||
}
|
||||
@ -1622,7 +1625,7 @@ void PTextEdit::fileCloseAllOthers()
|
||||
int result = QMessageBox::warning(this, "**WARNING**",
|
||||
"Do you really want to close all files.\nChanges of unsaved files will be lost",
|
||||
"Close", "Cancel");
|
||||
if (result == 1) // Cancel
|
||||
if (result == QMessageBox::Cancel) // Cancel
|
||||
return;
|
||||
break;
|
||||
}
|
||||
@ -1665,12 +1668,14 @@ void PTextEdit::fileExit()
|
||||
int result = QMessageBox::warning(this, "**WARNING**",
|
||||
"Do you really want to exit from the applcation.\nChanges will be lost",
|
||||
"Exit", "Cancel");
|
||||
if (result == 1) // Cancel
|
||||
if (result == QMessageBox::Cancel) // Cancel
|
||||
return;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
fAdmin->saveRecentFiles();
|
||||
|
||||
qApp->quit();
|
||||
}
|
||||
|
||||
@ -3613,6 +3618,7 @@ void PTextEdit::switchMenuIcons()
|
||||
fActions["musrStep"]->setIcon(QIcon(QPixmap(":/icons/musrStep-32x32-dark.svg")));
|
||||
fActions["msr2data"]->setIcon(QIcon(QPixmap(":/icons/msr2data-dark.svg")));
|
||||
fActions["mupp"]->setIcon(QIcon(QPixmap(":/icons/mupp-dark.svg")));
|
||||
fActions["musrview2dat"]->setIcon(QIcon(QPixmap(":/icons/musrview2dat-dark.svg")));
|
||||
fActions["musrview"]->setIcon(QIcon(QPixmap(":/icons/musrview-dark.svg")));
|
||||
fActions["musrt0"]->setIcon(QIcon(QPixmap(":/icons/musrt0-dark.svg")));
|
||||
fActions["musrFT"]->setIcon(QIcon(QPixmap(":/icons/musrFT-dark.svg")));
|
||||
@ -3639,6 +3645,7 @@ void PTextEdit::switchMenuIcons()
|
||||
fActions["musrStep"]->setIcon(QIcon(QPixmap(":/icons/musrStep-32x32.svg")));
|
||||
fActions["msr2data"]->setIcon(QIcon(QPixmap(":/icons/msr2data-plain.svg")));
|
||||
fActions["mupp"]->setIcon(QIcon(QPixmap(":/icons/mupp-plain.svg")));
|
||||
fActions["musrview2dat"]->setIcon(QIcon(QPixmap(":/icons/musrview2dat-plain.svg")));
|
||||
fActions["musrview"]->setIcon(QIcon(QPixmap(":/icons/musrview-plain.svg")));
|
||||
fActions["musrt0"]->setIcon(QIcon(QPixmap(":/icons/musrt0-plain.svg")));
|
||||
fActions["musrFT"]->setIcon(QIcon(QPixmap(":/icons/musrFT-plain.svg")));
|
||||
@ -3674,6 +3681,7 @@ void PTextEdit::switchToolbarIcons()
|
||||
fActions["musrStep-tb"]->setIcon(QIcon(QPixmap(":/icons/musrStep-32x32-dark.svg")));
|
||||
fActions["msr2data-tb"]->setIcon(QIcon(QPixmap(":/icons/msr2data-dark.svg")));
|
||||
fActions["mupp-tb"]->setIcon(QIcon(QPixmap(":/icons/mupp-dark.svg")));
|
||||
fActions["musrview2dat-tb"]->setIcon(QIcon(QPixmap(":/icons/musrview2dat-dark.svg")));
|
||||
fActions["musrview-tb"]->setIcon(QIcon(QPixmap(":/icons/musrview-dark.svg")));
|
||||
fActions["musrt0-tb"]->setIcon(QIcon(QPixmap(":/icons/musrt0-dark.svg")));
|
||||
fActions["musrFT-tb"]->setIcon(QIcon(QPixmap(":/icons/musrFT-dark.svg")));
|
||||
@ -3700,6 +3708,7 @@ void PTextEdit::switchToolbarIcons()
|
||||
fActions["musrStep-tb"]->setIcon(QIcon(QPixmap(":/icons/musrStep-32x32.svg")));
|
||||
fActions["msr2data-tb"]->setIcon(QIcon(QPixmap(":/icons/msr2data-plain.svg")));
|
||||
fActions["mupp-tb"]->setIcon(QIcon(QPixmap(":/icons/mupp-plain.svg")));
|
||||
fActions["musrview2dat-tb"]->setIcon(QIcon(QPixmap(":/icons/musrview2dat-plain.svg")));
|
||||
fActions["musrview-tb"]->setIcon(QIcon(QPixmap(":/icons/musrview-plain.svg")));
|
||||
fActions["musrt0-tb"]->setIcon(QIcon(QPixmap(":/icons/musrt0-plain.svg")));
|
||||
fActions["musrFT-tb"]->setIcon(QIcon(QPixmap(":/icons/musrFT-plain.svg")));
|
||||
|
@ -181,6 +181,7 @@ private:
|
||||
QString fLastDirInUse{QString("")}; ///< string holding the path from where the last file was loaded.
|
||||
QStringList fMusrFTPrevCmd;
|
||||
int fEditW{900}, fEditH{800};
|
||||
QStatusBar *fStatusBar{nullptr};
|
||||
|
||||
QMap<QString, QAction*> fActions;
|
||||
std::unique_ptr<QAction> fMusrT0Action;
|
||||
|
@ -24,7 +24,7 @@
|
||||
<dark_theme_icons_toolbar>n</dark_theme_icons_toolbar>
|
||||
<edit_w>900</edit_w>
|
||||
<edit_h>800</edit_h>
|
||||
</general>
|
||||
</general>
|
||||
<recent_files>
|
||||
<path_file_name>@DOCDIR@/examples/test-histo-PSI-BIN.msr</path_file_name>
|
||||
</recent_files>
|
||||
@ -137,6 +137,27 @@
|
||||
<pixmap></pixmap>
|
||||
<params>3</params>
|
||||
</func>
|
||||
<func>
|
||||
<name>dynGLKT_F_ZF</name>
|
||||
<comment>(damping hopping-rate)</comment>
|
||||
<label>dynamic Gauss-Lorentz KT Fast ZF</label>
|
||||
<pixmap></pixmap>
|
||||
<params>2</params>
|
||||
</func>
|
||||
<func>
|
||||
<name>dynGLKT_F_LF</name>
|
||||
<comment>(frequency damping hopping-rate)</comment>
|
||||
<label>dynamic Gauss-Lorentz KT Fast LF</label>
|
||||
<pixmap></pixmap>
|
||||
<params>3</params>
|
||||
</func>
|
||||
<func>
|
||||
<name>dynGLKT_LF</name>
|
||||
<comment>(frequency damping hopping-rate)</comment>
|
||||
<label>dynamic Gauss-Lorentz KT LF</label>
|
||||
<pixmap></pixmap>
|
||||
<params>3</params>
|
||||
</func>
|
||||
<func>
|
||||
<name>combiLGKT</name>
|
||||
<comment>(lorentzRate gaussRate)</comment>
|
||||
@ -249,6 +270,13 @@
|
||||
<pixmap></pixmap>
|
||||
<params>5</params>
|
||||
</func>
|
||||
<func>
|
||||
<name>F_mu_F</name>
|
||||
<comment>(w_d)</comment>
|
||||
<label>F-mu-F</label>
|
||||
<pixmap></pixmap>
|
||||
<params>1</params>
|
||||
</func>
|
||||
<func>
|
||||
<name>polynom</name>
|
||||
<comment>(tshift p0 p1 ... pn)</comment>
|
||||
|
@ -101,6 +101,7 @@ if (APPLE)
|
||||
MACOSX_BUNDLE_INFO_STRING "mupp is used to plot parameters from musrfit collections."
|
||||
MACOSX_BUNDLE_ICON_FILE "mupp.icns"
|
||||
MACOSX_BUNDLE_LONG_VERSION_STRING "${mupp_VERSION}"
|
||||
MACOSX_BUNDLE_GUI_IDENTIFIER "ch.psi.lmu.mupp"
|
||||
MACOSX_FRAMEWORK_IDENTIFIER ch.psi.mupp
|
||||
MACOSX_BUNDLE_COPYRIGHT "Andreas Suter"
|
||||
RESOURCE "${RESOURCE_FILES}"
|
||||
|
@ -156,8 +156,12 @@ bool PmuppAdminXMLParser::startElement()
|
||||
|
||||
if (qName == "path_file_name") {
|
||||
fKeyWord = eRecentFile;
|
||||
} else if (qName == "dark_theme") {
|
||||
fKeyWord = eDarkTheme;
|
||||
} else if (qName == "ignore_theme_auto_detection") {
|
||||
fKeyWord = eIgnoreThemeAutoDetection;
|
||||
} else if (qName == "dark_theme_icon_menu") {
|
||||
fKeyWord = eDarkThemeIconsMenu;
|
||||
} else if (qName == "dark_theme_icon_toolbar") {
|
||||
fKeyWord = eDarkThemeIconsToolbar;
|
||||
} else if (qName == "marker") {
|
||||
fKeyWord = eMarker;
|
||||
} else if (qName == "color") {
|
||||
@ -201,11 +205,23 @@ bool PmuppAdminXMLParser::characters()
|
||||
case eRecentFile:
|
||||
fAdmin->addRecentFile(QString(str.toLatin1()).trimmed());
|
||||
break;
|
||||
case eDarkTheme:
|
||||
if ((str == "yes") || (str == "1") || (str == "true"))
|
||||
fAdmin->setTheme(true);
|
||||
case eIgnoreThemeAutoDetection:
|
||||
if ((str == "yes") || (str == "y") || (str == "1") || (str == "true"))
|
||||
fAdmin->setIgnoreThemeAutoDetection(true);
|
||||
else
|
||||
fAdmin->setTheme(false);
|
||||
fAdmin->setIgnoreThemeAutoDetection(false);
|
||||
break;
|
||||
case eDarkThemeIconsMenu:
|
||||
if ((str == "yes") || (str == "y") || (str == "1") || (str == "true"))
|
||||
fAdmin->setThemeIconsMenu(true);
|
||||
else
|
||||
fAdmin->setThemeIconsMenu(false);
|
||||
break;
|
||||
case eDarkThemeIconsToolbar:
|
||||
if ((str == "yes") || (str == "y") || (str == "1") || (str == "true"))
|
||||
fAdmin->setThemeIconsToolbar(true);
|
||||
else
|
||||
fAdmin->setThemeIconsToolbar(false);
|
||||
break;
|
||||
case eMarker:
|
||||
tok = str.split(",", Qt::SkipEmptyParts);
|
||||
@ -272,7 +288,7 @@ bool PmuppAdminXMLParser::endDocument()
|
||||
* <p>Initializes that PmuppAdmin object, and calls the XML parser which feeds
|
||||
* the object variables.
|
||||
*/
|
||||
PmuppAdmin::PmuppAdmin() : QObject(), fDarkTheme(false)
|
||||
PmuppAdmin::PmuppAdmin() : QObject()
|
||||
{
|
||||
// XML Parser part
|
||||
// 1st: check local directory
|
||||
@ -433,7 +449,7 @@ void PmuppAdmin::getColor(int idx, int &r, int &g, int &b)
|
||||
* @param marker marker code
|
||||
* @param size marker size
|
||||
*/
|
||||
void PmuppAdmin::setMarker(int marker, double size)
|
||||
void PmuppAdmin::setMarker(const int marker, const double size)
|
||||
{
|
||||
PmuppMarker markerObj;
|
||||
|
||||
@ -456,7 +472,7 @@ void PmuppAdmin::setMarker(int marker, double size)
|
||||
* @param b blue value (0..255)
|
||||
* @param name color name
|
||||
*/
|
||||
void PmuppAdmin::setColor(int r, int g, int b, QString name)
|
||||
void PmuppAdmin::setColor(const int r, const int g, const int b, QString name)
|
||||
{
|
||||
if (((r<0) || (r>255)) ||
|
||||
((g<0) || (g>255)) ||
|
||||
|
@ -102,7 +102,9 @@ class PmuppAdminXMLParser
|
||||
virtual bool isValid() { return fValid; }
|
||||
|
||||
private:
|
||||
enum EAdminKeyWords {eEmpty, eRecentFile, eDarkTheme, eMarker, eColor};
|
||||
enum EAdminKeyWords {eEmpty, eRecentFile,
|
||||
eIgnoreThemeAutoDetection, eDarkThemeIconsMenu, eDarkThemeIconsToolbar,
|
||||
eMarker, eColor};
|
||||
|
||||
bool parse(QIODevice *device);
|
||||
bool startDocument();
|
||||
@ -145,18 +147,24 @@ class PmuppAdmin : public QObject
|
||||
void getColor(QString name, int &r, int &g, int &b);
|
||||
void getColor(int idx, int &r, int &g, int &b);
|
||||
|
||||
bool isDarkTheme() { return fDarkTheme; }
|
||||
bool getIgnoreThemeAutoDetection() { return fIgnoreThemeAutoDetection; }
|
||||
bool getDarkThemeIconsMenuFlag() { return fDarkThemeIconsMenu; }
|
||||
bool getDarkThemeIconsToolbarFlag() { return fDarkThemeIconsToolbar; }
|
||||
|
||||
void setTheme(bool theme) { fDarkTheme = theme; }
|
||||
void setMarker(int marker, double size);
|
||||
void setColor(int r, int g, int b, QString name="");
|
||||
void setIgnoreThemeAutoDetection(const bool theme) { fIgnoreThemeAutoDetection = theme; }
|
||||
void setThemeIconsMenu(const bool theme) { fDarkThemeIconsMenu = theme; }
|
||||
void setThemeIconsToolbar(const bool theme) { fDarkThemeIconsToolbar = theme; }
|
||||
void setMarker(const int marker, const double size);
|
||||
void setColor(const int r, const int g, const int b, QString name="");
|
||||
|
||||
private:
|
||||
friend class PmuppAdminXMLParser;
|
||||
|
||||
QVector<QString> fRecentFile; ///< keep vector of recent path-file names
|
||||
|
||||
bool fDarkTheme;
|
||||
bool fIgnoreThemeAutoDetection{false};
|
||||
bool fDarkThemeIconsMenu{false};
|
||||
bool fDarkThemeIconsToolbar{false};
|
||||
QVector<PmuppMarker> fMarker;
|
||||
QVector<PmuppColor> fColor;
|
||||
|
||||
|
@ -250,6 +250,9 @@ PmuppGui::PmuppGui(QStringList fln)
|
||||
readCmdHistory();
|
||||
|
||||
fAdmin = new PmuppAdmin();
|
||||
fIgnoreThemeAutoDetection = fAdmin->getIgnoreThemeAutoDetection();
|
||||
fDarkThemeIconsMenu = fAdmin->getDarkThemeIconsMenuFlag();
|
||||
fDarkThemeIconsToolbar = fAdmin->getDarkThemeIconsToolbarFlag();
|
||||
|
||||
fParamDataHandler = new PParamDataHandler();
|
||||
bool dataAtStartup = false;
|
||||
@ -270,7 +273,7 @@ PmuppGui::PmuppGui(QStringList fln)
|
||||
getTheme();
|
||||
|
||||
QString iconName("");
|
||||
if (fDarkTheme)
|
||||
if (fDarkThemeIconsMenu)
|
||||
iconName = QString(":/icons/mupp-dark.svg");
|
||||
else
|
||||
iconName = QString(":/icons/mupp-plain.svg");
|
||||
@ -513,7 +516,7 @@ void PmuppGui::setupFileActions()
|
||||
QAction *a;
|
||||
|
||||
QString iconName("");
|
||||
if (fDarkTheme)
|
||||
if (fDarkThemeIconsMenu)
|
||||
iconName = QString(":/icons/document-open-dark.svg");
|
||||
else
|
||||
iconName = QString(":/icons/document-open-plain.svg");
|
||||
@ -522,7 +525,7 @@ void PmuppGui::setupFileActions()
|
||||
a->setStatusTip( tr("Open a musrfit parameter file.") );
|
||||
connect( a, SIGNAL( triggered() ), this, SLOT( fileOpen() ) );
|
||||
menu->addAction(a);
|
||||
if (!fDarkToolBarIcon) { // tool bar icon is not dark, even though the theme is (ubuntu)
|
||||
if (!fDarkThemeIconsToolbar) { // tool bar icon is not dark, even though the theme is (ubuntu, mx, xfce)
|
||||
iconName = QString(":/icons/document-open-plain.svg");
|
||||
a = new QAction( QIcon( QPixmap(iconName) ), tr( "&New..." ), this );
|
||||
connect( a, SIGNAL( triggered() ), this, SLOT( fileOpen() ) );
|
||||
@ -847,26 +850,32 @@ bool PmuppGui::eventFilter(QObject *o, QEvent *e)
|
||||
*/
|
||||
void PmuppGui::getTheme()
|
||||
{
|
||||
fDarkTheme = false; // true if theme is dark
|
||||
fDarkToolBarIcon = false; // needed for ubuntu dark since there the menu icons
|
||||
// are dark, however the toolbar icons are plain!
|
||||
if (fIgnoreThemeAutoDetection)
|
||||
return;
|
||||
|
||||
fDarkThemeIconsMenu = false; // true if theme is dark
|
||||
fDarkThemeIconsToolbar = false; // needed for ubuntu dark since there the menu icons
|
||||
// are dark, however the toolbar icons are plain!
|
||||
|
||||
QString str = QIcon::themeName();
|
||||
|
||||
if (str.isEmpty()) {
|
||||
if (fAdmin->isDarkTheme()) {
|
||||
fDarkTheme = true;
|
||||
fDarkToolBarIcon = true;
|
||||
if (fAdmin->getDarkThemeIconsMenuFlag()) {
|
||||
fDarkThemeIconsMenu = true;
|
||||
}
|
||||
if (fAdmin->getDarkThemeIconsToolbarFlag()) {
|
||||
fDarkThemeIconsToolbar = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (str.contains("dark", Qt::CaseInsensitive)) {
|
||||
fDarkTheme = true;
|
||||
if (str.contains("ubuntu", Qt::CaseInsensitive)) {
|
||||
fDarkToolBarIcon = false;
|
||||
fDarkThemeIconsMenu = true;
|
||||
if (str.contains("ubuntu", Qt::CaseInsensitive) ||
|
||||
str.contains("xfce", Qt::CaseInsensitive)) {
|
||||
fDarkThemeIconsToolbar = false;
|
||||
} else {
|
||||
fDarkToolBarIcon = true;
|
||||
fDarkThemeIconsToolbar = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1304,7 +1313,7 @@ void PmuppGui::addVar()
|
||||
|
||||
// call variable dialog
|
||||
fVarDlg.reset();
|
||||
fVarDlg = std::make_unique<PVarDialog>(collection_list, fDarkTheme);
|
||||
fVarDlg = std::make_unique<PVarDialog>(collection_list, fDarkThemeIconsMenu);
|
||||
connect(fVarDlg.get(), SIGNAL(check_request(QString,QVector<int>)), this, SLOT(check(QString,QVector<int>)));
|
||||
connect(fVarDlg.get(), SIGNAL(add_request(QString,QVector<int>)), this, SLOT(add(QString,QVector<int>)));
|
||||
fVarDlg->show();
|
||||
|
@ -159,9 +159,10 @@ private:
|
||||
enum EAxis {kXaxis, kYaxis};
|
||||
|
||||
PmuppAdmin *fAdmin;
|
||||
bool fDarkTheme;
|
||||
bool fDarkToolBarIcon;
|
||||
bool fNormalize;
|
||||
bool fIgnoreThemeAutoDetection{false};
|
||||
bool fDarkThemeIconsMenu{false};
|
||||
bool fDarkThemeIconsToolbar{false};
|
||||
bool fNormalize{false};
|
||||
|
||||
qint64 fDatime;
|
||||
uint fMuppInstance;
|
||||
|
@ -548,11 +548,11 @@ int main(int argc, char *argv[])
|
||||
if (script.size() > 0) { // script
|
||||
guiFlag = false;
|
||||
}
|
||||
QCoreApplication *app = createApplication(argc, argv, guiFlag);
|
||||
QScopedPointer<QCoreApplication> app(createApplication(argc, argv, guiFlag));
|
||||
|
||||
std::unique_ptr<PmuppGui> gui;
|
||||
std::unique_ptr<PmuppScript> mupp_script;
|
||||
if (qobject_cast<QApplication *>(app)) { // GUI
|
||||
if (qobject_cast<QApplication *>(app.get())) { // GUI
|
||||
gui = std::make_unique<PmuppGui>(fln);
|
||||
if (gui == nullptr) {
|
||||
std::cerr << std::endl;
|
||||
@ -565,8 +565,8 @@ int main(int argc, char *argv[])
|
||||
gui->resize( 800, 500 );
|
||||
gui->show();
|
||||
|
||||
app->connect( app, SIGNAL( lastWindowClosed() ), app, SLOT( quit() ) );
|
||||
app->connect( app, SIGNAL( aboutToQuit() ), gui.get(), SLOT( aboutToQuit() ) );
|
||||
app.get()->connect( app.get(), SIGNAL( lastWindowClosed() ), app.get(), SLOT( quit() ) );
|
||||
app.get()->connect( app.get(), SIGNAL( aboutToQuit() ), gui.get(), SLOT( aboutToQuit() ) );
|
||||
} else { // scripting
|
||||
mupp_script = std::make_unique<PmuppScript>(script);
|
||||
if (mupp_script == nullptr) {
|
||||
@ -578,7 +578,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
// This will cause the application to exit when the task signals finished.
|
||||
QObject::connect( mupp_script.get(), SIGNAL( finished() ), app, SLOT( quit() ) );
|
||||
QObject::connect( mupp_script.get(), SIGNAL( finished() ), app.get(), SLOT( quit() ) );
|
||||
|
||||
// This will run the task from the application event loop.
|
||||
QTimer::singleShot(0, mupp_script.get(), SLOT( executeScript() ) );
|
||||
|
@ -5,7 +5,9 @@
|
||||
</comment>
|
||||
<recent_files>
|
||||
</recent_files>
|
||||
<dark_theme>no</dark_theme>
|
||||
<ignore_theme_auto_detection>n</ignore_theme_auto_detection>
|
||||
<dark_theme_icon_menu>n</dark_theme_icon_menu>
|
||||
<dark_theme_icon_toolbar>n</dark_theme_icon_toolbar>
|
||||
<root_settings>
|
||||
<marker_list>
|
||||
<!-- Root marker numbers -->
|
||||
|
@ -775,13 +775,13 @@ PAdmin::PAdmin() : QObject()
|
||||
|
||||
// XML Parser part
|
||||
// 1st: check local directory
|
||||
QString path = QString("./");
|
||||
QString path = QDir::currentPath();
|
||||
QString fln = QString("musredit_startup.xml");
|
||||
QString pathFln = path + fln;
|
||||
QProcessEnvironment procEnv = QProcessEnvironment::systemEnvironment();
|
||||
if (!QFile::exists(pathFln)) {
|
||||
// 2nd: check $HOME/.musrfit/musredit/musredit_startup.xml
|
||||
path = procEnv.value("HOME", "");
|
||||
path = QDir::homePath();
|
||||
pathFln = path + "/.musrfit/musredit/" + fln;
|
||||
if (!QFile::exists(pathFln)) {
|
||||
// 3rd: check $MUSRFITPATH/musredit_startup.xml
|
||||
@ -833,15 +833,6 @@ PAdmin::PAdmin() : QObject()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Destructor
|
||||
*/
|
||||
PAdmin::~PAdmin()
|
||||
{
|
||||
saveRecentFiles();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>returns the help url corresponding the the tag.
|
||||
@ -1096,7 +1087,7 @@ void PAdmin::saveRecentFiles()
|
||||
QString fln = QString("./musredit_startup.xml");
|
||||
if (!QFile::exists(fln))
|
||||
fln = fPrefPathName;
|
||||
|
||||
|
||||
if (QFile::exists(fln)) { // administration file present
|
||||
QVector<QString> data;
|
||||
QFile file(fln);
|
||||
@ -1130,7 +1121,7 @@ void PAdmin::saveRecentFiles()
|
||||
return;
|
||||
}
|
||||
i++;
|
||||
for (int j=0; j<fRecentFile.size(); j++) {
|
||||
for (int j=fRecentFile.size()-1; j>=0; j--) {
|
||||
str = " <path_file_name>" + fRecentFile[j] + "</path_file_name>";
|
||||
data.insert(i++, str);
|
||||
}
|
||||
|
@ -65,7 +65,6 @@ class PAdminXMLParser
|
||||
{
|
||||
public:
|
||||
PAdminXMLParser(const QString &fln, PAdmin*);
|
||||
virtual ~PAdminXMLParser() {}
|
||||
|
||||
virtual bool isValid() { return fValid; }
|
||||
|
||||
@ -113,7 +112,6 @@ class PAdmin : public QObject
|
||||
{
|
||||
public:
|
||||
PAdmin();
|
||||
virtual ~PAdmin();
|
||||
|
||||
int getTimeout() { return fTimeout; }
|
||||
QString getFontName() { return fFontName; }
|
||||
@ -173,6 +171,7 @@ class PAdmin : public QObject
|
||||
|
||||
int loadPrefs(QString fln);
|
||||
int savePrefs(QString pref_fln);
|
||||
void saveRecentFiles(); ///< save recent file list
|
||||
|
||||
protected:
|
||||
void setExecPath(const QString str) { fExecPath = str; }
|
||||
@ -228,7 +227,6 @@ class PAdmin : public QObject
|
||||
|
||||
QVector<PTheory> fTheory; ///< stores all known theories. Needed when generating theory blocks from within musredit.
|
||||
|
||||
void saveRecentFiles(); ///< save recent file list
|
||||
void createMusreditStartupFile(); ///< create default musredit_startup.xml
|
||||
};
|
||||
|
||||
|
@ -155,6 +155,8 @@ PTextEdit::PTextEdit( QWidget *parent )
|
||||
connect( fTabWidget.get(), SIGNAL( currentChanged(int) ), this, SLOT( applyFontSettings(int) ));
|
||||
|
||||
fLastDirInUse = fAdmin->getDefaultSavePath();
|
||||
|
||||
fStatusBar = this->statusBar();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@ -294,6 +296,7 @@ void PTextEdit::setupFileActions()
|
||||
|
||||
// Save Prefs
|
||||
a = new QAction( tr( "Save Prefs..." ), this );
|
||||
a->setStatusTip( tr("Save the preferences") );
|
||||
connect( a, SIGNAL( triggered() ), this, SLOT( fileSavePrefs() ) );
|
||||
menu->addAction(a);
|
||||
|
||||
@ -695,7 +698,7 @@ void PTextEdit::setupMusrActions()
|
||||
iconName = QString(":/icons/musrWiz-32x32.svg");
|
||||
a = new QAction( QIcon( QPixmap(iconName) ), tr( "musr&Wiz" ), this );
|
||||
a->setShortcut( tr("Alt+W") );
|
||||
a->setStatusTip( tr("Call musrWiz which helps to create msr-files") );
|
||||
a->setStatusTip( tr("Call musrWiz which helps to create msr-files - currently still very limited") );
|
||||
connect( a, SIGNAL( triggered() ), this, SLOT( musrWiz() ) );
|
||||
menu->addAction(a);
|
||||
fActions["musrWiz"] = a;
|
||||
@ -837,7 +840,7 @@ void PTextEdit::setupMusrActions()
|
||||
else
|
||||
iconName = QString(":/icons/musrview2dat-plain.svg");
|
||||
a = new QAction( QIcon( QPixmap(iconName) ), tr( "View2Dat" ), this );
|
||||
a->setStatusTip( tr("export musrview data") );
|
||||
a->setStatusTip( tr("Export musrview data from a collection of msr-files.") );
|
||||
connect( a, SIGNAL( triggered() ), this, SLOT( musrView2Dat() ) );
|
||||
menu->addAction(a);
|
||||
fActions["musrview2dat"] = a;
|
||||
@ -1031,7 +1034,7 @@ void PTextEdit::load( const QString &f, const int index )
|
||||
return;
|
||||
|
||||
// add file name to recent file names
|
||||
fAdmin->addRecentFile(f); // keep it in admin
|
||||
fAdmin->addRecentFile(QFileInfo(f).absoluteFilePath()); // keep it in admin
|
||||
fillRecentFiles(); // update menu
|
||||
|
||||
// add the msr-file to the file system watchersssss
|
||||
@ -1670,6 +1673,8 @@ void PTextEdit::fileExit()
|
||||
}
|
||||
}
|
||||
|
||||
fAdmin->saveRecentFiles();
|
||||
|
||||
qApp->quit();
|
||||
}
|
||||
|
||||
@ -3582,6 +3587,7 @@ void PTextEdit::switchMenuIcons()
|
||||
fActions["musrStep"]->setIcon(QIcon(QPixmap(":/icons/musrStep-32x32-dark.svg")));
|
||||
fActions["msr2data"]->setIcon(QIcon(QPixmap(":/icons/msr2data-dark.svg")));
|
||||
fActions["mupp"]->setIcon(QIcon(QPixmap(":/icons/mupp-dark.svg")));
|
||||
fActions["musrview2dat"]->setIcon(QIcon(QPixmap(":/icons/musrview2dat-dark.svg")));
|
||||
fActions["musrview"]->setIcon(QIcon(QPixmap(":/icons/musrview-dark.svg")));
|
||||
fActions["musrt0"]->setIcon(QIcon(QPixmap(":/icons/musrt0-dark.svg")));
|
||||
fActions["musrFT"]->setIcon(QIcon(QPixmap(":/icons/musrFT-dark.svg")));
|
||||
@ -3608,6 +3614,7 @@ void PTextEdit::switchMenuIcons()
|
||||
fActions["musrStep"]->setIcon(QIcon(QPixmap(":/icons/musrStep-32x32.svg")));
|
||||
fActions["msr2data"]->setIcon(QIcon(QPixmap(":/icons/msr2data-plain.svg")));
|
||||
fActions["mupp"]->setIcon(QIcon(QPixmap(":/icons/mupp-plain.svg")));
|
||||
fActions["musrview2dat"]->setIcon(QIcon(QPixmap(":/icons/musrview2dat-plain.svg")));
|
||||
fActions["musrview"]->setIcon(QIcon(QPixmap(":/icons/musrview-plain.svg")));
|
||||
fActions["musrt0"]->setIcon(QIcon(QPixmap(":/icons/musrt0-plain.svg")));
|
||||
fActions["musrFT"]->setIcon(QIcon(QPixmap(":/icons/musrFT-plain.svg")));
|
||||
@ -3643,6 +3650,7 @@ void PTextEdit::switchToolbarIcons()
|
||||
fActions["musrStep-tb"]->setIcon(QIcon(QPixmap(":/icons/musrStep-32x32-dark.svg")));
|
||||
fActions["msr2data-tb"]->setIcon(QIcon(QPixmap(":/icons/msr2data-dark.svg")));
|
||||
fActions["mupp-tb"]->setIcon(QIcon(QPixmap(":/icons/mupp-dark.svg")));
|
||||
fActions["musrview2dat-tb"]->setIcon(QIcon(QPixmap(":/icons/musrview2dat-dark.svg")));
|
||||
fActions["musrview-tb"]->setIcon(QIcon(QPixmap(":/icons/musrview-dark.svg")));
|
||||
fActions["musrt0-tb"]->setIcon(QIcon(QPixmap(":/icons/musrt0-dark.svg")));
|
||||
fActions["musrFT-tb"]->setIcon(QIcon(QPixmap(":/icons/musrFT-dark.svg")));
|
||||
@ -3669,6 +3677,7 @@ void PTextEdit::switchToolbarIcons()
|
||||
fActions["musrStep-tb"]->setIcon(QIcon(QPixmap(":/icons/musrStep-32x32.svg")));
|
||||
fActions["msr2data-tb"]->setIcon(QIcon(QPixmap(":/icons/msr2data-plain.svg")));
|
||||
fActions["mupp-tb"]->setIcon(QIcon(QPixmap(":/icons/mupp-plain.svg")));
|
||||
fActions["musrview2dat-tb"]->setIcon(QIcon(QPixmap(":/icons/musrview2dat-plain.svg")));
|
||||
fActions["musrview-tb"]->setIcon(QIcon(QPixmap(":/icons/musrview-plain.svg")));
|
||||
fActions["musrt0-tb"]->setIcon(QIcon(QPixmap(":/icons/musrt0-plain.svg")));
|
||||
fActions["musrFT-tb"]->setIcon(QIcon(QPixmap(":/icons/musrFT-plain.svg")));
|
||||
|
@ -181,6 +181,7 @@ private:
|
||||
QString fLastDirInUse{QString("")}; ///< string holding the path from where the last file was loaded.
|
||||
QStringList fMusrFTPrevCmd;
|
||||
int fEditW{900}, fEditH{800};
|
||||
QStatusBar *fStatusBar{nullptr};
|
||||
|
||||
QMap<QString, QAction*> fActions;
|
||||
std::unique_ptr<QAction> fMusrT0Action;
|
||||
|
@ -137,6 +137,27 @@
|
||||
<pixmap></pixmap>
|
||||
<params>3</params>
|
||||
</func>
|
||||
<func>
|
||||
<name>dynGLKT_F_ZF</name>
|
||||
<comment>(damping hopping-rate)</comment>
|
||||
<label>dynamic Gauss-Lorentz KT Fast ZF</label>
|
||||
<pixmap></pixmap>
|
||||
<params>2</params>
|
||||
</func>
|
||||
<func>
|
||||
<name>dynGLKT_F_LF</name>
|
||||
<comment>(frequency damping hopping-rate)</comment>
|
||||
<label>dynamic Gauss-Lorentz KT Fast LF</label>
|
||||
<pixmap></pixmap>
|
||||
<params>3</params>
|
||||
</func>
|
||||
<func>
|
||||
<name>dynGLKT_LF</name>
|
||||
<comment>(frequency damping hopping-rate)</comment>
|
||||
<label>dynamic Gauss-Lorentz KT LF</label>
|
||||
<pixmap></pixmap>
|
||||
<params>3</params>
|
||||
</func>
|
||||
<func>
|
||||
<name>combiLGKT</name>
|
||||
<comment>(lorentzRate gaussRate)</comment>
|
||||
@ -249,6 +270,13 @@
|
||||
<pixmap></pixmap>
|
||||
<params>5</params>
|
||||
</func>
|
||||
<func>
|
||||
<name>F_mu_F</name>
|
||||
<comment>(w_d)</comment>
|
||||
<label>F-mu-F</label>
|
||||
<pixmap></pixmap>
|
||||
<params>1</params>
|
||||
</func>
|
||||
<func>
|
||||
<name>polynom</name>
|
||||
<comment>(tshift p0 p1 ... pn)</comment>
|
||||
|
Reference in New Issue
Block a user