added NeXus support. Still a lot of testing will be needed, documentation updated, etc.

This commit is contained in:
nemu 2011-04-08 09:24:32 +00:00
parent 00d591fbff
commit 49619fcffb
18 changed files with 865 additions and 236 deletions

View File

@ -4,8 +4,9 @@
# $Id$
#---------------------------------------------------------------------
changes since 0.8.0
musrfit 0.9.0 - changes since 0.8.0
===================================
NEW added NeXus support. Still a lot of testing will be needed, documentation updated, etc.
NEW added a magnetic proximity user function to the ASlibs
NEW added the command SCALE_N0_BKG TRUE | FALSE to the command-block. This can be used to force a single histogram fit
to use either 1/ns scaling for N0 and background or 1/bins one.

View File

@ -1,5 +1,7 @@
AC_REVISION($Id$)
AC_PREREQ(2.59)
AC_INIT(musrfit, 0.8.0, andreas.suter@psi.ch)
AC_INIT(musrfit, 0.9.0, andreas.suter@psi.ch)
AC_CONFIG_AUX_DIR(admin)
AC_CANONICAL_HOST
#AC_MSG_RESULT([${host} ${host_cpu} ${host_vendor} ${host_os}])
@ -21,6 +23,7 @@ MUSR_LIBRARY_NAME=PMusr
LEM_LIBRARY_NAME=TLemRunHeader
PSIBIN_LIBRARY_NAME=Class_MuSR_PSI
MUD_LIBRARY_NAME=mud
PNEXUS_LIBRARY_NAME=PNeXus
CUBA_LIBRARY_NAME=cuba
dnl -----------------------------------------------
@ -30,7 +33,7 @@ dnl -----------------------------------------------
#release versioning
MUSR_MAJOR_VERSION=0
MUSR_MINOR_VERSION=8
MUSR_MINOR_VERSION=9
MUSR_MICRO_VERSION=0
#release versioning
@ -48,6 +51,11 @@ MUD_MAJOR_VERSION=0
MUD_MINOR_VERSION=0
MUD_MICRO_VERSION=0
#release versioning
PNEXUS_MAJOR_VERSION=0
PNEXUS_MINOR_VERSION=9
PNEXUS_MICRO_VERSION=0
#release versioning
PLUGIN_MAJOR_VERSION=1
PLUGIN_MINOR_VERSION=0
@ -71,6 +79,9 @@ AC_SUBST(PSIBIN_API_VERSION)
MUD_API_VERSION=$MUD_MAJOR_VERSION.$MUD_MINOR_VERSION
AC_SUBST(MUD_API_VERSION)
PNEXUS_API_VERSION=$PNEXUS_MAJOR_VERSION.$PNEXUS_MINOR_VERSION
AC_SUBST(PNEXUS_API_VERSION)
PLUGIN_API_VERSION=$PLUGIN_MAJOR_VERSION.$PLUGIN_MINOR_VERSION
AC_SUBST(PLUGIN_API_VERSION)
@ -83,6 +94,7 @@ PLUGIN_LIBRARY_VERSION=$PLUGIN_MAJOR_VERSION:$PLUGIN_MINOR_VERSION:$PLUGIN_MICRO
LEM_LIBRARY_VERSION=$LEM_MAJOR_VERSION:$LEM_MINOR_VERSION:$LEM_MICRO_VERSION
PSIBIN_LIBRARY_VERSION=$PSIBIN_MAJOR_VERSION:$PSIBIN_MINOR_VERSION:$PSIBIN_MICRO_VERSION
MUD_LIBRARY_VERSION=$MUD_MAJOR_VERSION:$MUD_MINOR_VERSION:$MUD_MICRO_VERSION
PNEXUS_LIBRARY_VERSION=$PNEXUS_MAJOR_VERSION:$PNEXUS_MINOR_VERSION:$PNEXUS_MICRO_VERSION
MUSR_LIBRARY_VERSION=$MUSR_MAJOR_VERSION:$MUSR_MINOR_VERSION:$MUSR_MICRO_VERSION
# This is definitely handled wrongly at the moment and needs to be fixed...
@ -103,6 +115,7 @@ AC_SUBST(MUSR_LIBRARY_VERSION)
AC_SUBST(LEM_LIBRARY_VERSION)
AC_SUBST(PSIBIN_LIBRARY_VERSION)
AC_SUBST(MUD_LIBRARY_VERSION)
AC_SUBST(PNEXUS_LIBRARY_VERSION)
AC_SUBST(PLUGIN_LIBRARY_VERSION)
AC_SUBST(CUBA_LIBRARY_VERSION)
@ -111,6 +124,7 @@ AC_SUBST(MUSR_LIBRARY_NAME)
AC_SUBST(LEM_LIBRARY_NAME)
AC_SUBST(PSIBIN_LIBRARY_NAME)
AC_SUBST(MUD_LIBRARY_NAME)
AC_SUBST(PNEXUS_LIBRARY_NAME)
AC_SUBST(CUBA_LIBRARY_NAME)
PSIBIN_VERSION=$PSIBIN_MAJOR_VERSION.$PSIBIN_MINOR_VERSION.$PSIBIN_MICRO_VERSION
@ -123,6 +137,11 @@ MUD_RELEASE=$MUD_MAJOR_VERSION.$MUD_MINOR_VERSION
AC_SUBST(MUD_RELEASE)
AC_SUBST(MUD_VERSION)
PNEXUS_VERSION=$PNEXUS_MAJOR_VERSION.$PNEXUS_MINOR_VERSION.$PNEXUS_MICRO_VERSION
PNEXUS_RELEASE=$PNEXUS_MAJOR_VERSION.$PNEXUS_MINOR_VERSION
AC_SUBST(PNEXUS_RELEASE)
AC_SUBST(PNEXUS_VERSION)
LEM_VERSION=$LEM_MAJOR_VERSION.$LEM_MINOR_VERSION.$LEM_MICRO_VERSION
LEM_RELEASE=$LEM_MAJOR_VERSION.$LEM_MINOR_VERSION
AC_SUBST(LEM_RELEASE)
@ -344,6 +363,136 @@ fi
AC_SUBST(ROOT_LIBS)
AC_SUBST(ROOT_CFLAGS)
dnl -----------------------------------------------
dnl Check for NeXus, HDF5, etc.
dnl -----------------------------------------------
AC_ARG_ENABLE([NeXus], [AC_HELP_STRING([--enable-NeXus], [build optional NeXus support [default=no]])],
[
# checking for hdf4
AC_ARG_WITH([hdf4],
[AC_HELP_STRING([--with-hdf4], [prefix of the HDF4 installation (needed for NeXus), e.g. /usr/local/hdf4 or /opt/hdf4])],
[HDF4_PREFIX=$with_hdf4
AC_MSG_CHECKING([whether HDF4 can be found at the specified location])
if !(test -r ${HDF4_PREFIX}/include/hdf.h); then
AC_MSG_RESULT([no])
AC_MSG_ERROR([HDF4 cannot be found at the specified path!])
fi
AC_MSG_RESULT([${HDF4_PREFIX}])],
[AC_MSG_CHECKING([whether HDF4 is installed in a standard location])
if test -r /usr/local/include/hdf.h; then
HDF4_PREFIX="/usr/local"
AC_MSG_RESULT([${HDF4_PREFIX}])
elif test -r /usr/local/hdf4/include/hdf.h; then
HDF4_PREFIX="/usr/local/hdf4"
AC_MSG_RESULT([${HDF4_PREFIX}])
elif test -r /usr/include/hdf.h; then
HDF4_PREFIX="/usr"
AC_MSG_RESULT([${HDF4_PREFIX}])
elif test -r /sw/hdf4/include/hdf.h; then
HDF4_PREFIX="/sw/hdf4"
AC_MSG_RESULT([${HDF4_PREFIX}])
elif test -r /opt/hdf4/include/hdf.h; then
HDF4_PREFIX="/opt/hdf4"
AC_MSG_RESULT([${HDF4_PREFIX}])
else
AC_MSG_RESULT([no])
AC_MSG_ERROR(
[HDF4 not found (needed for NeXus). Please call configure with the --with-hdf4 option.
This tells configure where to find the HDF4 C++ headers,
e.g. --with-hdf4=/usr/local/hdf4]
)
fi
]
)
# checking for hdf5
AC_ARG_WITH([hdf5],
[AC_HELP_STRING([--with-hdf5], [prefix of the HDF5 installation (needed for NeXus), e.g. /usr/local/hdf5 or /opt/hdf5])],
[HDF5_PREFIX=$with_hdf5
AC_MSG_CHECKING([whether HDF5 can be found at the specified location])
if !(test -r ${HDF5_PREFIX}/include/hdf5.h); then
AC_MSG_RESULT([no])
AC_MSG_ERROR([HDF5 cannot be found at the specified path!])
fi
AC_MSG_RESULT([${HDF5_PREFIX}])],
[AC_MSG_CHECKING([whether HDF5 is installed in a standard location])
if test -r /usr/local/include/hdf5.h; then
HDF5_PREFIX="/usr/local"
AC_MSG_RESULT([${HDF5_PREFIX}])
elif test -r /usr/local/hdf5/include/hdf5.h; then
HDF5_PREFIX="/usr/local/hdf5"
AC_MSG_RESULT([${HDF5_PREFIX}])
elif test -r /usr/include/hdf5.h; then
HDF5_PREFIX="/usr"
AC_MSG_RESULT([${HDF5_PREFIX}])
elif test -r /sw/hdf5/include/hdf5.h; then
HDF5_PREFIX="/sw/hdf5"
AC_MSG_RESULT([${HDF5_PREFIX}])
elif test -r /opt/hdf5/include/hdf5.h; then
HDF5_PREFIX="/opt/hdf5"
AC_MSG_RESULT([${HDF5_PREFIX}])
else
AC_MSG_RESULT([no])
AC_MSG_ERROR(
[HDF5 not found (needed for NeXus). Please call configure with the --with-hdf5 option.
This tells configure where to find the HDF5 C++ headers,
e.g. --with-hdf5=/usr/local/hdf5]
)
fi
]
)
# checking for NeXus
NEXUS_FOUND=0
AC_ARG_WITH([nexus],
[AC_HELP_STRING([--with-nexus], [prefix of the NeXus installation, e.g. /usr/local])],
[NEXUS_PREFIX=$with_nexus
AC_MSG_CHECKING([whether NeXus can be found at the specified location])
if !(test -r ${NEXUS_PREFIX}/include/napi.h); then
AC_MSG_RESULT([no])
AC_MSG_ERROR([NeXus cannot be found at the specified path!])
fi
AC_MSG_RESULT([${NEXUS_PREFIX}])],
[PKG_CHECK_MODULES(NEXUS, nexus >= 4.1, [NEXUS_FOUND=1],
[AC_MSG_CHECKING([whether NeXus is installed in a standard location])
if test -r /usr/local/include/napi.h; then
NEXUS_PREFIX="/usr/local"
AC_MSG_RESULT([${NEXUS_PREFIX}])
elif test -r /usr/local/nexus/include/napi.h; then
NEXUS_PREFIX="/usr/local/nexus"
AC_MSG_RESULT([${NEXUS_PREFIX}])
elif test -r /usr/include/napi.h; then
NEXUS_PREFIX="/usr"
AC_MSG_RESULT([${NEXUS_PREFIX}])
elif test -r /sw/nexus/include/napi.h; then
NEXUS_PREFIX="/sw/nexus"
AC_MSG_RESULT([${NEXUS_PREFIX}])
elif test -r /opt/local/nexus/include/napi.h; then
NEXUS_PREFIX="/opt/local/nexus"
AC_MSG_RESULT([${NEXUS_PREFIX}])
else
AC_MSG_RESULT([no])
AC_MSG_ERROR(
[NeXus not found. Please call configure with the --with-nexus option.
This tells configure where to find the NeXus headers,
e.g. --with-nexus=/usr/local/nexus]
)
fi
]
)]
)
AC_SUBST(NEXUS_PREFIX)
if test "${NEXUS_FOUND}" != "1"; then
NEXUS_LIBS="-L${NEXUS_PREFIX}/lib -lNeXus"
NEXUS_CFLAGS="-I${NEXUS_PREFIX}/include"
fi
AC_SUBST(NEXUS_LIBS)
AC_SUBST(NEXUS_CFLAGS)
PNEXUS_ENABLED=1
],
[PNEXUS_ENABLED=0]
)
dnl -----------------------------------------------
dnl Ask user if BMWlibs should be built and where to find the CUBA installation
@ -461,7 +610,7 @@ dnl -----------------------------------------------
AC_ARG_ENABLE([ASlibs], [AC_HELP_STRING([--enable-ASlibs],[build optional AS plug-ins [default=no]])],[BUILD_AS_LIBS=1], [BUILD_AS_LIBS=0])
dnl -----------------------------------------------
dnl Set some paths and flags for PMusr, TLemRunHeader, Class_MuSR_PSI and mud
dnl Set some paths and flags for PMusr, TLemRunHeader, Class_MuSR_PSI, mud, NeXus (if enabled), etc.
dnl -----------------------------------------------
SRCDIR="$(pwd)/src"
@ -489,6 +638,15 @@ PMUSR_CFLAGS="-I${SRCDIR}/include"
AC_SUBST(PMUSR_LIBS)
AC_SUBST(PMUSR_CFLAGS)
if test "${PNEXUS_ENABLED}" = "1"; then
AC_DEFINE([PNEXUS_ENABLED], [1], [Define to 1 if NeXus is enabled])
PNEXUS_SRCDIR="${SRCDIR}/external/nexus"
PNEXUS_LIBS="${PNEXUS_SRCDIR}/lib${PNEXUS_LIBRARY_NAME}.la"
PNEXUS_CXXFLAGS="-I${PNEXUS_SRCDIR}"
AC_SUBST(PNEXUS_LIBS)
AC_SUBST(PNEXUS_CXXFLAGS)
fi
if test "${BUILD_BMW_LIBS}" = "1"; then
BMWTOOLS_SRCDIR="${SRCDIR}/external/BMWtools"
BMWTOOLS_LIBS="${BMWTOOLS_SRCDIR}/libBMWtools.la"
@ -550,6 +708,7 @@ LOCAL_BIN_CXXFLAGS="${CPUFLAGS} -Wall -Wno-trigraphs"
LOCAL_LIB_CXXFLAGS="${LOCAL_BIN_CXXFLAGS}"
LOCAL_PSIBIN_LIB_CXXFLAGS="${LOCAL_LIB_CXXFLAGS}"
LOCAL_MUD_LIB_CFLAGS="${LOCAL_LIB_CXXFLAGS} ${USER_CFLAGS}"
LOCAL_PNEXUS_LIB_CXXFLAGS="${LOCAL_LIB_CXXFLAGS}"
LOCAL_CUBA_LIB_CFLAGS="${LOCAL_LIB_CXXFLAGS} ${CUBA_BUILD_CFLAGS}"
LOCAL_BIN_LDFLAGS=
LOCAL_LIB_LDFLAGS=
@ -561,6 +720,7 @@ case "$host" in
LOCAL_LIB_CXXFLAGS="${LOCAL_BIN_CXXFLAGS} -D_DLL"
LOCAL_PSIBIN_LIB_CXXFLAGS="${LOCAL_LIB_CXXFLAGS} -D_WIN32GCC"
LOCAL_MUD_LIB_CFLAGS="${LOCAL_LIB_CXXFLAGS} ${USER_CFLAGS}"
LOCAL_PNEXUS_LIB_CXXFLAGS="${LOCAL_LIB_CXXFLAGS}"
LOCAL_CUBA_LIB_CFLAGS="${LOCAL_LIB_CXXFLAGS} ${CUBA_BUILD_CFLAGS}"
LOCAL_BIN_LDFLAGS="${LOCAL_BIN_LDFLAGS} -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc"
LOCAL_LIB_LDFLAGS="-no-undefined ${LOCAL_BIN_LDFLAGS} -Wl,--export-all-symbols"
@ -580,6 +740,7 @@ AC_SUBST(LOCAL_BIN_CXXFLAGS)
AC_SUBST(LOCAL_LIB_CXXFLAGS)
AC_SUBST(LOCAL_PSIBIN_LIB_CXXFLAGS)
AC_SUBST(LOCAL_MUD_LIB_CFLAGS)
AC_SUBST(LOCAL_PNEXUS_LIB_CXXFLAGS)
AC_SUBST(LOCAL_CUBA_LIB_CFLAGS)
AC_SUBST(LOCAL_BIN_LDFLAGS)
AC_SUBST(LOCAL_LIB_LDFLAGS)
@ -614,6 +775,7 @@ dnl -----------------------------------------------
AM_CONDITIONAL([IS_DARWIN], [test "${ARCH}" = "DARWIN"])
AM_CONDITIONAL([IS_CYGWIN], [test "${ARCH}" = "CYGWIN"])
AM_CONDITIONAL([PNEXUS_ENABLED], [test "${PNEXUS_ENABLED}" = "1"])
AM_CONDITIONAL([BUILD_CUBALIB], [test "${BUILD_CUBA}" = "1"])
AM_CONDITIONAL([BUILD_BMWLIBS], [test "${BUILD_BMW_LIBS}" = "1"])
AM_CONDITIONAL([BUILD_ASLIBS], [test "${BUILD_AS_LIBS}" = "1"])
@ -631,6 +793,8 @@ AC_CONFIG_FILES([Makefile \
src/external/mud/Makefile \
src/external/mud/src/Makefile \
src/external/mud/src/mud.pc \
src/external/nexus/Makefile \
src/external/nexus/PNeXus.pc \
src/external/libCuba/Makefile \
src/external/libCuba/src/Makefile \
src/external/libCuba/src/cuba.pc \

View File

@ -3,6 +3,7 @@
SUBDIRS = external/TLemRunHeader \
external/MuSR_software \
external/mud \
external/nexus \
classes \
external
@ -18,10 +19,10 @@ any2many_SOURCES = any2many.cpp
xmldir = $(bindir)
xml_DATA = musrfit_startup.xml
LIBADD = $(PMUSR_LIBS) $(LEM_LIBS) $(PSIBIN_LIBS) $(MUD_LIBS)
LIBADD = $(PMUSR_LIBS) $(LEM_LIBS) $(PSIBIN_LIBS) $(MUD_LIBS) $(PNEXUS_LIBS)
AM_CXXFLAGS = $(LOCAL_BIN_CXXFLAGS)
AM_LDFLAGS = $(LOCAL_BIN_LDFLAGS)
INCLUDES = $(PMUSR_CFLAGS) $(FFTW3_CFLAGS) $(GSL_CFLAGS) $(BOOST_CFLAGS) $(ROOT_CFLAGS)
LIBS = $(PMUSR_LIBS) $(LEM_LIBS) $(PSIBIN_LIBS) $(MUD_LIBS) $(FFTW3_LIBS) $(GSL_LIBS) $(ROOT_LIBS)
LIBS = $(PMUSR_LIBS) $(LEM_LIBS) $(PSIBIN_LIBS) $(MUD_LIBS) $(PNEXUS_LIBS) $(FFTW3_LIBS) $(GSL_LIBS) $(ROOT_LIBS)

View File

@ -87,7 +87,7 @@ void any2many_syntax()
cout << endl << " (without extension) of the compressed data collection, and";
cout << endl << " 'g' will result in .tar.gz, and 'b' in .tar.bz2 files.";
cout << endl;
cout << endl << " If the output option '-o' is missing, the output file name will be";
cout << endl << " If the template option '-t' is absent, the output file name will be";
cout << endl << " generated according to the input data file name, and the output data";
cout << endl << " format.";
cout << endl;
@ -106,11 +106,15 @@ void any2many_syntax()
cout << endl << " Will take the runs 100 through 117 and convert the PSI-MDU input files to";
cout << endl << " ASCII output and instead of saving them into a file, they will be spit to";
cout << endl << " the standard output." << endl;
cout << endl << " any2many -r 100-117 -c NEXUS ROOT -t d[yyyy]/psi_gps_[rrrr].nexus \\";
cout << endl << " any2many -r 100-117 -c NEXUS ROOT -t d[yyyy]/psi_gps_[rrrr].NXS \\";
cout << endl << " psi_[yyyy]_gps_[rrrr].root -z b psi_gps_run_100to117";
cout << endl << " Will take the runs 100 through 117 and convert the PSI-NEXUS input files";
cout << endl << " to ROOT output. Afterwards these new files will be collected in a";
cout << endl << " compressed archive psi_gps_run_100to117.tar.bz2." << endl;
cout << endl << " any2many -f 2010/lem10_his_0123.root 2010/lem10_his_0012.root -c ROOT ROOT -rebin 25";
cout << endl << " Will read the two files '2010/lem10_his_0123.root' and '2010/lem10_his_0012.root',";
cout << endl << " rebin them with 25 and export them as LEM ROOT files with adding rebin25 to the";
cout << endl << " name, e.g. 2010/lem10_his_0123_rebin25.root";
cout << endl << endl;
}
@ -398,33 +402,16 @@ int main(int argc, char *argv[])
show_syntax = true;
}
cout << endl << "debug> info.year='" << info.year << "', info.year.length()=" << info.year.Length();
cout << endl << "debug> info.useStandardOutput=" << info.useStandardOutput;
cout << endl << "debug> info.inFormat=" << info.inFormat;
cout << endl << "debug> info.outFormat=" << info.outFormat;
cout << endl << "debug> info.runList=";
for (unsigned int i=0; i<info.runList.size(); i++)
cout << info.runList[i] << ", ";
cout << endl << "debug> info.outPath=" << info.outPath;
cout << endl << "debug> info.rebin=" << info.rebin;
cout << endl << "debug> info.inTemplate=" << info.inTemplate;
cout << endl << "debug> info.outTemplate=" << info.outTemplate;
cout << endl << "debug> info.compressionTag=" << info.compressionTag;
cout << endl << "debug> info.compressFileName=" << info.compressFileName;
cout << endl << "debug> info.inFileName=";
for (unsigned int i=0; i<info.inFileName.size(); i++)
cout << info.inFileName[i] << ", ";
cout << endl;
if (show_syntax) {
info.runList.clear();
any2many_syntax();
return PMUSR_WRONG_STARTUP_SYNTAX;
}
if (!info.inFormat.CompareTo(info.outFormat, TString::kIgnoreCase)) {
if (!info.inFormat.CompareTo(info.outFormat, TString::kIgnoreCase) && (info.rebin == 1)) {
info.runList.clear();
cout << endl << "**INFO** since input data format == output data format, I will not do anything." << endl;
cout << endl << ">> any2many **ERROR** input data format == output data format, only allowed if rebin != 1.";
cout << endl << " will ignore the request." << endl << endl;
return PMUSR_SUCCESS;
}
@ -433,7 +420,7 @@ cout << endl;
TSAXParser *saxParser = new TSAXParser();
PStartupHandler *startupHandler = new PStartupHandler();
if (!startupHandler->StartupFileFound()) {
cerr << endl << "**WARNING** couldn't find " << startupHandler->GetStartupFilePath().Data();
cerr << endl << ">> any2many **WARNING** couldn't find " << startupHandler->GetStartupFilePath().Data();
cerr << endl;
// clean up
if (saxParser) {
@ -450,7 +437,7 @@ cout << endl;
status = saxParser->ParseFile(startup_path_name);
// check for parse errors
if (status) { // error
cerr << endl << "**WARNING** reading/parsing musrfit_startup.xml.";
cerr << endl << ">> any2many **WARNING** reading/parsing musrfit_startup.xml.";
cerr << endl;
// clean up
if (saxParser) {

View File

@ -66,7 +66,7 @@ dict_cpp_sources = \
include_HEADERS = $(h_sources)
noinst_HEADERS = $(h_linkdef) $(dict_h_sources)
INCLUDES = -I$(top_srcdir)/src/include $(PSIBIN_CFLAGS) $(MUD_CFLAGS) $(LEM_CFLAGS) $(FFTW3_CFLAGS) $(GSL_CFLAGS) $(BOOST_CFLAGS) $(ROOT_CFLAGS)
INCLUDES = -I$(top_srcdir)/src/include $(PSIBIN_CFLAGS) $(MUD_CFLAGS) $(LEM_CFLAGS) $(FFTW3_CFLAGS) $(GSL_CFLAGS) $(BOOST_CFLAGS) $(ROOT_CFLAGS) $(PNEXUS_CXXFLAGS)
AM_CXXFLAGS = $(LOCAL_LIB_CXXFLAGS)
BUILT_SOURCES = $(dict_cpp_sources) $(dict_h_sources)
@ -79,7 +79,7 @@ CLEANFILES = *Dict.cpp *Dict.h *~ core
lib_LTLIBRARIES = libPMusr.la
libPMusr_la_SOURCES = $(h_sources) $(cpp_sources) $(dict_h_sources) $(dict_cpp_sources)
libPMusr_la_LIBADD = $(LEM_LIBS) $(PSIBIN_LIBS) $(MUD_LIBS) $(FFTW3_LIBS) $(GSL_LIBS) $(ROOT_LIBS)
libPMusr_la_LIBADD = $(LEM_LIBS) $(PSIBIN_LIBS) $(MUD_LIBS) $(PNEXUS_LIBS) $(FFTW3_LIBS) $(GSL_LIBS) $(ROOT_LIBS)
libPMusr_la_LDFLAGS = -version-info $(MUSR_LIBRARY_VERSION) -release $(MUSR_RELEASE) $(AM_LDFLAGS)
pkgconfigdir = $(libdir)/pkgconfig

View File

@ -4268,7 +4268,7 @@ Bool_t PMsrHandler::CheckRunBlockIntegrity()
cerr << endl << " forward parameter number not defined. Necessary for single histogram fits." << endl;
return false;
}
if (fRuns[i].GetForwardHistoNo() > static_cast<Int_t>(fParam.size())) {
if (fRuns[i].GetNormParamNo() > static_cast<Int_t>(fParam.size())) {
cerr << endl << "PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
cerr << endl << " forward histogram number " << fRuns[i].GetNormParamNo() << " is larger than the number of fit parameters (" << fParam.size() << ").";
cerr << endl << " Consider to check the manual ;-)" << endl;

View File

@ -162,7 +162,7 @@ PNonMusrRawRunData::~PNonMusrRawRunData()
void PNonMusrRawRunData::SetLabel(const UInt_t idx, const TString str)
{
if (idx >= fLabels.size()) {
cerr << endl << "**WARNING** PNonMusrRawRunData::SetLabel: idx=" << idx << " is out of range [0," << fLabels.size() << "[.";
cerr << endl << ">> PNonMusrRawRunData::SetLabel: **WARNING** idx=" << idx << " is out of range [0," << fLabels.size() << "[.";
cerr << endl;
return;
}
@ -182,7 +182,7 @@ void PNonMusrRawRunData::SetLabel(const UInt_t idx, const TString str)
void PNonMusrRawRunData::AppendSubData(const UInt_t idx, const Double_t dval)
{
if (idx >= fData.size()) {
cerr << endl << "**WARNING** PNonMusrRawRunData::AppendSubData: idx=" << idx << " is out of range [0," << fData.size() << "[.";
cerr << endl << ">> PNonMusrRawRunData::AppendSubData: **WARNING** idx=" << idx << " is out of range [0," << fData.size() << "[.";
cerr << endl;
return;
}
@ -202,7 +202,7 @@ void PNonMusrRawRunData::AppendSubData(const UInt_t idx, const Double_t dval)
void PNonMusrRawRunData::AppendSubErrData(const UInt_t idx, const Double_t dval)
{
if (idx >= fErrData.size()) {
cerr << endl << "**WARNING** PNonMusrRawRunData::AppendSubErrData: idx=" << idx << " is out of range [0," << fErrData.size() << "[.";
cerr << endl << ">> PNonMusrRawRunData::AppendSubErrData: **WARNING** idx=" << idx << " is out of range [0," << fErrData.size() << "[.";
cerr << endl;
return;
}
@ -221,16 +221,18 @@ void PNonMusrRawRunData::AppendSubErrData(const UInt_t idx, const Double_t dval)
*/
PRawRunData::PRawRunData()
{
fRunName = TString("");
fRunName = TString("n/a");
fRunNumber = -1;
fRunTitle = TString("");
fSetup = TString("");
fStartTime = TString("");
fStartDate = TString("");
fRunTitle = TString("n/a");
fSetup = TString("n/a");
fStartTime = TString("n/a");
fStartDate = TString("n/a");
fStartDateTimeSec = 0;
fStopTime = TString("");
fStopDate = TString("");
fStopTime = TString("n/a");
fStopDate = TString("n/a");
fStopDateTimeSec = 0;
fSample = TString("n/a");
fOrientation = TString("n/a");
fField = PMUSR_UNDEFINED;
fEnergy = PMUSR_UNDEFINED;
fTransport = PMUSR_UNDEFINED;
@ -271,7 +273,7 @@ PRawRunData::~PRawRunData()
const Double_t PRawRunData::GetTemperature(const UInt_t idx)
{
if (idx >= fTemp.size()) {
cerr << endl << "**WARNING** PRawRunData::GetTemperature: idx=" << idx << " is out of range [0," << fTemp.size() << "[.";
cerr << endl << ">> PRawRunData::GetTemperature: **WARNING** idx=" << idx << " is out of range [0," << fTemp.size() << "[.";
cerr << endl;
return PMUSR_UNDEFINED;
}
@ -293,7 +295,7 @@ const Double_t PRawRunData::GetTemperature(const UInt_t idx)
const Double_t PRawRunData::GetTempError(const UInt_t idx)
{
if (idx >= fTemp.size()) {
cerr << endl << "**WARNING** PRawRunData::GetTempError: idx=" << idx << " is out of range [0," << fTemp.size() << "[.";
cerr << endl << ">> PRawRunData::GetTempError: **WARNING** idx=" << idx << " is out of range [0," << fTemp.size() << "[.";
cerr << endl;
return PMUSR_UNDEFINED;
}
@ -315,7 +317,7 @@ const Double_t PRawRunData::GetTempError(const UInt_t idx)
const Double_t PRawRunData::GetRingAnode(const UInt_t idx)
{
if (idx >= fRingAnode.size()) {
cerr << endl << "**WARNING** PRawRunData::GetRingAnode: idx=" << idx << " is out of range [0," << fRingAnode.size() << "[.";
cerr << endl << ">> PRawRunData::GetRingAnode: **WARNING** idx=" << idx << " is out of range [0," << fRingAnode.size() << "[.";
cerr << endl;
return PMUSR_UNDEFINED;
}
@ -337,7 +339,7 @@ const Double_t PRawRunData::GetRingAnode(const UInt_t idx)
const Int_t PRawRunData::GetT0(const UInt_t idx)
{
if (idx >= fT0s.size()) {
cerr << endl << "**WARNING** PRawRunData::GetT0: idx=" << idx << " is out of range [0," << fT0s.size() << "[.";
cerr << endl << ">> PRawRunData::GetT0: **WARNING** idx=" << idx << " is out of range [0," << fT0s.size() << "[.";
cerr << endl;
return -1;
}
@ -359,7 +361,7 @@ const Int_t PRawRunData::GetT0(const UInt_t idx)
const Int_t PRawRunData::GetT0Estimated(const UInt_t idx)
{
if (idx >= fT0Estimated.size()) {
cerr << endl << "**WARNING** PRawRunData::GetT0Estimated: idx=" << idx << " is out of range [0," << fT0Estimated.size() << "[.";
cerr << endl << ">> PRawRunData::GetT0Estimated: **WARNING** idx=" << idx << " is out of range [0," << fT0Estimated.size() << "[.";
cerr << endl;
return -1;
}
@ -384,7 +386,7 @@ const PIntPair PRawRunData::GetBkgBin(const UInt_t idx)
PIntPair pair(-1, -1);
if (idx >= fBkgBin.size()) {
cerr << endl << "**WARNING** PRawRunData::GetBkgBin: idx=" << idx << " is out of range [0," << fBkgBin.size() << "[.";
cerr << endl << ">> PRawRunData::GetBkgBin: **WARNING** idx=" << idx << " is out of range [0," << fBkgBin.size() << "[.";
cerr << endl;
return pair;
}
@ -413,7 +415,7 @@ const PIntPair PRawRunData::GetGoodDataBin(const UInt_t idx)
PIntPair pair(-1, -1);
if (idx >= fGoodDataBin.size()) {
cerr << endl << "**WARNING** PRawRunData::GetGoodDataBin: idx=" << idx << " is out of range [0," << fGoodDataBin.size() << "[.";
cerr << endl << ">> PRawRunData::GetGoodDataBin: **WARNING** idx=" << idx << " is out of range [0," << fGoodDataBin.size() << "[.";
cerr << endl;
return pair;
}
@ -439,7 +441,7 @@ const PIntPair PRawRunData::GetGoodDataBin(const UInt_t idx)
const PDoubleVector* PRawRunData::GetDataBin(const UInt_t idx)
{
if (idx >= fDataBin.size()) {
cerr << endl << "**WARNING** PRawRunData::GetDataBin: idx=" << idx << " is out of range [0," << fDataBin.size() << "[.";
cerr << endl << ">> PRawRunData::GetDataBin: **WARNING** idx=" << idx << " is out of range [0," << fDataBin.size() << "[.";
cerr << endl;
return 0;
}
@ -514,13 +516,13 @@ void PRawRunData::SetTempError(const UInt_t idx, const Double_t errTemp)
void PRawRunData::SetDataBin(const UInt_t histoNo, const UInt_t bin, const Double_t dval)
{
if (histoNo > fDataBin.size()) {
cerr << endl << "**WARNING** PRawRunData::SetDataBin: histoNo=" << histoNo << " is out of range [0," << fDataBin.size() << "].";
cerr << endl << ">> PRawRunData::SetDataBin: **WARNING** histoNo=" << histoNo << " is out of range [0," << fDataBin.size() << "].";
cerr << endl;
return;
}
if (bin > fDataBin[histoNo].size()) {
cerr << endl << "**WARNING** PRawRunData::SetDataBin: bin=" << bin << " is out of range [0," << fDataBin[histoNo].size() << "].";
cerr << endl << ">> PRawRunData::SetDataBin: **WARNING** bin=" << bin << " is out of range [0," << fDataBin[histoNo].size() << "].";
cerr << endl;
return;
}
@ -541,13 +543,13 @@ void PRawRunData::SetDataBin(const UInt_t histoNo, const UInt_t bin, const Doubl
void PRawRunData::AddDataBin(const UInt_t histoNo, const UInt_t bin, const Double_t dval)
{
if (histoNo > fDataBin.size()) {
cerr << endl << "**WARNING** PRawRunData::AddDataBin: histoNo=" << histoNo << " is out of range [0," << fDataBin.size() << "].";
cerr << endl << ">> PRawRunData::AddDataBin: **WARNING** histoNo=" << histoNo << " is out of range [0," << fDataBin.size() << "].";
cerr << endl;
return;
}
if (bin > fDataBin[histoNo].size()) {
cerr << endl << "**WARNING** PRawRunData::AddDataBin: bin=" << bin << " is out of range [0," << fDataBin[histoNo].size() << "].";
cerr << endl << ">> PRawRunData::AddDataBin: **WARNING** bin=" << bin << " is out of range [0," << fDataBin[histoNo].size() << "].";
cerr << endl;
return;
}
@ -985,7 +987,7 @@ Double_t PMsrRunBlock::GetBkgFix(UInt_t idx)
void PMsrRunBlock::SetBkgFix(Double_t dval, Int_t idx)
{
if (idx >= 2) {
cerr << endl << "PMsrRunBlock::SetBkgFix: **WARNING** idx=" << idx << ", only idx=0,1 are sensible.";
cerr << endl << ">> PMsrRunBlock::SetBkgFix: **WARNING** idx=" << idx << ", only idx=0,1 are sensible.";
cerr << endl;
return;
}
@ -1026,7 +1028,7 @@ Int_t PMsrRunBlock::GetBkgRange(UInt_t idx)
void PMsrRunBlock::SetBkgRange(Int_t ival, Int_t idx)
{
if (idx >= 4) {
cerr << endl << "PMsrRunBlock::SetBkgRange: **WARNING** idx=" << idx << ", only idx=0..3 are sensible.";
cerr << endl << ">> PMsrRunBlock::SetBkgRange: **WARNING** idx=" << idx << ", only idx=0..3 are sensible.";
cerr << endl;
return;
}
@ -1068,7 +1070,7 @@ Int_t PMsrRunBlock::GetDataRange(UInt_t idx)
void PMsrRunBlock::SetDataRange(Int_t ival, Int_t idx)
{
if (idx >= 4) {
cerr << endl << "PMsrRunBlock::SetDataRange: **WARNING** idx=" << idx << ", only idx=0..3 are sensible.";
cerr << endl << ">> PMsrRunBlock::SetDataRange: **WARNING** idx=" << idx << ", only idx=0..3 are sensible.";
cerr << endl;
return;
}

View File

@ -29,6 +29,10 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <cstdio>
#include <ctime>
#include <iostream>
@ -50,6 +54,10 @@ using namespace std;
#include "MuSR_td_PSI_bin.h"
#include "mud.h"
#ifdef PNEXUS_ENABLED
#include "PNeXus.h"
#endif
#include "PRunDataHandler.h"
#define ROOT_ALL 0
@ -610,7 +618,7 @@ Bool_t PRunDataHandler::FileExistsCheck(PMsrRunBlock &runInfo, const UInt_t idx)
else if (!runInfo.GetFileFormat(idx)->CompareTo("root-ppc")) // post pile up corrected histos
ext = TString("root");
else if (!runInfo.GetFileFormat(idx)->CompareTo("nexus"))
ext = TString("nexus");
ext = TString("NXS");
else if (!runInfo.GetFileFormat(idx)->CompareTo("psi-bin"))
ext = TString("bin");
else if (!runInfo.GetFileFormat(idx)->CompareTo("psi-mdu"))
@ -640,7 +648,7 @@ Bool_t PRunDataHandler::FileExistsCheck(PMsrRunBlock &runInfo, const UInt_t idx)
assert(0);
}
pstr->ToUpper();
cerr << endl << ">> **ERROR** File Format '" << pstr->Data() << "' unsupported.";
cerr << endl << ">> PRunDataHandler::FileExistsCheck: **ERROR** File Format '" << pstr->Data() << "' unsupported.";
cerr << endl << ">> support file formats are:";
cerr << endl << ">> ROOT-NPP -> root not post pileup corrected for lem";
cerr << endl << ">> ROOT-PPC -> root post pileup corrected for lem";
@ -794,7 +802,7 @@ Bool_t PRunDataHandler::FileExistsCheck(const Bool_t fileName, const Int_t idx)
}
// check for input/output templates
if ((fAny2ManyInfo->inTemplate.Length() == 0) || (fAny2ManyInfo->outTemplate.Length() == 0)) {
cerr << endl << ">> PRunDataHandler::FileExistsCheck(): **ERROR** when using run lists, input/ouput templates are needed as well." << endl;
cerr << endl << ">> PRunDataHandler::FileExistsCheck(): **ERROR** when using run lists, input/output templates are needed as well." << endl;
return false;
}
// make the input file name according to the input template
@ -1214,8 +1222,106 @@ Bool_t PRunDataHandler::ReadRootFile(UInt_t tag)
*/
Bool_t PRunDataHandler::ReadNexusFile()
{
cout << endl << "PRunDataHandler::ReadNexusFile(): Sorry, not yet implemented, ask Alex Amato and Stephen Cottrell ...";
#ifdef PNEXUS_ENABLED
cout << endl << ">> PRunDataHandler::ReadNexusFile(): Will read nexus file " << fRunPathName.Data() << " ...";
PDoubleVector histoData;
PRawRunData runData;
TString str;
Double_t dval;
PNeXus *nxs_file = new PNeXus(fRunPathName.Data());
if (!nxs_file->IsValid()) {
cerr << endl << ">> PRunDataHandler::ReadNexusFile(): Not a valid NeXus file.";
cerr << endl << ">> Error Message: " << nxs_file->GetErrorMsg().data() << endl;
return false;
}
// get header information
// get/set run title
str = TString(nxs_file->GetRunTitle());
runData.SetRunTitle(str);
// get/set run number
runData.SetRunNumber(nxs_file->GetRunNumber());
// get/set temperature
runData.SetTemperature(0, nxs_file->GetSampleTemperature(), 0.0);
// get/set field
dval = nxs_file->GetMagneticField();
str = TString(nxs_file->GetMagneticFieldUnits());
// since field has to be given in Gauss, check the units
Double_t factor=1.0;
if (!str.CompareTo("gauss", TString::kIgnoreCase))
factor=1.0;
else if (!str.CompareTo("tesla", TString::kIgnoreCase))
factor=1.0e4;
else
factor=1.0;
runData.SetField(factor*dval);
// get/set implantation energy
runData.SetEnergy(PMUSR_UNDEFINED);
// get/set moderator HV
runData.SetTransport(PMUSR_UNDEFINED);
// get/set RA HV's (LEM specific)
for (UInt_t i=0; i<4; i++)
runData.SetRingAnode(i, PMUSR_UNDEFINED);
// get/set setup
runData.SetSetup(nxs_file->GetRunNotes());
// get/set sample
runData.SetSample(nxs_file->GetSampleName());
// get/set orientation
runData.SetOrientation("??");
// get/set time resolution (ns)
runData.SetTimeResolution(nxs_file->GetTimeResolution());
// get/set start/stop time
runData.SetStartTime(nxs_file->GetStartTime());
runData.SetStartDate(nxs_file->GetStartDate());
runData.SetStopTime(nxs_file->GetStopTime());
runData.SetStopDate(nxs_file->GetStopDate());
// get t0, firstGoodBin, lastGoodBin, data
UInt_t t0=nxs_file->GetT0();
PIntPair goodDataBin;
goodDataBin.first = nxs_file->GetFirstGoodBin();
goodDataBin.second = nxs_file->GetLastGoodBin();
PDoubleVector data;
for (Int_t i=0; i<nxs_file->GetNoHistos(); i++) {
runData.AppendT0(t0);
runData.AppendGoodDataBin(goodDataBin);
data.clear();
for (UInt_t j=0; j<nxs_file->GetHisto(i)->size(); j++) {
data.push_back((Double_t)nxs_file->GetHisto(i)->at(j));
}
runData.AppendDataBin(data);
}
data.clear();
// keep run name from the msr-file
runData.SetRunName(fRunName);
// keep the information
fData.push_back(runData);
// clean up
if (nxs_file) {
delete nxs_file;
nxs_file = 0;
}
#else
cout << endl << ">> PRunDataHandler::ReadNexusFile(): Sorry, not enabled at configuration level, i.e. --enable-NeXus when executing configure" << endl << endl;
#endif
return true;
}
//--------------------------------------------------------------------------
@ -1620,6 +1726,7 @@ Bool_t PRunDataHandler::ReadPsiBinFile()
}
runData.SetStopDate(sDateTime[0]);
runData.SetStopTime(sDateTime[1]);
sDateTime.clear();
// fill raw data
PDoubleVector histoData;
@ -2988,21 +3095,10 @@ Bool_t PRunDataHandler::WriteRootFile(TString fln)
// generate output file name if needed
if (!fAny2ManyInfo->useStandardOutput || (fAny2ManyInfo->compressionTag > 0)) {
if (fln.Length() == 0) {
Int_t start = fRunPathName.Last('/');
Int_t end = fRunPathName.Last('.');
if (end == -1) {
cerr << endl << ">> PRunDataHandler::WriteRootFile(): **ERROR** couldn't generate the output file name ..." << endl;
Bool_t ok = false;
fln = GetFileName(".root", ok);
if (!ok)
return false;
}
// cut out the filename (get rid of the extension, and the path)
Char_t str1[1024], str2[1024];
strncpy(str1, fRunPathName.Data(), sizeof(str1));
for (Int_t i=0; i<end-start-1; i++) {
str2[i] = str1[i+start+1];
}
str2[end-start-1] = 0;
fln = fAny2ManyInfo->outPath + str2 + ".root";
} else {
fln.Prepend(fAny2ManyInfo->outPath);
}
@ -3184,7 +3280,91 @@ Bool_t PRunDataHandler::WriteRootFile(TString fln)
*/
Bool_t PRunDataHandler::WriteNexusFile(TString fln)
{
cout << endl << ">> PRunDataHandler::WriteNexusFile(): will write a nexus data file. Not yet implemented ... " << endl;
#ifdef PNEXUS_ENABLED
// generate output file name
if (fln.Length() == 0) {
Bool_t ok = false;
fln = GetFileName(".nxs", ok);
if (!ok)
return false;
} else {
fln.Prepend(fAny2ManyInfo->outPath);
}
// keep the file name if compression is whished
fAny2ManyInfo->outPathFileName.push_back(fln);
if (!fAny2ManyInfo->useStandardOutput)
cout << endl << ">> PRunDataHandler::WriteNexusFile(): writing a NeXus data file (" << fln.Data() << ") ... " << endl;
// create NeXus object
PNeXus *nxs = new PNeXus();
if (nxs == 0) {
cerr << endl << ">> PRunDataHandler::WriteNexusFile(): **ERROR** couldn't invoke the NeXus object." << endl;
return false;
}
// fill necessary data structures
nxs->SetFileName(fln.Data());
nxs->SetIDFVersion(1);
nxs->SetProgramName("any2many");
nxs->SetProgramVersion("$Id$");
nxs->SetRunNumber(fData[0].GetRunNumber());
nxs->SetRunTitle(fData[0].GetRunTitle()->Data());
nxs->SetRunNotes("n/a");
nxs->SetAnalysisTag("n/a");
nxs->SetLab("PSI");
nxs->SetBeamline("n/a");
nxs->SetStartDate(fData[0].GetStartDate()->Data());
nxs->SetStartTime(fData[0].GetStartTime()->Data());
nxs->SetStopDate(fData[0].GetStopDate()->Data());
nxs->SetStopTime(fData[0].GetStopTime()->Data());
nxs->SetSwitchingState(0);
nxs->SetUser("n/a");
nxs->SetExperimentNumber("n/a");
nxs->SetSampleName(fData[0].GetSample()->Data());
nxs->SetSampleTemperature(fData[0].GetTemperature(0));
nxs->SetSampleTemperatureUints("Kelvin");
nxs->SetMagneticField(fData[0].GetField());
nxs->SetMagneticFieldUnits("Gauss");
nxs->SetSampleEnvironment("n/a");
nxs->SetSampleShape("n/a");
nxs->SetMagneticFieldVectorAvailable(0);
nxs->SetExperimentName("n/a");
nxs->SetNoDetectors(fData[0].GetNoOfHistos());
nxs->SetCollimatorType("n/a");
nxs->SetTimeResolution(fData[0].GetTimeResolution());
if (fData[0].GetT0(0) == -1)
nxs->SetT0(0);
else
nxs->SetT0(fData[0].GetT0(0)); // this needs to be changed in the long term, since for continous sources each detector has its one t0!!
if (fData[0].GetGoodDataBin(0).first == -1) {
nxs->SetFirstGoodBin(0);
nxs->SetLastGoodBin(0);
} else {
nxs->SetFirstGoodBin(fData[0].GetGoodDataBin(0).first);
nxs->SetLastGoodBin(fData[0].GetGoodDataBin(0).second);
}
// feed real histogram data
PUIntVector data;
for (UInt_t i=0; i<fData[0].GetNoOfHistos(); i++) {
for (UInt_t j=0; j<fData[0].GetDataBin(i)->size(); j++) {
data.push_back((UInt_t)fData[0].GetDataBin(i)->at(j));
}
nxs->SetHisto(i, data);
data.clear();
}
// write file
nxs->WriteFile(fln);
// clean up
if (nxs != 0) {
delete nxs;
nxs = 0;
}
#else
cout << endl << ">> PRunDataHandler::WriteNexusFile(): Sorry, not enabled at configuration level, i.e. --enable-NeXus when executing configure" << endl << endl;
#endif
return true;
}
@ -3204,21 +3384,10 @@ Bool_t PRunDataHandler::WriteWkmFile(TString fln)
{
// generate output file name
if (fln.Length() == 0) {
Int_t start = fRunPathName.Last('/');
Int_t end = fRunPathName.Last('.');
if (end == -1) {
cerr << endl << ">> PRunDataHandler::WriteWkmFile(): **ERROR** couldn't generate the output file name ..." << endl;
Bool_t ok = false;
fln = GetFileName(".wkm", ok);
if (!ok)
return false;
}
// cut out the filename (get rid of the extension, and the path)
Char_t str1[1024], str2[1024];
strncpy(str1, fRunPathName.Data(), sizeof(str1));
for (Int_t i=0; i<end-start-1; i++) {
str2[i] = str1[i+start+1];
}
str2[end-start-1] = 0;
fln = fAny2ManyInfo->outPath + str2 + ".wkm";
} else {
fln.Prepend(fAny2ManyInfo->outPath);
}
@ -3244,7 +3413,7 @@ Bool_t PRunDataHandler::WriteWkmFile(TString fln)
// save output buffer of the stream
strm_buffer = cout.rdbuf();
// redirect ouput into the file
// redirect output into the file
cout.rdbuf(fout.rdbuf());
}
@ -3266,7 +3435,7 @@ Bool_t PRunDataHandler::WriteWkmFile(TString fln)
} else {
cout << endl << "Field : ??";
}
cout << endl << "Date : ??";
cout << endl << "Date : " << fData[0].GetStartTime()->Data() << " " << fData[0].GetStartDate()->Data() << " / " << fData[0].GetStopTime()->Data() << " " << fData[0].GetStopDate()->Data();
cout << endl << "Setup : " << fData[0].GetSetup()->Data();
cout << endl << "Groups : " << fData[0].GetNoOfHistos();
cout << endl << "Channels : " << static_cast<UInt_t>(fData[0].GetDataBin(0)->size()/fAny2ManyInfo->rebin);
@ -3334,21 +3503,10 @@ Bool_t PRunDataHandler::WritePsiBinFile(TString fln)
// generate output file name if needed
if (!fAny2ManyInfo->useStandardOutput || (fAny2ManyInfo->compressionTag > 0)) {
if (fln.Length() == 0) {
Int_t start = fRunPathName.Last('/');
Int_t end = fRunPathName.Last('.');
if (end == -1) {
cerr << endl << ">> PRunDataHandler::WritePsiBinFile(): **ERROR** couldn't generate the output file name ..." << endl;
Bool_t ok = false;
fln = GetFileName(".bin", ok);
if (!ok)
return false;
}
// cut out the filename (get rid of the extension, and the path)
Char_t str1[1024], str2[1024];
strncpy(str1, fRunPathName.Data(), sizeof(str1));
for (Int_t i=0; i<end-start-1; i++) {
str2[i] = str1[i+start+1];
}
str2[end-start-1] = 0;
fln = fAny2ManyInfo->outPath + str2 + ".bin";
} else {
fln.Prepend(fAny2ManyInfo->outPath);
}
@ -3522,21 +3680,10 @@ Bool_t PRunDataHandler::WriteMudFile(TString fln)
// generate output file name if needed
if (!fAny2ManyInfo->useStandardOutput || (fAny2ManyInfo->compressionTag > 0)) {
if (fln.Length() == 0) {
Int_t start = fRunPathName.Last('/');
Int_t end = fRunPathName.Last('.');
if (end == -1) {
cerr << endl << ">> PRunDataHandler::WriteMudFile(): **ERROR** couldn't generate the output file name ..." << endl;
Bool_t ok = false;
fln = GetFileName(".msr", ok);
if (!ok)
return false;
}
// cut out the filename (get rid of the extension, and the path)
Char_t str1[1024], str2[1024];
strncpy(str1, fRunPathName.Data(), sizeof(str1));
for (Int_t i=0; i<end-start-1; i++) {
str2[i] = str1[i+start+1];
}
str2[end-start-1] = 0;
fln = fAny2ManyInfo->outPath + str2 + ".msr";
} else {
fln.Prepend(fAny2ManyInfo->outPath);
}
@ -3700,21 +3847,10 @@ Bool_t PRunDataHandler::WriteAsciiFile(TString fln)
{
// generate output file name
if (fln.Length() == 0) {
Int_t start = fRunPathName.Last('/');
Int_t end = fRunPathName.Last('.');
if (end == -1) {
cerr << endl << ">> PRunDataHandler::WriteAsciiFile(): **ERROR** couldn't generate the output file name ..." << endl;
Bool_t ok = false;
fln = GetFileName(".ascii", ok);
if (!ok)
return false;
}
// cut out the filename (get rid of the extension, and the path)
Char_t str1[1024], str2[1024];
strncpy(str1, fRunPathName.Data(), sizeof(str1));
for (Int_t i=0; i<end-start-1; i++) {
str2[i] = str1[i+start+1];
}
str2[end-start-1] = 0;
fln = fAny2ManyInfo->outPath + str2 + ".ascii";
} else {
fln.Prepend(fAny2ManyInfo->outPath);
}
@ -3740,7 +3876,7 @@ Bool_t PRunDataHandler::WriteAsciiFile(TString fln)
// save output buffer of the stream
strm_buffer = cout.rdbuf();
// redirect ouput into the file
// redirect output into the file
cout.rdbuf(fout.rdbuf());
}
@ -3754,6 +3890,8 @@ Bool_t PRunDataHandler::WriteAsciiFile(TString fln)
if (fData[0].GetSetup()->Length() > 0)
cout << endl << "% setup : " << fData[0].GetSetup()->Data();
cout << endl << "% field : " << fData[0].GetField() << " (G)";
if (fData[0].GetStartTime()->Length() > 0)
cout << endl << "% date : " << fData[0].GetStartTime()->Data() << " " << fData[0].GetStartDate()->Data() << " / " << fData[0].GetStopTime()->Data() << " " << fData[0].GetStopDate()->Data();
if (fData[0].GetNoOfTemperatures() > 0) {
cout << endl << "% temperature : ";
for (UInt_t i=0; i<fData[0].GetNoOfTemperatures()-1; i++) {
@ -4058,6 +4196,51 @@ Int_t PRunDataHandler::GetDataTagIndex(TString &str, const PStringVector* dataTa
return result;
}
//--------------------------------------------------------------------------
// GetFileName (private)
//--------------------------------------------------------------------------
/**
* <p>Construct the file name based on the any2many request.
*
* <b>return:</b>
* - constructed file name
* - empty string
*
* \param extension if the file name to be constructed
* \param ok flag which is 'true' if the file name could be constructed, 'false' otherwise
*/
TString PRunDataHandler::GetFileName(const TString extension, Bool_t &ok)
{
TString fileName = "";
ok = true;
Int_t start = fRunPathName.Last('/');
Int_t end = fRunPathName.Last('.');
if (end == -1) {
cerr << endl << ">> PRunDataHandler::GetFileName(): **ERROR** couldn't generate the output file name ..." << endl;
ok = false;
return fileName;
}
// cut out the filename (get rid of the extension, and the path)
Char_t str1[1024], str2[1024];
strncpy(str1, fRunPathName.Data(), sizeof(str1));
for (Int_t i=0; i<end-start-1; i++) {
str2[i] = str1[i+start+1];
}
str2[end-start-1] = 0;
if (fAny2ManyInfo->inFormat == fAny2ManyInfo->outFormat) { // only rebinning
TString rebinStr;
rebinStr += fAny2ManyInfo->rebin;
fileName = fAny2ManyInfo->outPath + str2 + "_rebin" + rebinStr + extension;
} else { // real conversion
fileName = fAny2ManyInfo->outPath + str2 + extension;
}
return fileName;
}
//--------------------------------------------------------------------------
// FileNameFromTemplate (private)
//--------------------------------------------------------------------------

View File

@ -1,5 +1,9 @@
## $Id$
if PNEXUS_ENABLED
PNEXUSDIRS = nexus
endif
if BUILD_ASLIBS
ASDIRS = Nonlocal \
MagProximity
@ -17,4 +21,4 @@ if BUILD_BMWLIBS
libCalcMeanFieldsLEM
endif
SUBDIRS = $(ASDIRS) $(CUBADIRS) $(BMWDIRS)
SUBDIRS = $(PNEXUSDIR) $(ASDIRS) $(CUBADIRS) $(BMWDIRS)

View File

@ -670,6 +670,7 @@ int PNeXus::WriteFile(const char *fileName, const char *fileType)
if (!ErrorHandler(NXputdata(fFileHandle, &idata), PNEXUS_PUT_DATA_ERROR, "couldn't put data 'switching_states'.")) return NX_ERROR;
NXclosedata(fFileHandle);
// make group 'user'
if (!ErrorHandler(NXmakegroup(fFileHandle, "user", "NXuser"), PNEXUS_CREATE_GROUP_ERROR, "couldn't create group 'user'.")) return NX_ERROR;
// open group 'user'
@ -935,6 +936,7 @@ int PNeXus::WriteFile(const char *fileName, const char *fileType)
// write data 'grouping'
int *grouping = new int[fData.fHisto.size()];
vector<int> groupNo; // keep the number of different groupings
if (fData.fHisto.size() == fData.fGrouping.size()) { // grouping vector seems to be properly defined
bool found;
groupNo.push_back(fData.fGrouping[0]);
for (unsigned int i=0; i<fData.fHisto.size(); i++) {
@ -950,6 +952,11 @@ int PNeXus::WriteFile(const char *fileName, const char *fileType)
groupNo.push_back(fData.fGrouping[i]);
}
}
} else { // grouping vector not available
for (unsigned int i=0; i<fData.fHisto.size(); i++) {
grouping[i] = 0;
}
}
size = fData.fHisto.size();
if (!ErrorHandler(NXmakedata(fFileHandle, "grouping", NX_INT32, 1, &size), PNEXUS_MAKE_DATA_ERROR, "couldn't create data entry 'grouping'.")) return NX_ERROR;
if (!ErrorHandler(NXopendata(fFileHandle, "grouping"), PNEXUS_OPEN_DATA_ERROR, "couldn't open data 'grouping' for writting.")) return NX_ERROR;
@ -1136,19 +1143,13 @@ bool PNeXus::SetStartDate(const char *date)
*/
bool PNeXus::SetStartDate(string date)
{
if (date.length() != 10) {
fErrorCode = PNEXUS_WRONG_DATE_FORMAT;
fErrorMsg = "PNeXus::SetStartDate **ERROR** given date="+date+", is not of the required form yyyy-mm-dd!";
return false;
}
bool ok=false;
string str = TransformDate(date, ok);
if ((date[4] != '-') || (date[7] != '-')) {
fErrorCode = PNEXUS_WRONG_DATE_FORMAT;
fErrorMsg = "PNeXus::SetStartDate **ERROR** given date="+date+", is not of the required form yyyy-mm-dd!";
if (!ok)
return false;
}
fStartDate = date;
fStartDate = str;
return true;
}
@ -1234,19 +1235,13 @@ bool PNeXus::SetStopDate(const char *date)
*/
bool PNeXus::SetStopDate(string date)
{
if (date.length() != 10) {
fErrorCode = PNEXUS_WRONG_DATE_FORMAT;
fErrorMsg = "PNeXus::SetStopDate **ERROR** given date="+date+", is not of the required form yyyy-mm-dd!";
return false;
}
bool ok=false;
string str = TransformDate(date, ok);
if ((date[4] != '-') || (date[7] != '-')) {
fErrorCode = PNEXUS_WRONG_DATE_FORMAT;
fErrorMsg = "PNeXus::SetStopDate **ERROR** given date="+date+", is not of the required form yyyy-mm-dd!";
if (!ok)
return false;
}
fStopDate = date;
fStopDate = str;
return true;
}
@ -1331,43 +1326,43 @@ void PNeXus::Init()
{
fIsValid = false;
fFileName = "";
fFileName = "n/a";
fFileHandle = 0;
fErrorMsg = "No Data available!";
fErrorCode = -1;
fIDFVersion = -1;
fProgramName = "";
fProgramVersion = "";
fProgramName = "n/a";
fProgramVersion = "n/a";
fRunNumber = -1;
fRunTitle = "";
fNotes = "";
fAnalysisTag = "";
fLab = "";
fBeamLine = "";
fStartDate = "";
fStartTime = "";
fStopDate = "";
fStopTime = "";
fRunTitle = "n/a";
fNotes = "n/a";
fAnalysisTag = "n/a";
fLab = "n/a";
fBeamLine = "n/a";
fStartDate = "n/a";
fStartTime = "n/a";
fStopDate = "n/a";
fStopTime = "n/a";
fSwitchingState = -1;
fSample.fEnvironment = "";
fSample.fEnvironment = "n/a";
fSample.fMagneticField = 9.9e17;
fSample.fMagneticFieldUnit = "";
fSample.fMagneticFieldState = "";
fSample.fName = "";
fSample.fShape = "";
fSample.fMagneticFieldUnit = "n/a";
fSample.fMagneticFieldState = "n/a";
fSample.fName = "n/a";
fSample.fShape = "n/a";
fSample.fTemperature = 9.9e17;
fSample.fTemperatureUnit = "";
fSample.fTemperatureUnit = "n/a";
fInstrument.name = "";
fInstrument.name = "n/a";
fInstrument.detector.number = 0;
fInstrument.collimator.type = "";
fInstrument.collimator.type = "n/a";
fInstrument.beam.total_counts = 0;
fInstrument.beam.total_counts_units = "";
fInstrument.beam.total_counts_units = "n/a";
fData.fNumberOfHistos = 0;
fData.fTimeResolution = 0.0;
@ -1649,6 +1644,60 @@ NXstatus PNeXus::GetIntVectorData(vector<int> &data)
return NX_OK;
}
//-----------------------------------------------------------------------------------------------------
// SetT0 (public)
//-----------------------------------------------------------------------------------------------------
/**
* <p>Sets t0. The current muSR NeXus implementation has only a single t0 for all detectors since it was
* tailored for pulsed muon sources (ISIS). This eventually needs to be changed.
*
* \param t0 to be set
* \param idx index of t0
*/
void PNeXus::SetT0(unsigned int t0, unsigned idx)
{
if (idx >= fData.fT0.size())
fData.fT0.resize(idx+1);
fData.fT0[idx] = t0;
}
//-----------------------------------------------------------------------------------------------------
// SetFirstGoodBin (public)
//-----------------------------------------------------------------------------------------------------
/**
* <p>Sets first good bin. The current muSR NeXus implementation has only a single first good bin for all detectors since it was
* tailored for pulsed muon sources (ISIS). This eventually needs to be changed.
*
* \param fgb first good bin to be set
* \param idx index of t0
*/
void PNeXus::SetFirstGoodBin(unsigned int fgb, unsigned int idx)
{
if (idx >= fData.fFirstGoodBin.size())
fData.fFirstGoodBin.resize(idx+1);
fData.fFirstGoodBin[idx] = fgb;
}
//-----------------------------------------------------------------------------------------------------
// SetLastGoodBin (public)
//-----------------------------------------------------------------------------------------------------
/**
* <p>Sets last good bin. The current muSR NeXus implementation has only a single last good bin for all detectors since it was
* tailored for pulsed muon sources (ISIS). This eventually needs to be changed.
*
* \param lgb to be set
* \param idx index of t0
*/
void PNeXus::SetLastGoodBin(unsigned int lgb, unsigned int idx)
{
if (idx >= fData.fLastGoodBin.size())
fData.fLastGoodBin.resize(idx+1);
fData.fLastGoodBin[idx] = lgb;
}
//-----------------------------------------------------------------------------------------------------
// SetHisto (public)
//-----------------------------------------------------------------------------------------------------
@ -1660,14 +1709,14 @@ NXstatus PNeXus::GetIntVectorData(vector<int> &data)
*/
void PNeXus::SetHisto(unsigned int histoNo, vector<unsigned int> &data)
{
if (histoNo > fData.fHisto.size())
if (histoNo >= fData.fHisto.size())
fData.fHisto.resize(histoNo+1);
fData.fHisto[histoNo] = data;
}
//-----------------------------------------------------------------------------------------------------
// GroupHistoData (public)
// GroupHistoData (private)
//-----------------------------------------------------------------------------------------------------
/**
* <p>Feed the grouped histo data, based on the grouping vector and the raw histo data.
@ -1730,3 +1779,161 @@ NXstatus PNeXus::GroupHistoData()
return NX_OK;
}
//-----------------------------------------------------------------------------------------------------
// TransformDate (private)
//-----------------------------------------------------------------------------------------------------
/**
* <p>Transformed a given date to the form yyyy-mm-dd if possible. Allowed input dates are yyyy-mm-dd,
* yy-mm-dd, yyyy-MMM-dd, or yy-MMM-dd, where mm is the month as number and MMM the month as string, e.g. APR
*
* <p><b>return:</b> transformed date
*
* \param date
* \param ok
*/
string PNeXus::TransformDate(string date, bool &ok)
{
string result = date;
string str;
char cstr[128];
int status, yy, mm, dd;
ok = true;
switch(date.length()) {
case 8: // yy-mm-dd
if ((date[2] != '-') || (date[5] != '-')) {
ok = false;
} else {
status = sscanf(date.c_str(), "%d-%d-%d", &yy, &mm, &dd);
if (status != 3) {
ok = false;
} else {
if (yy >= 70) // i.e. 1970
result = "19"+date;
else // i.e. 20YY
result = "20"+date;
}
}
break;
case 9: // yy-MMM-dd
if ((date[2] != '-') || (date[6] != '-')) {
ok = false;
} else {
str = date.substr(0,2); // yy
status = sscanf(str.c_str(), "%d", &yy);
if (status != 1)
ok = false;
str = date.substr(3,3); // MMM
mm = GetMonth(str);
if (mm == 0)
ok = false;
str = date.substr(7,2); // dd
status = sscanf(str.c_str(), "%d", &dd);
if (status != 1)
ok = false;
if (ok) {
if (yy >= 70) // i.e. 1970
yy += 1900;
else
yy += 2000;
snprintf(cstr, sizeof(cstr), "%04d-%02d-%02d", yy, mm, dd);
result = cstr;
}
}
break;
case 10: // yyyy-mm-dd
if ((date[4] != '-') || (date[7] != '-')) {
ok = false;
} else {
status = sscanf(date.c_str(), "%04d-%02d-%02d", &yy, &mm, &dd);
if (status != 3) {
ok = false;
} else {
ok = true;
}
}
break;
case 11: // yyyy-MMM-dd
if ((date[4] != '-') || (date[8] != '-')) {
ok = false;
} else {
str = date.substr(0,4); // yyyy
status = sscanf(str.c_str(), "%d", &yy);
if (status != 1)
ok = false;
str = date.substr(5,3); // MMM
mm = GetMonth(str);
if (mm == 0)
ok = false;
str = date.substr(9,2); // dd
status = sscanf(str.c_str(), "%d", &dd);
if (status != 1)
ok = false;
if (ok) {
snprintf(cstr, sizeof(cstr), "%04d-%02d-%02d", yy, mm, dd);
result = cstr;
}
}
break;
default:
ok = false;
break;
}
if (!ok) {
fErrorCode = PNEXUS_WRONG_DATE_FORMAT;
fErrorMsg = "PNeXus::TransformDate **ERROR** given date="+date+", is not of any of the the required forms!";
}
return result;
}
//-----------------------------------------------------------------------------------------------------
// GetMonth (private)
//-----------------------------------------------------------------------------------------------------
/**
* <p>For a month string MMM (e.g. APR) return the month number
*
* <p><b>return:</b> month number
*
* \param month string of the form MMM, e.g. APR
*/
int PNeXus::GetMonth(const string month)
{
int result = 0;
if (!month.compare("jan") || !month.compare("Jan") || !month.compare("JAN"))
result = 1;
else if (!month.compare("feb") || !month.compare("Feb") || !month.compare("FEB"))
result = 2;
else if (!month.compare("mar") || !month.compare("Mar") || !month.compare("MAR"))
result = 3;
else if (!month.compare("apr") || !month.compare("Apr") || !month.compare("APR"))
result = 4;
else if (!month.compare("may") || !month.compare("May") || !month.compare("MAY"))
result = 5;
else if (!month.compare("jun") || !month.compare("Jun") || !month.compare("JUN"))
result = 6;
else if (!month.compare("jul") || !month.compare("Jul") || !month.compare("JUL"))
result = 7;
else if (!month.compare("aug") || !month.compare("Aug") || !month.compare("AUG"))
result = 8;
else if (!month.compare("sep") || !month.compare("Sep") || !month.compare("SEP"))
result = 9;
else if (!month.compare("oct") || !month.compare("Oct") || !month.compare("OCT"))
result = 10;
else if (!month.compare("nov") || !month.compare("Nov") || !month.compare("NOV"))
result = 11;
else if (!month.compare("dec") || !month.compare("Dec") || !month.compare("DEC"))
result = 12;
else
result = 0;
return result;
}
//-----------------------------------------------------------------------------------------------------
// end
//-----------------------------------------------------------------------------------------------------

View File

@ -222,7 +222,8 @@ class PNeXus {
virtual void SetIDFVersion(int idfVersion) { fIDFVersion = idfVersion; }
virtual void SetProgramName(const char* progName) { fProgramName = progName; }
virtual void SetProgramName(string progName) { fProgramName = progName; }
virtual void SetProgramVersion(int progVersion) { fProgramVersion = progVersion; }
virtual void SetProgramVersion(const char* progVersion) { fProgramVersion = progVersion; }
virtual void SetProgramVersion(string progVersion) { fProgramVersion = progVersion; }
virtual void SetRunNumber(int runNumber) { fRunNumber = runNumber; }
virtual void SetRunTitle(const char* runTitle) { fRunTitle = runTitle; }
virtual void SetRunTitle(string runTitle) { fRunTitle = runTitle; }
@ -230,8 +231,8 @@ class PNeXus {
virtual void SetRunNotes(string notes) { fNotes = notes; }
virtual void SetAnalysisTag(const char* analysisTag) { fAnalysisTag = analysisTag; }
virtual void SetAnalysisTag(string analysisTag) { fAnalysisTag = analysisTag; }
virtual void SetLab(const char *lab) { fLab = fLab; }
virtual void SetLab(string lab) { fLab = fLab; }
virtual void SetLab(const char *lab) { fLab = lab; }
virtual void SetLab(string lab) { fLab = lab; }
virtual void SetBeamline(const char *beamline) { fBeamLine = beamline; }
virtual void SetBeamline(string beamline) { fBeamLine = beamline; }
virtual bool SetStartDate(const char *date);
@ -261,9 +262,9 @@ class PNeXus {
virtual void SetNoDetectors(unsigned int no) { fInstrument.detector.number = no; }
virtual void SetCollimatorType(string type) { fInstrument.collimator.type = type; }
virtual void SetTimeResolution(double timeResolution) { fData.fTimeResolution = timeResolution; } // given in ns
virtual void SetT0(unsigned int t0) { fData.fT0.clear(); fData.fT0.push_back(t0); }
virtual void SetFirstGoodBin(unsigned int fgb) { fData.fFirstGoodBin.clear(); fData.fFirstGoodBin.push_back(fgb); }
virtual void SetLastGoodBin(unsigned int lgb) { fData.fLastGoodBin.clear(); fData.fLastGoodBin.push_back(lgb); }
virtual void SetT0(unsigned int t0, unsigned int idx=0);
virtual void SetFirstGoodBin(unsigned int fgb, unsigned int idx=0);
virtual void SetLastGoodBin(unsigned int lgb, unsigned int idx=0);
virtual void SetHisto(unsigned int histoNo, vector<unsigned int> &data);
private:
@ -305,6 +306,8 @@ class PNeXus {
virtual NXstatus GetDoubleVectorData(vector<double> &data);
virtual NXstatus GetIntVectorData(vector<int> &data);
virtual NXstatus GroupHistoData();
virtual string TransformDate(string date, bool &ok);
virtual int GetMonth(const string month);
};
#endif // _PNEXUS_H_

View File

@ -91,6 +91,7 @@ class PRunDataHandler
virtual Int_t ToInt(TString &str, Bool_t &ok);
virtual Int_t GetDataTagIndex(TString &str, const PStringVector* fLabels);
virtual TString GetFileName(const TString extension, Bool_t &ok);
virtual TString FileNameFromTemplate(TString &fileNameTemplate, Int_t run, TString &year, Bool_t &ok);
virtual TString GetMonth(Int_t month);
};

View File

@ -406,7 +406,7 @@ int main(int argc, char *argv[])
// check if a filename is present
if (strlen(filename) == 0) {
show_syntax = true;
cout << endl << "**ERROR** no msr-file present!" << endl;
cout << endl << ">> musrfit **ERROR** no msr-file present!" << endl;
}
if (show_syntax) {
@ -428,7 +428,7 @@ int main(int argc, char *argv[])
TSAXParser *saxParser = new TSAXParser();
PStartupHandler *startupHandler = new PStartupHandler();
if (!startupHandler->StartupFileFound()) {
cerr << endl << "**WARNING** couldn't find " << startupHandler->GetStartupFilePath().Data();
cerr << endl << ">> musrfit **WARNING** couldn't find " << startupHandler->GetStartupFilePath().Data();
cerr << endl;
// clean up
if (saxParser) {
@ -445,7 +445,7 @@ int main(int argc, char *argv[])
status = saxParser->ParseFile(startup_path_name);
// check for parse errors
if (status) { // error
cerr << endl << "**WARNING** reading/parsing musrfit_startup.xml.";
cerr << endl << ">> musrfit **WARNING** reading/parsing musrfit_startup.xml.";
cerr << endl;
// clean up
if (saxParser) {
@ -465,13 +465,13 @@ int main(int argc, char *argv[])
if (status != PMUSR_SUCCESS) {
switch (status) {
case PMUSR_MSR_FILE_NOT_FOUND:
cout << endl << "**ERROR** couldn't find " << filename << endl << endl;
cout << endl << ">> musrfit **ERROR** couldn't find " << filename << endl << endl;
break;
case PMUSR_MSR_SYNTAX_ERROR:
cout << endl << "**SYNTAX ERROR** in file " << filename << ", full stop here." << endl << endl;
cout << endl << ">> musrfit **SYNTAX ERROR** in file " << filename << ", full stop here." << endl << endl;
break;
default:
cout << endl << "**UNKOWN ERROR** when trying to read the msr-file" << endl << endl;
cout << endl << ">> musrfit **UNKOWN ERROR** when trying to read the msr-file" << endl << endl;
break;
}
return status;
@ -486,7 +486,7 @@ int main(int argc, char *argv[])
bool success = dataHandler->IsAllDataAvailable();
if (!success) {
cout << endl << "**ERROR** Couldn't read all data files, will quit ..." << endl;
cout << endl << ">> musrfit **ERROR** Couldn't read all data files, will quit ..." << endl;
}
// if present, replace the run title of the <msr-file> with the run title of the FIRST run in the run block of the msr-file
@ -505,7 +505,7 @@ int main(int argc, char *argv[])
for (unsigned int i=0; i < msrHandler->GetMsrRunList()->size(); i++) {
success = runListCollection->Add(i, kFit);
if (!success) {
cout << endl << "**ERROR** Couldn't handle run no " << i << " ";
cout << endl << ">> musrfit **ERROR** Couldn't handle run no " << i << " ";
cout << (*msrHandler->GetMsrRunList())[i].GetRunName()->Data();
break;
}
@ -530,13 +530,13 @@ int main(int argc, char *argv[])
if (status != PMUSR_SUCCESS) {
switch (status) {
case PMUSR_MSR_LOG_FILE_WRITE_ERROR:
cout << endl << "**ERROR** couldn't write mlog-file" << endl << endl;
cout << endl << ">> musrfit **ERROR** couldn't write mlog-file" << endl << endl;
break;
case PMUSR_TOKENIZE_ERROR:
cout << endl << "**ERROR** couldn't generate mlog-file name" << endl << endl;
cout << endl << ">> musrfit **ERROR** couldn't generate mlog-file name" << endl << endl;
break;
default:
cout << endl << "**UNKOWN ERROR** when trying to write the mlog-file" << endl << endl;
cout << endl << ">> musrfit **UNKOWN ERROR** when trying to write the mlog-file" << endl << endl;
break;
}
}

View File

@ -85,7 +85,7 @@ Bool_t musrt0_item(TApplication &app, PMsrHandler *msrHandler, PMusrT0Data &data
// check if the musrT0 object could be invoked
if (musrT0 == 0) {
cerr << endl << ">> **ERROR** Couldn't invoke musrT0 ...";
cerr << endl << ">> musrt0 **ERROR** Couldn't invoke musrT0 ...";
cerr << endl << ">> run name " << data.GetRawRunData(idx)->GetRunName()->Data();
cerr << endl;
return false;
@ -93,7 +93,7 @@ Bool_t musrt0_item(TApplication &app, PMsrHandler *msrHandler, PMusrT0Data &data
// check if the musrT0 object is valid
if (!musrT0->IsValid()) {
cerr << endl << ">> **ERROR** invalid item found! (idx=" << idx << ")";
cerr << endl << ">> musrt0 **ERROR** invalid item found! (idx=" << idx << ")";
cerr << endl;
return false;
}
@ -214,7 +214,7 @@ Int_t main(Int_t argc, Char_t *argv[])
break;
case 2:
if (strstr(argv[1], "--version")) {
cout << endl << "musrt0 version: $Id$";
cout << endl << ">> musrt0 version: $Id$";
cout << endl << endl;
return PMUSR_SUCCESS;
} else if (strstr(argv[1], "--help")) {
@ -222,7 +222,7 @@ Int_t main(Int_t argc, Char_t *argv[])
} else {
// check if filename has extension msr or mlog
if (!strstr(argv[1], ".msr")) {
cerr << endl << "**ERROR** " << argv[1] << " is not a msr-file!" << endl;
cerr << endl << ">> musrt0 **ERROR** " << argv[1] << " is not a msr-file!" << endl;
show_syntax = true;
} else {
strncpy(filename, argv[1], sizeof(filename));
@ -232,7 +232,7 @@ Int_t main(Int_t argc, Char_t *argv[])
case 3:
// check if filename has extension msr or mlog
if (!strstr(argv[1], ".msr")) {
cerr << endl << "**ERROR** " << argv[1] << " is not a msr-file!" << endl;
cerr << endl << ">> musrt0 **ERROR** " << argv[1] << " is not a msr-file!" << endl;
show_syntax = true;
} else {
strncpy(filename, argv[1], sizeof(filename));
@ -244,7 +244,7 @@ Int_t main(Int_t argc, Char_t *argv[])
case 4:
// check if filename has extension msr or mlog
if (!strstr(argv[1], ".msr")) {
cerr << endl << "**ERROR** " << argv[1] << " is not a msr-file!" << endl;
cerr << endl << ">> musrt0 **ERROR** " << argv[1] << " is not a msr-file!" << endl;
show_syntax = true;
} else {
strncpy(filename, argv[1], sizeof(filename));
@ -256,11 +256,11 @@ Int_t main(Int_t argc, Char_t *argv[])
firstGoodBinOffsetPresent = true;
firstGoodBinOffset = dval;
} else { // it is not a number
cerr << endl << "**ERROR** first good bin offset option found: '" << argv[3] << "', this is not a number." << endl;
cerr << endl << ">> musrt0 **ERROR** first good bin offset option found: '" << argv[3] << "', this is not a number." << endl;
show_syntax = true;
}
} else {
cerr << endl << "**ERROR** found 4 input arguments, but missing the 'get prompt T0 from peak' option." << endl;
cerr << endl << ">> musrt0 **ERROR** found 4 input arguments, but missing the 'get prompt T0 from peak' option." << endl;
show_syntax = true;
}
}
@ -279,7 +279,7 @@ Int_t main(Int_t argc, Char_t *argv[])
TSAXParser *saxParser = new TSAXParser();
PStartupHandler *startupHandler = new PStartupHandler();
if (!startupHandler->StartupFileFound()) {
cerr << endl << "**WARNING** couldn't find " << startupHandler->GetStartupFilePath().Data();
cerr << endl << ">> musrt0 **WARNING** couldn't find " << startupHandler->GetStartupFilePath().Data();
cerr << endl;
// clean up
if (saxParser) {
@ -296,7 +296,7 @@ Int_t main(Int_t argc, Char_t *argv[])
status = saxParser->ParseFile(startup_path_name);
// check for parse errors
if (status) { // error
cerr << endl << "**WARNING** reading/parsing musrfit_startup.xml.";
cerr << endl << ">> musrt0 **WARNING** reading/parsing musrfit_startup.xml.";
cerr << endl;
// clean up
if (saxParser) {
@ -316,7 +316,7 @@ Int_t main(Int_t argc, Char_t *argv[])
if (status != PMUSR_SUCCESS) {
switch (status) {
case PMUSR_MSR_FILE_NOT_FOUND:
cout << endl << "**ERROR** couldn't find '" << filename << "'" << endl << endl;
cout << endl << ">> musrt0 **ERROR** couldn't find '" << filename << "'" << endl << endl;
break;
case PMUSR_MSR_SYNTAX_ERROR:
cout << endl << "**SYNTAX ERROR** in file " << filename << ", full stop here." << endl << endl;
@ -333,7 +333,7 @@ Int_t main(Int_t argc, Char_t *argv[])
PMsrRunList *runList = msrHandler->GetMsrRunList();
for (UInt_t i=0; i<runList->size(); i++) {
if (runList->at(i).GetFitType() == MSR_FITTYPE_NON_MUSR) {
cout << endl << "**ERROR** t0 setting for NonMusr fittype doesn't make any sense, will quit ..." << endl;
cout << endl << ">> musrt0 **ERROR** t0 setting for NonMusr fittype doesn't make any sense, will quit ..." << endl;
success = false;
break;
}
@ -349,12 +349,11 @@ Int_t main(Int_t argc, Char_t *argv[])
success = dataHandler->IsAllDataAvailable();
if (!success) {
cout << endl << "**ERROR** Couldn't read all data files, will quit ..." << endl;
cout << endl << ">> musrt0 **ERROR** Couldn't read all data files, will quit ..." << endl;
}
}
if (getT0FromPromptPeak) {
cout << endl << "debug> in get T0 from peak: firstGoodBinOffset = " << firstGoodBinOffset << endl;
Int_t histoNo = -1;
UInt_t t0Bin = 0;

View File

@ -112,7 +112,7 @@ int main(int argc, char *argv[])
} else {
// check if filename has extension msr or mlog
if (!strstr(argv[1], ".msr") && !strstr(argv[1], ".mlog")) {
cerr << endl << "**ERROR** " << argv[1] << " is not a msr/mlog-file, nor is it a supported graphics extension." << endl;
cerr << endl << ">> musrview **ERROR** " << argv[1] << " is not a msr/mlog-file, nor is it a supported graphics extension." << endl;
show_syntax = true;
} else {
strcpy(fileName, argv[1]);
@ -127,7 +127,7 @@ int main(int argc, char *argv[])
strcpy(graphicsExtension, argv[1]+2);
// check if filename has extension msr or mlog
if (!strstr(argv[2], ".msr") && !strstr(argv[2], ".mlog")) {
cerr << endl << "**ERROR** " << argv[2] << " is not a msr/mlog-file, nor is it a supported graphics extension." << endl;
cerr << endl << ">> musrview **ERROR** " << argv[2] << " is not a msr/mlog-file, nor is it a supported graphics extension." << endl;
show_syntax = true;
} else {
strcpy(fileName, argv[2]);
@ -139,7 +139,7 @@ int main(int argc, char *argv[])
strcpy(graphicsExtension, argv[2]+2);
// check if filename has extension msr or mlog
if (!strstr(argv[1], ".msr") && !strstr(argv[1], ".mlog")) {
cerr << endl << "**ERROR** " << argv[1] << " is not a msr/mlog-file, nor is it a supported graphics extension." << endl;
cerr << endl << ">> musrview **ERROR** " << argv[1] << " is not a msr/mlog-file, nor is it a supported graphics extension." << endl;
show_syntax = true;
} else {
strcpy(fileName, argv[1]);
@ -162,7 +162,7 @@ int main(int argc, char *argv[])
TSAXParser *saxParser = new TSAXParser();
PStartupHandler *startupHandler = new PStartupHandler();
if (!startupHandler->StartupFileFound()) {
cerr << endl << "**WARNING** couldn't find " << startupHandler->GetStartupFilePath().Data();
cerr << endl << ">> musrview **WARNING** couldn't find " << startupHandler->GetStartupFilePath().Data();
cerr << endl;
// clean up
if (saxParser) {
@ -179,7 +179,7 @@ int main(int argc, char *argv[])
status = saxParser->ParseFile(startup_path_name);
// check for parse errors
if (status) { // error
cerr << endl << "**WARNING** reading/parsing musrfit_startup.xml.";
cerr << endl << ">> musrview **WARNING** reading/parsing musrfit_startup.xml.";
cerr << endl;
// clean up
if (saxParser) {
@ -200,13 +200,13 @@ int main(int argc, char *argv[])
if (status != PMUSR_SUCCESS) {
switch (status) {
case PMUSR_MSR_FILE_NOT_FOUND:
cerr << endl << "**ERROR** couldn't find '" << fileName << "'" << endl << endl;
cerr << endl << ">> musrview **ERROR** couldn't find '" << fileName << "'" << endl << endl;
break;
case PMUSR_MSR_SYNTAX_ERROR:
cerr << endl << "**SYNTAX ERROR** in file " << fileName << ", full stop here." << endl << endl;
cerr << endl << ">> musrview **SYNTAX ERROR** in file " << fileName << ", full stop here." << endl << endl;
break;
default:
cerr << endl << "**UNKNOWN ERROR** when trying to read the msr-file" << endl << endl;
cerr << endl << ">> musrview **UNKNOWN ERROR** when trying to read the msr-file" << endl << endl;
break;
}
return status;
@ -240,7 +240,7 @@ int main(int argc, char *argv[])
success = dataHandler->IsAllDataAvailable();
if (!success) {
cerr << endl << "**ERROR** Couldn't read all data files, will quit ..." << endl;
cerr << endl << ">> musrview **ERROR** Couldn't read all data files, will quit ..." << endl;
}
// generate the necessary histogramms for the view
@ -260,7 +260,7 @@ int main(int argc, char *argv[])
if (runPresent) {
success = runListCollection->Add(i, kView);
if (!success) {
cerr << endl << "**ERROR** Couldn't handle run no " << i << " ";
cerr << endl << ">> musrview **ERROR** Couldn't handle run no " << i << " ";
cerr << (*msrHandler->GetMsrRunList())[i].GetRunName()->Data();
break;
}
@ -295,7 +295,7 @@ int main(int argc, char *argv[])
10+i*100, 10+i*100, 800, 600, graphicsOutput);
if (!musrCanvas->IsValid()) {
cerr << endl << "**SEVERE ERROR** Couldn't invoke all necessary objects, will quit.";
cerr << endl << ">> musrview **SEVERE ERROR** Couldn't invoke all necessary objects, will quit.";
cerr << endl;
ok = false;
break;

View File

@ -0,0 +1,74 @@
Temperature = 300 K, Magnetic Field = 20 Gauss, Sample = CAS
###############################################################
FITPARAMETER
# No Name Value Step Pos_Error Boundaries
1 zero 0 0 none
2 phase 11.43 -0.35 0.34 0 100
3 field 20.181 -0.028 0.028 0 none
4 asym 0.1876 -0.0010 0.0010 0 0.3
5 rate 0.1254 -0.0024 0.0024 0 100
6 beta 1 0 none
7 Norm_L 2863.3 -1.4 1.4
8 BG_L 0.000000000047 -0.000000000047 0.009142577870 0 none
9 Norm_R 2024.4 -1.1 1.2 0 none
10 BG_R 0.0000 -0.0000 0.0017 0 none
11 relPhase 172.23 -0.37 0.36 0 none
###############################################################
THEORY
asymmetry 4
generExpo 5 6 (rate exponent)
TFieldCos fun1 fun2 (phase frequency)
###############################################################
FUNCTIONS
fun1 = par2 + map1
fun2 = gamma_mu * par3
###############################################################
RUN data/32482 XXXX ISIS NEXUS (name beamline institute data-file-format)
fittype 0 (single histogram fit)
norm 7
backgr.fit 8
lifetimecorrection
map 1 0 0 0 0 0 0 0 0 0
forward 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
data 40 1500
fit 0.2 20
packing 1
RUN data/32482 XXXX ISIS NEXUS (name beamline institute data-file-format)
fittype 0 (single histogram fit)
norm 9
backgr.fit 10
lifetimecorrection
map 11 0 0 0 0 0 0 0 0 0
forward 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
data 40 1500
fit 0.2 20
packing 1
###############################################################
COMMANDS
MINIMIZE
MINOS
SAVE
###############################################################
FOURIER
units Gauss # units either 'Gauss', 'MHz', or 'Mc/s'
fourier_power 10
apodization STRONG # NONE, WEAK, MEDIUM, STRONG
plot REAL # REAL, IMAG, REAL_AND_IMAG, POWER, PHASE
range 0 100
phase par2
###############################################################
PLOT 0 (single histo plot)
runs 1 2
range 0 20 -0.3 0.3
view_packing 5
###############################################################
STATISTIC --- 2011-04-08 10:54:21
chisq = 3051.73767, NDF = 2465, chisq/NDF = 1.23802745

View File

@ -11,7 +11,7 @@ LD = g++
LDFLAGS = -g
LIBS = -L /usr/local/lib -lNeXus
LIBS += -L /usr/local/hdf5/lib -lhdf5
LIBS += -L /opt/hdf5/lib -lhdf5
EXEC = nexus_read_test

View File

@ -86,5 +86,8 @@ int main(int argc, char *argv[])
}
}
if (nxs_file)
delete nxs_file;
return 0;
}