diff --git a/ChangeLog b/ChangeLog index 16af6d29..e5ab7ca4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,8 @@ changes since 0.17.0 =================================== +NEW 2016-08-24 in musrview it is now possible to enable/disable a + crosshair cursor by pressing 'c'. NEW 2016-04-28 updated licence info in musredit and added paramList feature to the msr2data GUI. NEW 2016-04-28 msr2data gets a new option: paramList which allows to @@ -12,10 +14,11 @@ NEW 2016-04-28 msr2data gets a new option: paramList which allows to NEW 2016-04-22 Added the theory function muMinusExpTF for mu minus fits NEW 2016-03-08 added a theory translator for DKS NEW 2016-02-23 It is now possible to export the averaged data/Fourier +CHANGED 2016-08-10 drop NeXus support for Version < 4.4 CHANGED 2016-04-26 start-/endTimeBin are now class members. This reduces the number of recalculations. -FIXED 2016-04-14 added missing DKS selector in GetPhaseOptRealFourier. FIXED 2016-08-02 run lists are now properly loaded if containing nS-nE elements. +FIXED 2016-04-14 added missing DKS selector in GetPhaseOptRealFourier. changes since 0.16.0 =================================== diff --git a/configure.ac b/configure.ac index 4d5626cb..a6f3c3b0 100644 --- a/configure.ac +++ b/configure.ac @@ -554,34 +554,31 @@ AC_ARG_ENABLE([NeXus], [AS_HELP_STRING([--enable-NeXus],[build optional NeXus su [AS_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 + if !(test -r ${NEXUS_PREFIX}/include/nexus/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], + [PKG_CHECK_MODULES(NEXUS, nexus >= 4.4, [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" + if test -r /usr/local/include/nexus/napi.h; then + NEXUS_PREFIX="/usr/local" 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/include/napi.h; then + elif test -r /sw/include/nexus/napi.h; then NEXUS_PREFIX="/sw" AC_MSG_RESULT([${NEXUS_PREFIX}]) - elif test -r /opt/local/include/napi.h; then + elif test -r /opt/local/include/nexus/napi.h; then NEXUS_PREFIX="/opt/local" AC_MSG_RESULT([${NEXUS_PREFIX}]) - else + elif test -r /opt/nexus/include/nexus/napi.h; then + NEXUS_PREFIX="/opt/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. + [NeXus Version >= 4.4 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] + e.g. --with-nexus=/opt/nexus] ) fi ] @@ -589,8 +586,27 @@ AC_ARG_ENABLE([NeXus], [AS_HELP_STRING([--enable-NeXus],[build optional NeXus su ) AC_SUBST(NEXUS_PREFIX) if test "${NEXUS_FOUND}" != "1"; then - NEXUS_LIBS="-L${NEXUS_PREFIX}/lib -lNeXus" - NEXUS_CFLAGS="-I${NEXUS_PREFIX}/include" + dnl get suffix for the NeXus library depending on the OS + AC_REQUIRE([AC_CANONICAL_HOST]) + AS_CASE([$host_os], + [linux*], [NEXUS_SUFFIX="so"], + [darwin*], [NEXUS_SUFFIX="dylib"], + [*cygwin*], [NEXUS_SUFFIX="dll"], + [AC_MSG_ERROR([NeXus check: Your platform is not currently supported])] + ) + AC_MSG_NOTICE([NeXus Suffix Result: "${NEXUS_SUFFIX}"]) + if test -r ${NEXUS_PREFIX}/lib/libNeXus.${NEXUS_SUFFIX}; then + NEXUS_LIB_DIR="lib" + elif test -r ${NEXUS_PREFIX}/lib64/libNeXus.${NEXUS_SUFFIX}; then + NEXUS_LIB_DIR="lib64" + else + AC_MSG_ERROR( + [Couldn't find the NeXus library.] + ) + fi + + NEXUS_LIBS="-L${NEXUS_PREFIX}/${NEXUS_LIB_DIR} -lNeXus" + NEXUS_CFLAGS="-I${NEXUS_PREFIX}/include/nexus" fi AC_SUBST(NEXUS_LIBS) AC_SUBST(NEXUS_CFLAGS) diff --git a/doc/examples/UserFcn/Makefile.PUserFcn b/doc/examples/UserFcn/Makefile.PUserFcn new file mode 100644 index 00000000..c2e9aeed --- /dev/null +++ b/doc/examples/UserFcn/Makefile.PUserFcn @@ -0,0 +1,60 @@ +#--------------------------------------------------- +# get compilation flags from root-config + +ROOTCFLAGS = $(shell $(ROOTSYS)/bin/root-config --cflags) + +#--------------------------------------------------- + +OS = LINUX +CXX = g++ +CXXFLAGS = -O3 -Wall -Wno-trigraphs -fPIC +LOCALINCLUDE = . +ROOTINCLUDE = $(ROOTSYS)/include +INCLUDES = -I$(LOCALINCLUDE) -I$(ROOTINCLUDE) +LD = g++ +LDFLAGS = +SOFLAGS = -O -shared + +# the output from the root-config script: +CXXFLAGS += $(ROOTCFLAGS) +LDFLAGS += + +# some definitions: headers (used to generate *Dict* stuff), sources, objects,... +OBJS = +OBJS += PUserFcn.o PUserFcnDict.o + +SHLIB = libPUserFcn.so + +# make the shared lib: +# +all: $(SHLIB) + +$(SHLIB): $(OBJS) + @echo "---> Building shared library $(SHLIB) ..." + /bin/rm -f $(SHLIB) + $(LD) $(OBJS) $(SOFLAGS) -o $(SHLIB) + @echo "done" + +# clean up: remove all object file (and core files) +# semicolon needed to tell make there is no source +# for this target! +# +clean:; @rm -f $(OBJS) *Dict* core* + @echo "---> removing $(OBJS)" + +# +$(OBJS): %.o: %.cpp + $(CXX) $(INCLUDES) $(CXXFLAGS) -c $< + +# Generate the ROOT CINT dictionary + +PUserFcnDict.cpp: PUserFcn.h PUserFcnLinkDef.h + @echo "Generating dictionary $@..." + rootcint -f $@ -c -p -I$(ROOTINCLUDE) $^ + +install: all + @echo "Installing shared lib: libTApproximation.so" +ifeq ($(OS),LINUX) + cp -pv $(SHLIB) $(ROOTSYS)/lib + cp -pv $(LOCALINCLUDE)/*.h $(ROOTSYS)/include +endif diff --git a/doc/examples/UserFcn/PUserFcn.cpp b/doc/examples/UserFcn/PUserFcn.cpp new file mode 100644 index 00000000..f5f31aa3 --- /dev/null +++ b/doc/examples/UserFcn/PUserFcn.cpp @@ -0,0 +1,59 @@ +/*************************************************************************** + + PUserFcn.cpp + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + +***************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2007-2016 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include +using namespace std; + +#include + +#include "PUserFcn.h" + +ClassImp(PUserFcn) + +//------------------------------------------------------ +/** + *

user function example: polynome of 3rd order + * + * \f[ = \sum_{k=0}^3 c_k t^k \f] + * + * meaning of paramValues: \f$c_0\f$, \f$c_1\f$, \f$c_2\f$, \f$c_3\f$ + * + * return: function value + * + * \param t time in \f$(\mu\mathrm{s})\f$, or x-axis value for non-muSR fit + * \param param parameter vector + */ +Double_t PUserFcn::operator()(Double_t t, const std::vector ¶m) const +{ + // expected parameters: c0, c1, c2, c3 + + assert(param.size() == 4); + + return param[0] + param[1]*t + param[2]*t*t + param[3]*t*t*t; +} diff --git a/doc/examples/UserFcn/PUserFcn.h b/doc/examples/UserFcn/PUserFcn.h new file mode 100644 index 00000000..78d6793e --- /dev/null +++ b/doc/examples/UserFcn/PUserFcn.h @@ -0,0 +1,58 @@ +/*************************************************************************** + + PUserFcn.h + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + +***************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2007-2016 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef _PUSERFCN_H_ +#define _PUSERFCN_H_ + +#include + +#include "PUserFcnBase.h" + +/** + *

User function example class. Polynome of 3rd order. + */ +class PUserFcn : public PUserFcnBase +{ + public: + PUserFcn() {} + ~PUserFcn() {} + + // global user-function-access functions, here without any functionality + Bool_t NeedGlobalPart() const { return false; } + void SetGlobalPart(vector &globalPart, UInt_t idx) { } + Bool_t GlobalPartIsValid() const { return true; } + + // function operator + Double_t operator()(Double_t t, const std::vector ¶m) const; + + // definition of the class for the ROOT dictionary + ClassDef(PUserFcn, 1) +}; + +#endif // _PUSERFCN_H_ diff --git a/doc/examples/UserFcn/PUserFcnLinkDef.h b/doc/examples/UserFcn/PUserFcnLinkDef.h new file mode 100644 index 00000000..a7f7eaa1 --- /dev/null +++ b/doc/examples/UserFcn/PUserFcnLinkDef.h @@ -0,0 +1,15 @@ +/*************************************************************************** + + PUserFcnLinkDef.h + +***************************************************************************/ + +#ifdef __CINT__ + +#pragma link off all globals; +#pragma link off all classes; +#pragma link off all functions; + +#pragma link C++ class PUserFcn+; + +#endif //__CINT__ diff --git a/doc/examples/UserFcn/README b/doc/examples/UserFcn/README new file mode 100644 index 00000000..caf43406 --- /dev/null +++ b/doc/examples/UserFcn/README @@ -0,0 +1,89 @@ +/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ + +Simple Example for a User Function without Global Part + +/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ + +Goal: define a user function which implements a polynom + of 3rd order. + +For details see: http://lmu.web.psi.ch/musrfit/user/MUSR/MusrFit.html#A_6_User_Functions + +Implementation: + 3 Files are needed: + + 1) A header file which defines your user function + interface. + + In the example here it is called PUserFcn.h + + Please rename it in your case to something more + sensible, e.g. PMyPoly.h. At the same time also + rename correspondingly the class name in your + header file, i.e. PUserFcn -> PMyPoly. This will + be at 4 places in the header file of this example. + + 2) The source file which defines your user function. + + In the example here it is called PUserFcn.cpp + + Please rename it accordingly to the header file. + In case the header file is called PMyPoly.h, the + source file will need to be called PMyPoly.cpp. + As for the header file, the class names need to + be adopted: PUserFcn -> PMyPoly. + + In the source file change the operator implementation + (Double_t PUserFcn::operator()(Double_t t, + const std::vector ¶m) const) + to whatever you need. + + 3) There is another header file needed to generate + the necessary ROOT dictionary. + + In this example it is called PUserFcnLinkDef.h + + Here you only will need to find PUserFcn+ and + replace it with your class name, e.g. PMyPoly+ + +Generate Code: + You will find the Makefil.PUserFcn which generates + the needed shared library for your user function. + + Again, if your user function is called PMyPoly, you + will need to replace things accordingly in the + Makefile, i.e. + + Makefile.PUserFcn -> Makefile.PMyPoly + + In the Makefile: + + PUserFcn.o -> PMyPoly.o + PUserFcnDict.o -> PMyPolyDict.o + libPUserFcn.so -> libPMyPoly.so + + To create the shared library do: + + make -f Makefile.PUserFcn + + on the command line. This should create a file + libPUserFcn.so. + + Next call on the command line: + + make -f Makefile.PUserFcn install + + This will copy the shared library to the correct + place. + + You also will need to make sure that the system is + finding the shared library, either by setting + LD_LIBRARY_PATH or by calling /sbin/ldconfig as + superuser/root assuming you are using linux. + +Example msr-file: + You will find an example msr-file test-asy-MUS.msr + which is using PUserFcn. The example is UN-PHYSICALLY + it is just to show how to use a user function. + + diff --git a/doc/examples/UserFcn/data/000100.msr b/doc/examples/UserFcn/data/000100.msr new file mode 100644 index 00000000..e00399f4 Binary files /dev/null and b/doc/examples/UserFcn/data/000100.msr differ diff --git a/doc/examples/UserFcn/test-asy-MUD.msr b/doc/examples/UserFcn/test-asy-MUD.msr new file mode 100644 index 00000000..ea932df1 --- /dev/null +++ b/doc/examples/UserFcn/test-asy-MUD.msr @@ -0,0 +1,55 @@ +MgB12H12 No2 ZF T=150 +############################################################### +FITPARAMETER +# Nr. Name Value Step Pos_Error Boundaries + 1 alpha 1 0 none 0 2 + 2 asy 0.1650 0.0027 none 0 0.33 + 3 c0 1.047 0.016 none + 4 c1 -0.1957 0.0038 none + 5 c2 0.0216 0.0011 none + 6 c3 -0.00119 0.00011 none + +############################################################### +THEORY +asymmetry 2 +userFcn libPUserFcn PUserFcn 3 4 5 6 + +############################################################### +RUN data/000100 XXXX TRIUMF MUD (name beamline institute data-file-format) +fittype 2 (asymmetry fit) +alpha 1 +map 0 0 0 0 0 0 0 0 0 0 0 +forward 1 +backward 2 +background 79 391 80 409 # estimated bkg: 21.0833 / 17.2249 +data 438 12785 436 12787 +t0 432.0 431.0 +fit 0 8 +packing 100 + +############################################################### +COMMANDS +MINIMIZE +MINOS +#HESSE +SAVE + +############################################################### +FOURIER +units Gauss # units either 'Gauss', 'Tesla', 'MHz', or 'Mc/s' +fourier_power 12 +apodization NONE # NONE, WEAK, MEDIUM, STRONG +plot POWER # REAL, IMAG, REAL_AND_IMAG, POWER, PHASE +phase 8 +#range_for_phase_correction 50.0 70.0 +range 0 2000 +dc-corrected true + +############################################################### +PLOT 2 (asymmetry plot) +runs 1 +range 0 9 0 0.22 + +############################################################### +STATISTIC --- 2016-06-22 09:34:01 + chisq = 152.4, NDF = 97, chisq/NDF = 1.571461 diff --git a/doc/html/user/MUSR/BmwLibs.html b/doc/html/user/MUSR/BmwLibs.html index 65e81a5d..209d2779 100644 --- a/doc/html/user/MUSR/BmwLibs.html +++ b/doc/html/user/MUSR/BmwLibs.html @@ -1,6 +1,6 @@ - + @@ -14,14 +14,14 @@ - + - - + + - - + + + + + + + + + + - - - - - + + + - + + - + - - + + + + +