diff --git a/ChangeLog b/ChangeLog
index 2bd3a9c1..249b9c8d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,10 +4,17 @@
changes since 0.13.0
===================================
+NEW 2015-02-20 add a switch to musrview that it plots initially the Fouier data rather
+ than the time domain data.
+NEW 2015-02-19 added a first preliminary user interface for musrFT within musredit.
+NEW 2015-02-16 changed the data export handling from musrview. It is now more
+ main line and follows the implementation of musrFT.
NEW 2015-02-13 first implementation of a standalone Fourier transform/plotter:
musrFT. Initially it is meant to be used for HAL-9500,
i.e. Fourier transform WITHOUT lifetime correction.
A first simple minded lifetime correction is implemented as well.
+NEW 2015-02-04 Integration of libBNMR for fitting beta-NMR relaxation data
+ into automake of musrfit.
NEW 2015-01-17 adding a branch for ROOT 6.x. This needs some minor adaptations due
to the new rootcint/rootclang and the stricter c++11.
NEW 2014-12-18 first implementation of a GLOBAL block which allows to shorten
diff --git a/configure.ac b/configure.ac
index 74e1ecb6..ecd1034c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,7 +1,7 @@
AC_REVISION([m4_esyscmd_s([git describe --always])])
AC_PREREQ(2.63)
-AC_INIT([musrfit],[0.13.0],[andreas.suter@psi.ch])
+AC_INIT([musrfit],[0.14.0],[andreas.suter@psi.ch])
AC_CONFIG_AUX_DIR(admin)
AC_CANONICAL_HOST
#AC_MSG_RESULT([${host} ${host_cpu} ${host_vendor} ${host_os}])
@@ -35,7 +35,7 @@ dnl -----------------------------------------------
#release versioning
MUSR_MAJOR_VERSION=0
-MUSR_MINOR_VERSION=13
+MUSR_MINOR_VERSION=14
MUSR_MICRO_VERSION=0
#release versioning
@@ -733,6 +733,12 @@ dnl -----------------------------------------------
AC_ARG_ENABLE([ASlibs], [AS_HELP_STRING([--enable-ASlibs],[build optional AS plug-ins [default=no]])],[BUILD_AS_LIBS=1], [BUILD_AS_LIBS=0])
+dnl -----------------------------------------------
+dnl Ask user if BNMRlibs should be built
+dnl -----------------------------------------------
+
+AC_ARG_ENABLE([BNMRlibs], [AS_HELP_STRING([--enable-BNMRlibs],[build optional BNMR plug-ins [default=no]])],[BUILD_BNMR_LIBS=1], [BUILD_BNMR_LIBS=0])
+
dnl -----------------------------------------------
dnl Set some paths and flags for PMusr, MusrRoot, TLemRunHeader, Class_MuSR_PSI, mud, NeXus (if enabled), etc.
dnl -----------------------------------------------
@@ -780,6 +786,14 @@ if test "${PNEXUS_ENABLED}" = "1"; then
AC_SUBST(PNEXUS_CXXFLAGS)
fi
+if test "${BUILD_BNMR_LIBS}" = "1"; then
+ BNMRLIBS_SRCDIR="${SRCDIR}/external/libBNMR"
+ BNMRLIBS_LIBS="${BNMRLIBS_SRCDIR}/libBNMR.la"
+ BNMRLIBS_CFLAGS="-I${BNMRLIBS_SRCDIR}"
+ AC_SUBST(BNMRLIBS_LIBS)
+ AC_SUBST(BNMRLIBS_CFLAGS)
+fi
+
if test "${BUILD_BMW_LIBS}" = "1"; then
BMWTOOLS_SRCDIR="${SRCDIR}/external/BMWtools"
BMWTOOLS_LIBS="${BMWTOOLS_SRCDIR}/libBMWtools.la"
@@ -1114,6 +1128,7 @@ 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"])
+AM_CONDITIONAL([BUILD_BNMRLIBS], [test "${BUILD_BNMR_LIBS}" = "1"])
AC_CONFIG_FILES([Makefile \
src/Makefile \
@@ -1154,6 +1169,9 @@ AC_CONFIG_FILES([Makefile \
src/external/libSpinValve/classes/Makefile \
src/external/libPhotoMeissner/Makefile \
src/external/libPhotoMeissner/classes/Makefile \
+ src/external/libBNMR/Makefile \
+ src/musredit/Makefile \
+ src/musrgui/Makefile \
src/musredit/musredit_startup.xml \
src/musrgui/musrgui_startup.xml])
@@ -1273,6 +1291,11 @@ if test "${BUILD_AS_LIBS}" -eq 1; then
else
echo " ASlibs: no"
fi
+if test "${BUILD_BNMR_LIBS}" -eq 1; then
+ echo " BNMRlibs: yes"
+else
+ echo " BNMRlibs: no"
+fi
if test "${BUILD_BMW_LIBS}" -eq 1; then
echo " BMWlibs: yes"
else
diff --git a/doc/html/user/MUSR/BmwLibs.html b/doc/html/user/MUSR/BmwLibs.html
index 492bc7f1..3ee693e6 100644
--- a/doc/html/user/MUSR/BmwLibs.html
+++ b/doc/html/user/MUSR/BmwLibs.html
@@ -1,6 +1,6 @@
-
+
@@ -179,12 +179,11 @@ Since quite some effort is going into the development and maintenance of the
-
+
-
@@ -193,7 +192,7 @@ Since quite some effort is going into the development and maintenance of the
-
+
diff --git a/doc/html/user/MUSR/LibFitPofB.html b/doc/html/user/MUSR/LibFitPofB.html
index 734a904d..66a1108f 100644
--- a/doc/html/user/MUSR/LibFitPofB.html
+++ b/doc/html/user/MUSR/LibFitPofB.html
@@ -1,6 +1,6 @@
-
+
@@ -8,7 +8,7 @@
-
+
@@ -108,9 +108,9 @@ pre {
@@ -210,7 +211,7 @@ In the menu bar the Musrfit menu can be found. From there some
Fourier
performs the Fourier transformation of the selected data and shows the result
Difference
shows the difference between the selected data and the fit
Average
toggle between the current view and the averaged data view. Useful if the averaged Fourier power spectrum of lots of detectors shall be shown.
-
Save Data
saves the selected data in a simple multi-column ASCII file
+
Export Data
saves the selected data in a simple multi-column ASCII file
Additionally, some functions can be accessed using key-shortcuts:
@@ -221,8 +222,56 @@ Additionally, some functions can be accessed using key-shortcuts:
u
reset the plotting range to the area given in the msr file ("unzoom")
+
+
2.3 musrFT
+musrFT is an interactive graphical user interface for the presentation of Fourier transforms of raw μSR histograms. It's purpose is to get a quick overview for high TF-field data, as found e.g. at the HAL-9500 instrument at PSI. It Fourier transforms the raw histogram data, i.e. N(t) rather than A(t), and hence shows the lifetime contribution of the muon. This is no problem for large enough fields, but will be a severe problem at very low fields. musrFT is still in its early stage and should be considered a beta-version.
+
+If called from within a shell it accepts the following parameters:
+
<msr_files>
msr-file name(s). These msr-files are used for the Fourier transform. It can be a list of msr-files, e.g. musrFT 3110.msr 3111.msr
+
-df, --data-file <data-file>
This allows to feed only μSR data file(s) to perform the Fourier transform. Since the extended <msr-file> information are missing, they will need to be provided by to options, or musrFT tries to guess, based on musrfit_startup.xml settings.
+
--help
display a help and exit
+
--version
output version information and exit
+
-g, --graphic-format <graphic-format-extension>
will produce a graphic-output-file without starting a root session. The name is based either on the <msr-file> or the <data-file>, e.g. 3310.msr -> 3310_0.png. Supported graphic-format-extension: eps, pdf, gif, jpg, png, svg, xpm, root
+
--dump <fln>
rather than starting a root session and showing Fourier graphs of the data, it will output the Fourier data in an ascii file <fln>.
+
-br, --background-range <start> <end>
background interval used to estimate the background to be subtracted before the Fourier transform. <start>, <end> to be given in bins.
+
-bg, --background
gives the background explicit for each histogram.
+
-fo, --fourier-option <fopt>
<fopt> can be 'real', 'imag', 'real+imag', 'power', or 'phase'. If this is not defined (neither on the command line nor in the musrfit_startup.xml). Default will be 'power'.
+
-ap, --apodization <val>
<val> can be either 'none', 'weak', 'medium', 'strong'. Default will be 'none'.
+
-fp, --fourier-power <N>
<N> being the Fourier power, i.e. 2^<N> used for zero padding. Default is -1, i.e. no zero padding will be performed.
+
-u, --units <units>
<units> is used to define the x-axis of the Fourier transform. One may choose between the fields (Gauss) or (Tesla), the frequency (MHz), and the angular-frequency domain (Mc/s). Default will be 'MHz'.
+
-ph, --phase <val>
defines the initial phase <val>. This only is of concern for 'real', 'imag', and 'real+imag'. Default will be 0.0.
+
-fr, --fourier-range <start> <end>
Fourier range. <start>, <end> are interpreted in the units given. Default will be -1.0 for both which means, take the full Fourier range.
+
-tr, --time-range <start> <end>
time domain range to be used for Fourier transform. <start>, <end> are to be given in (μsec). If nothing is given, the full time range found in the data file(s) will be used.
+
--histo <list>
give the <list> of histograms to be used for the Fourier transform. E.g. musrFT -df lem15_his_01234.root --histo 1 3, will only be needed together with the option --data-file. If multiple data file are given, <list> will apply to all data-files given. If --histo is not given, all histos of a data file will be used. <list> can be anything like: 2 3 6, or 2-17, or 1-6 9, etc.
+
-a, --average
show the average of all Fourier transformed data.
+
--t0 <list>
A list of t0's can be provided. This in conjunction with --data-file and --fourier-option real allows to get the proper initial phase if t0's are known. If a single t0 for multiple histos is given, it is assume, that this t0 is common to all histos. Example: musrFT -df lem15_his_01234.root -fo real --t0 2750 --histo 1 3.
+
-pa, --packing <N>
if <N> (an integer), the time domain data will first be packed/rebinned by <N>.
+
--title <title>
give a global title for the plot.
+
--create-msr-file <fln>
creates a msr-file based on the command line options provided. This will help on the way to a full fitting model.
+
-lc, --lifetimecorrection <fudge>
try to eliminate muon life time decay. Only makes sense for low transverse fields. <fudge> is a tweaking factor (scaling factor for the estimated t0) and should be kept around 1.0.
+
--timeout <timeout>
<timeout> given in seconds after which musrFT terminates. If <timeout> <= 0, no timeout will take place. Default <timeout> is 3600 sec.
+
+
+
Example 1
musrFT -df tdc_hifi_2014_00153.mdu --title "MnSi" -tr 0 10 -fr 7.0 7.6 -u Tesla --histo 2-17 -a
will take time range from t=0..10μsec, will show the Fourier transform in units of Tesla from B=7.0..7.6 Tesla of the detectors 2-17. Rather than showing the 16 individual Fourier transforms, the average of all Fourier spectra will be shown. t0's will be guessed by the maximum of the time domain histogram (assuming a prompt peak).
+
Example 2
musrFT -df tdc_hifi_2014_00153.mdu -tr 0 10 -fr 7.0 7.6 -u Tesla --histo 2-17 --title "MnSi average, T=50K, B=7.5T" -a -g pdf
as Example 1 but rather than showing an interactive GUI, the output will be dumped into a pdf-file. The file name will be tdc_hifi_2014_00153.pdf.
+
as Example 1 but rather than showing an interactive GUI, the output will be dumped into the ascii file MnSi.dat.
+
+
+Within the drawn canvas all standard actions applicable to ROOT canvases might be performed.
+In the menu bar the MusrFT menu can be found. From there some musrFT-specific actions might be taken:
+
Fourier
allows to switch between different Fourier transform representations 'Power', 'Real', ...
+
Average
toggle between the current view and the averaged data view.
+
Export Data
saves the selected data in a simple multi-column ASCII file
+
+
+Additionally, some functions can be accessed using key-shortcuts:
+
q
quits musrFT
+
a
toggle between average of the presented data and single Fourier histos, e.g. the averaged Fourier power spectra of various detectors.
+
u
reset the plotting range to the area given in the msr-file or the form the command line ("unzoom")
+
+
-
2.3 musrt0
+
2.4 musrt0
musrt0 is a user interface for the determination of t0 and the time windows of data and background needed to be specified in the RUN blocks of the msr file. It can be operated either as an interactive program or in a non-interactive mode. In the non-interactive mode it accepts the following parameters:
<msr_file>
name of an msr file
-g, --getT0FromPromptPeak [<firstGoodBinOffset>]
tries to estimate t0 from the prompt peak (maximum entry) in each histogram and writes the corresponding values to the t0 lines in the RUN blocks of the msr file. If an optional number <firstGoodBinOffset> is given, the lower limit of the data range will be set to t0 + <firstGoodBinOffset>.
@@ -253,7 +302,7 @@ Using the key Q, musrt0 can be interrupted. No cha
Closing a window by clicking the X button is equivalent to pressing Q, i.e. musrt0 is simply terminated.
-
2.4 musrfit_startup.xml
+
2.5 musrfit_startup.xml
musrfit_startup.xml is a configuration file located at the musrfit binary path. In this file the following XML tags are allowed to define settings:
<data_path>PATH_TO_DATA</data_path>
add the new path PATH_TO_DATA where musrfit and musrview will search for data files
if enabled χ2 for each RUN block will be written to the STATISTIC block of the resulting msr file. Additionally, in case a χ2single-histogram fit is done, also Pearson's χ2 will be added.
@@ -309,7 +358,7 @@ An example would look like:
-
2.5 msr2msr
+
2.6 msr2msr
msr2msr is a small utility for converting existing WKM msr files into musrfit msr files. It accepts the following parameters:
<msr_file_in>
input WKM msr file (mandatory first parameter)
<msr_file_out>
converted output musrfit msr file (mandatory second parameter)
@@ -321,7 +370,7 @@ A typical example then looks like:
If the input file has already the musrfit msr file structure, the output file will be just a copy of the input file.
-
2.6 any2many
+
2.7 any2many
any2many is a muSR data file converter. Currently different facilities (PSI, TRIUMF, ISIS, J-PARC) are saving their muSR data files in different formats, or even worse some instruments are using other muSR data formats than others. The aim of any2many is that these files can be converted into each other. Of course only a subset of header information can be converted.
Currently any2many can convert the following muSR data file formats:
@@ -367,7 +416,7 @@ Will take the runs 100 through 117 and convert the NeXus input file
Will read the two files '2010/lem10_his_0123.root' and '2010/lem10_his_0012.root', rebin them with 25 and export them as LEM ROOT files with adding rebin25 to the name, e.g. 2010/lem10_his_0123_rebin25.root.
-
2.7 dump_header
+
2.8 dump_header
dump_header is a little program which tries to read a μSR data file and sends the relevant information (required header info, start of the histos, etc.) to the standard output. Currently the following μSR data file formats are supported: MusrROOT, ROOT (old LEM format), PSI-BIN, PSI-MDU, NeXus (IDF1 and IDF2), MUD, and WKM.
@@ -1540,20 +1589,8 @@ For reporting bugs or requesting new features and improvements please use the
-
-musrgui and musredit are editors which also provide a graphical user interface to the programs contained in the musrfit suite and are intended to help the user handle musrfit msr files. They are implemented in C++ and use the Qt framework. Principally, musrgui and musredit are doing the same, but are based on different Qt versions. musrgui is based on Qt 3.x and will only be maintained on bug-fixing level since the Qt 3.x licensing is less straight forward than the Qt 4.x one. musredit is based on Qt 4.6 (or above) and this is the program which will be developed further.
+musredit and musrgui are editors which also provide a graphical user interface to the programs contained in the musrfit suite and are intended to help the user handle musrfit msr files. They are implemented in C++ and use the Qt framework. Principally, musrgui and musredit are doing the same, but are based on different Qt versions. musrgui is based on Qt 3.x and will only be maintained on bug-fixing level since the Qt 3.x licensing is less straight forward than the Qt 4.x one. musredit is based on Qt 4.6 (or above) and this is the program which will be developed further.
On this documentation page only the features related to musrfit are described—the basic editor functions which should be self-explanatory are not.
Before going on using musrgui / musredit it is strongly recommended to read the manual of musrfit first!
2 Available Executables, Configuration Files and their Basic Usage
-
2.1 musrgui / musredit
-musrgui / musredit are the editor executables. If called from within a shell they accept a few optional parameters:
+
2.1 musredit / (musrgui)
+musredit / musrgui are the editor executables. If called from within a shell they accept a few optional parameters:
<msr_files>
file names of the msr files that should be opened in separate editor tabs on startup of musrgui / musredit.
--help
displays a small help notice in the shell explaining the basic usage of the program
--version
prints the version number of musrgui / musredit
@@ -148,10 +148,10 @@ On this documentation page only the features related to musrfit are
If called without any parameters an empty editor window opens.
-
2.2 musrgui_startup.xml / musredit_startup.xml
-musrgui_startup.xml / musredit_startup.xml are configuration files located at the musrgui / musredit binary path. It is also possible to have another version of this file in the working directory which then will be used!
+
2.2 musredit_startup.xml / musrgui_startup.xml
+musredit_startup.xml / musrgui_startup.xml are configuration files located at the musredit / musrgui binary path. It is also possible to have another version of this file in the working directory which then will be used!
-In this file the following XML tags are allowed to define settings and might proof useful for all users of musrgui / musredit:
+In this file the following XML tags are allowed to define settings and might proof useful for all users of musredit / musrgui:
<general></general>
set the default paths to executables and files in this environment
<exec_path>PATH_TO_EXEC</exec_path>
set the path PATH_TO_EXEC where the executables musrfit, musrview, musrt0, etc. can be found (inside the <general> environment)
<default_save_path>SAV_PATH</default_save_path>
specify the path SAV_PATH where musrgui / musredit point by default when opening and saving msr files (inside the <general> environment)
@@ -291,6 +291,9 @@ The features of musrfit which can be accessed by the graphical fron
T0 (Alt+t)
musrt0 <msr_file>
is called for the <msr_file> selected in the editor. For further information refer to the manual of musrfit.
+
+
Raw Fourier
musrFT <with-many-options> is called. For a proper documentation of it, check the manual of musrFT.
+
Preferences (Alt+p)
Opens a window in which the optional parameters that should be passed to musrfit can be chosen. These options are --keep-mn2-output, --dump ascii, --dump root, and --title-from-data-file. For further information refer to the manual of musrfit. Additionally, the access to musrt0 can be enabled temporarily.
@@ -310,9 +313,9 @@ Besides the functions described above and which are mostly interfacing mus
5 Bugtracking
-For reporting bugs or requesting new features and improvements please use the PSI Tracker or send an e-mail to A. Suter.
+For reporting bugs or requesting new features and improvements please use the Bitbucket Tracker, PSI Tracker (PSI account needed) or send an e-mail to A. Suter.
--- BMW & AS
set the background values for all the histos.
+ *
+ * \param bkg vector
+ */
+void PPrepFourier::SetBkg(PDoubleVector bkg)
+{
+ for (unsigned int i=0; i= fRawData[i].rawData.size()) || (fBkgRange[1] >= fRawData[i].rawData.size())) {
- cerr << endl << "PPrepFourier::DoBkgCorrection() **ERROR** bkg-range out of data-range!";
+ if ((fBkgRange[0] != -1) && (fBkgRange[1] != -1)) { // background range is given
+ // make sure that the bkg range is ok
+ for (unsigned int i=0; i= fRawData[i].rawData.size()) || (fBkgRange[1] >= fRawData[i].rawData.size())) {
+ cerr << endl << "PPrepFourier::DoBkgCorrection() **ERROR** bkg-range out of data-range!";
+ return;
+ }
+ }
+
+ Double_t bkg=0.0;
+ for (unsigned int i=0; i background " << i << ": " << bkg << endl;
+
+ // correct data
+ for (unsigned int j=0; jNot implemented yet.
- */
-void PPrepFourier::DoFiltering()
-{
- // make sure fData are already present, and if not create the necessary data sets
- if (fData.size() != fRawData.size()) {
- InitData();
- }
-}
-
//--------------------------------------------------------------------------
// DoLifeTimeCorrection
//--------------------------------------------------------------------------
@@ -417,7 +437,7 @@ TH1F *PPrepFourier::GetData(const UInt_t idx)
}
//--------------------------------------------------------------------------
-// InitData
+// InitData (private)
//--------------------------------------------------------------------------
/**
*
Copy raw-data to internal data from t0 to the size of raw-data.
diff --git a/src/external/Makefile.am b/src/external/Makefile.am
index 360579d1..755d9210 100644
--- a/src/external/Makefile.am
+++ b/src/external/Makefile.am
@@ -19,4 +19,8 @@ if BUILD_BMWLIBS
libCalcMeanFieldsLEM
endif
-SUBDIRS = $(ASDIRS) $(CUBADIRS) $(BMWDIRS)
+if BUILD_BNMRLIBS
+ BNMRDIRS = libBNMR
+endif
+
+SUBDIRS = $(ASDIRS) $(CUBADIRS) $(BMWDIRS) $(BNMRDIRS)
diff --git a/src/external/libBNMR/Makefile.am b/src/external/libBNMR/Makefile.am
new file mode 100644
index 00000000..8023d07b
--- /dev/null
+++ b/src/external/libBNMR/Makefile.am
@@ -0,0 +1,52 @@
+## Process this file with automake to create Makefile.in
+
+h_sources = \
+ TBNMR.h
+
+h_linkdef = \
+ TBNMRLinkDef.h
+
+dict_h_sources = \
+ TBNMRDict.h
+
+cpp_sources = \
+ TBNMR.cpp
+
+dict_cpp_sources = \
+ TBNMRDict.cpp
+
+include_HEADERS = $(h_sources)
+noinst_HEADERS = $(h_linkdef) $(dict_h_sources)
+
+AM_CPPFLAGS = -I$(top_srcdir)/src/include $(PMUSR_CFLAGS) -I$(ROOTINCDIR)
+AM_CXXFLAGS = $(LOCAL_LIB_CXXFLAGS)
+
+BUILT_SOURCES = $(dict_cpp_sources) $(dict_h_sources)
+AM_LDFLAGS = $(LOCAL_LIB_LDFLAGS) -L@ROOTLIBDIR@
+CLEANFILES = *Dict.cpp *Dict.h *~ core
+
+%Dict.cpp %Dict.h: %.h %LinkDef.h
+ @ROOTCINT@ -v -f $*Dict.cpp -c -p $(AM_CPPFLAGS) $^
+
+lib_LTLIBRARIES = libBNMR.la
+
+libBNMR_la_SOURCES = $(h_sources) $(cpp_sources) $(dict_h_sources) $(dict_cpp_sources)
+libBNMR_la_LIBADD = $(ROOT_LIBS)
+libBNMR_la_LDFLAGS = -version-info $(PLUGIN_LIBRARY_VERSION) -release $(PLUGIN_RELEASE) $(AM_LDFLAGS)
+
+## However, create some symbolic links to the shared library
+## in order to unify the function call on different operating systems
+
+if IS_DARWIN
+install-exec-hook:
+ $(LN_S) -f $(libdir)/libBNMR.dylib $(libdir)/libBNMR.so
+uninstall-hook:
+ rm -f $(libdir)/libBNMR.so
+endif
+
+if IS_CYGWIN
+install-exec-hook:
+ $(LN_S) -f $(bindir)/cygBNMR-$(PLUGIN_MAJOR_VERSION)-$(PLUGIN_MINOR_VERSION)-$(PLUGIN_MAJOR_VERSION).dll $(libdir)/libBNMR.so
+uninstall-hook:
+ rm -f $(libdir)/libBNMR.so
+endif
diff --git a/src/include/PFourier.h b/src/include/PFourier.h
index 787450e1..868b1d09 100644
--- a/src/include/PFourier.h
+++ b/src/include/PFourier.h
@@ -55,6 +55,7 @@ class PFourier
virtual const char* GetDataTitle() { return fData->GetTitle(); }
virtual const Int_t GetUnitTag() { return fUnitTag; }
virtual Double_t GetResolution() { return fResolution; }
+ virtual Double_t GetMaxFreq();
virtual TH1F* GetRealFourier(const Double_t scale = 1.0);
virtual TH1F* GetImaginaryFourier(const Double_t scale = 1.0);
virtual TH1F* GetPowerFourier(const Double_t scale = 1.0);
diff --git a/src/include/PFourierCanvas.h b/src/include/PFourierCanvas.h
index d509e39e..a1a1913d 100644
--- a/src/include/PFourierCanvas.h
+++ b/src/include/PFourierCanvas.h
@@ -127,7 +127,6 @@ class PFourierCanvas : public TObject, public TQObject
TRootCanvas *fImp; ///< ROOT native GUI version of main window with menubar and drawing area
TGMenuBar *fBar; ///< menu bar
TGPopupMenu *fPopupMain; ///< popup menu MusrFT in the main menu bar
-// TGPopupMenu *fPopupSave; ///< popup menu of the MusrFT/Save Data sub menu
TGPopupMenu *fPopupFourier; ///< popup menu of the MusrFT/Fourier sub menu
// canvas related variables
diff --git a/src/include/PMusr.h b/src/include/PMusr.h
index f083b13b..8a501d59 100644
--- a/src/include/PMusr.h
+++ b/src/include/PMusr.h
@@ -36,6 +36,12 @@ using namespace std;
#include
+// the following ifdef is needed for GCC 4.6 or higher, fftw 3.3 or higher and root 5.30.03 or lower
+#ifdef __CINT__
+typedef struct { char a[7]; } __float128; // needed since cint doesn't know it
+#endif
+#include "fftw3.h"
+
#define PMUSR_SUCCESS 0
#define PMUSR_WRONG_STARTUP_SYNTAX -1
#define PMUSR_MSR_FILE_NOT_FOUND -2
diff --git a/src/include/PMusrCanvas.h b/src/include/PMusrCanvas.h
index e8296e4c..19241149 100644
--- a/src/include/PMusrCanvas.h
+++ b/src/include/PMusrCanvas.h
@@ -67,7 +67,7 @@
#define P_MENU_ID_FOURIER 10002
#define P_MENU_ID_DIFFERENCE 10003
#define P_MENU_ID_AVERAGE 10004
-#define P_MENU_ID_SAVE_DATA 10005
+#define P_MENU_ID_EXPORT_DATA 10005
#define P_MENU_PLOT_OFFSET 1000
@@ -79,8 +79,6 @@
#define P_MENU_ID_FOURIER_PHASE_PLUS 105
#define P_MENU_ID_FOURIER_PHASE_MINUS 106
-#define P_MENU_ID_SAVE_ASCII 200
-
//------------------------------------------------------------------------
/**
*
@@ -204,11 +202,13 @@ class PMusrCanvas : public TObject, public TQObject
public:
PMusrCanvas();
PMusrCanvas(const Int_t number, const Char_t* title,
- Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh, const Bool_t batch);
+ Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh, const Bool_t batch,
+ const Bool_t fourier=false);
PMusrCanvas(const Int_t number, const Char_t* title,
Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh,
PMsrFourierStructure fourierDefault,
- const PIntVector markerList, const PIntVector colorList, const Bool_t batch);
+ const PIntVector markerList, const PIntVector colorList, const Bool_t batch,
+ const Bool_t fourier=false);
virtual ~PMusrCanvas();
virtual Bool_t IsValid() { return fValid; }
@@ -229,9 +229,10 @@ class PMusrCanvas : public TObject, public TQObject
virtual void LastCanvasClosed(); // SLOT
virtual void SaveGraphicsAndQuit(Char_t *fileName, Char_t *graphicsFormat);
- virtual void SaveDataAscii();
+ virtual void ExportData(const Char_t *fileName);
private:
+ Bool_t fStartWithFourier; ///< flag if true, the Fourier transform will be presented bypassing the time domain representation
Int_t fTimeout; ///< timeout after which the Done signal should be emited. If timeout <= 0, no timeout is taking place
Bool_t fScaleN0AndBkg; ///< true=N0 and background is scaled to (1/ns), otherwise (1/bin) for the single histogram case
Bool_t fBatchMode; ///< musrview in ROOT batch mode
@@ -259,7 +260,6 @@ class PMusrCanvas : public TObject, public TQObject
TRootCanvas *fImp; ///< ROOT native GUI version of main window with menubar and drawing area
TGMenuBar *fBar; ///< menu bar
TGPopupMenu *fPopupMain; ///< popup menu Musrfit in the main menu bar
- TGPopupMenu *fPopupSave; ///< popup menu of the Musrfit/Save Data sub menu
TGPopupMenu *fPopupFourier; ///< popup menu of the Musrfit/Fourier sub menu
// canvas related variables
diff --git a/src/include/PPrepFourier.h b/src/include/PPrepFourier.h
index d1066809..de945f4b 100644
--- a/src/include/PPrepFourier.h
+++ b/src/include/PPrepFourier.h
@@ -34,7 +34,8 @@
#include
using namespace std;
-#include "TH1F.h"
+#include
+#include
#include "PMusr.h"
@@ -59,16 +60,16 @@ typedef struct {
class PPrepFourier {
public:
PPrepFourier();
- PPrepFourier(const Int_t *bkgRange, const Int_t packing);
+ PPrepFourier(const Int_t packing, const Int_t *bkgRange, PDoubleVector bkg);
virtual ~PPrepFourier();
- void SetBkgRange(const Int_t *bkgRange);
- void SetPacking(const Int_t packing);
- void AddData(musrFT_data &data);
- void DoBkgCorrection();
- void DoPacking();
- void DoFiltering();
- void DoLifeTimeCorrection(Double_t fudge);
+ virtual void SetBkgRange(const Int_t *bkgRange);
+ virtual void SetBkg(PDoubleVector bkg);
+ virtual void SetPacking(const Int_t packing);
+ virtual void AddData(musrFT_data &data);
+ virtual void DoBkgCorrection();
+ virtual void DoPacking();
+ virtual void DoLifeTimeCorrection(Double_t fudge);
TString GetInfo(const UInt_t idx);
UInt_t GetNoOfData() { return fRawData.size(); }
@@ -79,9 +80,10 @@ class PPrepFourier {
vector fRawData;
vectorfData;
Int_t fBkgRange[2];
+ PDoubleVector fBkg;
Int_t fPacking;
- void InitData();
+ virtual void InitData();
};
#endif // _PPREPFOURIER_H_
diff --git a/src/musrFT.cpp b/src/musrFT.cpp
index 68d3c47b..c0f0b230 100644
--- a/src/musrFT.cpp
+++ b/src/musrFT.cpp
@@ -65,7 +65,8 @@ typedef struct {
TString graphicFormat; ///< format for the graphical output dump
TString dumpFln; ///< dump file name for Fourier data output
TString msrFlnOut; ///< dump file name for msr-file generation
- int bkg[2]; ///< background range
+ int bkg_range[2]; ///< background range
+ vector bkg; ///< background value
TString fourierOpt; ///< Fourier options, i.e. real, imag, power, phase
TString apodization; ///< apodization setting: none, weak, medium, strong
int fourierPower; ///< Fourier power for zero padding, i.e. 2^fourierPower points
@@ -95,7 +96,7 @@ void musrFT_syntax()
cout << endl << " -df, --data-file : This allows to feed only muSR data file(s) to";
cout << endl << " perform the Fourier transform. Since the extended information";
cout << endl << " are missing, they will need to be provided by to options, or musrFT";
- cout << endl << " tries to guess, based on musrFT_startup.xml settings.";
+ cout << endl << " tries to guess, based on musrfit_startup.xml settings.";
cout << endl << " Options: ";
cout << endl << " --help : display this help and exit";
cout << endl << " --version : output version information and exit";
@@ -106,13 +107,13 @@ void musrFT_syntax()
cout << endl << " Supported graphic-format-extension: eps, pdf, gif, jpg, png, svg, xpm, root";
cout << endl << " --dump : rather than starting a root session and showing Fourier graphs of the data,";
cout << endl << " it will output the Fourier data in an ascii file .";
- cout << endl << " --filter : filter and filter-specific-information -- ***TO BE WRITTEN YET***.";
- cout << endl << " -b, --background : background interval used to estimate the backround to be";
+ cout << endl << " -br, --background-range : background interval used to estimate the background to be";
cout << endl << " subtracted before the Fourier transform. , to be given in bins.";
+ cout << endl << " -bg, --background : gives the background explicit for each histogram.";
cout << endl << " -fo, --fourier-option : can be 'real', 'imag', 'real+imag', 'power', or 'phase'.";
- cout << endl << " If this is not defined (neither on the command line nor in the musrFT_startup.xml),";
+ cout << endl << " If this is not defined (neither on the command line nor in the musrfit_startup.xml),";
cout << endl << " default will be 'power'.";
- cout << endl << " -apod, --apodization : can be either 'none', 'weak', 'medium', 'strong'.";
+ cout << endl << " -ap, --apodization : can be either 'none', 'weak', 'medium', 'strong'.";
cout << endl << " Default will be 'none'.";
cout << endl << " -fp, --fourier-power : being the Fourier power, i.e. 2^ used for zero padding.";
cout << endl << " Default is -1, i.e. no zero padding will be performed.";
@@ -132,9 +133,10 @@ void musrFT_syntax()
cout << endl << " E.g. musrFT -df lem15_his_01234.root --histo 1 3, will only be needed together with";
cout << endl << " the option --data-file. If multiple data file are given, will apply";
cout << endl << " to all data-files given. If --histo is not given, all histos of a data file will be used.";
+ cout << endl << " can be anything like: 2 3 6, or 2-17, or 1-6 9, etc.";
cout << endl << " -a, --average : show the average of all Fourier transformed data.";
cout << endl << " --t0 : A list of t0's can be provided. This in conjunction with --data-file and";
- cout << endl << " --fourier-option real allows to get the proper inital phase if t0's are known.";
+ cout << endl << " --fourier-option real allows to get the proper initial phase if t0's are known.";
cout << endl << " If a single t0 for multiple histos is given, it is assume, that this t0 is common";
cout << endl << " to all histos.";
cout << endl << " Example: musrFT -df lem15_his_01234.root -fo real --t0 2750 --histo 1 3";
@@ -160,8 +162,8 @@ void musrFT_init(musrFT_startup_param &startupParam)
startupParam.graphicFormat = TString("");
startupParam.dumpFln = TString("");
startupParam.msrFlnOut = TString("");
- startupParam.bkg[0] = -1;
- startupParam.bkg[1] = -1;
+ startupParam.bkg_range[0] = -1;
+ startupParam.bkg_range[1] = -1;
startupParam.fourierOpt = TString("??");
startupParam.apodization = TString("none");
startupParam.fourierPower = -1;
@@ -321,27 +323,44 @@ int musrFT_parse_options(int argc, char *argv[], musrFT_startup_param &startupPa
}
startupParam.dumpFln = argv[i+1];
i++;
- } else if (tstr.Contains("--filter")) {
- cout << endl << "debug> found option filter. NOT YET ANY FUNCTIONALITY." << endl;
- } else if (tstr.Contains("-b") || tstr.Contains("--background")) {
+ } else if (tstr.Contains("-br") || tstr.Contains("--background-range")) {
if (i+2 >= argc) { // something is wrong since there needs to be two arguments here
- cerr << endl << ">> musrFT **ERROR** found option --background with wrong number of arguments." << endl;
+ cerr << endl << ">> musrFT **ERROR** found option --background-range with wrong number of arguments." << endl;
return 2;
}
- TString bkg[2];
- bkg[0] = argv[i+1];
- bkg[1] = argv[i+2];
- if (!bkg[0].IsDigit()) {
- cerr << endl << ">> musrFT **ERROR** bin of option --background is NOT an int-number! ('" << bkg[0] << "')." << endl;
+ TString bkgRange[2];
+ bkgRange[0] = argv[i+1];
+ bkgRange[1] = argv[i+2];
+ if (!bkgRange[0].IsDigit()) {
+ cerr << endl << ">> musrFT **ERROR** bin of option --background-range is NOT an int-number! ('" << bkgRange[0] << "')." << endl;
return 2;
}
- if (!bkg[1].IsDigit()) {
- cerr << endl << ">> musrFT **ERROR** bin of option --background is NOT an int-number! ('" << bkg[1] << "')." << endl;
+ if (!bkgRange[1].IsDigit()) {
+ cerr << endl << ">> musrFT **ERROR** bin of option --background-range is NOT an int-number! ('" << bkgRange[1] << "')." << endl;
return 2;
}
- startupParam.bkg[0] = bkg[0].Atoi();
- startupParam.bkg[1] = bkg[1].Atoi();
+ startupParam.bkg_range[0] = bkgRange[0].Atoi();
+ startupParam.bkg_range[1] = bkgRange[1].Atoi();
i += 2;
+ } else if (tstr.BeginsWith("-bg") || !tstr.CompareTo("--background")) {
+ TString topt("");
+ while (++i < argc) {
+ if (argv[i][0] == '-') {
+ --i;
+ break;
+ } else {
+ topt = argv[i];
+ if (!topt.IsFloat()) {
+ cerr << endl << ">> musrFT **ERROR** found option --background='" << topt << "' which is not a float" << endl;
+ return 2;
+ }
+ startupParam.bkg.push_back(topt.Atoi());
+ }
+ }
+ if (startupParam.bkg.size() == 0) { // something is wrong since there needs to be an argument here
+ cerr << endl << ">> musrFT **ERROR** found option --background without argument!" << endl;
+ return 2;
+ }
} else if (tstr.BeginsWith("-fo") || tstr.BeginsWith("--fourier-option")) {
if (i+1 >= argc) { // something is wrong since there needs to be two arguments here
cerr << endl << ">> musrFT **ERROR** found option --fourier-option without arguments." << endl;
@@ -354,7 +373,7 @@ int musrFT_parse_options(int argc, char *argv[], musrFT_startup_param &startupPa
}
startupParam.fourierOpt = topt;
i++;
- } else if (tstr.BeginsWith("-apod") || tstr.BeginsWith("--apodization")) {
+ } else if (tstr.BeginsWith("-ap") || tstr.BeginsWith("--apodization")) {
if (i+1 >= argc) { // something is wrong since there needs to be two arguments here
cerr << endl << ">> musrFT **ERROR** found option --apodization without arguments." << endl;
return 2;
@@ -453,7 +472,7 @@ int musrFT_parse_options(int argc, char *argv[], musrFT_startup_param &startupPa
startupParam.t0.push_back(topt.Atoi());
}
}
- if (startupParam.dataFln.size() == 0) { // something is wrong since there needs to be an argument here
+ if (startupParam.t0.size() == 0) { // something is wrong since there needs to be an argument here
cerr << endl << ">> musrFT **ERROR** found option --t0 without argument!" << endl;
return 2;
}
@@ -550,11 +569,11 @@ int musrFT_parse_options(int argc, char *argv[], musrFT_startup_param &startupPa
cerr << endl << ">> musrFT **ERROR** neither nor defined." << endl;
return 2;
}
- if (startupParam.bkg[0] > startupParam.bkg[1]) {
- cerr << endl << ">> musrFT **WARNING** in --background, start=" << startupParam.bkg[0] << " > end=" << startupParam.bkg[1] << ", will swap them." << endl;
- double swap = startupParam.bkg[0];
- startupParam.bkg[0] = startupParam.bkg[1];
- startupParam.bkg[1] = swap;
+ if (startupParam.bkg_range[0] > startupParam.bkg_range[1]) {
+ cerr << endl << ">> musrFT **WARNING** in --background-range, start=" << startupParam.bkg_range[0] << " > end=" << startupParam.bkg_range[1] << ", will swap them." << endl;
+ double swap = startupParam.bkg_range[0];
+ startupParam.bkg_range[0] = startupParam.bkg_range[1];
+ startupParam.bkg_range[1] = swap;
}
if (startupParam.fourierRange[0] > startupParam.fourierRange[1]) {
cerr << endl << ">> musrFT **WARNING** in --fourier-range, start=" << startupParam.fourierRange[0] << " > end=" << startupParam.fourierRange[1] << ", will swap them." << endl;
@@ -875,8 +894,8 @@ void musrFT_dumpMsrFile(musrFT_startup_param ¶m)
if ((param.t0.size() > 1) && (j < param.t0.size())) {
fout << "t0 " << param.t0[j] << endl;
}
- if ((param.bkg[0] > -1) && (param.bkg[1] > -1))
- fout << "background " << param.bkg[0] << " " << param.bkg[1] << endl;
+ if ((param.bkg_range[0] > -1) && (param.bkg_range[1] > -1))
+ fout << "background " << param.bkg_range[0] << " " << param.bkg_range[1] << endl;
fout << "#--------------------------------------------------------------" << endl;
}
}
@@ -1027,7 +1046,7 @@ int main(int argc, char *argv[])
startupHandler->SetStartupOptions(startup_options);
// defines the raw time-domain data vector
- PPrepFourier data(startupParam.bkg, startupParam.packing);
+ PPrepFourier data(startupParam.packing, startupParam.bkg_range, startupParam.bkg);
// load msr-file(s)
vector msrHandler;
@@ -1146,6 +1165,24 @@ int main(int argc, char *argv[])
if (fourierBlock->fFourierBlockPresent) {
// get units
unitTag = fourierBlock->fUnits;
+ if (startupParam.fourierUnits.BeginsWith("??")) {
+ switch (unitTag) {
+ case FOURIER_UNIT_GAUSS:
+ startupParam.fourierUnits = TString("Gauss");
+ break;
+ case FOURIER_UNIT_TESLA:
+ startupParam.fourierUnits = TString("Tesla");
+ break;
+ case FOURIER_UNIT_FREQ:
+ startupParam.fourierUnits = TString("MHz");
+ break;
+ case FOURIER_UNIT_CYCLES:
+ startupParam.fourierUnits = TString("Mc/s");
+ break;
+ default:
+ break;
+ }
+ }
// get fourier power
if (startupParam.fourierPower == -1) { // no Fourier power given from the command line, hence check FOURIER block
if (fourierBlock->fFourierPower > 1)
@@ -1277,9 +1314,6 @@ int main(int argc, char *argv[])
// calculate background levels and subtract them from the data
data.DoBkgCorrection();
- // do the time domain filtering now
- data.DoFiltering();
-
// do lifetime correction
if (startupParam.lifetimecorrection != 0.0)
data.DoLifeTimeCorrection(startupParam.lifetimecorrection);
@@ -1321,7 +1355,13 @@ int main(int argc, char *argv[])
fourier[i]->Transform(apodTag);
}
double end = millitime();
- cout << endl << "debug> after FFT. calculation time: " << (end-start)/1.0e3 << " (sec)." << endl;
+ cout << endl << "info> after FFT. calculation time: " << (end-start)/1.0e3 << " (sec)." << endl;
+
+ // make sure that a Fourier range is provided, if not calculate one
+ if ((startupParam.fourierRange[0] == -1.0) && (startupParam.fourierRange[1] == -1.0)) {
+ startupParam.fourierRange[0] = 0.0;
+ startupParam.fourierRange[1] = fourier[0]->GetMaxFreq();
+ }
PFourierCanvas *fourierCanvas = 0;
diff --git a/src/musredit/Makefile.am b/src/musredit/Makefile.am
new file mode 100644
index 00000000..2f509505
--- /dev/null
+++ b/src/musredit/Makefile.am
@@ -0,0 +1,5 @@
+## Process this file with automake to create Makefile.in
+
+CLEANFILES = *~ core
+
+
diff --git a/src/musredit/PAdmin.cpp b/src/musredit/PAdmin.cpp
index a94b3d70..ac360c58 100644
--- a/src/musredit/PAdmin.cpp
+++ b/src/musredit/PAdmin.cpp
@@ -85,6 +85,8 @@ bool PAdminXMLParser::startElement( const QString&, const QString&,
fKeyWord = eDefaultSavePath;
} else if (qName == "title_from_data_file") {
fKeyWord = eTitleFromDataFile;
+ } else if (qName == "musrview_show_fourier") {
+ fKeyWord = eMusrviewShowFourier;
} else if (qName == "enable_musrt0") {
fKeyWord = eEnableMusrT0;
} else if (qName == "keep_minuit2_output") {
@@ -130,7 +132,9 @@ bool PAdminXMLParser::startElement( const QString&, const QString&,
} else if (qName == "musr_web_statistic") {
fKeyWord = eHelpStatistic;
} else if (qName == "musr_web_msr2data") {
- fKeyWord = eHelpMsr2Data;
+ fKeyWord = eHelpMsr2Data;
+ } else if (qName == "musr_web_musrFT") {
+ fKeyWord = eHelpMusrFT;
} else if (qName == "chain_fit") {
fKeyWord = eChainFit;
} else if (qName == "write_data_header") {
@@ -240,6 +244,13 @@ bool PAdminXMLParser::characters(const QString& str)
flag = false;
fAdmin->setTitleFromDataFileFlag(flag);
break;
+ case eMusrviewShowFourier:
+ if (str == "y")
+ flag = true;
+ else
+ flag = false;
+ fAdmin->setMusrviewShowFourierFlag(flag);
+ break;
case eEnableMusrT0:
if (str == "y")
flag = true;
@@ -338,6 +349,9 @@ bool PAdminXMLParser::characters(const QString& str)
case eHelpMsr2Data:
fAdmin->setHelpUrl("msr2data", str);
break;
+ case eHelpMusrFT:
+ fAdmin->setHelpUrl("musrFT", str);
+ break;
case eChainFit:
if (str == "y")
flag = true;
@@ -598,6 +612,8 @@ PAdmin::PAdmin() : QObject()
fInstitute = QString("");
fFileFormat = QString("");
+ fMusrviewShowFourier = false;
+
fTitleFromDataFile = false;
fEnableMusrT0 = false;
fLifetimeCorrection = true;
diff --git a/src/musredit/PAdmin.h b/src/musredit/PAdmin.h
index 2fae7258..998a0e3a 100644
--- a/src/musredit/PAdmin.h
+++ b/src/musredit/PAdmin.h
@@ -69,12 +69,12 @@ class PAdminXMLParser : public QXmlDefaultHandler
private:
enum EAdminKeyWords {eEmpty, eTimeout, eKeepMinuit2Output, eDumpAscii, eDumpRoot,
- eTitleFromDataFile, eChisqPreRunBlock, eEstimateN0, eEnableMusrT0,
+ eTitleFromDataFile, eChisqPreRunBlock, eEstimateN0, eMusrviewShowFourier, eEnableMusrT0,
eFontName, eFontSize, eExecPath, eDefaultSavePath,
eRecentFile, eBeamline, eInstitute, eFileFormat, eLifetimeCorrection, eMsrDefaultFilePath,
eTheoFuncPixmapPath, eFunc, eFuncName, eFuncComment, eFuncLabel,
eFuncPixmap, eFuncParams, eHelpMain, eHelpTitle, eHelpParameters, eHelpTheory, eHelpFunctions,
- eHelpRun, eHelpCommand, eHelpFourier, eHelpPlot, eHelpStatistic, eHelpMsr2Data,
+ eHelpRun, eHelpCommand, eHelpFourier, eHelpPlot, eHelpStatistic, eHelpMsr2Data, eHelpMusrFT,
eChainFit, eWriteDataHeader, eIgnoreDataHeaderInfo, eWriteColumnData,
eRecreateDataFile, eOpenFileAfterFitting, eCreateMsrFileOnly, eFitOnly, eGlobal, eGlobalPlus};
@@ -118,6 +118,7 @@ class PAdmin : public QObject
QString getExecPath() { return fExecPath; }
QString getDefaultSavePath() { return fDefaultSavePath; }
bool getTitleFromDataFileFlag() { return fTitleFromDataFile; }
+ bool getMusrviewShowFourierFlag() { return fMusrviewShowFourier; }
bool getEnableMusrT0Flag() { return fEnableMusrT0; }
bool getKeepMinuit2OutputFlag() { return fKeepMinuit2Output; }
bool getDumpAsciiFlag() { return fDumpAscii; }
@@ -139,6 +140,7 @@ class PAdmin : public QObject
void setTimeout(const int ival) { fTimeout = ival; }
void setTitleFromDataFileFlag(const bool flag) { fTitleFromDataFile = flag; }
+ void setMusrviewShowFourierFlag(const bool flag) { fMusrviewShowFourier = flag; }
void setEnableMusrT0Flag(const bool flag) { fEnableMusrT0 = flag; }
void setKeepMinuit2OutputFlag(const bool flag) { fKeepMinuit2Output = flag; }
void setDumpAsciiFlag(const bool flag) { fDumpAscii = flag; }
@@ -180,13 +182,14 @@ class PAdmin : public QObject
QVector fRecentFile; ///< keep vector of recent path-file names
- bool fKeepMinuit2Output; ///< flag indicating if the Minuit2 output shall be kept (default: no)
- bool fDumpAscii; ///< flag indicating if musrfit shall make an ascii-dump file (for debugging purposes, default: no).
- bool fDumpRoot; ///< flag indicating if musrfit shall make an root-dump file (for debugging purposes, default: no).
- bool fTitleFromDataFile; ///< flag indicating if the title should be extracted from the data file (default: yes).
- bool fChisqPreRunBlock; ///< flag indicating if musrfit shall write 'per run block' chisq to the msr-file (default: no).
- bool fEstimateN0; ///< flag indicating if musrfit shall estimate N0 for single histogram fits (default: yes).
- bool fEnableMusrT0; ///< flag indicating if musrT0 shall be enabled at startup from within musredit (default: yes).
+ bool fMusrviewShowFourier; ///< flag indicating if musrview should show at startup data (=false) or Fourier of data (=true).
+ bool fKeepMinuit2Output; ///< flag indicating if the Minuit2 output shall be kept (default: no)
+ bool fDumpAscii; ///< flag indicating if musrfit shall make an ascii-dump file (for debugging purposes, default: no).
+ bool fDumpRoot; ///< flag indicating if musrfit shall make an root-dump file (for debugging purposes, default: no).
+ bool fTitleFromDataFile; ///< flag indicating if the title should be extracted from the data file (default: yes).
+ bool fChisqPreRunBlock; ///< flag indicating if musrfit shall write 'per run block' chisq to the msr-file (default: no).
+ bool fEstimateN0; ///< flag indicating if musrfit shall estimate N0 for single histogram fits (default: yes).
+ bool fEnableMusrT0; ///< flag indicating if musrT0 shall be enabled at startup from within musredit (default: yes).
QString fBeamline; ///< name of the beamline. Used to generate default run header lines.
QString fInstitute; ///< name of the institute. Used to generate default run header lines.
diff --git a/src/musredit/PGetMusrFTOptionsDialog.cpp b/src/musredit/PGetMusrFTOptionsDialog.cpp
new file mode 100644
index 00000000..8c05f541
--- /dev/null
+++ b/src/musredit/PGetMusrFTOptionsDialog.cpp
@@ -0,0 +1,565 @@
+/****************************************************************************
+
+ PGetMusrFTOptionsDialog.cpp
+
+ Author: Andreas Suter
+ e-mail: andreas.suter@psi.ch
+
+*****************************************************************************/
+
+/***************************************************************************
+ * Copyright (C) 2009-2015 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
+#include
+#include
+#include
+
+#include "PHelp.h"
+
+#include "PGetMusrFTOptionsDialog.h"
+
+#define MUSRFT_OPT_UNDEF 0
+#define MUSRFT_OPT_REAL 1
+#define MUSRFT_OPT_IMAG 2
+#define MUSRFT_OPT_REAL_AND_IMAG 3
+#define MUSRFT_OPT_POWER 4
+#define MUSRFT_OPT_PHASE 5
+
+#define MUSRFT_APOD_UNDEF 0
+#define MUSRFT_APOD_WEAK 1
+#define MUSRFT_APOD_MEDIUM 2
+#define MUSRFT_APOD_STRONG 3
+
+#define MUSRFT_UNIT_UNDEF 0
+#define MUSRFT_UNIT_GAUSS 1
+#define MUSRFT_UNIT_TESLA 2
+#define MUSRFT_UNIT_FREQ 3
+#define MUSRFT_UNIT_CYCLE 4
+
+//----------------------------------------------------------------------------------------------------
+/**
+ *
Constructor.
+ *
+ * \param currentMsrFile path-file name of the currently active msr-file in musredit
+ * \param prevCmd list of the last (potential) previously call.
+ * \param helpUrl help url for the asymmetry run block
+ */
+PGetMusrFTOptionsDialog::PGetMusrFTOptionsDialog(QString currentMsrFile, QStringList &prevCmd, const QString helpUrl) :
+ fCurrentMsrFileName(currentMsrFile), fHelpUrl(helpUrl)
+{
+ setupUi(this);
+ setModal(true);
+
+ fBkgRangeStartBin_lineEdit->setValidator( new QIntValidator(fBkgRangeStartBin_lineEdit) );
+ fBkgRangeEndBin_lineEdit->setValidator( new QIntValidator(fBkgRangeEndBin_lineEdit) );
+ fPacking_lineEdit->setValidator( new QIntValidator(fPacking_lineEdit) );
+ fTimeRangeStart_lineEdit->setValidator( new QDoubleValidator(fTimeRangeStart_lineEdit) );
+ fTimeRangeEnd_lineEdit->setValidator( new QDoubleValidator(fTimeRangeEnd_lineEdit) );
+ fFourierPower_lineEdit->setValidator( new QIntValidator(fFourierPower_lineEdit) );
+ fLifetimeCorrection_lineEdit->setValidator( new QDoubleValidator(fLifetimeCorrection_lineEdit) );
+ fFourierRangeStart_lineEdit->setValidator( new QDoubleValidator(fFourierRangeStart_lineEdit) );
+ fFourierRangeEnd_lineEdit->setValidator( new QDoubleValidator(fFourierRangeEnd_lineEdit) );
+ fPacking_lineEdit->setText("1");
+
+ // populate dialog with the previous cmd call
+ bool msrTag = true;
+ QString str, str1, line;
+ int idx;
+ for (int i=0; isetText(line);
+ msrTag = false;
+ }
+ // collect data-file-names
+ if (prevCmd[i] == "-df") {
+ i++;
+ line = "";
+ while (!prevCmd[i].startsWith("-") && (isetText(line);
+ }
+ // background-range
+ if (prevCmd[i] == "-br") {
+ fBkgRangeStartBin_lineEdit->setText(prevCmd[++i]);
+ fBkgRangeEndBin_lineEdit->setText(prevCmd[++i]);
+ }
+ // fourier-option
+ if (prevCmd[i] == "-fo") {
+ if (prevCmd[i+1] == "real")
+ fFourierOption_comboBox->setCurrentIndex(MUSRFT_OPT_REAL);
+ else if (prevCmd[i+1] == "imag")
+ fFourierOption_comboBox->setCurrentIndex(MUSRFT_OPT_IMAG);
+ else if (prevCmd[i+1] == "real+imag")
+ fFourierOption_comboBox->setCurrentIndex(MUSRFT_OPT_REAL_AND_IMAG);
+ else if (prevCmd[i+1] == "power")
+ fFourierOption_comboBox->setCurrentIndex(MUSRFT_OPT_POWER);
+ else if (prevCmd[i+1] == "phase")
+ fFourierOption_comboBox->setCurrentIndex(MUSRFT_OPT_PHASE);
+ else
+ fFourierOption_comboBox->setCurrentIndex(MUSRFT_OPT_UNDEF);
+ i++;
+ }
+ // apodization
+ if (prevCmd[i] == "-ap") {
+ if (prevCmd[i+1] == "weak")
+ fApodization_comboBox->setCurrentIndex(MUSRFT_APOD_WEAK);
+ else if (prevCmd[i+1] == "medium")
+ fApodization_comboBox->setCurrentIndex(MUSRFT_APOD_MEDIUM);
+ else if (prevCmd[i+1] == "strong")
+ fApodization_comboBox->setCurrentIndex(MUSRFT_APOD_STRONG);
+ else
+ fApodization_comboBox->setCurrentIndex(MUSRFT_APOD_UNDEF);
+ i++;
+ }
+ // fourier-power
+ if (prevCmd[i] == "-fp") {
+ fFourierPower_lineEdit->setText(prevCmd[++i]);
+ }
+ // units
+ if (prevCmd[i] == "-u") {
+ if (prevCmd[i+1] == "Gauss")
+ fFourierUnits_comboBox->setCurrentIndex(MUSRFT_UNIT_GAUSS);
+ else if (prevCmd[i+1] == "Tesla")
+ fFourierUnits_comboBox->setCurrentIndex(MUSRFT_UNIT_TESLA);
+ else if (prevCmd[i+1] == "MHz")
+ fFourierUnits_comboBox->setCurrentIndex(MUSRFT_UNIT_FREQ);
+ else if (prevCmd[i+1] == "Mc/s")
+ fFourierUnits_comboBox->setCurrentIndex(MUSRFT_UNIT_CYCLE);
+ else
+ fFourierUnits_comboBox->setCurrentIndex(MUSRFT_UNIT_UNDEF);
+ i++;
+ }
+ // phase
+ if (prevCmd[i] == "-ph") {
+ // NOT YET IMPLEMENTED
+ }
+ // fourier-range
+ if (prevCmd[i] == "-fr") {
+ fFourierRangeStart_lineEdit->setText(prevCmd[++i]);
+ fFourierRangeEnd_lineEdit->setText(prevCmd[++i]);
+ }
+ // time-range
+ if (prevCmd[i] == "-tr") {
+ fTimeRangeStart_lineEdit->setText(prevCmd[++i]);
+ fTimeRangeEnd_lineEdit->setText(prevCmd[++i]);
+ }
+ // histo list
+ if (prevCmd[i] == "--histo") {
+ i++;
+ line = "";
+ while (!prevCmd[i].startsWith("-") && (isetText(line);
+ }
+ // average tag
+ if (prevCmd[i] == "-a") {
+ fAveragedView_checkBox->setCheckState(Qt::Checked);
+ }
+ // t0 list
+ if (prevCmd[i] == "--t0") {
+ i++;
+ line = "";
+ while (!prevCmd[i].startsWith("-") && (isetText(line);
+ }
+ // packing
+ if (prevCmd[i] == "-pa") {
+ fPacking_lineEdit->setText(prevCmd[++i]);
+ }
+ // title
+ if (prevCmd[i] == "--title") {
+ fFourierTitle_lineEdit->setText(prevCmd[i+1]);
+ }
+ // create msr-file tag
+ if (prevCmd[i] == "--create-msr-file") {
+ fCreateMsrFileName = prevCmd[++i];
+ fCreateMsrFile_checkBox->setCheckState(Qt::Checked);
+ }
+ // lifetime correction
+ if (prevCmd[i] == "-lc") {
+ fLifetimeCorrection_lineEdit->setText(prevCmd[++i]);
+ }
+ }
+
+ // connect all necessary single and slots
+ connect(fCurrentMsrFile_checkBox, SIGNAL( stateChanged(int) ), this, SLOT( currentMsrFileTagChanged(int) ) );
+ connect(fAllMsrFiles_checkBox, SIGNAL( stateChanged(int) ), this, SLOT( allMsrFileTagChanged(int) ) );
+ connect(fMsrFileSelector_pushButton, SIGNAL( clicked() ), this, SLOT( selectMsrFileNames() ) );
+ connect(fDataFileSelector_pushButton, SIGNAL( clicked() ), this, SLOT( selectDataFileNames() ) );
+ connect(fCreateMsrFile_checkBox, SIGNAL( stateChanged(int) ), this, SLOT( createMsrFileChanged(int) ) );
+ connect(fMsrFileNameClear_pushButton, SIGNAL (clicked() ), this, SLOT( clearMsrFileNames() ) );
+ connect(fDataFileNameClear_pushButton, SIGNAL (clicked() ), this, SLOT( clearDataFileNames() ) );
+ connect(fResetAll_pushButton, SIGNAL( clicked() ), this, SLOT( resetAll() ) );
+}
+
+//----------------------------------------------------------------------------------------------------
+/**
+ *
SLOT called when fCurrentMsrFile_checkBox is checked/unchecked. If checked, it will clean up
+ * the msr-file path-file list and the data-file path-file list.
+ */
+void PGetMusrFTOptionsDialog::currentMsrFileTagChanged(int state)
+{
+ if (state == Qt::Checked) {
+ fAllMsrFiles_checkBox->setCheckState(Qt::Unchecked);
+
+ // remove all msr-data-file-names and data-path-file-names
+ fMsrFilePaths.clear();
+ fMsrFileNames.clear();
+ fMsrFileSelector_lineEdit->setText("");
+ fDataFilePaths.clear();
+ fDataFileNames.clear();
+ fDataFileSelector_lineEdit->setText("");
+ }
+}
+
+//----------------------------------------------------------------------------------------------------
+/**
+ *
SLOT called when fAllMsrFiles_checkBox is checked/unchecked. Currently it has no functionality.
+ */
+void PGetMusrFTOptionsDialog::allMsrFileTagChanged(int state)
+{
+ if (state == Qt::Checked) {
+ fCurrentMsrFile_checkBox->setCheckState(Qt::Unchecked);
+ }
+}
+
+//----------------------------------------------------------------------------------------------------
+/**
+ *
SLOT called when fMsrFileSelector_pushButton is clicked. Collects the msr-file path-name list.
+ */
+void PGetMusrFTOptionsDialog::selectMsrFileNames()
+{
+ QStringList flns = QFileDialog::getOpenFileNames( this, tr("Open msr-File(s)"), tr( "./" ),
+ tr( "msr-Files (*.msr);;All Files (*)" ));
+
+ QString str(""), str1("");
+ int idx;
+ if (flns.size() > 0) {
+ // delete already present elements
+ fMsrFilePaths.clear();
+ fMsrFileNames.clear();
+
+ // split path-name into path and name
+ for (int i=0; isetText(str);
+ }
+}
+
+//----------------------------------------------------------------------------------------------------
+/**
+ *
SLOT called when the fMsrFileNameClear_pushButton is clicked.
+ */
+void PGetMusrFTOptionsDialog::clearMsrFileNames()
+{
+ fMsrFileSelector_lineEdit->setText("");
+ fMsrFilePaths.clear();
+ fMsrFileNames.clear();
+}
+
+//----------------------------------------------------------------------------------------------------
+/**
+ *
SLOT called when fDataFileSelector_pushButton is clicked. Collects the data-file path-name list.
+ */
+void PGetMusrFTOptionsDialog::selectDataFileNames()
+{
+ QStringList flns = QFileDialog::getOpenFileNames( this, tr("Open msr-File(s)"), tr( "./" ),
+ tr( "data-Files (*.root *.bin *.msr *.nxs *.mdu);;All Files (*)" ));
+
+ QString str(""), str1("");
+ int idx;
+ if (flns.size() > 0) {
+ // delete already present elements
+ fDataFilePaths.clear();
+ fDataFileNames.clear();
+
+ // split path-name into path and name
+ for (int i=0; isetText(str);
+ }
+}
+
+//----------------------------------------------------------------------------------------------------
+/**
+ *
SLOT called when the fDataFileNameClear_pushButton is clicked.
+ */
+void PGetMusrFTOptionsDialog::clearDataFileNames()
+{
+ fDataFileSelector_lineEdit->setText("");
+ fDataFilePaths.clear();
+ fDataFileNames.clear();
+}
+
+//----------------------------------------------------------------------------------------------------
+/**
+ *
SLOT called when the create-msr-file tag has changed
+ */
+void PGetMusrFTOptionsDialog::createMsrFileChanged(int state)
+{
+ if (state == Qt::Checked) {
+ fCreateMsrFileName = QFileDialog::getSaveFileName(this, tr("Create msr-file"), "./", tr("msr-Files (*.msr);;All Files (*)"));
+ if (fCreateMsrFileName.length() == 0)
+ fCreateMsrFile_checkBox->setCheckState(Qt::Unchecked);
+ } else {
+ fCreateMsrFileName = "";
+ }
+}
+
+//----------------------------------------------------------------------------------------------------
+/**
+ *
Generates a help content window showing the description for musrFT.
+ */
+void PGetMusrFTOptionsDialog::helpContent()
+{
+ if (fHelpUrl.isEmpty()) {
+ QMessageBox::information(this, "**INFO**", "Will eventually show a help window");
+ } else {
+#ifdef _WIN32GCC
+ QMessageBox::information(this, "**INFO**", "If a newer Qt version was available, a help window would be shown!");
+#else
+ PHelp *help = new PHelp(fHelpUrl);
+ help->show();
+#endif // _WIN32GCC
+ }
+}
diff --git a/src/musredit/PGetMusrFTOptionsDialog.h b/src/musredit/PGetMusrFTOptionsDialog.h
new file mode 100644
index 00000000..8d3e0942
--- /dev/null
+++ b/src/musredit/PGetMusrFTOptionsDialog.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+
+ PGetMusrFTOptionsDialog.h
+
+ Author: Andreas Suter
+ e-mail: andreas.suter@psi.ch
+
+*****************************************************************************/
+
+/***************************************************************************
+ * Copyright (C) 2010-2015 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 _PGETMUSRFTOPTIONSDIALOG_H_
+#define _PGETMUSRFTOPTIONSDIALOG_H_
+
+#include
+#include
+
+#include "ui_PGetMusrFTOptionsDialog.h"
+
+class PGetMusrFTOptionsDialog : public QDialog, private Ui::PGetMusrFTOptionsDialog
+{
+ Q_OBJECT
+
+ public:
+ PGetMusrFTOptionsDialog(QString currentMsrFile, QStringList &prevCmd, const QString helpUrl);
+ QStringList getMusrFTOptions();
+
+ public slots:
+ void helpContent();
+
+ private slots:
+ void currentMsrFileTagChanged(int state);
+ void allMsrFileTagChanged(int state);
+ void selectMsrFileNames();
+ void clearMsrFileNames();
+ void selectDataFileNames();
+ void clearDataFileNames();
+ void createMsrFileChanged(int state);
+ void resetAll();
+
+ private:
+ QStringList fMsrFilePaths; ///< list keeping all the paths from the msr-file path-name list
+ QStringList fMsrFileNames; ///< list keeping all the names from the msr-file path-name list
+ QStringList fDataFilePaths; ///< list keeping all the paths from the data-file path-name list
+ QStringList fDataFileNames; ///< list keeping all the names from the data-file path-name list
+ QString fCreateMsrFileName; ///< keeps the msr-path-file name for msr-file creation
+ QString fCurrentMsrFileName; ///< keeps the msr-path-file name of the currently active msr-file in musredit.
+ QString fHelpUrl; ///< help url for the asymmetry run block
+};
+
+#endif // _PGETMUSRFTOPTIONSDIALOG_H_
diff --git a/src/musredit/PPrefsDialog.cpp b/src/musredit/PPrefsDialog.cpp
index fb18d832..a6fb9ca3 100644
--- a/src/musredit/PPrefsDialog.cpp
+++ b/src/musredit/PPrefsDialog.cpp
@@ -61,6 +61,7 @@ PPrefsDialog::PPrefsDialog(PAdmin *admin) : fAdmin(admin)
fEnableMusrT0_checkBox->setChecked(fAdmin->getEnableMusrT0Flag());
fPerRunBlockChisq_checkBox->setChecked(fAdmin->getChisqPerRunBlockFlag());
fEstimateN0_checkBox->setChecked(fAdmin->getEstimateN0Flag());
+ fFourier_checkBox->setChecked(fAdmin->getMusrviewShowFourierFlag());
fTimeout_lineEdit->setText(QString("%1").arg(fAdmin->getTimeout()));
fTimeout_lineEdit->setValidator(new QIntValidator(fTimeout_lineEdit));
diff --git a/src/musredit/PPrefsDialog.h b/src/musredit/PPrefsDialog.h
index 7bf6d89f..5f113eb1 100644
--- a/src/musredit/PPrefsDialog.h
+++ b/src/musredit/PPrefsDialog.h
@@ -46,6 +46,7 @@ class PPrefsDialog : public QDialog, private Ui::PPrefsDialog
public:
PPrefsDialog(PAdmin *admin);
+ bool getMusrviewShowFourierFlag() { return fFourier_checkBox->isChecked(); }
bool getKeepMinuit2OutputFlag() { return fKeepMn2Output_checkBox->isChecked(); }
bool getTitleFromDataFileFlag() { return fTitleFromData_checkBox->isChecked(); }
bool getEnableMusrT0Flag() { return fEnableMusrT0_checkBox->isChecked(); }
diff --git a/src/musredit/PTextEdit.cpp b/src/musredit/PTextEdit.cpp
index 08cc9e18..94334ab3 100644
--- a/src/musredit/PTextEdit.cpp
+++ b/src/musredit/PTextEdit.cpp
@@ -55,6 +55,7 @@ using namespace std;
#include
#include
#include
+#include
#include
@@ -68,6 +69,7 @@ using namespace std;
#include "PFitOutputHandler.h"
#include "PDumpOutputHandler.h"
#include "PPrefsDialog.h"
+#include "PGetMusrFTOptionsDialog.h"
#include "PGetDefaultDialog.h"
#include "PMusrEditAbout.h"
#include "PMsr2DataDialog.h"
@@ -550,6 +552,12 @@ void PTextEdit::setupMusrActions()
menu->addAction(fMusrT0Action);
fMusrT0Action->setEnabled(fAdmin->getEnableMusrT0Flag());
+ a = new QAction( QIcon( QPixmap (":/images/musrFT.xpm") ), tr( "Raw Fourier" ), this );
+ a->setStatusTip( tr("Start musrFT") );
+ connect( a, SIGNAL( triggered() ), this, SLOT( musrFT() ) );
+ tb->addAction(a);
+ menu->addAction(a);
+
a = new QAction( QIcon( QPixmap( ":/images/musrprefs.xpm" ) ), tr( "&Preferences" ), this );
a->setStatusTip( tr("Show Preferences") );
connect( a, SIGNAL( triggered() ), this, SLOT( musrPrefs() ) );
@@ -2183,7 +2191,10 @@ void PTextEdit::musrView()
str = *fFilenames.find( currentEditor() );
QString numStr;
numStr.setNum(fAdmin->getTimeout());
- cmd += str + "\" --timeout " + numStr + " &";
+ cmd += str + "\" --timeout " + numStr;
+ if (fAdmin->getMusrviewShowFourierFlag())
+ cmd += " -f ";
+ cmd += " &";
int status=system(cmd.toLatin1());
}
@@ -2223,6 +2234,33 @@ void PTextEdit::musrT0()
QString fln = *fFilenames.find( currentEditor() );
}
+//----------------------------------------------------------------------------------------------------
+/**
+ *
Calls musrFT via selection/option dialog. It will ask the user if he/she wants to overwrite some
+ * of the default settings.
+ */
+void PTextEdit::musrFT()
+{
+
+ PGetMusrFTOptionsDialog *dlg = new PGetMusrFTOptionsDialog(*fFilenames.find( currentEditor() ), fMusrFTPrevCmd, fAdmin->getHelpUrl("musrFT"));
+
+ if (dlg == 0) {
+ QMessageBox::critical(this, "**ERROR** musrFT", "Couldn't invoke musrFT Options Dialog.");
+ return;
+ }
+
+ if (dlg->exec() == QDialog::Accepted) {
+ fMusrFTPrevCmd = dlg->getMusrFTOptions();
+ QProcess proc(this);
+ proc.setStandardOutputFile("musrFT.log");
+ proc.setStandardErrorFile("musrFT.log");
+ proc.startDetached("musrFT", fMusrFTPrevCmd);
+ }
+
+ delete dlg;
+ dlg = 0;
+}
+
//----------------------------------------------------------------------------------------------------
/**
*