16 Commits

Author SHA1 Message Date
bface6bf1e adopted to the newer Qt versions. 2022-11-07 09:48:19 +01:00
e3c2149847 adopted to the newer boost versions. 2022-11-07 09:47:50 +01:00
f3414f687c replaced sprintf -> snprintf throughout. 2022-11-05 20:16:44 +01:00
44aacfca50 adopted from qt5 to qt6. 2022-09-06 20:50:59 +02:00
173d20f05e improved export parameter list behavior. Allow multiple deliminators: ',', ';', ' ' 2022-09-02 14:40:12 +02:00
ccc1dda352 fixed typo. 2022-09-02 14:38:54 +02:00
b4c7780ff5 improved msr<->mlog swap dialog. 2022-09-02 13:53:34 +02:00
2ba6e8a230 make sure that the minimum height of musrStep is not larger than the available screen resolution height. 2022-09-02 13:29:45 +02:00
43b4566870 fixed bug in msr2data global+ according to issue #33 reported on bitbucket. 2022-08-08 18:16:48 +02:00
b1ffba391a lift cmake requirement to 3.17. 2022-07-06 13:48:59 +02:00
804c56fd1f removed obsolete filed. 2022-07-06 13:48:07 +02:00
ae7f1a2168 more work towards a modern cmake. As a first example reworked FFTW3 binding. 2022-07-01 16:18:24 +02:00
3f2e96303a improvement dealing with rpath on macOS. 2022-06-20 15:53:57 +02:00
1b190830e9 fixed typo. 2022-06-01 13:43:01 +02:00
7b19ba8b36 use PFindRun facility now. Cleaned up various little things. 2022-06-01 13:08:07 +02:00
137a3f17c9 move on to modernize towards modern c++. 2022-05-31 12:32:58 +02:00
81 changed files with 592 additions and 630 deletions

View File

@ -1,11 +1,7 @@
# - musrfit
cmake_minimum_required(VERSION 3.9)
# - musrfit
cmake_minimum_required(VERSION 3.17)
if (CMAKE_VERSION GREATER_EQUAL 3.12)
cmake_policy(SET CMP0075 NEW)
endif (CMAKE_VERSION GREATER_EQUAL 3.12)
project(musrfit VERSION 1.8.0 LANGUAGES C CXX)
project(musrfit VERSION 1.8.1 LANGUAGES C CXX)
#--- musrfit specific options -------------------------------------------------
option(nexus "build optional NeXus support. Needed for ISIS" OFF)
@ -21,7 +17,7 @@ set_property(CACHE qt_version PROPERTY STRINGS AUTO 3 4 5 6)
#--- 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
@ -35,7 +31,7 @@ endif ()
#--- the next two lines are needed that the math functions are found ----------
set(CMAKE_REQUIRED_INCLUDES math.h)
set(CMAKE_REQUIRED_LIBRARIES m)
set(CMAKE_REQUIRED_LIBRARIES m)
include(CheckTypeSize)
include(CheckIncludeFiles)
@ -84,17 +80,17 @@ if (ROOT_mathmore_FOUND)
endif (ROOT_mathmore_FOUND)
#--- the next check is need to set a flag, since root 6.24 (minuit2) breaks
#--- the backwards compatibility. ---------------------------------------------
#--- the backwards compatibility. ---------------------------------------------
if (ROOT_VERSION VERSION_LESS "6.23")
set(ROOT_GRTEQ_24 0)
else ()
else ()
set(ROOT_GRTEQ_24 1)
endif ()
set(ROOT_GRTEQ_24 ${ROOT_GRTEQ_24} CACHE INTERNAL "ROOT Version check")
#--- check for boost ----------------------------------------------------------
find_package(Boost REQUIRED
COMPONENTS
COMPONENTS
system
filesystem
)
@ -105,12 +101,6 @@ find_package(GSL REQUIRED)
#--- check for fftw3 ----------------------------------------------------------
find_package(FFTW3 REQUIRED)
if (FFTW3_THREAD_FOUND)
set(HAVE_LIBFFTW3_THREADS 1 CACHE INTERNAL "fftw3_threads are available")
endif (FFTW3_THREAD_FOUND)
if (FFTW3F_THREAD_FOUND)
set(HAVE_LIBFFTW3F_THREADS 1 CACHE INTERNAL "fftw3f_threads are available")
endif (FFTW3F_THREAD_FOUND)
#--- check for libxml2 --------------------------------------------------------
find_package(LibXml2 REQUIRED)
@ -135,7 +125,7 @@ if (qt_based_tools)
find_package(Qt6Xml CONFIG REQUIRED)
find_package(Qt6Network CONFIG REQUIRED)
find_package(Qt6Svg CONFIG REQUIRED)
find_package(Qt6PrintSupport CONFIG REQUIRED)
find_package(Qt6PrintSupport CONFIG REQUIRED)
endif (Qt6Core_FOUND)
# try Qt5
if (NOT Qt6Core_FOUND)
@ -209,7 +199,7 @@ endif (qt_based_tools)
if (nexus)
find_package(HDF5 COMPONENTS CXX REQUIRED )
find_package(HDF4 REQUIRED)
find_package(NeXus REQUIRED)
find_package(NEXUS REQUIRED)
add_definitions(-DPNEXUS_ENABLED)
endif (nexus)
@ -232,7 +222,7 @@ endif ()
#--- propagate to the sub-directories -----------------------------------------
add_subdirectory(src)
#--- write summary of the installation
#--- write summary of the installation
message("")
message("|-----------------------------------------------------------------------|")
message("| |")
@ -249,7 +239,7 @@ message("")
message(" Requirements:")
message(" -------------")
message("")
message(" FFTW3 found in ${FFTW3_INCLUDE_DIR}")
message(" FFTW3 found in ${FFTW3_INCLUDE}")
message(" GSL found in ${GSL_INCLUDE_DIRS}")
message(" BOOST found in ${Boost_INCLUDE_DIRS}")
message(" LibXML2 found in ${LIBXML2_INCLUDE_DIR}")
@ -264,14 +254,14 @@ endif (OpenMP_FOUND)
if (nexus)
message("")
message(" HDF4 found in ${HDF4_INCLUDE_DIRS}")
message(" HDF4 found in ${HDF4_INCLUDE_DIRS}")
message(" HDF5 found in ${HDF5_INCLUDE_DIRS}")
message(" NeXus found in ${NEXUS_INCLUDE_DIR}")
message(" NeXus found in ${NEXUS_INCLUDE_DIR}")
endif (nexus)
message("")
if (qt_based_tools)
if (Qt6Core_FOUND)
if (Qt6Core_FOUND)
message(" Qt found in ${Qt6Core_INCLUDE_DIRS} (Version: ${Qt6Core_VERSION})")
else (Qt6Core_FOUND)
if (Qt5Core_FOUND)
@ -363,8 +353,8 @@ message("-----------------------------------------------------------------------
message("")
#--- cpack specific info ......................................................
file(TO_NATIVE_PATH ${PROJECT_SOURCE_DIR} PROJECT_SOURCE_DIR_NATIVE)
file(TO_NATIVE_PATH ${PROJECT_BINARY_DIR} PROJECT_BINARY_DIR_NATIVE)
file(TO_NATIVE_PATH ${PROJECT_SOURCE_DIR} PROJECT_SOURCE_DIR_NATIVE)
file(TO_NATIVE_PATH ${PROJECT_BINARY_DIR} PROJECT_BINARY_DIR_NATIVE)
string(REPLACE "\\" "\\\\" PROJECT_SOURCE_DIR_NATIVE_D ${PROJECT_SOURCE_DIR_NATIVE})
string(REPLACE "\\" "\\\\" PROJECT_BINARY_DIR_NATIVE_D ${PROJECT_BINARY_DIR_NATIVE})

View File

@ -1,7 +1,7 @@
# - Find fftw3 library
# Find the native FFTW3 includes and library
# This module defines
# FFTW3_INCLUDE_DIR, where to find fftw3.h, etc.
# FFTW3_INCLUDE, where to find fftw3.h, etc.
# ---
# FFTW3_LIBRARY, library to link against to use FFTW3
# FFTW3_OMP_LIBRARY, library to link against to use FFTW3_omp
@ -31,17 +31,53 @@
# FFTW3Q_OMP_FOUND, if false, do not try to use OpenMP FFTW3q.
# FFTW3Q_THREADS_FOUND, if false, do not try to use threaded FFTW3q.
find_path(FFTW3_INCLUDE_DIR fftw3.h
function(add_imported_library lib_name library headers)
add_library(FFTW3::${lib_name} UNKNOWN IMPORTED)
set_target_properties(FFTW3::${lib_name} PROPERTIES
IMPORTED_LOCATION ${library}
INTERFACE_INCLUDE_DIRECTORIES ${headers}
)
set(${lib_name}_FOUND 1 CACHE INTERNAL "FFTW3 ${lib_name} found" FORCE)
set(${lib_name}_LIBRARY ${library}
CACHE STRING "Path to FFTW3::${lib_name} library" FORCE)
set(FFTW3_INCLUDE ${headers}
CACHE STRING "Path to FFTW3 headers" FORCE)
mark_as_advanced(FORCE ${lib_name}_LIBRARY)
mark_as_advanced(FORCE FFTW3_INCLUDE)
endfunction()
#as35 if (FFTW3_LIBRARY AND FFTW3_INCLUDE)
#as35 add_imported_library(${FFTW3_LIBRARY} ${FFTW3_INCLUDE})
#as35 if (FFTW3_OMP_LIBRARY AND FFTW3_INCLUDE)
#as35 add_imported_library(${FFTW3_OMP_LIBRARY} ${FFTW3_INCLUDE})
#as35 elseif (FFTW3_THREAD_LIBRARY AND FFTW3_INCLUDE)
#as35 add_imported_library(${FFTW3_THRED_LIBRARY} ${FFTW3_INCLUDE})
#as35 elseif (FFTW3L_LIBRARY AND FFTW3_INCLUDE)
#as35 add_imported_library(${FFTW3L_LIBRARY} ${FFTW3_INCLUDE})
#as35 elseif (FFTW3L_OMP_LIBRARY AND FFTW3_INCLUDE)
#as35 add_imported_library(${FFTW3L_OMP_LIBRARY} ${FFTW3_INCLUDE})
#as35 elseif (FFTW3L_THREAD_LIBRARY AND FFTW3_INCLUDE)
#as35 add_imported_library(${FFTW3L_THRED_LIBRARY} ${FFTW3_INCLUDE})
#as35 elseif (FFTW3F_LIBRARY AND FFTW3_INCLUDE)
#as35 add_imported_library(${FFTW3F_LIBRARY} ${FFTW3_INCLUDE})
#as35 elseif (FFTW3F_OMP_LIBRARY AND FFTW3_INCLUDE)
#as35 add_imported_library(${FFTW3F_OMP_LIBRARY} ${FFTW3_INCLUDE})
#as35 elseif (FFTW3F_THREAD_LIBRARY AND FFTW3_INCLUDE)
#as35 add_imported_library(${FFTW3F_THRED_LIBRARY} ${FFTW3_INCLUDE})
#as35 elseif (FFTW3Q_LIBRARY AND FFTW3_INCLUDE)
#as35 add_imported_library(${FFTW3Q_LIBRARY} ${FFTW3_INCLUDE})
#as35 elseif (FFTW3Q_OMP_LIBRARY AND FFTW3_INCLUDE)
#as35 add_imported_library(${FFTW3Q_OMP_LIBRARY} ${FFTW3_INCLUDE})
#as35 elseif (FFTW3Q_THREAD_LIBRARY AND FFTW3_INCLUDE)
#as35 add_imported_library(${FFTW3Q_THRED_LIBRARY} ${FFTW3_INCLUDE})
#as35 endif()
#as35 return()
#as35 endif()
find_path(FFTW3_INCLUDE NAMES fftw3.h
HINTS "/usr/include" "/opt/local/include"
)
# find position of fftw3.h from the end
string(FIND "${FFTW3_INCLUDE_DIR}" "/fftw3.h" pos REVERSE)
# truncate the string
string(SUBSTRING "${FFTW3_INCLUDE_DIR}" 0 ${pos} substr)
set(FFTW3_INCLUDE_DIR ${substr})
unset(substr)
find_library(FFTW3_LIBRARY fftw3)
find_library(FFTW3_OMP_LIBRARY fftw3_omp)
find_library(FFTW3_THREAD_LIBRARY fftw3_threads)
@ -58,94 +94,126 @@ find_library(FFTW3Q_THREAD_LIBRARY fftw3q_threads)
# handle the QUIETLY and REQUIRED arguments and set FFTW3_FOUND to TRUE if
# all listed variables are TRUE
include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
# FFTW3
find_package_handle_standard_args(FFTW3
REQUIRED_VARS FFTW3_LIBRARY FFTW3_INCLUDE_DIR
VERSION_VAR "3")
DEFAULT_MSG FFTW3_LIBRARY FFTW3_INCLUDE
)
if (FFTW3_FOUND)
add_imported_library("FFTW3" "${FFTW3_LIBRARY}" "${FFTW3_INCLUDE}")
endif()
# FFTW3_OMP
find_package_handle_standard_args(FFTW3_OMP
REQUIRED_VARS FFTW3_OMP_LIBRARY FFTW3_INCLUDE_DIR
VERSION_VAR "3")
REQUIRED_VARS FFTW3_OMP_LIBRARY FFTW3_INCLUDE
HANDLE_COMPONENTS
NAME_MISMATCHED
)
if (FFTW3_OMP_FOUND)
add_imported_library("FFTW3_OMP" "${FFTW3_OMP_LIBRARY}" "${FFTW3_INCLUDE}")
endif()
# FFTW3_THREAD
find_package_handle_standard_args(FFTW3_THREAD
REQUIRED_VARS FFTW3_THREAD_LIBRARY FFTW3_INCLUDE_DIR
VERSION_VAR "3")
REQUIRED_VARS FFTW3_THREAD_LIBRARY FFTW3_INCLUDE
HANDLE_COMPONENTS
NAME_MISMATCHED
)
if (FFTW3_THREAD_FOUND)
add_imported_library("FFTW3_THREAD" "${FFTW3_THREAD_LIBRARY}" "${FFTW3_INCLUDE}")
endif()
# FFTW3L
find_package_handle_standard_args(FFTW3L
REQUIRED_VARS FFTW3L_LIBRARY FFTW3_INCLUDE_DIR
VERSION_VAR "3")
REQUIRED_VARS FFTW3L_LIBRARY FFTW3_INCLUDE
HANDLE_COMPONENTS
NAME_MISMATCHED
)
if (FFTW3L_FOUND)
add_imported_library("FFTW3L" "${FFTW3L_LIBRARY}" "${FFTW3_INCLUDE}")
endif()
# FFTW3L_OMP
find_package_handle_standard_args(FFTW3L_OMP
REQUIRED_VARS FFTW3L_OMP_LIBRARY FFTW3_INCLUDE_DIR
VERSION_VAR "3")
REQUIRED_VARS FFTW3L_OMP_LIBRARY FFTW3_INCLUDE
HANDLE_COMPONENTS
NAME_MISMATCHED
)
if (FFTW3L_OMP_FOUND)
add_imported_library("FFTW3L_OMP" "${FFTW3L_OMP_LIBRARY}" "${FFTW3_INCLUDE}")
endif()
# FFTW3L_THREAD
find_package_handle_standard_args(FFTW3L_THREAD
REQUIRED_VARS FFTW3L_THREAD_LIBRARY FFTW3_INCLUDE_DIR
VERSION_VAR "3")
REQUIRED_VARS FFTW3L_THREAD_LIBRARY FFTW3_INCLUDE
HANDLE_COMPONENTS
NAME_MISMATCHED
)
if (FFTW3L_THREAD_FOUND)
add_imported_library("FFTW3L_THREAD" "${FFTW3L_THREAD_LIBRARY}" "${FFTW3_INCLUDE}")
endif()
# FFTW3F
find_package_handle_standard_args(FFTW3F
REQUIRED_VARS FFTW3F_LIBRARY FFTW3_INCLUDE_DIR
VERSION_VAR "3")
REQUIRED_VARS FFTW3F_LIBRARY FFTW3_INCLUDE
HANDLE_COMPONENTS
NAME_MISMATCHED
)
if (FFTW3F_FOUND)
add_imported_library("FFTW3F" "${FFTW3F_LIBRARY}" "${FFTW3_INCLUDE}")
endif()
# FFTW3F_OMP
find_package_handle_standard_args(FFTW3F_OMP
REQUIRED_VARS FFTW3F_OMP_LIBRARY FFTW3_INCLUDE_DIR
VERSION_VAR "3")
REQUIRED_VARS FFTW3F_OMP_LIBRARY FFTW3_INCLUDE
HANDLE_COMPONENTS
NAME_MISMATCHED
)
if (FFTW3F_OMP_FOUND)
add_imported_library("FFTW3F_OMP" "${FFTW3F_OMP_LIBRARY}" "${FFTW3_INCLUDE}")
endif()
# FFTW3F_THREAD
find_package_handle_standard_args(FFTW3F_THREAD
REQUIRED_VARS FFTW3F_THREAD_LIBRARY FFTW3_INCLUDE_DIR
VERSION_VAR "3")
REQUIRED_VARS FFTW3F_THREAD_LIBRARY FFTW3_INCLUDE
HANDLE_COMPONENTS
NAME_MISMATCHED
)
if (FFTW3F_THREAD_FOUND)
add_imported_library("FFTW3F_THREAD" "${FFTW3F_THREAD_LIBRARY}" "${FFTW3_INCLUDE}")
endif()
# FFTW3Q
find_package_handle_standard_args(FFTW3Q
REQUIRED_VARS FFTW3Q_LIBRARY FFTW3_INCLUDE_DIR
VERSION_VAR "3")
REQUIRED_VARS FFTW3Q_LIBRARY FFTW3_INCLUDE
HANDLE_COMPONENTS
NAME_MISMATCHED
)
if (FFTW3Q_FOUND)
add_imported_library("FFTW3Q" "${FFTW3Q_LIBRARY}" "${FFTW3_INCLUDE}")
endif()
# FFTW3Q_OMP
find_package_handle_standard_args(FFTW3Q_OMP
REQUIRED_VARS FFTW3Q_OMP_LIBRARY FFTW3_INCLUDE_DIR
VERSION_VAR "3")
REQUIRED_VARS FFTW3Q_OMP_LIBRARY FFTW3_INCLUDE
HANDLE_COMPONENTS
NAME_MISMATCHED
)
if (FFTW3Q_OMP_FOUND)
add_imported_library("FFTW3Q_OMP" "${FFTW3Q_OMP_LIBRARY}" "${FFTW3_INCLUDE}")
endif()
# FFTW3Q_THREAD
find_package_handle_standard_args(FFTW3Q_THREAD
REQUIRED_VARS FFTW3Q_THREAD_LIBRARY FFTW3_INCLUDE_DIR
VERSION_VAR "3")
if (NOT FFTW3_FOUND)
unset(FFTW3_LIBRARY)
endif()
if (NOT FFTW3_OMP_FOUND)
unset(FFTW3_OMP_LIBRARY)
endif()
if (NOT FFTW3_THREAD_FOUND)
unset(FFTW3_THREAD_LIBRARY)
REQUIRED_VARS FFTW3Q_THREAD_LIBRARY FFTW3_INCLUDE
HANDLE_COMPONENTS
NAME_MISMATCHED
)
if (FFTW3Q_THREAD_FOUND)
add_imported_library("FFTW3Q_THREAD" "${FFTW3Q_THREAD_LIBRARY}" "${FFTW3_INCLUDE}")
endif()
if (NOT FFTW3L_FOUND)
unset(FFTW3L_LIBRARY)
endif()
if (NOT FFTW3L_OMP_FOUND)
unset(FFTW3L_OMP_LIBRARY)
endif()
if (NOT FFTW3L_THREAD_FOUND)
unset(FFTW3L_THREAD_LIBRARY)
endif()
if (NOT FFTW3F_FOUND)
unset(FFTW3F_LIBRARY)
endif()
if (NOT FFTW3F_OMP_FOUND)
unset(FFTW3F_OMP_LIBRARY)
endif()
if (NOT FFTW3F_THREAD_FOUND)
unset(FFTW3F_THREAD_LIBRARY)
endif()
if (NOT FFTW3Q_FOUND)
unset(FFTW3Q_LIBRARY)
endif()
if (NOT FFTW3Q_OMP_FOUND)
unset(FFTW3Q_OMP_LIBRARY)
endif()
if (NOT FFTW3Q_THREAD_FOUND)
unset(FFTW3Q_THREAD_LIBRARY)
endif()
mark_as_advanced(
FFTW3_INCLUDE_DIR
FFTW3_LIBRARY FFTW3_OMP_LIBRARY FFTW3_THREAD_LIBRARY
FFTW3L_LIBRARY FFTW3L_OMP_LIBRARY FFTW3L_THREAD_LIBRARY
FFTW3F_LIBRARY FFTW3F_OMP_LIBRARY FFTW3F_THREAD_LIBRARY
FFTW3Q_LIBRARY FFTW3Q_OMP_LIBRARY FFTW3Q_THREAD_LIBRARY
)
if (FFTW3_FOUND)
message("-- Found FFTW3: ${FFTW3_INCLUDE_DIR}")
message("-- Found FFTW3: ${FFTW3_INCLUDE}")
endif (FFTW3_FOUND)

View File

@ -60,7 +60,6 @@ target_compile_options(addRun BEFORE PRIVATE "-DHAVE_CONFIG_H" "${HAVE_GIT_REV_H
target_include_directories(addRun
BEFORE PRIVATE
$<BUILD_INTERFACE:${Boost_INCLUDE_DIR}>
$<BUILD_INTERFACE:${FFTW3_INCLUDE_DIR}>
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/src>
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src/include>
@ -72,7 +71,6 @@ target_compile_options(any2many BEFORE PRIVATE "-DHAVE_CONFIG_H" "${HAVE_GIT_REV
target_include_directories(any2many
BEFORE PRIVATE
$<BUILD_INTERFACE:${Boost_INCLUDE_DIR}>
$<BUILD_INTERFACE:${FFTW3_INCLUDE_DIR}>
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/src>
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src/include>
@ -84,7 +82,6 @@ target_compile_options(dump_header BEFORE PRIVATE "-DHAVE_CONFIG_H" "${HAVE_GIT_
target_include_directories(dump_header
BEFORE PRIVATE
$<BUILD_INTERFACE:${Boost_INCLUDE_DIRS}>
$<BUILD_INTERFACE:${FFTW3_INCLUDE_DIR}>
$<BUILD_INTERFACE:${NEXUS_INCLUDE_DIR}>
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/src>
@ -102,7 +99,6 @@ target_compile_options(msr2data BEFORE PRIVATE "-DHAVE_CONFIG_H" "${HAVE_GIT_REV
target_include_directories(msr2data
BEFORE PRIVATE
$<BUILD_INTERFACE:${Boost_INCLUDE_DIRS}>
$<BUILD_INTERFACE:${FFTW3_INCLUDE_DIR}>
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/src>
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src/include>
@ -117,7 +113,6 @@ target_compile_options(musrfit BEFORE PRIVATE "-DHAVE_CONFIG_H" "${HAVE_GIT_REV_
target_include_directories(musrfit
BEFORE PRIVATE
$<BUILD_INTERFACE:${Boost_INCLUDE_DIR}>
$<BUILD_INTERFACE:${FFTW3_INCLUDE_DIR}>
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/src>
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src/include>
@ -129,18 +124,17 @@ target_compile_options(musrFT BEFORE PRIVATE "-DHAVE_CONFIG_H" "${HAVE_GIT_REV_H
target_include_directories(musrFT
BEFORE PRIVATE
$<BUILD_INTERFACE:${Boost_INCLUDE_DIR}>
$<BUILD_INTERFACE:${FFTW3_INCLUDE_DIR}>
$<BUILD_INTERFACE:${FFTW3_INCLUDE}>
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/src>
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src/include>
)
target_link_libraries(musrFT ${FFTW3_LIBRARY} ${ROOT_LIBRARIES} ${MUSRFIT_LIBS})
target_link_libraries(musrFT FFTW3::FFTW3 ${ROOT_LIBRARIES} ${MUSRFIT_LIBS})
add_executable(musrRootValidation ${GIT_REV_H} musrRootValidation.cpp)
target_compile_options(musrRootValidation BEFORE PRIVATE "-DHAVE_CONFIG_H" "${HAVE_GIT_REV_H}")
target_include_directories(musrRootValidation
BEFORE PRIVATE
$<BUILD_INTERFACE:${FFTW3_INCLUDE_DIR}>
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/src>
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src/include>
@ -153,7 +147,6 @@ target_compile_options(musrt0 BEFORE PRIVATE "-DHAVE_CONFIG_H" "${HAVE_GIT_REV_H
target_include_directories(musrt0
BEFORE PRIVATE
$<BUILD_INTERFACE:${Boost_INCLUDE_DIR}>
$<BUILD_INTERFACE:${FFTW3_INCLUDE_DIR}>
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/src>
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src/include>
@ -165,18 +158,17 @@ target_compile_options(musrview BEFORE PRIVATE "-DHAVE_CONFIG_H" "${HAVE_GIT_REV
target_include_directories(musrview
BEFORE PRIVATE
$<BUILD_INTERFACE:${Boost_INCLUDE_DIR}>
$<BUILD_INTERFACE:${FFTW3_INCLUDE_DIR}>
$<BUILD_INTERFACE:${FFTW3_INCLUDE}>
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/src>
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src/include>
)
target_link_libraries(musrview ${FFTW3_LIBRARY} ${ROOT_LIBRARIES} ${MUSRFIT_LIBS})
target_link_libraries(musrview FFTW3::FFTW3 ${ROOT_LIBRARIES} ${MUSRFIT_LIBS})
add_executable(write_musrRoot_runHeader ${GIT_REV_H} write_musrRoot_runHeader.cpp)
target_compile_options(write_musrRoot_runHeader BEFORE PRIVATE "-DHAVE_CONFIG_H" "${HAVE_GIT_REV_H}")
target_include_directories(write_musrRoot_runHeader
BEFORE PRIVATE
$<BUILD_INTERFACE:${FFTW3_INCLUDE_DIR}>
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/src>
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src/include>

View File

@ -12,7 +12,7 @@ root_generate_dictionary(
PFourierCanvas.h
OPTIONS
-I${MUSRFIT_INC}
-I${FFTW3_INCLUDE_DIR}
-I${FFTW3_INCLUDE}
-inlineInputHeader
LINKDEF ${MUSRFIT_INC}/PFourierCanvasLinkDef.h
MODULE PFourierCanvas
@ -22,7 +22,7 @@ root_generate_dictionary(
PMusrCanvas.h
LINKDEF ${MUSRFIT_INC}/PMusrCanvasLinkDef.h
OPTIONS
-I${Boost_INCLUDE_DIR} -I${FFTW3_INCLUDE_DIR} -I${MUSRFIT_INC}
-I${Boost_INCLUDE_DIR} -I${FFTW3_INCLUDE} -I${MUSRFIT_INC}
-inlineInputHeader
MODULE PMusrCanvas
)
@ -31,7 +31,7 @@ root_generate_dictionary(
PMusrT0.h
LINKDEF ${MUSRFIT_INC}/PMusrT0LinkDef.h
OPTIONS
-I${Boost_INCLUDE_DIR} -I${FFTW3_INCLUDE_DIR} -I${MUSRFIT_INC}
-I${Boost_INCLUDE_DIR} -I${FFTW3_INCLUDE} -I${MUSRFIT_INC}
-inlineInputHeader
MODULE PMusrT0
)
@ -40,7 +40,7 @@ root_generate_dictionary(
PStartupHandler.h
LINKDEF ${MUSRFIT_INC}/PStartupHandlerLinkDef.h
OPTIONS
-I${FFTW3_INCLUDE_DIR} -I${MUSRFIT_INC}
-I${FFTW3_INCLUDE} -I${MUSRFIT_INC}
-inlineInputHeader
MODULE PStartupHandler
)
@ -50,7 +50,7 @@ root_generate_dictionary(
LINKDEF ${MUSRFIT_INC}/PUserFcnBaseLinkDef.h
OPTIONS
-inlineInputHeader
-I${FFTW3_INCLUDE_DIR} -I${MUSRFIT_INC}
-I${FFTW3_INCLUDE} -I${MUSRFIT_INC}
MODULE PUserFcnBase
)
root_generate_dictionary(
@ -59,7 +59,7 @@ root_generate_dictionary(
OPTIONS
-I${NONLOCAL_INC}
-I${MUSRFIT_INC}
-I${FFTW3_INCLUDE_DIR}
-I${FFTW3_INCLUDE}
-I${CMAKE_CURRENT_SOURCE_DIR}
-inlineInputHeader
LINKDEF ${MUSRFIT_INC}/PRgeHandlerLinkDef.h
@ -118,7 +118,7 @@ add_library(PMusr SHARED
target_include_directories(
PMusr BEFORE PRIVATE
$<BUILD_INTERFACE:${Boost_INCLUDE_DIR}>
$<BUILD_INTERFACE:${FFTW3_INCLUDE_DIR}>
$<BUILD_INTERFACE:${FFTW3_INCLUDE}>
$<BUILD_INTERFACE:${NEXUS_INCLUDE_DIR}>
$<BUILD_INTERFACE:${MUSRFIT_INC}>
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src/external/MusrRoot>
@ -176,7 +176,8 @@ endif (OpenMP_FOUND)
#--- add library dependencies -------------------------------------------------
set(DependOnLibs ${ROOT_LIBARIES})
set(DependOnLibs ${DependOnLibs} ${FFTW3_LIBRARY})
#set(DependOnLibs ${DependOnLibs} ${FFTW3_LIBRARY})
set(DependOnLibs ${DependOnLibs} FFTW3::FFTW3)
set(DependOnLibs ${DependOnLibs} PUserFcnBase)
set(DependOnLibs ${DependOnLibs} mud)
set(DependOnLibs ${DependOnLibs} TMusrRunHeader)

View File

@ -1827,12 +1827,7 @@ Int_t PMsrHandler::WriteMsrFile(const Char_t *filename, std::map<UInt_t, TString
if (fGlobal.GetFitRange(j) == -1)
break;
UInt_t neededWidth = 7;
UInt_t neededPrec = 2;
if (fGlobal.GetFitRange(j) > 0.0) { // global fit range present
LastSignificant(fGlobal.GetFitRange(j));
} else { // global fit range absent
neededPrec = LastSignificant(fRuns[i].GetFitRange(j));
}
UInt_t neededPrec = LastSignificant(fGlobal.GetFitRange(j));
fout.width(neededWidth);
fout.precision(neededPrec);
fout << std::left << std::fixed << fGlobal.GetFitRange(j);
@ -3868,7 +3863,7 @@ Bool_t PMsrHandler::FilterNumber(TString str, const Char_t *filter, Int_t offset
Char_t *cstr, filterStr[32];
cstr = new Char_t[str.Sizeof()];
strncpy(cstr, str.Data(), str.Sizeof());
sprintf(filterStr, "%s%%d", filter);
snprintf(filterStr, sizeof(filterStr), "%s%%d", filter);
// get number if present
found = sscanf(cstr, filterStr, &no_found);
@ -6614,7 +6609,7 @@ UInt_t PMsrHandler::LastSignificant(Double_t dval, UInt_t precLimit)
char str[128];
sprintf(str, "%lf", dval);
snprintf(str, sizeof(str), "%lf", dval);
// find decimal point
for (UInt_t i=0; i<strlen(str); i++) {

View File

@ -543,7 +543,7 @@ void PMusrCanvas::UpdateParamTheoryPad()
for (UInt_t i=0; i<param.size(); i++) {
str = "";
accuracy = GetNeededAccuracy(param[i]);
sprintf(accStr, "%%.%dlf", accuracy);
snprintf(accStr, sizeof(accStr), "%%.%dlf", accuracy);
// parameter no
str += param[i].fNo;
if (param[i].fNo<10)
@ -556,9 +556,9 @@ void PMusrCanvas::UpdateParamTheoryPad()
str += " ";
// parameter value
if (round(param[i].fValue)-param[i].fValue==0)
sprintf(cnum, "%.1lf", param[i].fValue);
snprintf(cnum, sizeof(cnum), "%.1lf", param[i].fValue);
else
sprintf(cnum, accStr, param[i].fValue);
snprintf(cnum, sizeof(cnum), accStr, param[i].fValue);
str += cnum;
for (Int_t j=0; j<9-(Int_t)strlen(cnum); j++) // fill spaces
str += " ";
@ -572,22 +572,22 @@ void PMusrCanvas::UpdateParamTheoryPad()
if ((fabs(fabs(param[i].fStep) - param[i].fPosError) < 0.1*fabs(param[i].fStep)) &&
(fabs(fabs(param[i].fStep) - param[i].fPosError) < 0.1*param[i].fPosError)) {
if (round(err)-err==0)
sprintf(cnum, "%.1lf", err);
snprintf(cnum, sizeof(cnum), "%.1lf", err);
else
sprintf(cnum, accStr, err);
snprintf(cnum, sizeof(cnum), accStr, err);
} else {
sprintf(accStr, "%%.%dlf!!", accuracy);
snprintf(accStr, sizeof(accStr), "%%.%dlf!!", accuracy);
if (round(err)-err==0)
sprintf(cnum, "%.1lf!!", err);
snprintf(cnum, sizeof(cnum), "%.1lf!!", err);
else
sprintf(cnum, accStr, err);
snprintf(cnum, sizeof(cnum), accStr, err);
}
str += cnum;
} else { // minos was not used
if (round(param[i].fStep)-param[i].fStep==0)
sprintf(cnum, "%.1lf", param[i].fStep);
snprintf(cnum, sizeof(cnum), "%.1lf", param[i].fStep);
else
sprintf(cnum, accStr, param[i].fStep);
snprintf(cnum, sizeof(cnum), accStr, param[i].fStep);
str += cnum;
}
ypos = 0.98-i*yoffset;
@ -936,13 +936,13 @@ void PMusrCanvas::UpdateInfoPad()
tstr += TString("??,");
} else if (ddvec->size() == 1){
tstr += TString("T=");
sprintf(sval, "%0.2lf", ddvec->at(0).first);
snprintf(sval, sizeof(sval), "%0.2lf", ddvec->at(0).first);
tstr += TString(sval) + TString("K,");
} else {
for(UInt_t i(0); i<ddvec->size(); ++i){
sprintf(sval, "T%u=", i);
snprintf(sval, sizeof(sval), "T%u=", i);
tstr += TString(sval);
sprintf(sval, "%0.2lf", ddvec->at(i).first);
snprintf(sval, sizeof(sval), "%0.2lf", ddvec->at(i).first);
tstr += TString(sval) + TString("K,");
}
}
@ -953,10 +953,10 @@ void PMusrCanvas::UpdateInfoPad()
tstr += TString("??,");
} else {
if (dval < 1.0e4) { // Gauss makes sense as a unit
sprintf(sval, "%0.2lf", dval);
snprintf(sval, sizeof(sval), "%0.2lf", dval);
tstr += TString(sval) + TString("G,");
} else { // Tesla makes sense as a unit
sprintf(sval, "%0.2lf", dval/1.0e4);
snprintf(sval, sizeof(sval), "%0.2lf", dval/1.0e4);
tstr += TString(sval) + TString("T,");
}
}
@ -967,10 +967,10 @@ void PMusrCanvas::UpdateInfoPad()
tstr += TString("??,");
} else {
if (dval < 1.0e3) { // keV makes sense as a unit
sprintf(sval, "%0.2lf", dval);
snprintf(sval, sizeof(sval), "%0.2lf", dval);
tstr += TString(sval) + TString("keV,");
} else { // MeV makes sense as a unit
sprintf(sval, "%0.2lf", dval/1.0e3);
snprintf(sval, sizeof(sval), "%0.2lf", dval/1.0e3);
tstr += TString(sval) + TString("MeV,");
}
}
@ -1579,13 +1579,13 @@ void PMusrCanvas::SaveGraphicsAndQuit(Char_t *fileName, Char_t *graphicsFormat)
}
if (fStartWithFourier)
sprintf(ext, "_%d_F", fPlotNumber);
snprintf(ext, sizeof(ext), "_%d_F", fPlotNumber);
else
sprintf(ext, "_%d", fPlotNumber);
snprintf(ext, sizeof(ext), "_%d", fPlotNumber);
str.Replace(idx, size, ext, strlen(ext));
idx += strlen(ext);
size = strlen(ext);
sprintf(ext, ".%s", graphicsFormat);
snprintf(ext, sizeof(ext), ".%s", graphicsFormat);
str.Replace(idx, size, ext, strlen(ext));
std::cout << std::endl << ">> SaveGraphicsAndQuit: " << str.Data() << std::endl;
@ -6539,7 +6539,7 @@ UInt_t PMusrCanvas::GetNeededAccuracy(PMsrParamStructure param)
if (param.fStep == 0.0) { // check if fit parameter is a constant, i.e. step==0
char str[128];
sprintf(str, "%lf", param.fValue);
snprintf(str, sizeof(str), "%lf", param.fValue);
// find decimal point
for (UInt_t i=0; i<strlen(str); i++) {

View File

@ -823,9 +823,9 @@ Bool_t PRunDataHandler::ReadWriteFilesList()
else // bzip2
fln += TString(".tar.bz2");
if (fAny2ManyInfo->compressionTag == 1) // gzip
sprintf(cmd, "tar -zcf %s %s", fln.Data(), fAny2ManyInfo->outPathFileName[0].Data());
snprintf(cmd, sizeof(cmd), "tar -zcf %s %s", fln.Data(), fAny2ManyInfo->outPathFileName[0].Data());
else // bzip2
sprintf(cmd, "tar -jcf %s %s", fln.Data(), fAny2ManyInfo->outPathFileName[0].Data());
snprintf(cmd, sizeof(cmd), "tar -jcf %s %s", fln.Data(), fAny2ManyInfo->outPathFileName[0].Data());
if (system(cmd) == -1) {
std::cerr << "**ERROR** cmd: " << cmd << " failed." << std::endl;
}
@ -833,19 +833,19 @@ Bool_t PRunDataHandler::ReadWriteFilesList()
fln += TString(".tar");
for (UInt_t i=0; i<fAny2ManyInfo->outPathFileName.size(); i++) {
if (i==0) {
sprintf(cmd, "tar -cf %s %s", fln.Data(), fAny2ManyInfo->outPathFileName[i].Data());
snprintf(cmd, sizeof(cmd), "tar -cf %s %s", fln.Data(), fAny2ManyInfo->outPathFileName[i].Data());
} else {
sprintf(cmd, "tar -rf %s %s", fln.Data(), fAny2ManyInfo->outPathFileName[i].Data());
snprintf(cmd, sizeof(cmd), "tar -rf %s %s", fln.Data(), fAny2ManyInfo->outPathFileName[i].Data());
}
if (system(cmd) == -1) {
std::cerr << "**ERROR** cmd: " << cmd << " failed." << std::endl;
}
}
if (fAny2ManyInfo->compressionTag == 1) { // gzip
sprintf(cmd, "gzip %s", fln.Data());
snprintf(cmd, sizeof(cmd), "gzip %s", fln.Data());
fln += ".gz";
} else {
sprintf(cmd, "bzip2 -z %s", fln.Data());
snprintf(cmd, sizeof(cmd), "bzip2 -z %s", fln.Data());
fln += ".bz2";
}
if (system(cmd) == -1) {
@ -1642,7 +1642,7 @@ Bool_t PRunDataHandler::ReadRootFile()
// get all the data
Char_t histoName[32];
for (Int_t i=0; i<noOfHistos; i++) {
sprintf(histoName, "hDecay%02d", i);
snprintf(histoName, sizeof(histoName), "hDecay%02d", i);
TH1F *histo = dynamic_cast<TH1F*>(folder->FindObjectAny(histoName));
if (!histo) {
std::cerr << std::endl << ">> PRunDataHandler::ReadRootFile: **ERROR** Couldn't get histo " << histoName;
@ -1671,14 +1671,14 @@ Bool_t PRunDataHandler::ReadRootFile()
histoData.clear();
}
// check if any post pileup histos are present at all (this is not the case for LEM data 2006 and earlier)
sprintf(histoName, "hDecay%02d", POST_PILEUP_HISTO_OFFSET);
snprintf(histoName, sizeof(histoName), "hDecay%02d", POST_PILEUP_HISTO_OFFSET);
if (!folder->FindObjectAny(histoName)) {
std::cerr << std::endl << ">> PRunDataHandler::ReadRootFile: **WARNING** Couldn't get histo " << histoName;
std::cerr << std::endl << ">> most probably this is an old (2006 or earlier) LEM file without post pileup histos.";
std::cerr << std::endl;
} else {
for (Int_t i=0; i<noOfHistos; i++) {
sprintf(histoName, "hDecay%02d", i+POST_PILEUP_HISTO_OFFSET);
snprintf(histoName, sizeof(histoName), "hDecay%02d", i+POST_PILEUP_HISTO_OFFSET);
TH1F *histo = dynamic_cast<TH1F*>(folder->FindObjectAny(histoName));
if (!histo) {
std::cerr << std::endl << ">> PRunDataHandler::ReadRootFile: **ERROR** Couldn't get histo " << histoName;
@ -4676,7 +4676,7 @@ Bool_t PRunDataHandler::WriteRootFile(TString fln)
return false;
}
size = dataSet->GetData()->size();
sprintf(str, "hDecay%02d", static_cast<Int_t>(i));
snprintf(str, sizeof(str), "hDecay%02d", static_cast<Int_t>(i));
histo = new TH1F(str, str, size+1, -0.5, static_cast<Double_t>(size)+0.5);
for (UInt_t j=0; j<size; j++) {
histo->SetBinContent(j+1, dataSet->GetData()->at(j));
@ -4694,7 +4694,7 @@ Bool_t PRunDataHandler::WriteRootFile(TString fln)
return false;
}
size = dataSet->GetData()->size();
sprintf(str, "hDecay%02d", static_cast<Int_t>(i));
snprintf(str, sizeof(str), "hDecay%02d", static_cast<Int_t>(i));
histo = new TH1F(str, str, static_cast<UInt_t>(size/fAny2ManyInfo->rebin)+1, -0.5, static_cast<Double_t>(size)/static_cast<Double_t>(fAny2ManyInfo->rebin)+0.5);
dataCount = 0;
for (UInt_t j=0; j<size; j++) {
@ -5558,9 +5558,9 @@ Bool_t PRunDataHandler::WriteMudFile(TString fln)
MUD_setOrient(fd, (char *)fData[0].GetOrientation()->Data());
MUD_setDas(fd, dummy);
MUD_setExperimenter(fd, dummy);
sprintf(info, "%lf+-%lf (K)", fData[0].GetTemperature(0), fData[0].GetTempError(0));
snprintf(info, sizeof(info), "%lf+-%lf (K)", fData[0].GetTemperature(0), fData[0].GetTempError(0));
MUD_setTemperature(fd, info);
sprintf(info, "%lf", fData[0].GetField());
snprintf(info, sizeof(info), "%lf", fData[0].GetField());
MUD_setField(fd, info);
// generate the histograms
@ -6219,7 +6219,7 @@ TString PRunDataHandler::FileNameFromTemplate(TString &fileNameTemplate, Int_t r
if (idx == str.Length()) { // 'r' only
TString runStr("");
char fmt[128];
sprintf(fmt , "%%0%dd", str.Length());
snprintf(fmt, sizeof(fmt), "%%0%dd", str.Length());
runStr.Form(fmt, run);
result += runStr;
} else { // not only 'r'

View File

@ -114,7 +114,7 @@ PStartupHandler::PStartupHandler()
// check if the startup file is found under $HOME/.musrfit
home = getenv("HOME");
if (home != nullptr) {
sprintf(startup_path_name, "%s/.musrfit/musrfit_startup.xml", home);
snprintf(startup_path_name, sizeof(startup_path_name), "%s/.musrfit/musrfit_startup.xml", home);
if (StartupFileExists(startup_path_name)) {
fStartupFilePath = TString(startup_path_name);
fStartupFileFound = true;
@ -125,7 +125,7 @@ PStartupHandler::PStartupHandler()
// check if the MUSRFITPATH system variable is set
pmusrpath = getenv("MUSRFITPATH");
if (pmusrpath != nullptr) {
sprintf(startup_path_name, "%s/musrfit_startup.xml", pmusrpath);
snprintf(startup_path_name, sizeof(startup_path_name), "%s/musrfit_startup.xml", pmusrpath);
if (StartupFileExists(startup_path_name)) {
fStartupFilePath = TString(startup_path_name);
fStartupFileFound = true;
@ -135,9 +135,9 @@ PStartupHandler::PStartupHandler()
if (!fStartupFileFound) { // MUSRFITPATH not set or empty, will try $ROOTSYS/bin
home = getenv("ROOTSYS");
if (home != nullptr) {
sprintf(musrpath, "%s/bin", home);
snprintf(musrpath, sizeof(musrpath), "%s/bin", home);
std::cerr << std::endl << "**WARNING** MUSRFITPATH environment variable not set will try " << musrpath << std::endl;
sprintf(startup_path_name, "%s/musrfit_startup.xml", musrpath);
snprintf(startup_path_name, sizeof(startup_path_name), "%s/musrfit_startup.xml", musrpath);
if (StartupFileExists(startup_path_name)) {
fStartupFilePath = TString(startup_path_name);
fStartupFileFound = true;
@ -153,7 +153,7 @@ PStartupHandler::PStartupHandler()
} else {
home = getenv("HOME");
if (home != nullptr) {
sprintf(startup_path_name, "%s/.musrfit/musrfit_startup.xml", home);
snprintf(startup_path_name, sizeof(startup_path_name), "%s/.musrfit/musrfit_startup.xml", home);
if (StartupFileExists(startup_path_name)) {
fStartupFilePath = TString(startup_path_name);
fStartupFileFound = true;
@ -620,7 +620,7 @@ Bool_t PStartupHandler::WriteDefaultStartupFile()
// first check that $HOME/.musrfit exists and if NOT create it
struct stat info;
sprintf(startup_path_name, "%s/.musrfit", home);
snprintf(startup_path_name, sizeof(startup_path_name), "%s/.musrfit", home);
if (!stat(startup_path_name, &info)) {
if (!(info.st_mode & S_IFDIR))
return false;
@ -632,7 +632,7 @@ Bool_t PStartupHandler::WriteDefaultStartupFile()
}
// set path-name for musrfit_startup.xml
sprintf(startup_path_name, "%s/.musrfit/musrfit_startup.xml", home);
snprintf(startup_path_name, sizeof(startup_path_name), "%s/.musrfit/musrfit_startup.xml", home);
std::ofstream fout(startup_path_name, std::ofstream::out);
if (!fout.is_open()) {

View File

@ -841,12 +841,12 @@ void PTheory::MakeCleanAndTidyTheoryBlock(PMsrLines *fullTheoryBlock)
if (static_cast<UInt_t>(tokens->GetEntries()) < fgTheoDataBase[idx].fNoOfParam + 1)
return;
// make tidy string
sprintf(substr, "%-10s", fgTheoDataBase[idx].fName.Data());
snprintf(substr, sizeof(substr), "%-10s", fgTheoDataBase[idx].fName.Data());
tidy = TString(substr);
for (Int_t j=1; j<tokens->GetEntries(); j++) {
ostr = dynamic_cast<TObjString*>(tokens->At(j));
str = ostr->GetString();
sprintf(substr, "%6s", str.Data());
snprintf(substr, sizeof(substr), "%6s", str.Data());
tidy += TString(substr);
}
if (fgTheoDataBase[idx].fComment.Length() != 0) {
@ -913,7 +913,7 @@ void PTheory::MakeCleanAndTidyPolynom(UInt_t i, PMsrLines *fullTheoryBlock)
for (Int_t j=1; j<max; j++) {
ostr = dynamic_cast<TObjString*>(tokens->At(j));
str = ostr->GetString();
sprintf(substr, "%6s", str.Data());
snprintf(substr, sizeof(substr), "%6s", str.Data());
tidy += TString(substr);
}

View File

@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2021 by Andreas Suter *
* Copyright (C) 2007-2022 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *
@ -57,6 +57,7 @@
#include "git-revision.h"
#endif
#include "PFindRun.h"
#include "PStartupHandler.h"
#include "TMusrRunHeader.h"
#include "TLemRunHeader.h"
@ -72,7 +73,7 @@
//------------------------------------------------------------------------
/**
*
* <p>dump help to stdout.
*/
void dump_header_syntax()
{
@ -94,9 +95,8 @@ void dump_header_syntax()
std::cout << std::endl << " year is used. If a file name is given, this option has no effect.";
std::cout << std::endl << " -s, --summary : this option is used for LE-uSR data sets only. It will, additionally";
std::cout << std::endl << " to the header information, print the summary file content.";
std::cout << std::endl << " --psi-bulk <opt> : where <opt> consists of two items: (i) pta or tdc, ";
std::cout << std::endl << " (ii) gps | ltf | dolly | gpd | hifi. This is needed in combination with";
std::cout << std::endl << " the file formats PSI-BIN and PSI-MDU.";
std::cout << std::endl << " -i, --instrument <inst> : where <inst> is the requested instrument:";
std::cout << std::endl << " lem (default) | gps | ltf | dolly | gpd | hifi.";
std::cout << std::endl << " -h, --help : will show this help";
std::cout << std::endl << " -v, --version : will show the current version.";
std::cout << std::endl << std::endl;
@ -104,13 +104,21 @@ void dump_header_syntax()
//------------------------------------------------------------------------
/**
* <p>dumps header of a ROOT file.
*
* @param fileName file name of the ROOT file
* @param summary bool, if true dump the summary
*
* @return 0 on success, otherwise 1.
*/
int dump_header_root(const std::string fileName, const std::string fileFormat, const bool summary)
int dump_header_root(const std::string fileName, const bool summary)
{
TFile f(fileName.c_str());
if (f.IsZombie()) {
return false;
std::cerr << std::endl;
std::cerr << "**ERROR** couldn't invoke ROOT/MusrRoot file object." << std::endl;
std::cerr << std::endl;
return 1;
}
UInt_t fileType = DH_MUSR_ROOT;
@ -142,7 +150,7 @@ int dump_header_root(const std::string fileName, const std::string fileFormat, c
}
std::cout << std::endl << "-------------------";
std::cout << std::endl << "fileName = " << fileName << ", fileFormat = " << fileFormat;
std::cout << std::endl << "fileName = " << fileName << ", fileFormat = ROOT (PSI LEM).";
std::cout << std::endl << "-------------------";
std::cout << std::endl << "Run Title : " << runHeader->GetRunTitle().GetString().Data();
std::cout << std::endl << "Run Number : " << runHeader->GetRunNumber();
@ -231,15 +239,31 @@ int dump_header_root(const std::string fileName, const std::string fileFormat, c
//------------------------------------------------------------------------
/**
* <p>dumps the header information of a NeXus file.
*
* @param fileName file name of the NeXus file.
*
* @return 0 on success, 1 otherwise
*/
int dump_header_nexus(const std::string fileName) {
#ifdef PNEXUS_ENABLED
PNeXus *nxs_file = new PNeXus(fileName.c_str());
if (nxs_file == nullptr) {
std::cerr << std::endl;
std::cerr << "**ERROR** couldn't invoke NeXus file object." << std::endl;
std::cerr << std::endl;
return 1;
}
if (nxs_file->IsValid(false)) {
nxs_file->Dump();
} else {
std::cerr << std::endl;
std::cerr << "**ERROR** found invalid NeXus file." << std::endl;
std::cerr << std::endl;
return 1;
}
if (nxs_file)
@ -253,7 +277,11 @@ int dump_header_nexus(const std::string fileName) {
//------------------------------------------------------------------------
/**
* <p>dump the instrument specific info for the PSI-BIN format.
*
* @param fileName file name of the PSI-BIN.
*
* @return string vector with the instrument specific info.
*/
std::vector<std::string> dump_header_instrument_info(std::string fileName)
{
@ -312,7 +340,12 @@ std::vector<std::string> dump_header_instrument_info(std::string fileName)
//------------------------------------------------------------------------
/**
* <p>dump the header information of a PSI-BIN file.
*
* @param fileName file name of the PSI-BIN
* @param fileFormat either PSI-BIN or PSI-MDU
*
* @return 0 on success, 1 otherwise
*/
int dump_header_psi_bin(const std::string fileName, const std::string fileFormat)
{
@ -415,9 +448,12 @@ int dump_header_psi_bin(const std::string fileName, const std::string fileFormat
//------------------------------------------------------------------------
/**
* <p>dump the header information of a MUD file.
* @param fileName file name of the MUD file
*
* @return 0 on success, 1 otherwise
*/
int dump_header_mud(const std::string fileName, const std::string fileFormat)
int dump_header_mud(const std::string fileName)
{
int fh;
UINT32 type, val;
@ -433,7 +469,7 @@ int dump_header_mud(const std::string fileName, const std::string fileFormat)
}
std::cout << std::endl << "-------------------";
std::cout << std::endl << "fileName = " << fileName << ", fileFormat = " << fileFormat;
std::cout << std::endl << "fileName = " << fileName << ", fileFormat = MUD";
std::cout << std::endl << "-------------------";
// run title
success = MUD_getTitle( fh, str, sizeof(str) );
@ -593,9 +629,12 @@ int dump_header_mud(const std::string fileName, const std::string fileFormat)
//------------------------------------------------------------------------
/**
* <p>dump the header information of a WKM file.
* @param fileName file name of the WKM file.
*
* @return 0 on success, 1 otherwise
*/
int dump_header_wkm(const std::string fileName, const std::string fileFormat)
int dump_header_wkm(const std::string fileName)
{
std::ifstream fin(fileName.c_str(), std::ifstream::in);
if (!fin.is_open()) {
@ -603,7 +642,7 @@ int dump_header_wkm(const std::string fileName, const std::string fileFormat)
return 1;
}
std::cout << std::endl << "-------------------";
std::cout << std::endl << "fileName = " << fileName << ", fileFormat = " << fileFormat;
std::cout << std::endl << "fileName = " << fileName << ", fileFormat = WKM";
std::cout << std::endl << "-------------------";
char header[256];
while (fin.good()) {
@ -620,9 +659,11 @@ int dump_header_wkm(const std::string fileName, const std::string fileFormat)
//------------------------------------------------------------------------
/**
* @brief is_number
* @param s
* @return
* <p>checks if a string is a number
*
* @param s number string to be checked
*
* @return true if 's' is a number, false otherwise
*/
bool dump_is_number(const char *s)
{
@ -642,8 +683,9 @@ bool dump_is_number(const char *s)
//------------------------------------------------------------------------
/**
* @brief dump_current_year
* @return
* <p>reads the current year from the system and converts it to a string.
*
* @return the current year as a string.
*/
int dump_current_year()
{
@ -660,109 +702,13 @@ int dump_current_year()
//------------------------------------------------------------------------
/**
* @brief dump_create_fln
* @param runNo
* @param year
* @param fileFormat
* @return
*/
std::string dump_create_fln(std::string runNo, std::string year, std::string fileFormat, bool pta, std::string instrument)
{
std::string result = "??";
int yearShort=0;
int iRunNo=0;
if (fileFormat.empty())
fileFormat = "MusrRoot";
// make sure that a 'legal' file format has been found
if (!boost::iequals(fileFormat, "MusrRoot") &&
!boost::iequals(fileFormat, "NeXus") &&
!boost::iequals(fileFormat, "ROOT") &&
!boost::iequals(fileFormat, "PSI-BIN") &&
!boost::iequals(fileFormat, "PSI-MDU") &&
!boost::iequals(fileFormat, "MDU") &&
!boost::iequals(fileFormat, "WKM")) {
return result;
}
// if year is an empty string get the current year
int yy=-1;
std::stringstream ss;
if (year.empty()) {
yy = dump_current_year();
ss << yy;
year = ss.str();
}
yy = atoi(year.c_str());
if (yy > 2000)
yearShort = yy - 2000;
else
yearShort = yy - 1900;
iRunNo = atoi(runNo.c_str());
char fln[64];
char ptatdc[8];
memset(ptatdc, '\0', sizeof(ptatdc));
if (pta)
strcpy(ptatdc, "pta");
else
strcpy(ptatdc, "tdc");
if (boost::iequals(fileFormat, "MusrRoot") || boost::iequals(fileFormat, "ROOT")) {
if (instrument == "") // i.e. LEM
snprintf(fln, sizeof(fln), "lem%02d_his_%04d.root", yearShort, iRunNo);
else
snprintf(fln, sizeof(fln), "deltat_%s_%s_%s_%04d.root", ptatdc, instrument.c_str(), year.c_str(), iRunNo);
} else if (boost::iequals(fileFormat, "NeXus")) {
snprintf(fln, sizeof(fln), "%s.nxs", runNo.c_str());
} else if (boost::iequals(fileFormat, "PSI-BIN")) {
snprintf(fln, sizeof(fln), "deltat_%s_%s_%04d.bin", ptatdc, instrument.c_str(), iRunNo);
} else if (boost::iequals(fileFormat, "PSI-MDU")) {
snprintf(fln, sizeof(fln), "%s_%s_%s_%05d.mdu", ptatdc, instrument.c_str(), year.c_str(), iRunNo);
} else if (boost::iequals(fileFormat, "MUD")) {
snprintf(fln, sizeof(fln), "%06d.msr", iRunNo);
} else if (boost::iequals(fileFormat, "WKM")) {
}
result = fln;
return result;
}
//------------------------------------------------------------------------
/**
* @brief dump_file_exists
* @param pathName
* @return
*/
bool dump_file_exists(const std::string pathName)
{
bool exists = true;
int res = access(pathName.c_str(), R_OK);
if (res < 0) {
if (errno == ENOENT) {
// file does not exist
exists = false;
} else if (errno == EACCES) {
// file exists but is not readable
exists = false;
} else {
// FAIL
exists = false;
}
}
return exists;
}
//------------------------------------------------------------------------
/**
* @brief main
* @param argc
* @param argv
* @return
* <p>dump_header allows to dump the header (meta) information for various
* muSR specific file formats.
*
* @param argc argument count
* @param argv argument list
*
* @return 0 on success, 1 otherwise
*/
int main(int argc, char *argv[])
{
@ -775,8 +721,7 @@ int main(int argc, char *argv[])
std::string fileName("");
std::string fileFormat("");
std::string year("");
bool pta(false);
std::string instrument("");
std::string instrument("lem");
bool summary(false);
for (int i=1; i<argc; i++) {
@ -867,29 +812,20 @@ int main(int argc, char *argv[])
i++;
} else if (!strcmp(argv[i], "-s") || !strcmp(argv[i], "--summary")) {
summary = true;
} else if (!strcmp(argv[i], "--psi-bulk")) {
if (i+2 >= argc) {
std::cerr << std::endl << "**ERROR** found --psi-bulk with insufficient input!" << std::endl;
} else if (!strcmp(argv[i], "-i") || !strcmp(argv[i], "--instrument")) {
if (i+1 >= argc) {
std::cerr << std::endl << "**ERROR** found option --instrument without <instrument> input!" << std::endl;
dump_header_syntax();
return 1;
}
if (!strcmp(argv[i+1], "pta"))
pta = true;
else if (!strcmp(argv[i+1], "tdc"))
pta = false;
else {
std::cerr << std::endl << "**ERROR** found --psi-bulk with 1st argument '" << argv[i+1] << "'! Allowed is 'pta' or 'tdc'." << std::endl;
if (strcmp(argv[i+1], "lem") && strcmp(argv[i+1], "gps") && strcmp(argv[i+1], "ltf") &&
strcmp(argv[i+1], "dolly") && strcmp(argv[i+1], "gpd") && strcmp(argv[i+1], "hifi")) {
std::cerr << std::endl << "**ERROR** found --instrument with unkown instrument name: '" << argv[i+1] << "'!" << std::endl;
dump_header_syntax();
return 1;
}
if (strcmp(argv[i+2], "gps") && strcmp(argv[i+2], "ltf") && strcmp(argv[i+2], "dolly") &&
strcmp(argv[i+2], "gpd") && strcmp(argv[i+2], "hifi")) {
std::cerr << std::endl << "**ERROR** found --psi-bulk with 2nd argument '" << argv[i+2] << "'! This is an unkown instrument." << std::endl;
dump_header_syntax();
return 1;
}
instrument = argv[i+2];
i += 2;
instrument = argv[i+1];
i++;
} else {
std::cerr << std::endl << "**ERROR** found unkown option '" << argv[i] << "'." << std::endl;
dump_header_syntax();
@ -949,70 +885,25 @@ int main(int argc, char *argv[])
}
}
// runNo given, hence try to create the necessary file name based on the provided information
if (runNo != "") {
std::string str = dump_create_fln(runNo, year, fileFormat, pta, instrument);
if (str == "??") {
std::cerr << std::endl << "**ERROR** couldn't get a proper file name." << std::endl;
return 1;
}
fileName = str;
}
bool found_fln = false;
// try to find path-file-name via run name templates
std::string pathFln("");
// 1st check if the file name is the full path-file name and the file exists
pathFln = fileName;
if (dump_file_exists(pathFln))
found_fln = true;
// 2nd check if the file name is found in the current directory
if (!found_fln) {
pathFln = "./" + fileName;
if (dump_file_exists(pathFln))
found_fln = true;
}
// 3rd check if file name is found in any default search paths if not already found in the current directory
if (!found_fln) {
PStringVector pathList = startupHandler->GetDataPathList();
for (unsigned int i=0; i<pathList.size(); i++) {
if (boost::iequals(fileFormat, "MusrRoot") || boost::iequals(fileFormat, "ROOT") ||
boost::iequals(fileFormat, "WKM")) {
if (instrument == "") // i.e. LEM
pathFln = pathList[i] + "/" + year + "/" + fileName;
else
pathFln = pathList[i] + "/d" + year + "/tdc/root/" + fileName;
} else {
if (pta)
pathFln = pathList[i] + "/d" + year + "/pta/" + fileName;
else
pathFln = pathList[i] + "/d" + year + "/tdc/" + fileName;
}
if (dump_file_exists(pathFln)) {
found_fln = true;
break;
}
if (fileName == "") { // only look for runs if the file name is not explicitly given
int yy = static_cast<int>(strtod(year.c_str(), static_cast<char**>(nullptr)));
int run = static_cast<int>(strtod(runNo.c_str(), static_cast<char**>(nullptr)));
PFindRun findRun(startupHandler->GetDataPathList(), startupHandler->GetRunNameTemplateList(), instrument, yy, run);
if (findRun.FoundPathName()) {
pathFln = findRun.GetPathName().Data();
} else {
std::cout << "debug> Couldn't find run: " << run << " for instrument " << instrument << ", and year: " << year << std::endl;
return 1;
}
}
if (!found_fln) {
std::cerr << "**ERROR** couldn't find any appropriate file." << std::endl;
// cleanup
if (saxParser) {
delete saxParser;
saxParser = 0;
}
if (startupHandler) {
delete startupHandler;
startupHandler = nullptr;
}
return 1;
} else { // file name explicitly provided, hence use this as pathFln
pathFln = fileName;
}
// if file format is not given explicitly try to guess it based on the file name extension
if ((fileFormat == "") && (fileName != "")) {
std::string fln(fileName);
if (fileFormat == "") {
std::string fln(pathFln);
boost::to_lower(fln);
if (fln.find(".root") != std::string::npos)
fileFormat = "MusrRoot"; // could be old ROOT (LEM) as well
@ -1038,7 +929,7 @@ int main(int argc, char *argv[])
boost::to_lower(fileFormat);
if (boost::iequals(fileFormat, "MusrRoot") || boost::iequals(fileFormat, "ROOT")) {
dump_header_root(pathFln, fileFormat, summary);
dump_header_root(pathFln, summary);
} else if (boost::iequals(fileFormat, "NeXus")) {
#ifdef PNEXUS_ENABLED
dump_header_nexus(pathFln);
@ -1048,9 +939,9 @@ int main(int argc, char *argv[])
} else if (boost::iequals(fileFormat, "PSI-BIN") || boost::iequals(fileFormat, "PSI-MDU")) {
dump_header_psi_bin(pathFln, fileFormat);
} else if (boost::iequals(fileFormat, "MUD")) {
dump_header_mud(pathFln, fileFormat);
dump_header_mud(pathFln);
} else if (boost::iequals(fileFormat, "WKM")) {
dump_header_wkm(pathFln, fileFormat);
dump_header_wkm(pathFln);
}
// cleanup

View File

@ -403,7 +403,7 @@ void BMWStartupHandler::CheckLists()
<< "BMWStartupHandler::CheckLists: Most probably this will go wrong and should therefore be fixed in the xml-file!" << std::endl;
char eChar[5];
for(unsigned int i(0); i<fEnergyList.size(); i++) {
sprintf(eChar, "%02.1f", fEnergyList[i]);
snprintf(eChar, sizeof(eChar), "%02.1f", fEnergyList[i]);
fEnergyLabelList.push_back(std::string(eChar));
}
}

View File

@ -47,7 +47,6 @@ set_target_properties(BMWtools
#--- make sure that the include directory is found ----------------------------
target_include_directories(
BMWtools BEFORE PRIVATE
$<BUILD_INTERFACE:${FFTW3_INCLUDE_DIR}>
$<BUILD_INTERFACE:${CUBA_INC}>
$<BUILD_INTERFACE:${MUSRFIT_INC}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>

View File

@ -12,7 +12,6 @@ root_generate_dictionary(
PDummyUserFcnDict
PDummyUserFcn.h
OPTIONS
-I${FFTW3_INCLUDE_DIR}
-I${MUSRFIT_INC}
-I${DUMMY_USER_FUNC_INC}
-inlineInputHeader
@ -44,13 +43,12 @@ set_target_properties(PDummyUserFcn
#--- make sure that the include directory is found ----------------------------
target_include_directories(
PDummyUserFcn BEFORE PRIVATE
$<BUILD_INTERFACE:${FFTW3_INCLUDE_DIR}>
$<BUILD_INTERFACE:${MUSRFIT_INC}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../inc>
)
#--- add library dependencies -------------------------------------------------
target_link_libraries(PDummyUserFcn ${FFTW3_LIBRARY} ${ROOT_LIBRARIES} PUserFcnBase)
target_link_libraries(PDummyUserFcn ${ROOT_LIBRARIES} PUserFcnBase)
#--- install PDummyUserFcn solib -------------------------------------------------
install(TARGETS PDummyUserFcn DESTINATION lib)

View File

@ -7,7 +7,7 @@ root_generate_dictionary(
PMagProximityFitterDict
PMagProximityFitter.h
OPTIONS
-I${FFTW3_INCLUDE_DIR}
-I${FFTW3_INCLUDE}
-I${MUSRFIT_INC}
-I${CMAKE_CURRENT_SOURCE_DIR}
-inlineInputHeader
@ -44,7 +44,7 @@ add_library(PMagProximityFitter SHARED
#--- make sure that the include directory is found ----------------------------
target_include_directories(
PMagProximityFitter BEFORE PRIVATE
$<BUILD_INTERFACE:${FFTW3_INCLUDE_DIR}>
$<BUILD_INTERFACE:${FFTW3_INCLUDE}>
$<BUILD_INTERFACE:${MUSRFIT_INC}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
)
@ -56,7 +56,7 @@ set_target_properties(PMagProximityFitter
)
#--- add library dependencies -------------------------------------------------
target_link_libraries(PMagProximityFitter ${FFTW3_LIBRARY} ${ROOT_LIBRARIES} PRgeHandler PUserFcnBase)
target_link_libraries(PMagProximityFitter FFTW3::FFTW3 ${ROOT_LIBRARIES} PRgeHandler PUserFcnBase)
#--- install PMagProximityFitter solib ----------------------------------------
install(TARGETS PMagProximityFitter DESTINATION lib)

View File

@ -50,11 +50,11 @@ typedef std::vector<Double_t> PDoubleVector;
/**
* <p>
*/
typedef struct {
struct PMPRgeData {
Double_t energy;
PDoubleVector stoppingDistance;
PDoubleVector stoppingAmplitude;
} PMPRgeData;
};
//-------------------------------------------------------------
/**

View File

@ -14,7 +14,7 @@ root_generate_dictionary(
PNL_PippardFitterDict
PNL_PippardFitter.h
OPTIONS
-I${FFTW3_INCLUDE_DIR}
-I${FFTW3_INCLUDE}
-I${MUSRFIT_INC}
-I${NONLOCAL_INC}
-I${CMAKE_CURRENT_SOURCE_DIR}
@ -52,7 +52,7 @@ add_library(PNL_PippardFitter SHARED
#--- make sure that the include directory is found ----------------------------
target_include_directories(
PNL_PippardFitter BEFORE PRIVATE
$<BUILD_INTERFACE:${FFTW3_INCLUDE_DIR}>
$<BUILD_INTERFACE:${FFTW3_INCLUDE}>
$<BUILD_INTERFACE:${MUSRFIT_INC}>
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}>
)
@ -64,7 +64,7 @@ set_target_properties(PNL_PippardFitter
)
#--- add library dependencies -------------------------------------------------
target_link_libraries(PNL_PippardFitter ${Boost_LIBRARIES} ${FFTW3_LIBRARY} ${ROOT_LIBRARIES} PRgeHandler PUserFcnBase)
target_link_libraries(PNL_PippardFitter ${Boost_LIBRARIES} FFTW3::FFTW3 ${ROOT_LIBRARIES} PRgeHandler PUserFcnBase)
#--- install PNL_PippardFitter solib ------------------------------------------
install(TARGETS PNL_PippardFitter DESTINATION lib)

View File

@ -91,7 +91,7 @@ void TLemRunHeader::SetStopTimeString(const Char_t *stop){
void TLemRunHeader::SetModeratorHV(Float_t modHV, Float_t error){
TString str;
char s[80];
sprintf(s, "05 Moderator HV: %8.2f(%5.2f)", modHV, error);
snprintf(s, sizeof(s), "05 Moderator HV: %8.2f(%5.2f)", modHV, error);
str = s;
fModeratorHVString.SetString(str);
fModeratorHV = modHV;
@ -101,7 +101,7 @@ void TLemRunHeader::SetModeratorHV(Float_t modHV, Float_t error){
void TLemRunHeader::SetSampleHV(Float_t value, Float_t error){
TString str;
char s[80];
sprintf(s,"06 Sample HV: %8.2f(%5.2f)", value, error);
snprintf(s, sizeof(s), "06 Sample HV: %8.2f(%5.2f)", value, error);
str = s;
fSampleHVString.SetString(str);
fSampleHV = value;
@ -111,7 +111,7 @@ void TLemRunHeader::SetSampleHV(Float_t value, Float_t error){
void TLemRunHeader::SetImpEnergy(Float_t value){
TString str;
char s[80];
sprintf(s,"07 Impl. Energy: %8.2f", value);
snprintf(s, sizeof(s), "07 Impl. Energy: %8.2f", value);
str = s;
fImpEnergyString.SetString(str);
fImpEnergy = value;
@ -120,7 +120,7 @@ void TLemRunHeader::SetImpEnergy(Float_t value){
void TLemRunHeader::SetSampleTemperature(Float_t value, Float_t error){
TString str;
char s[80];
sprintf(s,"08 Sample T: %8.2f(%5.2f)", value, error);
snprintf(s, sizeof(s), "08 Sample T: %8.2f(%5.2f)", value, error);
str = s;
fSampleTemperatureString.SetString(str);
fSampleTemperature = value;
@ -130,7 +130,7 @@ void TLemRunHeader::SetSampleTemperature(Float_t value, Float_t error){
void TLemRunHeader::SetSampleBField(Float_t value, Float_t error){
TString str;
char s[80];
sprintf(s,"09 Sample B: %8.2f(%5.2f)", value, error);
snprintf(s, sizeof(s), "09 Sample B: %8.2f(%5.2f)", value, error);
str = s;
fSampleBFieldString.SetString(str);
fSampleBField = value;
@ -140,7 +140,7 @@ void TLemRunHeader::SetSampleBField(Float_t value, Float_t error){
void TLemRunHeader::SetTimeResolution(Float_t value){
TString str;
char s[80];
sprintf(s,"10 Time Res.: %10.7f", value);
snprintf(s, sizeof(s), "10 Time Res.: %10.7f", value);
str = s;
fTimeResolutionString.SetString(str);
fTimeResolution = value;
@ -149,7 +149,7 @@ void TLemRunHeader::SetTimeResolution(Float_t value){
void TLemRunHeader::SetNChannels(Int_t value){
TString str;
char s[80];
sprintf(s,"11 N Channels: %8d", value);
snprintf(s, sizeof(s), "11 N Channels: %8d", value);
str = s;
fNChannelsString.SetString(str);
fNChannels = value;
@ -158,7 +158,7 @@ void TLemRunHeader::SetNChannels(Int_t value){
void TLemRunHeader::SetNHist(Int_t value){
TString str;
char s[80];
sprintf(s,"12 N Histograms: %6d", value);
snprintf(s, sizeof(s), "12 N Histograms: %6d", value);
str = s;
fNHistString.SetString(str);
fNHist = value;
@ -168,7 +168,7 @@ void TLemRunHeader::SetNHist(Int_t value){
void TLemRunHeader::SetOffsetPPCHistograms(UInt_t value){
TString str;
char s[80];
sprintf(s,"13 Offset PPC Histograms: %6d", value);
snprintf(s, sizeof(s), "13 Offset PPC Histograms: %6d", value);
str = s;
fOffsetPPCHistogramsString.SetString(str);
fOffsetPPCHistograms = value;
@ -364,25 +364,25 @@ void TLemRunHeader::DrawHeader() const {
strcpy(str, "Run Stop: ");
strcat(str, runStop);
text = pt->AddText(str);
sprintf(str, "Run Number: %10d", GetRunNumber());
snprintf(str, sizeof(str), "Run Number: %10d", GetRunNumber());
text = pt->AddText(str);
sprintf(str, "Moderator HV: %10.2f kV", fModeratorHV);
snprintf(str, sizeof(str), "Moderator HV: %10.2f kV", fModeratorHV);
text = pt->AddText(str);
sprintf(str, "Sample HV: %10.2f kV", fSampleHV);
snprintf(str, sizeof(str), "Sample HV: %10.2f kV", fSampleHV);
text = pt->AddText(str);
sprintf(str, "Impl. Energy: %10.2f keV", fImpEnergy);
snprintf(str, sizeof(str), "Impl. Energy: %10.2f keV", fImpEnergy);
text = pt->AddText(str);
sprintf(str, "Sample T: %10.2f K", fSampleTemperature);
snprintf(str, sizeof(str), "Sample T: %10.2f K", fSampleTemperature);
text = pt->AddText(str);
sprintf(str, "Sample B: %10.2f G", fSampleBField);
snprintf(str, sizeof(str), "Sample B: %10.2f G", fSampleBField);
text = pt->AddText(str);
sprintf(str, "Time Res.: %10.7f ns", fTimeResolution);
snprintf(str, sizeof(str), "Time Res.: %10.7f ns", fTimeResolution);
text = pt->AddText(str);
sprintf(str, "N Channels: %10d", fNChannels);
snprintf(str, sizeof(str), "N Channels: %10d", fNChannels);
text = pt->AddText(str);
sprintf(str, "N Histograms: %10d", fNHist);
snprintf(str, sizeof(str), "N Histograms: %10d", fNHist);
text = pt->AddText(str);
sprintf(str, "Offset PPC Histograms: %10d", fOffsetPPCHistograms);
snprintf(str, sizeof(str), "Offset PPC Histograms: %10d", fOffsetPPCHistograms);
text = pt->AddText(str);
strcpy(str, "Cuts: ");
strcat(str, cuts);
@ -393,7 +393,7 @@ void TLemRunHeader::DrawHeader() const {
strcpy(str,"t0: ");
for (Int_t i=0; i<fNHist; i++){
sprintf(helpstr, " %7.2f ", fTimeZero[i]);
snprintf(helpstr, sizeof(helpstr), " %7.2f ", fTimeZero[i]);
strcat(str, helpstr);
}
text = pt->AddText(str);

View File

@ -14,7 +14,6 @@ root_generate_dictionary(
TBNMRDict
TBNMR.h
OPTIONS
-I${FFTW3_INCLUDE_DIR}
-I${MUSRFIT_INC}
-inlineInputHeader
LINKDEF TBNMRLinkDef.h

View File

@ -11,7 +11,7 @@ root_generate_dictionary(
LineProfileDict
LineProfile.h
OPTIONS
-I${FFTW3_INCLUDE_DIR}
-I${FFTW3_INCLUDE}
-I${MUSRFIT_INC}
LINKDEF LineProfileLinkDef.h
MODULE LineProfile

View File

@ -13,7 +13,7 @@ root_generate_dictionary(
TCalcMeanFieldsLEMDict
TCalcMeanFieldsLEM.h
OPTIONS
-I${FFTW3_INCLUDE_DIR}
-I${FFTW3_INCLUDE}
-I${MUSRFIT_INC}
-I${BMW_TOOLS_INC}
-I${POFB_INC}
@ -48,7 +48,7 @@ set_target_properties(CalcMeanFieldsLEM
#--- make sure that the include directory is found ----------------------------
target_include_directories(
CalcMeanFieldsLEM BEFORE PRIVATE
$<BUILD_INTERFACE:${FFTW3_INCLUDE_DIR}>
$<BUILD_INTERFACE:${FFTW3_INCLUDE}>
$<BUILD_INTERFACE:${MUSRFIT_INC}>
$<BUILD_INTERFACE:${BMW_TOOLS_INC}>
$<BUILD_INTERFACE:${POFB_INC}>
@ -57,7 +57,7 @@ target_include_directories(
#--- add library dependencies -------------------------------------------------
target_link_libraries(CalcMeanFieldsLEM
${FFTW3_LIBRARY} ${ROOT_LIBRARIES} BMWtools FitPofB PUserFcnBase
FFTW3::FFTW3 ${ROOT_LIBRARIES} BMWtools FitPofB PUserFcnBase
)
#--- install CalcMeanFieldsLEM solib ------------------------------------------

View File

@ -101,7 +101,7 @@ double TMeanFieldsForScHalfSpace::operator()(double E, const std::vector<double>
if (E > energies.back())
return CalcMeanB(energies.back(), BofZ);
energyIter = find_if(energies.begin(), energies.end(), bind2nd( greater<double>(), E));
energyIter = find_if(energies.begin(), energies.end(), [E](const double ee){ return E < ee; }); //as35: bind2nd( greater<double>(), E));
// cout << *(energyIter - 1) << " " << *(energyIter) << endl;
double E1(*(energyIter - 1));
@ -201,7 +201,7 @@ double TMeanFieldsForScSingleLayer::operator()(double E, const std::vector<doubl
if (E > energies.back())
return CalcMeanB(energies.back(), interfaces, weights, BofZ);
energyIter = find_if(energies.begin(), energies.end(), bind2nd( greater<double>(), E));
energyIter = find_if(energies.begin(), energies.end(), [E](const double ee){ return E < ee; }); //as35: bind2nd( greater<double>(), E));
// cout << *(energyIter - 1) << " " << *(energyIter) << endl;
double E1(*(energyIter - 1));
@ -310,7 +310,7 @@ double TMeanFieldsForScBilayer::operator()(double E, const std::vector<double> &
if (E > energies.back())
return CalcMeanB(energies.back(), interfaces, weights, BofZ, width);
energyIter = find_if(energies.begin(), energies.end(), bind2nd( greater<double>(), E));
energyIter = find_if(energies.begin(), energies.end(), [E](const double ee){ return E < ee; }); //as35: bind2nd( greater<double>(), E));
// cout << *(energyIter - 1) << " " << *(energyIter) << endl;
double E1(*(energyIter - 1));
@ -425,7 +425,7 @@ double TMeanFieldsForScTrilayer::operator()(double E, const std::vector<double>
if (E > energies.back())
return CalcMeanB(energies.back(), interfaces, weights, BofZ);
energyIter = find_if(energies.begin(), energies.end(), bind2nd( greater<double>(), E));
energyIter = find_if(energies.begin(), energies.end(), [E](const double ee){ return E < ee; }); //as35: bind2nd( greater<double>(), E));
// cout << *(energyIter - 1) << " " << *(energyIter) << endl;
double E1(*(energyIter - 1));
@ -530,7 +530,7 @@ double TMeanFieldsForScTrilayerWithInsulator::operator()(double E, const std::ve
if (E > energies.back())
return CalcMeanB(energies.back(), interfaces, weights, BofZ);
energyIter = find_if(energies.begin(), energies.end(), bind2nd( greater<double>(), E));
energyIter = find_if(energies.begin(), energies.end(), [E](const double ee){ return E < ee; }); //as35: bind2nd( greater<double>(), E));
// cout << *(energyIter - 1) << " " << *(energyIter) << endl;
double E1(*(energyIter - 1));

View File

@ -75,7 +75,7 @@ Extern void SUFFIX(cubafork)(Spin **pspin)
}
if( cubaverb_ ) {
sprintf(out, "using %d cores %d accelerators via "
snprintf(out, sizeof(out), "using %d cores %d accelerators via "
#ifdef HAVE_SHMGET
"shared memory",
#else

View File

@ -47,7 +47,7 @@ static inline void DoSampleParallel(This *t, number n, creal *x, real *f
t->neval += n;
if( VERBOSE > 2 ) {
sprintf(out, "sampling " NUMBER " points each on %d cores",
snprintf(out, sizeof(out), "sampling " NUMBER " points each on %d cores",
pcores, ncores);
Print(out);
}

View File

@ -94,7 +94,7 @@ enum { uninitialized = 0x61627563 };
var = atoi(env); \
if( cubaverb_ ) { \
char out[64]; \
sprintf(out, "env " name " = %d", (int)var); \
snprintf(out, sizeof(out), "env " name " = %d", (int)var); \
Print(out); \
} \
} \
@ -280,7 +280,7 @@ enum { signature = 0x41425543 };
} \
if( ini | statemsg ) { \
char s[512]; \
sprintf(s, ini ? \
snprintf(s, sizeof(s), ini ? \
"\nError restoring state from %s, starting from scratch." : \
"\nRestored state from %s.", (t)->statefile); \
Print(s); \
@ -307,7 +307,7 @@ enum { signature = 0x41425543 };
} \
if( fail | statemsg ) { \
char s[512]; \
sprintf(s, fail ? \
snprintf(s, sizeof(s), fail ? \
"\nError saving state to %s." : \
"\nSaved state to %s.", (t)->statefile); \
Print(s); \

View File

@ -36,7 +36,7 @@ static int Integrate(This *t, real *integral, real *error, real *prob)
int fail;
if( VERBOSE > 1 ) {
sprintf(out, "Divonne input parameters:\n"
snprintf(out, sizeof(out), "Divonne input parameters:\n"
" ndim " COUNT "\n ncomp " COUNT "\n"
ML_NOT(" nvec " NUMBER "\n")
" epsrel " REAL "\n epsabs " REAL "\n"
@ -189,7 +189,7 @@ if( StateWriteTest(t) ) { \
WriteState(t);
if( VERBOSE ) {
char *oe = out + sprintf(out, "\n"
char *oe = out + snprintf(out, sizeof(out), "\n"
"Iteration " COUNT " (pass " COUNT "): " COUNT " regions\n"
NUMBER7 " integrand evaluations so far,\n"
NUMBER7 " in optimizing regions,\n"
@ -197,7 +197,7 @@ if( StateWriteTest(t) ) { \
state->iter, state->pass, t->nregions,
t->neval, t->neval_opt, t->neval_cut);
for( comp = 0; comp < t->ncomp; ++comp )
oe += sprintf(oe, "\n[" COUNT "] "
oe += snprintf(oe, sizeof(out), "\n[" COUNT "] "
REAL " +- " REAL,
comp + 1, SHOW(integral[comp]), SHOW(error[comp]));
Print(out);
@ -255,7 +255,7 @@ if( StateWriteTest(t) ) { \
SamplesAlloc(t, &t->samples[1]);
if( VERBOSE ) {
sprintf(out, "\nMain integration on " COUNT
snprintf(out, sizeof(out), "\nMain integration on " COUNT
" regions with " NUMBER " samples per region.",
t->nregions, t->samples[1].neff);
Print(out);
@ -325,7 +325,7 @@ refine:
can_adjust = false;
if( VERBOSE > 2 ) {
sprintf(out, "Sampling remaining " COUNT
snprintf(out, sizeof(out), "Sampling remaining " COUNT
" regions with " NUMBER " points per region.",
t->nregions, t->samples[1].neff);
Print(out);
@ -369,7 +369,7 @@ refine:
if( VERBOSE > 2 ) {
cchar *msg = "\nRegion (" REALF ") - (" REALF ")";
for( B = (b = region->bounds) + t->ndim; b < B; ++b ) {
oe += sprintf(oe, msg, b->lower, b->upper);
oe += snprintf(oe, sizeof(out), msg, b->lower, b->upper);
msg = "\n (" REALF ") - (" REALF ")";
}
}
@ -408,12 +408,12 @@ refine:
if( VERBOSE > 2 ) {
#define Out2(f, r) SHOW((r)->avg), SHOW(res->spread/t->samples[f].neff), SHOW((r)->err)
#define Out(f) Out2(f, &tot->phase[f])
oe += sprintf(oe, "\n[" COUNT "] "
oe += snprintf(oe, sizeof(out), "\n[" COUNT "] "
REAL " +- " REAL "(" REAL ")\n "
REAL " +- " REAL "(" REAL ")", ++comp, Out(0), Out(1));
if( todo == 3 ) oe += sprintf(oe, "\n "
if( todo == 3 ) oe += snprintf(oe, sizeof(out), "\n "
REAL " +- " REAL "(" REAL ")", Out2(2, res));
oe += sprintf(oe, " \tchisq " REAL, SHOW(chisq));
oe += snprintf(oe, sizeof(out), " \tchisq " REAL, SHOW(chisq));
}
tot->integral += avg;
@ -440,9 +440,9 @@ refine:
}
if( VERBOSE > 2 ) {
char *oe = out + sprintf(out, "\nTotals:");
char *oe = out + snprintf(out, sizeof(out), "\nTotals:");
for( tot = state->totals, comp = 0; tot < Tot; ++tot, ++comp )
oe += sprintf(oe, "\n[" COUNT "] "
oe += snprintf(oe, sizeof(out), "\n[" COUNT "] "
REAL " +- " REAL " \tchisq " REAL " (" COUNT " df)",
comp + 1, SHOW(integral[comp]), SHOW(error[comp]),
SHOW(tot->chisq), df);

View File

@ -13,7 +13,7 @@ root_generate_dictionary(
TLondon1DDict
TLondon1D.h
OPTIONS
-I${FFTW3_INCLUDE_DIR}
-I${FFTW3_INCLUDE}
-I${MUSRFIT_INC}
-I${BMW_TOOLS_INC}
-I${FIT_P_OF_B_INC}
@ -25,7 +25,7 @@ root_generate_dictionary(
TVortexDict
TVortex.h
OPTIONS
-I${FFTW3_INCLUDE_DIR}
-I${FFTW3_INCLUDE}
-I${MUSRFIT_INC}
-I${BMW_TOOLS_INC}
-I${FIT_P_OF_B_INC}
@ -37,7 +37,7 @@ root_generate_dictionary(
TSkewedGssDict
TSkewedGss.h
OPTIONS
-I${FFTW3_INCLUDE_DIR}
-I${FFTW3_INCLUDE}
-I${MUSRFIT_INC}
-I${BMW_TOOLS_INC}
-I${POFB_INC}
@ -82,7 +82,7 @@ set_target_properties(FitPofB
#--- make sure that the include directory is found ----------------------------
target_include_directories(
FitPofB BEFORE PRIVATE
$<BUILD_INTERFACE:${FFTW3_INCLUDE_DIR}>
$<BUILD_INTERFACE:${FFTW3_INCLUDE}>
$<BUILD_INTERFACE:${MUSRFIT_INC}>
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src/external/TLemRunHeader>
$<BUILD_INTERFACE:${BMW_TOOLS_INC}>
@ -101,7 +101,7 @@ if (OpenMP_FOUND AND (${CMAKE_HOST_SYSTEM_NAME} STREQUAL Linux))
endif (OpenMP_FOUND AND (${CMAKE_HOST_SYSTEM_NAME} STREQUAL Linux))
target_link_libraries(FitPofB
${gomp}
${FFTW3_LIBRARY} ${FFTW3F_LIBRARY} ${ROOT_LIBRARIES}
FFTW3::FFTW3 FFTW3::FFTW3F ${ROOT_LIBRARIES}
TLemRunHeader PUserFcnBase BMWtools
)

View File

@ -317,7 +317,7 @@ void TPofBCalc::Calculate(const TBofZCalc *BofZ, const TTrimSPData *dataTrimSP,
seconds = time (NULL);
char debugfile[50];
int n = sprintf (debugfile, "test_Bz_%ld_%f.dat", seconds, fBmin);
int n = snprintf (debugfile, sizeof(debugfile), "test_Bz_%ld_%f.dat", seconds, fBmin);
if (n > 0) {
ofstream of(debugfile);
@ -330,10 +330,10 @@ void TPofBCalc::Calculate(const TBofZCalc *BofZ, const TTrimSPData *dataTrimSP,
}
char debugfile1[50];
int n1 = sprintf (debugfile1, "test_NZ_%ld_%f.dat", seconds, para[2]);
int n1 = snprintf (debugfile1, sizeof(debugfile1), "test_NZ_%ld_%f.dat", seconds, para[2]);
char debugfile2[50];
int n2 = sprintf (debugfile2, "test_NZgss_%ld_%f.dat", seconds, para[2]);
int n2 = snprintf (debugfile2, sizeof(debugfile2), "test_NZgss_%ld_%f.dat", seconds, para[2]);
if (n1 > 0) {
ofstream of1(debugfile1);

View File

@ -357,7 +357,7 @@ void TPofTCalc::FakeData(const string &rootOutputFileName, const std::vector<dou
// create run info folder and content
TFolder *runInfoFolder = new TFolder("RunInfo", "Run Info");
TLemRunHeader *runHeader = new TLemRunHeader();
//sprintf(str, "Fake Data generated from %s", pBFileName.Data());
//snprintf(str, sizeof(str), "Fake Data generated from %s", pBFileName.Data());
runHeader->SetRunTitle("Fake Data");
if (optPar && (optPar->size() > 1)) { // set energy and field if they were specified
runHeader->SetImpEnergy((*optPar)[1]);

View File

@ -12,7 +12,7 @@ root_generate_dictionary(
TGapIntegralsDict
TGapIntegrals.h
OPTIONS
-I${FFTW3_INCLUDE_DIR}
-I${FFTW3_INCLUDE}
-I${MUSRFIT_INC}
-I${BMW_TOOLS_INC}
-I${CMAKE_CURRENT_SOURCE_DIR}
@ -47,7 +47,7 @@ set_target_properties(GapIntegrals
#--- make sure that the include directory is found ----------------------------
target_include_directories(
GapIntegrals BEFORE PRIVATE
$<BUILD_INTERFACE:${FFTW3_INCLUDE_DIR}>
$<BUILD_INTERFACE:${FFTW3_INCLUDE}>
$<BUILD_INTERFACE:${MUSRFIT_INC}>
$<BUILD_INTERFACE:${BMW_TOOLS_INC}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
@ -55,7 +55,7 @@ target_include_directories(
#--- add library dependencies -------------------------------------------------
target_link_libraries(GapIntegrals
${GSL_LIBRARIES} ${FFTW3F_LIBRARY} ${ROOT_LIBRARIES}
${GSL_LIBRARIES} FFTW3::FFTW3F ${ROOT_LIBRARIES}
PUserFcnBase cuba BMWtools
)

View File

@ -31,7 +31,7 @@ add_library(PGbGLF SHARED
#--- make sure that the include directory is found ----------------------------
target_include_directories(
PGbGLF BEFORE PRIVATE
$<BUILD_INTERFACE:${FFTW3_INCLUDE_DIR}>
$<BUILD_INTERFACE:${FFTW3_INCLUDE}>
$<BUILD_INTERFACE:${MUSRFIT_INC}>
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}>
)
@ -43,7 +43,7 @@ set_target_properties(PGbGLF
)
#--- add library dependencies -------------------------------------------------
target_link_libraries(PGbGLF ${FFTW3_LIBRARY} ${ROOT_LIBRARIES} PUserFcnBase)
target_link_libraries(PGbGLF FFTW3::FFTW3 ${ROOT_LIBRARIES} PUserFcnBase)
#--- install PGbGLF solib -----------------------------------------------------
install(TARGETS PGbGLF DESTINATION lib)

View File

@ -12,7 +12,7 @@ root_generate_dictionary(
TLFRelaxationDict
TLFRelaxation.h
OPTIONS
-I${FFTW3_INCLUDE_DIR}
-I${FFTW3_INCLUDE}
-I${MUSRFIT_INC}
-I${BMW_TOOLS_INC}
-inlineInputHeader
@ -46,7 +46,7 @@ set_target_properties(LFRelaxation
#--- make sure that the include directory is found ----------------------------
target_include_directories(
LFRelaxation BEFORE PRIVATE
$<BUILD_INTERFACE:${FFTW3_INCLUDE_DIR}>
$<BUILD_INTERFACE:${FFTW3_INCLUDE}>
$<BUILD_INTERFACE:${MUSRFIT_INC}>
$<BUILD_INTERFACE:${BMW_TOOLS_INC}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
@ -63,7 +63,7 @@ if (OpenMP_FOUND AND (${CMAKE_HOST_SYSTEM_NAME} STREQUAL Linux))
endif (OpenMP_FOUND AND (${CMAKE_HOST_SYSTEM_NAME} STREQUAL Linux))
target_link_libraries(LFRelaxation
${gomp}
${GSL_LIBRARIES} ${FFTW3F_LIBRARY}
${GSL_LIBRARIES} FFTW3::FFTW3F
${ROOT_LIBRARIES} PUserFcnBase cuba BMWtools
)

View File

@ -12,7 +12,7 @@ root_generate_dictionary(
PPhotoMeissnerDict
PPhotoMeissner.h
OPTIONS
-I${FFTW3_INCLUDE_DIR}
-I${FFTW3_INCLUDE}
-I${GSL_INCLUDE_DIRS}
-I${ROOT_INCLUDE_DIRS}
-I${MUSRFIT_INC}
@ -46,7 +46,7 @@ set_target_properties(PPhotoMeissner
#--- make sure that the include directory is found ----------------------------
target_include_directories(
PPhotoMeissner BEFORE PRIVATE
$<BUILD_INTERFACE:${FFTW3_INCLUDE_DIR}>
$<BUILD_INTERFACE:${FFTW3_INCLUDE}>
$<BUILD_INTERFACE:${GSL_INCLUDE_DIRS}>
$<BUILD_INTERFACE:${ROOT_INCLUDE_DIRS}>
$<BUILD_INTERFACE:${MUSRFIT_INC}>
@ -55,7 +55,7 @@ target_include_directories(
#--- add library dependencies -------------------------------------------------
target_link_libraries(PPhotoMeissner
${FFTW3_LIBRARY} ${GSL_LIBRARY} ${ROOT_LIBRARIES} PRgeHandler PUserFcnBase
FFTW3::FFTW3 ${GSL_LIBRARY} ${ROOT_LIBRARIES} PRgeHandler PUserFcnBase
)
#--- install PPhotoMeissner solib ---------------------------------------------

View File

@ -163,7 +163,7 @@ int generateRgeFln(const string prefix, const string elist, vector<string> &rgeF
}
ival = start;
do {
sprintf(istr, "%d", ival);
snprintf(istr, sizeof(istr), "%d", ival);
str = prefix + istr + ".rge";
rgeFln.push_back(str);
ival += step;

View File

@ -12,7 +12,7 @@ root_generate_dictionary(
PSkewedLorentzianDict
PSkewedLorentzian.h
OPTIONS
-I${FFTW3_INCLUDE_DIR}
-I${FFTW3_INCLUDE}
-I${MUSRFIT_INC}
-I${SPIN_VALVE_INC}
-inlineInputHeader
@ -55,13 +55,13 @@ set_target_properties(PSpinValve
#--- make sure that the include directory is found ----------------------------
target_include_directories(
PSpinValve BEFORE PRIVATE
$<BUILD_INTERFACE:${FFTW3_INCLUDE_DIR}>
$<BUILD_INTERFACE:${FFTW3_INCLUDE}>
$<BUILD_INTERFACE:${MUSRFIT_INC}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
)
#--- add library dependencies -------------------------------------------------
target_link_libraries(PSpinValve ${FFTW3_LIBRARY} ${ROOT_LIBRARIES} PUserFcnBase)
target_link_libraries(PSpinValve FFTW3::FFTW3 ${ROOT_LIBRARIES} PUserFcnBase)
#--- install PSpinValve solib -------------------------------------------------
install(TARGETS PSpinValve DESTINATION lib)

View File

@ -12,7 +12,7 @@ root_generate_dictionary(
ZFRelaxationDict
ZFRelaxation.h
OPTIONS
-I${FFTW3_INCLUDE_DIR}
-I${FFTW3_INCLUDE}
-I${MUSRFIT_INC}
-I${BMW_TOOLS_INC}
-inlineInputHeader
@ -46,7 +46,7 @@ set_target_properties(ZFRelaxation
#--- make sure that the include directory is found ----------------------------
target_include_directories(
ZFRelaxation BEFORE PRIVATE
$<BUILD_INTERFACE:${FFTW3_INCLUDE_DIR}>
$<BUILD_INTERFACE:${FFTW3_INCLUDE}>
$<BUILD_INTERFACE:${MUSRFIT_INC}>
$<BUILD_INTERFACE:${BMW_TOOLS_INC}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
@ -62,7 +62,7 @@ if (OpenMP_FOUND AND (${CMAKE_HOST_SYSTEM_NAME} STREQUAL Linux))
set(gomp gomp)
endif (OpenMP_FOUND AND (${CMAKE_HOST_SYSTEM_NAME} STREQUAL Linux))
target_link_libraries(ZFRelaxation
${gomp} ${FFTW3_LIBRARY} ${ROOT_LIBRARIES} PUserFcnBase cuba BMWtools
${gomp} FFTW3::FFTW3 ${ROOT_LIBRARIES} PUserFcnBase cuba BMWtools
)
#--- install ZFRelaxation solib -----------------------------------------------

View File

@ -67,14 +67,14 @@
/**
* <p>Structure holding all necessary Fourier histograms.
*/
typedef struct {
struct PFourierCanvasDataSet {
TH1F *dataFourierRe; ///< real part of the Fourier transform of the data histogram
TH1F *dataFourierIm; ///< imaginary part of the Fourier transform of the data histogram
TH1F *dataFourierPwr; ///< power spectrum of the Fourier transform of the data histogram
TH1F *dataFourierPhase; ///< phase spectrum of the Fourier transform of the data histogram
TH1F *dataFourierPhaseOptReal; ///< phase otpimized real Fourier transform of the data histogram
std::vector<Double_t> optPhase; ///< optimal phase which maximizes the real Fourier
} PFourierCanvasDataSet;
};
//------------------------------------------------------------------------
/**

View File

@ -526,10 +526,10 @@ typedef std::vector<PRawRunData> PRawRunDataList;
/**
* <p>Helper structure for parsing. Keeps a msr-file line string and the corresponding line number.
*/
typedef struct {
struct PMsrLineStructure {
Int_t fLineNo; ///< original line number of the msr-file
TString fLine; ///< msr-file line
} PMsrLineStructure;
};
//-------------------------------------------------------------
/**
@ -541,7 +541,7 @@ typedef std::vector<PMsrLineStructure> PMsrLines;
/**
* <p>Handles the information of a parameter.
*/
typedef struct {
struct PMsrParamStructure{
Int_t fNoOfParams; ///< how many parameters are given
Int_t fNo; ///< parameter number
TString fName; ///< name
@ -554,7 +554,7 @@ typedef struct {
Bool_t fUpperBoundaryPresent; ///< flag showing if an upper boundary is present
Double_t fUpperBoundary; ///< upper boundary for the fit parameter
Bool_t fIsGlobal; ///< flag showing if the parameter is a global one (used for msr2data global)
} PMsrParamStructure;
};
//-------------------------------------------------------------
/**
@ -756,7 +756,7 @@ typedef std::vector<PMsrRunBlock> PMsrRunList;
/**
* <p>Holds the information of the Fourier block
*/
typedef struct {
struct PMsrFourierStructure {
Bool_t fFourierBlockPresent; ///< flag indicating if a Fourier block is present in the msr-file
Int_t fUnits; ///< flag used to indicate the units. 1=field units (G); 2=field units (T); 3=frequency units (MHz); 4=Mc/s
Bool_t fDCCorrected; ///< if set true, the dc offset of the signal/theory will be removed before the FFT is made.
@ -769,13 +769,13 @@ typedef struct {
Double_t fRangeForPhaseCorrection[2]; ///< field/frequency range for automatic phase correction
Double_t fPlotRange[2]; ///< field/frequency plot range
Double_t fPhaseIncrement; ///< phase increment for manual phase optimization
} PMsrFourierStructure;
};
//-------------------------------------------------------------
/**
* <p>Holds the information of a single plot block
*/
typedef struct {
struct PMsrPlotStructure{
Int_t fPlotType; ///< plot type
Bool_t fLifeTimeCorrection; ///< needed for single histo. If yes, only the asymmetry is shown, otherweise the positron spectrum
Bool_t fUseFitRanges; ///< yes -> use the fit ranges to plot the data, no (default) -> use range information if present
@ -792,7 +792,7 @@ typedef struct {
UInt_t fRRFUnit; ///< RRF frequency unit. 0=kHz, 1=MHz, 2=Mc/s, 3=Gauss, 4=Tesla
Int_t fRRFPhaseParamNo; ///< parameter number if used instead of a RRF phase value
Double_t fRRFPhase; ///< RRF phase
} PMsrPlotStructure;
};
//-------------------------------------------------------------
/**
@ -804,7 +804,7 @@ typedef std::vector<PMsrPlotStructure> PMsrPlotList;
/**
* <p>Holds the informations for the statistics block.
*/
typedef struct {
struct PMsrStatisticStructure {
Bool_t fValid; ///< flag showing if the statistics block is valid, i.e. a fit took place which converged
PMsrLines fStatLines; ///< statistics block in msr-file clear text
TString fDate; ///< string holding fitting date and time
@ -815,13 +815,13 @@ typedef struct {
Double_t fMinExpected; ///< expected total chi2 or max. likelihood
PDoubleVector fMinExpectedPerHisto; ///< expected pre histo chi2 or max. likelihood
PUIntVector fNdfPerHisto; ///< number of degrees of freedom per histo
} PMsrStatisticStructure;
};
//-------------------------------------------------------------
/**
* <p>Holds the informations for the any2many converter program
*/
typedef struct {
struct PAny2ManyInfo {
Bool_t useStandardOutput{false}; ///< flag showing if the converted shall be sent to the standard output
TString inFormat{""}; ///< holds the information about the input data file format
TString outFormat{""}; ///< holds the information about the output data file format
@ -838,16 +838,16 @@ typedef struct {
UInt_t compressionTag{0}; ///< 0=no compression, 1=gzip compression, 2=bzip2 compression
TString compressFileName{""}; ///< holds the name of the outputfile name in case of compression is used
UInt_t idf{0}; ///< IDF version for NeXus files.
} PAny2ManyInfo;
};
//-------------------------------------------------------------
/**
* <p>Holds information given at startup
*/
typedef struct {
struct PStartupOptions {
Bool_t writeExpectedChisq; ///< if set to true, expected chisq and chisq per block will be written
Bool_t estimateN0; ///< if set to true, for single histogram fits N0 will be estimated
} PStartupOptions;
};
//-------------------------------------------------------------
/**
@ -878,10 +878,10 @@ class PStringNumberList {
/**
* <p> Run name template structure.
*/
typedef struct {
struct PRunNameTemplate {
TString instrument{""};
TString runNameTemplate{""};
} PRunNameTemplate;
};
//-------------------------------------------------------------
/**

View File

@ -118,7 +118,7 @@ class PMusrCanvasPlotRange : public TObject
* <p>Structure holding all necessary histograms for a single plot block entry for
* fit types: asymmetry fit and single histogram fit.
*/
typedef struct {
struct PMusrCanvasDataSet {
TH1F *data; ///< data histogram
TH1F *dataFourierRe; ///< real part of the Fourier transform of the data histogram
TH1F *dataFourierIm; ///< imaginary part of the Fourier transform of the data histogram
@ -139,7 +139,7 @@ typedef struct {
TH1F *diffFourierPhaseOptReal; ///< phase optimized real part spectrum Fourier transform of the diff histogram
PMusrCanvasPlotRange *dataRange; ///< keep the msr-file plot data range
UInt_t diffFourierTag; ///< 0=not relevant, 1=d-f (Fourier of difference time spectra), 2=f-d (difference of Fourier spectra)
} PMusrCanvasDataSet;
};
//------------------------------------------------------------------------
/**
@ -152,7 +152,7 @@ typedef std::vector<PMusrCanvasDataSet> PMusrCanvasDataList;
* <p>Structure holding all necessary error graphs for a single plot block entry for
* fit types: non-muSR fit.
*/
typedef struct {
struct PMusrCanvasNonMusrDataSet {
TGraphErrors *data; ///< data error graph
TGraphErrors *dataFourierRe; ///< real part of the Fourier transform of the data error graph
TGraphErrors *dataFourierIm; ///< imaginary part of the Fourier transform of the data error graph
@ -170,7 +170,7 @@ typedef struct {
TGraphErrors *diffFourierPhase; ///< phase spectrum of the Fourier transform of the diff error graph
PMusrCanvasPlotRange *dataRange; ///< keep the msr-file plot data range
UInt_t diffFourierTag; ///< 0=not relevant, 1=d-f (Fourier of difference time spectra), 2=f-d (difference of Fourier spectra)
} PMusrCanvasNonMusrDataSet;
};
//------------------------------------------------------------------------
/**
@ -182,11 +182,11 @@ typedef std::vector<PMusrCanvasNonMusrDataSet> PMusrCanvasNonMusrDataList;
/**
* <p> data structure needed for ascii dump within musrview.
*/
typedef struct {
struct PMusrCanvasAsciiDump {
PDoubleVector dataX; ///< x-axis data set
PDoubleVector data; ///< y-axis data set
PDoubleVector dataErr; ///< error of the y-axis data set
} PMusrCanvasAsciiDump;
};
//------------------------------------------------------------------------
/**

View File

@ -43,14 +43,14 @@
* <p>Data structure holding raw time domain uSR data together with some
* necessary meta information.
*/
typedef struct {
struct musrFT_data {
Int_t dataSetTag; ///< tag to label the data set. Needed for average-per-data-set
TString info; ///< keeps all the meta information
Double_t timeResolution; ///< time resolution in (usec)
Int_t t0; ///< keep the t0 bin
Double_t timeRange[2]; ///< time range to be used, given in (usec).
PDoubleVector rawData; ///< a single time domain data vector
} musrFT_data;
};
//----------------------------------------------------------------------------
/**

View File

@ -43,13 +43,13 @@
/**
* <p>Keep a single rge table from TrimSP for a given energy.
*/
typedef struct {
struct PRgeData {
Double_t energy;
PDoubleVector depth;
PDoubleVector amplitude;
PDoubleVector nn; // normalized int n(z) dz = 1 amplitudes
Double_t noOfParticles;
} PRgeData;
};
//-----------------------------------------------------------------------------
/**

View File

@ -78,8 +78,9 @@ void msr2msr_syntax()
* - false otherwise
*
* \param str msr-file line
* \param size size of str
*/
bool msr2msr_run(char *str)
bool msr2msr_run(char *str, const std::size_t size)
{
// not the RUN line itself, hence nothing to be done
if (!strstr(str, "RUN"))
@ -109,27 +110,27 @@ bool msr2msr_run(char *str)
}
if (tokens->GetEntries() == 5) { // already a new msr file, do only add the proper run comment
sprintf(str, "%s (name beamline institute data-file-format)", line.Data());
snprintf(str, size, "%s (name beamline institute data-file-format)", line.Data());
return true;
}
if (run.Contains("NEMU")) {
ostr[0] = dynamic_cast<TObjString*>(tokens->At(1)); // file name
sprintf(str, "RUN %s MUE4 PSI WKM (name beamline institute data-file-format)", ostr[0]->GetString().Data());
snprintf(str, size, "RUN %s MUE4 PSI WKM (name beamline institute data-file-format)", ostr[0]->GetString().Data());
} else if (run.Contains("PSI")) {
ostr[0] = dynamic_cast<TObjString*>(tokens->At(1)); // file name
ostr[1] = dynamic_cast<TObjString*>(tokens->At(2)); // beamline
sprintf(str, "RUN %s %s PSI PSI-BIN (name beamline institute data-file-format)",
snprintf(str, size, "RUN %s %s PSI PSI-BIN (name beamline institute data-file-format)",
ostr[0]->GetString().Data(), ostr[1]->GetString().Data());
} else if (run.Contains("TRIUMF")) {
ostr[0] = dynamic_cast<TObjString*>(tokens->At(1)); // file name
ostr[1] = dynamic_cast<TObjString*>(tokens->At(2)); // beamline
sprintf(str, "RUN %s %s TRIUMF MUD (name beamline institute data-file-format)",
snprintf(str, size, "RUN %s %s TRIUMF MUD (name beamline institute data-file-format)",
ostr[0]->GetString().Data(), ostr[1]->GetString().Data());
} else if (run.Contains("RAL")) {
ostr[0] = dynamic_cast<TObjString*>(tokens->At(1)); // file name
ostr[1] = dynamic_cast<TObjString*>(tokens->At(2)); // beamline
sprintf(str, "RUN %s %s RAL NEXUS (name beamline institute data-file-format)",
snprintf(str, size, "RUN %s %s RAL NEXUS (name beamline institute data-file-format)",
ostr[0]->GetString().Data(), ostr[1]->GetString().Data());
}
@ -175,7 +176,7 @@ bool msr2msr_param(char *str)
for (unsigned int i=0; i<4; i++)
ostr[i] = dynamic_cast<TObjString*>(tokens->At(i));
// number
sprintf(sstr, "%10s", ostr[0]->GetString().Data());
snprintf(sstr, sizeof(sstr), "%10s", ostr[0]->GetString().Data());
// name
strcat(sstr, " ");
strcat(sstr, ostr[1]->GetString().Data());
@ -206,7 +207,7 @@ bool msr2msr_param(char *str)
for (unsigned int i=0; i<6; i++)
ostr[i] = dynamic_cast<TObjString*>(tokens->At(i));
// number
sprintf(sstr, "%10s", ostr[0]->GetString().Data());
snprintf(sstr, sizeof(sstr), "%10s", ostr[0]->GetString().Data());
// name
strcat(sstr, " ");
strcat(sstr, ostr[1]->GetString().Data());
@ -480,7 +481,7 @@ void msr2msr_replace(char *str, int paramNo)
memset(temp, 0, sizeof(temp));
sprintf(no, "%d", paramNo);
snprintf(no, sizeof(no), "%d", paramNo);
int j=0;
for (unsigned int i=0; i<strlen(str); i++) {
@ -573,7 +574,7 @@ bool msr2msr_finalize_theory(char *fln, int theoryTag, int noOfAddionalParams)
// cp __temp.msr fln
sprintf(str, "cp __temp.msr %s", fln);
snprintf(str, sizeof(str), "cp __temp.msr %s", fln);
if (system(str) == -1) {
std::cerr << "**ERROR** cmd: " << str << " failed." << std::endl;
return false;
@ -598,8 +599,9 @@ bool msr2msr_finalize_theory(char *fln, int theoryTag, int noOfAddionalParams)
* - false otherwise
*
* \param str msr-file statistic block line
* \param size size of str
*/
bool msr2msr_statistic(char *str) {
bool msr2msr_statistic(char *str, const std::size_t size) {
bool success = true;
char *pstr;
@ -621,7 +623,7 @@ bool msr2msr_statistic(char *str) {
}
}
if (success) {
sprintf(str, " chisq = %lf, NDF = %d, chisq/NDF = %lf", chisq, static_cast<int>(chisq/chisqred), chisqred);
snprintf(str, size, " chisq = %lf, NDF = %d, chisq/NDF = %lf", chisq, static_cast<int>(chisq/chisqred), chisqred);
}
}
@ -691,10 +693,10 @@ int main(int argc, char *argv[])
success = msr2msr_theory(str, theoryTag, noOfAddionalParams);
break;
case MSR_TAG_RUN:
success = msr2msr_run(str);
success = msr2msr_run(str, sizeof(str));
break;
case MSR_TAG_STATISTIC:
success = msr2msr_statistic(str);
success = msr2msr_statistic(str, sizeof(str));
break;
default:
break;
@ -709,7 +711,7 @@ int main(int argc, char *argv[])
// check if conversion seems to be OK
if (!success) {
sprintf(str, "rm -rf %s", argv[2]);
snprintf(str, sizeof(str), "rm -rf %s", argv[2]);
if (system(str) == -1) {
std::cerr << "**ERROR** cmd: " << str << " failed." << std::endl;
return 0;

View File

@ -38,11 +38,11 @@
#include "PVarHandler.h"
//----------------------------------------------------------------------------
typedef struct {
struct PmuppPlotEntry {
int collIdx; ///< collection index
QString xLabel; ///< x-axis label
QVector<QString> yLabel; ///< y-axis label(s)
} PmuppPlotEntry;
};
//----------------------------------------------------------------------------
/**

View File

@ -50,20 +50,20 @@
#define P_MENU_ID_ABOUT 10002
//--------------------------------------------------------------------------
typedef struct {
struct PDataPoint {
Double_t y;
Double_t eYpos;
Double_t eYneg;
} PDataPoint;
};
//--------------------------------------------------------------------------
typedef struct {
struct PDataCollection {
TString name; // collection name
TString xLabel;
PStringVector yLabel;
PDoubleVector xValue;
std::vector< std::vector<PDataPoint> > yValue;
} PDataCollection;
};
//--------------------------------------------------------------------------
class PMuppCanvas : public TObject, public TQObject

View File

@ -103,7 +103,7 @@ PMuppStartupHandler::PMuppStartupHandler()
// check if the startup file is found under $HOME/.musrfit/mupp
home = getenv("HOME");
if (home != 0) {
sprintf(startup_path_name, "%s/.musrfit/mupp/mupp_startup.xml", home);
snprintf(startup_path_name, sizeof(startup_path_name), "%s/.musrfit/mupp/mupp_startup.xml", home);
if (StartupFileExists(startup_path_name)) {
fStartupFilePath = TString(startup_path_name);
fStartupFileFound = true;

View File

@ -62,7 +62,7 @@ namespace mupp
Iterator line_start = get_pos(err_pos, line);
const char *homeStr = getenv("HOME");
char fln[1024];
sprintf(fln, "%s/.musrfit/mupp/mupp_err.log", homeStr);
snprintf(fln, sizeof(fln), "%s/.musrfit/mupp/mupp_err.log", homeStr);
std::ofstream fout(fln, std::ofstream::app);
if (err_pos != last) {
fout << message << what << ':' << std::endl;

View File

@ -33,7 +33,7 @@
#include "PExpression.hpp"
#include "PErrorHandler.hpp"
#include "PAnnotation.hpp"
#include <boost/spirit/include/phoenix_function.hpp>
#include <boost/phoenix/function.hpp>
namespace mupp { namespace parser
{

View File

@ -42,9 +42,9 @@
#include <boost/function.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/spirit/include/phoenix_core.hpp>
#include <boost/spirit/include/phoenix_function.hpp>
#include <boost/spirit/include/phoenix_operator.hpp>
#include <boost/phoenix/core.hpp>
#include <boost/phoenix/function.hpp>
#include <boost/phoenix/operator.hpp>
namespace mupp { namespace prog {
///////////////////////////////////////////////////////////////////////////

View File

@ -39,6 +39,8 @@
#include <QDoubleValidator>
#include <QTextStream>
#include <QPixmap>
#include <QGuiApplication>
#include <QScreen>
#include <QDebug>
@ -175,6 +177,12 @@ PMusrStep::PMusrStep(const char *fln, QWidget *parent) :
height = 20*fParamVec.size();
else
height = 900;
// make sure that the minimal height is not larger than the screen resolution height
QScreen *screen = QGuiApplication::primaryScreen();
int hh = screen->geometry().height();
if (height > hh)
height = hh - 70;
setMinimumSize(400, height);
// populate dialog
@ -536,7 +544,7 @@ int PMusrStep::writeMsrFile()
bool paramBlock = false;
do {
line = getLine(data, idx);
if ((idx == -1) || (idx == data.count())) {
if ((idx == -1) || (idx == data.size())) {
done = true;
} else {
if (line.startsWith("FITPARAMETER")) {

View File

@ -38,7 +38,7 @@
#include <QLabel>
#include <QCheckBox>
typedef struct {
struct PParam {
QString number;
QString name;
QString value;
@ -46,7 +46,7 @@ typedef struct {
QString posErr;
QString boundLow;
QString boundHigh;
} PParam;
};
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class PModSelect : public QDialog

View File

@ -70,13 +70,13 @@
#define T0_ENTER_WIZ 2
//-------------------------------------------------------------------
typedef struct {
struct PParamGui {
QLineEdit *paramName;
QLineEdit *paramVal;
QLineEdit *paramStep;
QLineEdit *paramBoundLow;
QLineEdit *paramBoundHigh;
} PParamGui;
};
//-------------------------------------------------------------------
class PMsrData
@ -192,7 +192,7 @@ class PIntroPage : public QWizardPage
PIntroPage(PAdmin *admin, PMsrData *data, QWidget *parent=0);
int nextId() const Q_DECL_OVERRIDE;
bool validatePage();
bool validatePage() override;
private slots:
void handleInstituteChanged(int idx);
@ -223,8 +223,8 @@ class PTheoPage : public QWizardPage
PTheoPage(PAdmin *admin, PMsrData *data, QWidget *parent=0);
int nextId() const Q_DECL_OVERRIDE;
void initializePage();
bool validatePage();
void initializePage() override;
bool validatePage() override;
private slots:
void templateState(int);
@ -269,9 +269,9 @@ class PFuncPage : public QWizardPage
PFuncPage(PMsrData *data, QWidget *parent=0);
int nextId() const Q_DECL_OVERRIDE;
void initializePage();
void cleanupPage();
bool validatePage();
void initializePage() override;
void cleanupPage() override;
bool validatePage() override;
private slots:
void showTheo();
@ -295,8 +295,8 @@ class PMapPage : public QWizardPage
PMapPage(PMsrData *data, QWidget *parent=0);
int nextId() const Q_DECL_OVERRIDE;
void initializePage();
bool validatePage();
void initializePage() override;
bool validatePage() override;
private slots:
void showTheo();
@ -318,8 +318,8 @@ class PParamPage : public QWizardPage
PParamPage(PMsrData *data, QWidget *parent=0);
int nextId() const Q_DECL_OVERRIDE;
void initializePage();
bool validatePage();
void initializePage() override;
bool validatePage() override;
private slots:
void showTheo();
@ -341,8 +341,8 @@ class PFitInfoPage : public QWizardPage
PFitInfoPage(PMsrData *data, QWidget *parent=0);
int nextId() const Q_DECL_OVERRIDE;
void initializePage();
bool validatePage();
void initializePage() override;
bool validatePage() override;
private:
PMsrData *fMsrData;

View File

@ -67,9 +67,9 @@ class PParam {
};
//-------------------------------------------------------------------
typedef struct {
struct PFunc {
int number;
QString fun;
} PFunc;
};
#endif // _MUSRWIZ_H_

View File

@ -45,14 +45,14 @@ class PAdmin;
* <p>This structure is keeping informations necessary to handle musrfit
* theory functions (see also <code>http://lmu.web.psi.ch/musrfit/user/html/user-manual.html#the-theory-block</code>).
*/
typedef struct {
struct PTheory {
QString name;
QString comment;
QString label;
QString pixmapName;
QPixmap pixmap;
int params;
} PTheory;
};
//---------------------------------------------------------------------------
/**

View File

@ -103,7 +103,7 @@ PMsr2DataDialog::PMsr2DataDialog(PMsr2DataParam *msr2DataParam, const QString he
//----------------------------------------------------------------------------------------------------
/**
* <p>returns the msr2data relavant parameters from the GUI.
* <p>returns the msr2data relevant parameters from the GUI.
*/
PMsr2DataParam* PMsr2DataDialog::getMsr2DataParam()
{

View File

@ -61,6 +61,7 @@
#include <QFileSystemWatcher>
#include <QDesktopServices>
#include <QUrl>
#include <QRegExp>
#include <QtDebug>
@ -2287,7 +2288,11 @@ void PTextEdit::musrMsr2Data()
// parameter export list
if (!fMsr2DataParam->paramList.isEmpty()) {
cmd.append("paramList");
QStringList list = fMsr2DataParam->paramList.split(' ');
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
QStringList list = fMsr2DataParam->paramList.split(QRegExp("[(\\s|,|;)]"), QString::SkipEmptyParts);
#else
QStringList list = fMsr2DataParam->paramList.split(QRegExp("[(\\s|,|;)]"), Qt::SkipEmptyParts);
#endif
for (int i=0; i<list.size(); i++)
cmd.append(list[i]);
}
@ -2859,13 +2864,16 @@ void PTextEdit::musrSwapMsrMlog()
return;
}
if (QMessageBox::information(this, "INFO",
QString("Will now swap files: %1 <-> %2").arg(currentFileName).arg(swapFileName),
QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Cancel)
return;
// check if the file needs to be saved
if (fTabWidget->tabText(fTabWidget->currentIndex()).indexOf("*") > 0) { // needs to be saved first
fileSave();
}
QMessageBox::information(nullptr, "INFO", QString("Will now swap files: %1 <-> %2").arg(currentFileName).arg(swapFileName));
// swap files
// copy currentFile -> tempFile

View File

@ -40,7 +40,7 @@
* parameters to handle <code>msr2data</code>. For a detailed description of the meaning of these
* parameters see <code>msr2data --help</code> and the online documentation.
*/
typedef struct {
struct PMsr2DataParam {
QString runList; ///< list of run numbers (usage 3 of msr2data)
QString runListFileName; ///< run list filename (usage 4 of msr2data)
QString msrFileExtension; ///< msr filename extension, e.g. '0100_h13.msr' -> '_h13'
@ -61,13 +61,13 @@ typedef struct {
bool fitOnly; ///< flag: true = just perform the fits wihtout generating any msr-files ('fit' in msr2data).
bool global; ///< flag: true = 'global' option
bool globalPlus; ///< flag: true = 'global+' option
} PMsr2DataParam;
};
//-------------------------------------------------------------------------------------------------
/**
* This structure is used to handle find (and replace) within <code>musredit</code> properly.
*/
typedef struct {
struct PFindReplaceData {
QString findText; ///< text to be found
QString replaceText; ///< replacement string
bool caseSensitive; ///< true = case sensitive
@ -76,6 +76,6 @@ typedef struct {
bool findBackwards; ///< true = reversed search
bool selectedText; ///< true = handle only the selected text
bool promptOnReplace; ///< true = request on OK from the user before performing the replace action
} PFindReplaceData;
};
#endif // _MUSREDIT_H_

View File

@ -42,18 +42,18 @@ set(GENERATED_HEADER_FILES
set_property(SOURCE mupp_version.h PROPERTY SKIP_AUTOMOC ON) # needed for cmake 3.x
set(MUPP_SOURCE_FILES
mupp.cpp
PmuppAdmin.cpp
mupp.cpp
PmuppAdmin.cpp
Pmupp.cpp
PmuppScript.cpp
PmuppScript.cpp
PmuppGui.cpp
PVarDialog.cpp
)
if (APPLE)
set(RESOURCE_FILES icons/mupp.icns)
add_executable(mupp
MACOSX_BUNDLE ${GENERATED_HEADER_FILES} ${MUPP_SOURCE_FILES}
add_executable(mupp
MACOSX_BUNDLE ${GENERATED_HEADER_FILES} ${MUPP_SOURCE_FILES}
mupp.qrc ${RESOURCE_FILES}
)
else (APPLE)
@ -62,24 +62,24 @@ endif (APPLE)
#--- check if project source is repo ------------------------------------------
if (IS_GIT_REPO)
set(HAVE_GIT_REV_H "-DHAVE_GIT_REV_H")
set(HAVE_GIT_REV_H "-DHAVE_GIT_REV_H")
else (IS_GIT_REPO)
set(HAVE_GIT_REV_H "")
set(HAVE_GIT_REV_H "")
endif (IS_GIT_REPO)
#--- compiler option to workaround a little cast problem for some
#--- compiler option to workaround a little cast problem for some
#--- boost/compiler combinations ----------------------------------------------
target_compile_options(mupp
PRIVATE
"-fpermissive"
"${HAVE_GIT_REV_H}"
"${HAVE_GIT_REV_H}"
)
#--- add the variable related sources -----------------------------------------
add_subdirectory(var)
#--- add the necessary header includes ----------------------------------------
target_include_directories(mupp
target_include_directories(mupp
BEFORE PRIVATE
$<BUILD_INTERFACE:${Boost_INCLUDE_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/../..>
@ -104,6 +104,7 @@ if (APPLE)
MACOSX_FRAMEWORK_IDENTIFIER ch.psi.mupp
MACOSX_BUNDLE_COPYRIGHT "Andreas Suter"
RESOURCE "${RESOURCE_FILES}"
INSTALL_RPATH "${Qt6_DIR}/../.."
)
endif (APPLE)

View File

@ -38,11 +38,11 @@
#include "PVarHandler.h"
//----------------------------------------------------------------------------
typedef struct {
struct PmuppPlotEntry {
int collIdx; ///< collection index
QString xLabel; ///< x-axis label
QVector<QString> yLabel; ///< y-axis label(s)
} PmuppPlotEntry;
};
//----------------------------------------------------------------------------
/**

View File

@ -50,20 +50,20 @@
#define P_MENU_ID_ABOUT 10002
//--------------------------------------------------------------------------
typedef struct {
struct PDataPoint {
Double_t y;
Double_t eYpos;
Double_t eYneg;
} PDataPoint;
};
//--------------------------------------------------------------------------
typedef struct {
struct PDataCollection {
TString name; // collection name
TString xLabel;
PStringVector yLabel;
PDoubleVector xValue;
std::vector< std::vector<PDataPoint> > yValue;
} PDataCollection;
};
//--------------------------------------------------------------------------
class PMuppCanvas : public TObject, public TQObject

View File

@ -103,7 +103,7 @@ PMuppStartupHandler::PMuppStartupHandler()
// check if the startup file is found under $HOME/.musrfit/mupp
home = getenv("HOME");
if (home != 0) {
sprintf(startup_path_name, "%s/.musrfit/mupp/mupp_startup.xml", home);
snprintf(startup_path_name, sizeof(startup_path_name), "%s/.musrfit/mupp/mupp_startup.xml", home);
if (StartupFileExists(startup_path_name)) {
fStartupFilePath = TString(startup_path_name);
fStartupFileFound = true;

View File

@ -62,7 +62,7 @@ namespace mupp
Iterator line_start = get_pos(err_pos, line);
const char *homeStr = getenv("HOME");
char fln[1024];
sprintf(fln, "%s/.musrfit/mupp/mupp_err.log", homeStr);
snprintf(fln, sizeof(fln), "%s/.musrfit/mupp/mupp_err.log", homeStr);
std::ofstream fout(fln, std::ofstream::app);
if (err_pos != last) {
fout << message << what << ':' << std::endl;

View File

@ -33,7 +33,7 @@
#include "PExpression.hpp"
#include "PErrorHandler.hpp"
#include "PAnnotation.hpp"
#include <boost/spirit/include/phoenix_function.hpp>
#include <boost/phoenix/function.hpp>
namespace mupp { namespace parser
{

View File

@ -42,9 +42,9 @@
#include <boost/function.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/spirit/include/phoenix_core.hpp>
#include <boost/spirit/include/phoenix_function.hpp>
#include <boost/spirit/include/phoenix_operator.hpp>
#include <boost/phoenix/core.hpp>
#include <boost/phoenix/function.hpp>
#include <boost/phoenix/operator.hpp>
namespace mupp { namespace prog {
///////////////////////////////////////////////////////////////////////////

View File

@ -2,9 +2,9 @@
#--- check if project source is repo ------------------------------------------
if (IS_GIT_REPO)
set(HAVE_GIT_REV_H "-DHAVE_GIT_REV_H")
set(HAVE_GIT_REV_H "-DHAVE_GIT_REV_H")
else (IS_GIT_REPO)
set(HAVE_GIT_REV_H "")
set(HAVE_GIT_REV_H "")
endif (IS_GIT_REPO)
#--- instruct CMake to run moc automatically when needed ----------------------
@ -29,7 +29,7 @@ if (APPLE)
${macosx_icon}
)
else (APPLE)
add_executable(musrStep
add_executable(musrStep
${musrStep_src}
musrStep.qrc
)
@ -46,7 +46,7 @@ target_include_directories(musrStep
target_compile_options(musrStep
PRIVATE
"${HAVE_GIT_REV_H}"
"${HAVE_GIT_REV_H}"
)
target_link_libraries(musrStep PRIVATE ${qt_libs})
@ -62,6 +62,7 @@ if (APPLE)
MACOSX_BUNDLE_GUI_IDENTIFIER "ch.psi.lmu.musrStep"
MACOSX_BUNDLE_COPYRIGHT "Andreas Suter"
RESOURCE ${macosx_icon}
INSTALL_RPATH "${Qt6_DIR}/../.."
)
endif (APPLE)
@ -74,4 +75,3 @@ else (APPLE)
RUNTIME DESTINATION bin
)
endif (APPLE)

View File

@ -39,6 +39,8 @@
#include <QDoubleValidator>
#include <QTextStream>
#include <QPixmap>
#include <QGuiApplication>
#include <QScreen>
#include <QDebug>
@ -175,6 +177,11 @@ PMusrStep::PMusrStep(const char *fln, QWidget *parent) :
height = 20*fParamVec.size();
else
height = 900;
// make sure that the minimal height is not larger than the screen resolution height
QScreen *screen = QGuiApplication::primaryScreen();
int hh = screen->geometry().height();
if (height > hh)
height = hh - 70;
setMinimumSize(400, height);
// populate dialog
@ -532,7 +539,7 @@ int PMusrStep::writeMsrFile()
bool paramBlock = false;
do {
line = getLine(data, idx);
if ((idx == -1) || (idx == data.count())) {
if ((idx == -1) || (idx == data.size())) {
done = true;
} else {
if (line.startsWith("FITPARAMETER")) {

View File

@ -38,7 +38,7 @@
#include <QLabel>
#include <QCheckBox>
typedef struct {
struct PParam {
QString number;
QString name;
QString value;
@ -46,7 +46,7 @@ typedef struct {
QString posErr;
QString boundLow;
QString boundHigh;
} PParam;
};
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class PModSelect : public QDialog

View File

@ -2,9 +2,9 @@
#--- check if project source is repo ------------------------------------------
if (IS_GIT_REPO)
set(HAVE_GIT_REV_H "-DHAVE_GIT_REV_H")
set(HAVE_GIT_REV_H "-DHAVE_GIT_REV_H")
else (IS_GIT_REPO)
set(HAVE_GIT_REV_H "")
set(HAVE_GIT_REV_H "")
endif (IS_GIT_REPO)
#--- instruct CMake to run moc automatically when needed ----------------------
@ -30,10 +30,10 @@ if (APPLE)
add_executable(musrWiz MACOSX_BUNDLE
${musrWiz_src}
musrWiz.qrc
${macosx_icon}
${macosx_icon}
)
else (APPLE)
add_executable(musrWiz
add_executable(musrWiz
${musrWiz_src}
musrWiz.qrc
)
@ -50,7 +50,7 @@ target_include_directories(musrWiz
target_compile_options(musrWiz
PRIVATE
"${HAVE_GIT_REV_H}"
"${HAVE_GIT_REV_H}"
)
target_link_libraries(musrWiz PRIVATE ${qt_libs})
@ -66,6 +66,7 @@ if (APPLE)
MACOSX_BUNDLE_GUI_IDENTIFIER "ch.psi.lmu.musrWiz"
MACOSX_BUNDLE_COPYRIGHT "Andreas Suter"
RESOURCE ${macosx_icon}
INSTALL_RPATH "${Qt6_DIR}/../.."
)
endif (APPLE)

View File

@ -70,13 +70,13 @@
#define T0_ENTER_WIZ 2
//-------------------------------------------------------------------
typedef struct {
struct PParamGui {
QLineEdit *paramName;
QLineEdit *paramVal;
QLineEdit *paramStep;
QLineEdit *paramBoundLow;
QLineEdit *paramBoundHigh;
} PParamGui;
};
//-------------------------------------------------------------------
class PMsrData
@ -192,7 +192,7 @@ class PIntroPage : public QWizardPage
PIntroPage(PAdmin *admin, PMsrData *data, QWidget *parent=0);
int nextId() const Q_DECL_OVERRIDE;
bool validatePage();
bool validatePage() override;
private slots:
void handleInstituteChanged(int idx);
@ -223,8 +223,8 @@ class PTheoPage : public QWizardPage
PTheoPage(PAdmin *admin, PMsrData *data, QWidget *parent=0);
int nextId() const Q_DECL_OVERRIDE;
void initializePage();
bool validatePage();
void initializePage() override;
bool validatePage() override;
private slots:
void templateState(int);
@ -269,9 +269,9 @@ class PFuncPage : public QWizardPage
PFuncPage(PMsrData *data, QWidget *parent=0);
int nextId() const Q_DECL_OVERRIDE;
void initializePage();
void cleanupPage();
bool validatePage();
void initializePage() override;
void cleanupPage() override;
bool validatePage() override;
private slots:
void showTheo();
@ -295,8 +295,8 @@ class PMapPage : public QWizardPage
PMapPage(PMsrData *data, QWidget *parent=0);
int nextId() const Q_DECL_OVERRIDE;
void initializePage();
bool validatePage();
void initializePage() override;
bool validatePage() override;
private slots:
void showTheo();
@ -318,8 +318,8 @@ class PParamPage : public QWizardPage
PParamPage(PMsrData *data, QWidget *parent=0);
int nextId() const Q_DECL_OVERRIDE;
void initializePage();
bool validatePage();
void initializePage() override;
bool validatePage() override;
private slots:
void showTheo();
@ -341,8 +341,8 @@ class PFitInfoPage : public QWizardPage
PFitInfoPage(PMsrData *data, QWidget *parent=0);
int nextId() const Q_DECL_OVERRIDE;
void initializePage();
bool validatePage();
void initializePage() override;
bool validatePage() override;
private:
PMsrData *fMsrData;

View File

@ -67,9 +67,9 @@ class PParam {
};
//-------------------------------------------------------------------
typedef struct {
struct PFunc {
int number;
QString fun;
} PFunc;
};
#endif // _MUSRWIZ_H_

View File

@ -2,9 +2,9 @@
#--- check if project source is repo ------------------------------------------
if (IS_GIT_REPO)
set(HAVE_GIT_REV_H "-DHAVE_GIT_REV_H")
set(HAVE_GIT_REV_H "-DHAVE_GIT_REV_H")
else (IS_GIT_REPO)
set(HAVE_GIT_REV_H "")
set(HAVE_GIT_REV_H "")
endif (IS_GIT_REPO)
#--- instruct CMake to run moc automatically when needed ----------------------
@ -63,7 +63,7 @@ set(musredit_ui
forms/PGetFourierBlockDialog.ui
forms/PGetPlotBlockDialog.ui
forms/PMsr2DataDialog.ui
forms/PChangeDefaultPathsDialog.ui
forms/PChangeDefaultPathsDialog.ui
)
if (APPLE)
@ -72,7 +72,7 @@ if (APPLE)
else()
set(macosx_icon_name musredit.icns)
endif()
set(macosx_icon "icons/${macosx_icon_name}")
set(macosx_icon "icons/${macosx_icon_name}")
add_executable(musredit MACOSX_BUNDLE
${musredit_src}
${musredit_ui}
@ -80,7 +80,7 @@ if (APPLE)
${macosx_icon}
)
else (APPLE)
add_executable(musredit
add_executable(musredit
${musredit_src}
${musredit_ui}
musredit.qrc
@ -99,7 +99,7 @@ target_include_directories(musredit
target_compile_options(musredit
PRIVATE
"${HAVE_GIT_REV_H}"
"${HAVE_GIT_REV_H}"
)
target_link_libraries(musredit PRIVATE ${qt_libs})
@ -115,6 +115,7 @@ if (APPLE)
MACOSX_BUNDLE_GUI_IDENTIFIER "ch.psi.lmu.musredit"
MACOSX_BUNDLE_COPYRIGHT "Andreas Suter"
RESOURCE ${macosx_icon}
INSTALL_RPATH "${Qt6_DIR}/../.."
)
endif (APPLE)
@ -138,4 +139,3 @@ install(
${CMAKE_INSTALL_PREFIX}/share/doc/musrfit
MESSAGE_NEVER
)

View File

@ -45,14 +45,14 @@ class PAdmin;
* <p>This structure is keeping informations necessary to handle musrfit
* theory functions (see also <code>http://lmu.web.psi.ch/musrfit/user/html/user-manual.html#the-theory-block</code>).
*/
typedef struct {
struct PTheory {
QString name;
QString comment;
QString label;
QString pixmapName;
QPixmap pixmap;
int params;
} PTheory;
};
//---------------------------------------------------------------------------
/**

View File

@ -103,7 +103,7 @@ PMsr2DataDialog::PMsr2DataDialog(PMsr2DataParam *msr2DataParam, const QString he
//----------------------------------------------------------------------------------------------------
/**
* <p>returns the msr2data relavant parameters from the GUI.
* <p>returns the msr2data relevant parameters from the GUI.
*/
PMsr2DataParam* PMsr2DataDialog::getMsr2DataParam()
{

View File

@ -61,6 +61,7 @@
#include <QFileSystemWatcher>
#include <QDesktopServices>
#include <QUrl>
#include <QRegularExpression>
#include <QtDebug>
@ -2288,7 +2289,7 @@ void PTextEdit::musrMsr2Data()
// parameter export list
if (!fMsr2DataParam->paramList.isEmpty()) {
cmd.append("paramList");
QStringList list = fMsr2DataParam->paramList.split(' ');
QStringList list = fMsr2DataParam->paramList.split(QRegularExpression("[(\\s|,|;)]"), Qt::SkipEmptyParts);
for (int i=0; i<list.size(); i++)
cmd.append(list[i]);
}
@ -2848,13 +2849,16 @@ void PTextEdit::musrSwapMsrMlog()
return;
}
if (QMessageBox::information(this, "INFO",
QString("Will now swap files: %1 <-> %2").arg(currentFileName).arg(swapFileName),
QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Cancel)
return;
// check if the file needs to be saved
if (fTabWidget->tabText(fTabWidget->currentIndex()).indexOf("*") > 0) { // needs to be saved first
fileSave();
}
QMessageBox::information(nullptr, "INFO", QString("Will now swap files: %1 <-> %2").arg(currentFileName).arg(swapFileName));
// swap files
// copy currentFile -> tempFile

View File

@ -40,7 +40,7 @@
* parameters to handle <code>msr2data</code>. For a detailed description of the meaning of these
* parameters see <code>msr2data --help</code> and the online documentation.
*/
typedef struct {
struct PMsr2DataParam {
QString runList; ///< list of run numbers (usage 3 of msr2data)
QString runListFileName; ///< run list filename (usage 4 of msr2data)
QString msrFileExtension; ///< msr filename extension, e.g. '0100_h13.msr' -> '_h13'
@ -61,13 +61,13 @@ typedef struct {
bool fitOnly; ///< flag: true = just perform the fits wihtout generating any msr-files ('fit' in msr2data).
bool global; ///< flag: true = 'global' option
bool globalPlus; ///< flag: true = 'global+' option
} PMsr2DataParam;
};
//-------------------------------------------------------------------------------------------------
/**
* This structure is used to handle find (and replace) within <code>musredit</code> properly.
*/
typedef struct {
struct PFindReplaceData {
QString findText; ///< text to be found
QString replaceText; ///< replacement string
bool caseSensitive; ///< true = case sensitive
@ -76,6 +76,6 @@ typedef struct {
bool findBackwards; ///< true = reversed search
bool selectedText; ///< true = handle only the selected text
bool promptOnReplace; ///< true = request on OK from the user before performing the replace action
} PFindReplaceData;
};
#endif // _MUSREDIT_H_

View File

@ -283,10 +283,10 @@ void musrfit_write_root(TFile &f, TString fln, PRunData *data, int runCounter)
char name[128];
TString title = fln.Copy();
sprintf(name, "_%d", runCounter);
snprintf(name, sizeof(name), "_%d", runCounter);
title.ReplaceAll(".root", name);
sprintf(name, "c%d", runCounter);
snprintf(name, sizeof(name),"c%d", runCounter);
TCanvas *c = new TCanvas(name, title.Data(), 10, 10, 800, 600);

View File

@ -85,7 +85,7 @@ PDumpOutputHandler::~PDumpOutputHandler()
}
if (fProc->isRunning()) { // try low level kill
char cmd[128];
sprintf(cmd, "kill -9 %ld", fProcPID);
snprintf(cmd, sizeof(cnd), "kill -9 %ld", fProcPID);
system(cmd);
}
if (fProc) {

View File

@ -88,7 +88,7 @@ PFitOutputHandler::~PFitOutputHandler()
}
if (fProc->isRunning()) { // try low level kill
char cmd[128];
sprintf(cmd, "kill -9 %ld", fProcPID);
snprintf(cmd, sizeof(cmd), "kill -9 %ld", fProcPID);
system(cmd);
}
if (fProc) {

View File

@ -396,7 +396,7 @@ int main(int argc, char *argv[])
char canvasName[32];
for (unsigned int i=0; i<canvasVector.size(); i++) {
// check if canvas is still there before calling the destructor **TO BE DONE**
sprintf(canvasName, "fMainCanvas%d", i);
snprintf(canvasName, sizeof(canvasName), "fMainCanvas%d", i);
if (gROOT->GetListOfCanvases()->FindObject(canvasName) != nullptr) {
canvasVector[i]->~PMusrCanvas();
}

View File

@ -168,9 +168,9 @@ int main(int argc, char *argv[])
char fln[128];
if (gaussian)
sprintf(fln, "dynKT_LF_w0_%1.1f_width%1.1f_nu%1.1f_N%d_G.dat", param[0], param[1], param[2], N);
snprintf(fln, sizeof(fln), "dynKT_LF_w0_%1.1f_width%1.1f_nu%1.1f_N%d_G.dat", param[0], param[1], param[2], N);
else
sprintf(fln, "dynKT_LF_w0_%1.1f_width%1.1f_nu%1.1f_N%d_L.dat", param[0], param[1], param[2], N);
snprintf(fln, sizeof(fln), "dynKT_LF_w0_%1.1f_width%1.1f_nu%1.1f_N%d_L.dat", param[0], param[1], param[2], N);
const double H = Tmax/N;

View File

@ -124,7 +124,7 @@ int main(int argc, char *argv[])
// get data histo
char histoName[32];
// read first the data which are NOT post pileup corrected
sprintf(histoName, "hDecay%02d", histoNo);
snprintf(histoName, sizeof(histoName), "hDecay%02d", histoNo);
TH1F *histo = dynamic_cast<TH1F*>(folder->FindObjectAny(histoName));
if (!histo) {
cout << endl << "PRunDataHandler::ReadRootFile: Couldn't get histo " << histoName;

View File

@ -5,8 +5,6 @@
Author: Andreas Suter
e-mail: andreas.suter@psi.ch
$Id$
***************************************************************************/
/***************************************************************************
@ -443,7 +441,7 @@ int main(int argc, char *argv[])
// create run info folder and content
TFolder *runInfoFolder = new TFolder("RunInfo", "Run Info");
TLemRunHeader *runHeader = new TLemRunHeader();
sprintf(str, "Fake Data generated from %s", pBFileName.Data());
snprintf(str, sizeof(str), "Fake Data generated from %s", pBFileName.Data());
runHeader->SetRunTitle(str);
Float_t fval = timeResolution;
runHeader->SetTimeResolution(fval);