Merged muonspin/musrfit/root6 into master

This commit is contained in:
Zaher Salman 2017-01-19 09:22:28 +01:00
commit 3141548262
46 changed files with 897 additions and 575 deletions

View File

@ -130,6 +130,8 @@ NEW 2015-02-13 first implementation of a standalone Fourier transform/plotter:
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
a typical msr-file. Duplicate entries from the RUN blocks can be
added here. Furthermore, the 'lifetimecorrection' flag is

View File

@ -1119,6 +1119,9 @@ case "${host_cpu}" in
;;
esac
CXXFLAGS="-std=c++11 ${CXXFLAGS}"
AC_SUBST(CXXFLAGS)
LOCAL_BIN_CXXFLAGS="${CPUFLAGS} -Wall -Wno-trigraphs"
LOCAL_LIB_CXXFLAGS="${LOCAL_BIN_CXXFLAGS}"
LOCAL_PSIBIN_LIB_CXXFLAGS="${LOCAL_LIB_CXXFLAGS}"
@ -1143,7 +1146,7 @@ case "$host" in
;;
*-*-darwin*)
ARCH=DARWIN
LOCAL_PSIBIN_LIB_CXXFLAGS="${LOCAL_LIB_CXXFLAGS} -D__linux__"
LOCAL_PSIBIN_LIB_CXXFLAGS="${LOCAL_LIB_CXXFLAGS} -D_Darwin_"
;;
*)
ARCH=OTHERUNIX

View File

@ -84,6 +84,14 @@ dict_cpp_sources = \
dict_cpp_sources_userFcn = \
PUserFcnBaseDict.cpp
pcmdir = $(libdir)
pcm_DATA = \
PFourierCanvasDict_rdict.pcm \
PMusrCanvasDict_rdict.pcm \
PMusrT0Dict_rdict.pcm \
PStartupHandlerDict_rdict.pcm \
PUserFcnBaseDict_rdict.pcm
include_HEADERS = $(h_sources) $(h_sources_userFcn)
noinst_HEADERS = $(h_linkdef) $(dict_h_sources) $(h_linkdef_userFcn) $(dict_h_sources_userFcn)
@ -92,7 +100,7 @@ AM_CXXFLAGS = $(LOCAL_LIB_CXXFLAGS)
BUILT_SOURCES = $(dict_cpp_sources) $(dict_h_sources) $(dict_cpp_sources_userFcn) $(dict_h_sources_userFcn)
AM_LDFLAGS = $(LOCAL_LIB_LDFLAGS) -L@ROOTLIBDIR@
CLEANFILES = *Dict.cpp *Dict.h *~ core
CLEANFILES = *Dict.cpp *Dict.h *Dict* *~ core
%Dict.cpp %Dict.h: ../include/%.h ../include/%LinkDef.h
@ROOTCINT@ -v -f $*Dict.cpp -c -p $(AM_CPPFLAGS) $^

View File

@ -507,7 +507,7 @@ TH1F* PFourier::GetPhaseOptRealFourier(const TH1F *re, const TH1F *im, vector<Do
phase.resize(2); // c0, c1
TAxis *axis = re->GetXaxis();
const TAxis *axis = re->GetXaxis();
Int_t minBin = 1;
Int_t maxBin = axis->GetNbins();

View File

@ -757,8 +757,8 @@ Bool_t PRunAsymmetry::SubtractEstimatedBkg()
beamPeriod = 0.0;
// check if start and end are in proper order
UInt_t start[2] = {fRunInfo->GetBkgRange(0), fRunInfo->GetBkgRange(2)};
UInt_t end[2] = {fRunInfo->GetBkgRange(1), fRunInfo->GetBkgRange(3)};
Int_t start[2] = {fRunInfo->GetBkgRange(0), fRunInfo->GetBkgRange(2)};
Int_t end[2] = {fRunInfo->GetBkgRange(1), fRunInfo->GetBkgRange(3)};
for (UInt_t i=0; i<2; i++) {
if (end[i] < start[i]) {
cout << endl << "PRunAsymmetry::SubtractEstimatedBkg(): end = " << end[i] << " > start = " << start[i] << "! Will swap them!";

View File

@ -746,8 +746,8 @@ Bool_t PRunAsymmetryRRF::SubtractEstimatedBkg()
beamPeriod = 0.0;
// check if start and end are in proper order
UInt_t start[2] = {fRunInfo->GetBkgRange(0), fRunInfo->GetBkgRange(2)};
UInt_t end[2] = {fRunInfo->GetBkgRange(1), fRunInfo->GetBkgRange(3)};
UInt_t start[2] = {(UInt_t)fRunInfo->GetBkgRange(0), (UInt_t)fRunInfo->GetBkgRange(2)};
UInt_t end[2] = {(UInt_t)fRunInfo->GetBkgRange(1), (UInt_t)fRunInfo->GetBkgRange(3)};
for (UInt_t i=0; i<2; i++) {
if (end[i] < start[i]) {
cout << endl << "PRunAsymmetryRRF::SubtractEstimatedBkg(): end = " << end[i] << " > start = " << start[i] << "! Will swap them!";

View File

@ -929,13 +929,20 @@ int main(int argc, char *argv[])
}
bool found_fln = false;
// 1st check if the file name is found in the current directory
string pathFln("");
pathFln = "./" + fileName;
// 1st check if the file name is the full path-file name and the file exists
pathFln = fileName;
if (dump_file_exists(pathFln))
found_fln = true;
// 2nd check if file name is found in any default search paths if not already found in the current directory
// 2nd check if the file name is found in the current directory
if (!found_fln) {
pathFln = "./" + fileName;
if (dump_file_exists(pathFln))
found_fln = true;
}
// 3rd check if file name is found in any default search paths if not already found in the current directory
if (!found_fln) {
PStringVector pathList = startupHandler->GetDataPathList();
for (unsigned int i=0; i<pathList.size(); i++) {

View File

@ -19,6 +19,9 @@ cpp_sources = \
dict_cpp_sources = \
BMWStartupHandlerDict.cpp
pcmdir = $(libdir)
pcm_DATA = BMWStartupHandlerDict_rdict.pcm
include_HEADERS = $(h_sources)
noinst_HEADERS = $(h_linkdef) $(dict_h_sources)
@ -27,7 +30,7 @@ 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
CLEANFILES = *Dict.cpp *Dict.h *Dict* *~ core
%Dict.cpp %Dict.h: %.h %LinkDef.h
@ROOTCINT@ -v -f $*Dict.cpp -c -p $(INCLUDES) $^

View File

@ -23,6 +23,11 @@ dict_cpp_sources = \
PMagProximityFitterDict.cpp \
PMPStartupHandlerDict.cpp
pcmdir = $(libdir)
pcm_DATA = \
PMagProximityFitterDict_rdict.pcm \
PMPStartupHandlerDict_rdict.pcm
include_HEADERS = $(h_sources)
noinst_HEADERS = $(h_linkdef) $(dict_h_sources)
@ -31,7 +36,7 @@ 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
CLEANFILES = *Dict.cpp *Dict.h *Dict* *~ core
%Dict.cpp %Dict.h: %.h %LinkDef.h
@ROOTCINT@ -v -f $*Dict.cpp -c -p $(AM_CPPFLAGS) $^

View File

@ -1,5 +1,4 @@
## Process this file with automake to create Makefile.in
## $Id$
h_sources = MuSR_td_PSI_bin.h
cpp_sources = MuSR_td_PSI_bin.cpp

View File

@ -205,7 +205,7 @@ typedef long int Int32;
#else /* other operating system */
/* 32 bit word length */
#if (defined(_WIN32) || defined(__linux__) || defined(_WIN32GCC))
#if (defined(_WIN32) || defined(__linux__) || defined(_Darwin_) || defined(_WIN32GCC))
typedef short Int16;
typedef int Int32;
#else

View File

@ -15,6 +15,9 @@ cpp_sources = \
dict_cpp_sources = \
TMusrRunHeaderDict.cpp
pcmdir = $(libdir)
pcm_DATA = TMusrRunHeaderDict_rdict.pcm
include_HEADERS = $(h_sources)
noinst_HEADERS = $(h_linkdef) $(dict_h_sources)
@ -23,7 +26,7 @@ AM_CXXFLAGS = $(LOCAL_LIB_CXXFLAGS)
BUILT_SOURCES = $(dict_cpp_sources) $(dist_h_sources)
AM_LDFLAGS = $(LOCAL_LIB_LDFLAGS) -L@ROOTLIBDIR@
CLEANFILES = *Dict.cpp *Dict.h *~ core
CLEANFILES = *Dict.cpp *Dict.h *Dict* *~ core
%Dict.cpp %Dict.h: %.h %LinkDef.h
@ROOTCINT@ -v -f $*Dict.cpp -c -p $(INCLUDES) $^

View File

@ -23,6 +23,11 @@ dict_cpp_sources = \
PNL_PippardFitterDict.cpp \
PNL_StartupHandlerDict.cpp
pcmdir = $(libdir)
pcm_DATA = \
PNL_PippardFitterDict_rdict.pcm \
PNL_StartupHandlerDict_rdict.pcm
include_HEADERS = $(h_sources)
noinst_HEADERS = $(h_linkdef) $(dict_h_sources)
@ -31,7 +36,7 @@ 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
CLEANFILES = *Dict.cpp *Dict.h *Dict* *~ core
%Dict.cpp %Dict.h: %.h %LinkDef.h
@ROOTCINT@ -v -f $*Dict.cpp -c -p $(AM_CPPFLAGS) $^

View File

@ -20,6 +20,11 @@ dict_cpp_sources = \
TLemStatsDict.cxx \
TLemRunHeaderDict.cxx
pcmdir = $(libdir)
pcm_DATA = \
TLemStatsDict_rdict.pcm \
TLemRunHeaderDict_rdict.pcm
include_HEADERS = $(h_sources)
noinst_HEADERS = $(h_linkdef) $(dict_h_sources)
@ -28,7 +33,7 @@ AM_CXXFLAGS = $(LOCAL_LIB_CXXFLAGS)
BUILT_SOURCES = $(dict_cpp_sources) $(dist_h_sources)
AM_LDFLAGS = $(LOCAL_LIB_LDFLAGS) -L@ROOTLIBDIR@
CLEANFILES = *Dict.cxx *Dict.h *~ core
CLEANFILES = *Dict.cxx *Dict.h *Dict* *~ core
%Dict.cxx %Dict.h: %.h %LinkDef.h
@ROOTCINT@ -v -f $*Dict.cxx -c -p $(INCLUDES) $^

View File

@ -15,6 +15,9 @@ cpp_sources = \
dict_cpp_sources = \
TCalcMeanFieldsLEMDict.cpp
pcmdir = $(libdir)
pcm_DATA = TCalcMeanFieldsLEMDict_rdict.pcm
include_HEADERS = $(h_sources)
noinst_HEADERS = $(h_linkdef) $(dict_h_sources)
@ -23,7 +26,7 @@ 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
CLEANFILES = *Dict.cpp *Dict.h *Dict* *~ core
%Dict.cpp %Dict.h: %.h %LinkDef.h
@ROOTCINT@ -v -f $*Dict.cpp -c -p $(AM_CPPFLAGS) $^

View File

@ -33,6 +33,12 @@ dict_cpp_sources = \
TSkewedGssDict.cpp \
TVortexDict.cpp
pcmdir = $(libdir)
pcm_DATA = \
TLondon1DDict_rdict.pcm \
TSkewedGssDict_rdict.pcm \
TVortexDict_rdict.pcm
include_HEADERS = $(h_sources)
noinst_HEADERS = $(h_linkdef) $(dict_h_sources)
@ -41,7 +47,7 @@ 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 *~ ../include/*~ core
CLEANFILES = *Dict.cpp *Dict.h *Dict* *~ ../include/*~ core
%Dict.cpp %Dict.h: ../include/%.h ../include/%LinkDef.h
@ROOTCINT@ -v -f $*Dict.cpp -c -p $(AM_CPPFLAGS) $^

View File

@ -15,6 +15,9 @@ cpp_sources = \
dict_cpp_sources = \
TGapIntegralsDict.cpp
pcmdir = $(libdir)
pcm_DATA = TGapIntegralsDict_rdict.pcm
include_HEADERS = $(h_sources)
noinst_HEADERS = $(h_linkdef) $(dict_h_sources)
@ -23,7 +26,7 @@ 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
CLEANFILES = *Dict.cpp *Dict.h *Dict* *~ core
%Dict.cpp %Dict.h: %.h %LinkDef.h
@ROOTCINT@ -v -f $*Dict.cpp -c -p $(AM_CPPFLAGS) $^

View File

@ -15,6 +15,9 @@ cpp_sources = \
dict_cpp_sources = \
TLFRelaxationDict.cpp
pcmdir = $(libdir)
pcm_DATA = TLFRelaxationDict_rdict.pcm
include_HEADERS = $(h_sources)
noinst_HEADERS = $(h_linkdef) $(dict_h_sources)
@ -23,7 +26,7 @@ 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
CLEANFILES = *Dict.cpp *Dict.h *Dict* *~ core
%Dict.cpp %Dict.h: %.h %LinkDef.h
@ROOTCINT@ -v -f $*Dict.cpp -c -p $(AM_CPPFLAGS) $^

View File

@ -20,6 +20,11 @@ dict_cpp_sources = \
PStartupHandler_PMDict.cpp \
PPhotoMeissnerDict.cpp
pcmdir = $(libdir)
pcm_DATA = \
PPhotoMeissnerDict_rdict.pcm \
PStartupHandler_PMDict_rdict.pcm
include_HEADERS = $(h_sources)
noinst_HEADERS = $(h_linkdef) $(dict_h_sources)

View File

@ -57,8 +57,8 @@ class PPhotoMeissner : public PUserFcnBase
Bool_t fValid; ///< flag indicating if initialization went through smoothly
static const Double_t fDegToRad = 0.0174532925199432955;
static const Double_t fTwoPi = 6.28318530717958623;
constexpr static const Double_t fDegToRad = 0.0174532925199432955;
constexpr static const Double_t fTwoPi = 6.28318530717958623;
Double_t InuMinus(const Double_t nu, const Double_t x) const;
Double_t FieldFilm(const Double_t z, const vector<Double_t> &par) const;

View File

@ -20,6 +20,11 @@ dict_cpp_sources = \
PStartupHandler_SVDict.cpp \
PSkewedLorentzianDict.cpp
pcmdir = $(libdir)
pcm_DATA = \
PStartupHandler_SVDict_rdict.pcm \
PSkewedLorentzianDict_rdict.pcm
include_HEADERS = $(h_sources)
noinst_HEADERS = $(h_linkdef) $(dict_h_sources)

View File

@ -59,8 +59,8 @@ class PSkewedLorentzian : public PUserFcnBase
UInt_t fNoOfFields; ///< number of sampling points in field around the Lorentzian peak
Double_t fRange; ///< range in which the sampling points are placed, given in units of \beta(1\pm\Delta)
static const Double_t fDegToRad = 0.0174532925199432955;
static const Double_t fTwoPi = 6.28318530717958623;
constexpr static const Double_t fDegToRad = 0.0174532925199432955;
constexpr static const Double_t fTwoPi = 6.28318530717958623;
// definition of the class for the ROOT dictionary
ClassDef(PSkewedLorentzian, 1)

View File

@ -15,6 +15,9 @@ cpp_sources = \
dict_cpp_sources = \
ZFRelaxationDict.cpp
pcmdir = $(libdir)
pcm_DATA = ZFRelaxationDict_rdict.pcm
include_HEADERS = $(h_sources)
noinst_HEADERS = $(h_linkdef) $(dict_h_sources)
@ -23,7 +26,7 @@ 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
CLEANFILES = *Dict.cpp *Dict.h *Dict* *~ core
%Dict.cpp %Dict.h: %.h %LinkDef.h
@ROOTCINT@ -v -f $*Dict.cpp -c -p $(AM_CPPFLAGS) $^

View File

@ -68,7 +68,7 @@ using namespace boost::algorithm;
*/
bool isNumber(const string &s)
{
unsigned int number;
unsigned int number(0);
try {
number = boost::lexical_cast<unsigned int>(s);
return true;
@ -123,8 +123,10 @@ void msr2data_syntax()
cout << endl << " the successive files are generated using the musrfit output from the preceding runs";
cout << endl << " msr-<template> : same as above without calling musrfit";
cout << endl << " In case any fitting option is present, this option is ignored!";
cout << endl << " -k : if fitting is used, pass the option --keep-mn2-output to musrfit";
cout << endl << " -t : if fitting is used, pass the option --title-from-data-file to musrfit";
cout << endl << " -k, --keep-mn2-output : if fitting is used, pass the option --keep-mn2-output to musrfit";
cout << endl << " -t, --title-from-data-file : if fitting is used, pass the option --title-from-data-file to musrfit";
cout << endl << " -e, --estimateN0: estimate N0 for single histogram fits.";
cout << endl << " -p, --per-run-block-chisq: will per run block chisq to the msr-file.";
cout << endl;
cout << endl << " global : switch on the global-fit mode";
cout << endl << " Within that mode all specified runs will be united in a single msr file!";
@ -216,7 +218,10 @@ string msr2data_validArguments(const vector<string> &arg)
for (vector<string>::const_iterator iter(arg.begin()); iter != arg.end(); ++iter) {
if ( (!iter->compare("header")) || (!iter->compare("noheader")) || (!iter->compare("nosummary")) \
|| (!iter->substr(0,3).compare("fit")) || (!iter->compare("-k")) || (!iter->compare("-t")) \
|| (!iter->substr(0,3).compare("fit")) || (!iter->compare("-k")) || (!iter->compare("--keep-mn2-output")) \
|| (!iter->compare("-t")) || (!iter->compare("--title-from-data-file")) \
|| (!iter->compare("-e")) || (!iter->compare("--estimateN0")) \
|| (!iter->compare("-p")) || (!iter->compare("--per-run-block-chisq")) \
|| (!iter->compare("data")) || (!iter->substr(0,4).compare("msr-")) || (!iter->compare("global")) \
|| (!iter->compare("global+")) || (!iter->compare("global+!")) || (!iter->compare("new")) \
|| !iter->compare("paramList") )
@ -265,6 +270,7 @@ string msr2data_outputfile(vector<string> &arg, bool db = true)
if (!iter->compare("-o")) {
if ((iterNext != arg.end()) && (iterNext->compare("header")) && (iterNext->compare("noheader")) && (iterNext->compare("nosummary")) \
&& (iterNext->substr(0,3).compare("fit")) && (iterNext->compare("-k")) && (iterNext->compare("-t")) \
&& (iterNext->compare("-e")) && (iterNext->compare("-p")) \
&& (iterNext->compare("data")) && (iterNext->substr(0,3).compare("msr")) && (iterNext->compare("global")) \
&& (iterNext->compare("global+")) && (iterNext->compare("global+!")) && (iterNext->compare("new"))) {
outputFile = *iterNext;
@ -741,10 +747,14 @@ int main(int argc, char *argv[])
// check if any options should be passed to musrfit
if (temp) {
if (!msr2data_useOption(arg, "-k"))
if (!msr2data_useOption(arg, "-k") || !msr2data_useOption(arg, "--keep-mn2-output"))
musrfitOptions.append("-k ");
if (!msr2data_useOption(arg, "-t"))
if (!msr2data_useOption(arg, "-t") || !msr2data_useOption(arg, "--title-from-data-file"))
musrfitOptions.append("-t ");
if (!msr2data_useOption(arg, "-e") || !msr2data_useOption(arg, "--estimateN0"))
musrfitOptions.append("-e ");
if (!msr2data_useOption(arg, "-p") || !msr2data_useOption(arg, "--per-run-block-chisq"))
musrfitOptions.append("-p ");
}
// if no fitting should be done, check if only the input files should be created

View File

@ -294,6 +294,7 @@ bool PAdminXMLParser::characters(const QString& str)
flag = true;
else
flag = false;
fAdmin->fMsr2DataParam.estimateN0 = flag;
fAdmin->setEstimateN0Flag(flag);
break;
case eChisqPreRunBlock:
@ -301,6 +302,7 @@ bool PAdminXMLParser::characters(const QString& str)
flag = true;
else
flag = false;
fAdmin->fMsr2DataParam.perRunBlockChisq = flag;
fAdmin->setChisqPerRunBlockFlag(flag);
break;
case eRecentFile:
@ -631,8 +633,6 @@ PAdmin::PAdmin() : QObject()
fEstimateN0 = true;
fChisqPreRunBlock = false;
fMsr2DataParam.firstRun = -1;
fMsr2DataParam.lastRun = -1;
fMsr2DataParam.runList = QString("");
fMsr2DataParam.runListFileName = QString("");
fMsr2DataParam.msrFileExtension = QString("");
@ -641,10 +641,12 @@ PAdmin::PAdmin() : QObject()
fMsr2DataParam.writeDbHeader = true;
fMsr2DataParam.ignoreDataHeaderInfo = false;
fMsr2DataParam.keepMinuit2Output = false;
fMsr2DataParam.estimateN0 = fEstimateN0;
fMsr2DataParam.writeColumnData = false;
fMsr2DataParam.recreateDbFile = false;
fMsr2DataParam.chainFit = true;
fMsr2DataParam.openFilesAfterFitting = true;
fMsr2DataParam.perRunBlockChisq = fChisqPreRunBlock;
fMsr2DataParam.titleFromDataFile = true;
fMsr2DataParam.createMsrFileOnly = false;
fMsr2DataParam.fitOnly = false;

View File

@ -54,18 +54,6 @@ PMsr2DataDialog::PMsr2DataDialog(PMsr2DataParam *msr2DataParam, const QString he
fRunTag = -1;
fFirst_lineEdit->setValidator( new QIntValidator(fFirst_lineEdit) );
if (fMsr2DataParam->firstRun != -1) {
str = QString("%1").arg(fMsr2DataParam->firstRun);
fFirst_lineEdit->setText(str);
}
fLast_lineEdit->setValidator( new QIntValidator(fLast_lineEdit) );
if (fMsr2DataParam->lastRun != -1) {
str = QString("%1").arg(fMsr2DataParam->lastRun);
fLast_lineEdit->setText(str);
}
if (!fMsr2DataParam->runListFileName.isEmpty()) {
fRunListFileName_lineEdit->setText(fMsr2DataParam->runListFileName);
}
@ -95,10 +83,12 @@ PMsr2DataDialog::PMsr2DataDialog(PMsr2DataParam *msr2DataParam, const QString he
fWriteDataHeader_checkBox->setChecked(fMsr2DataParam->writeDbHeader);
fIgnoreDataHeaderInfo_checkBox->setChecked(fMsr2DataParam->ignoreDataHeaderInfo);
fKeepMinuit2Output_checkBox->setChecked(fMsr2DataParam->keepMinuit2Output);
fEstimateN0_checkBox->setChecked(fMsr2DataParam->estimateN0);
fWriteColumnData_checkBox->setChecked(fMsr2DataParam->writeColumnData);
fRecreateDataFile_checkBox->setChecked(fMsr2DataParam->recreateDbFile);
fChainFit_checkBox->setChecked(fMsr2DataParam->chainFit);
fOpenFilesAfterFitting_checkBox->setChecked(fMsr2DataParam->openFilesAfterFitting);
fWritePerRunBlockChisq_checkBox->setChecked(fMsr2DataParam->perRunBlockChisq);
fTitleFromData_checkBox->setChecked(fMsr2DataParam->titleFromDataFile);
fCreateMsrFileOnly_checkBox->setChecked(fMsr2DataParam->createMsrFileOnly);
fFitOnly_checkBox->setChecked(fMsr2DataParam->fitOnly);
@ -115,16 +105,6 @@ PMsr2DataDialog::PMsr2DataDialog(PMsr2DataParam *msr2DataParam, const QString he
*/
PMsr2DataParam* PMsr2DataDialog::getMsr2DataParam()
{
if (fFirst_lineEdit->text().isEmpty()) {
fMsr2DataParam->firstRun = -1;
} else {
fMsr2DataParam->firstRun = fFirst_lineEdit->text().toInt();
}
if (fLast_lineEdit->text().isEmpty()) {
fMsr2DataParam->lastRun = -1;
} else {
fMsr2DataParam->lastRun = fLast_lineEdit->text().toInt();
}
fMsr2DataParam->runList = fRunList_lineEdit->text();
fMsr2DataParam->runListFileName = fRunListFileName_lineEdit->text();
fMsr2DataParam->msrFileExtension = fMsrFileExtension_lineEdit->text();
@ -138,10 +118,12 @@ PMsr2DataParam* PMsr2DataDialog::getMsr2DataParam()
fMsr2DataParam->writeDbHeader = fWriteDataHeader_checkBox->isChecked();
fMsr2DataParam->ignoreDataHeaderInfo = fIgnoreDataHeaderInfo_checkBox->isChecked();
fMsr2DataParam->keepMinuit2Output = fKeepMinuit2Output_checkBox->isChecked();
fMsr2DataParam->estimateN0 = fEstimateN0_checkBox->isChecked();
fMsr2DataParam->writeColumnData = fWriteColumnData_checkBox->isChecked();
fMsr2DataParam->recreateDbFile = fRecreateDataFile_checkBox->isChecked();
fMsr2DataParam->chainFit = fChainFit_checkBox->isChecked();
fMsr2DataParam->openFilesAfterFitting = fOpenFilesAfterFitting_checkBox->isChecked();
fMsr2DataParam->perRunBlockChisq = fWritePerRunBlockChisq_checkBox->isChecked();
fMsr2DataParam->titleFromDataFile = fTitleFromData_checkBox->isChecked();
fMsr2DataParam->createMsrFileOnly = fCreateMsrFileOnly_checkBox->isChecked();
fMsr2DataParam->fitOnly = fFitOnly_checkBox->isChecked();
@ -151,50 +133,6 @@ PMsr2DataParam* PMsr2DataDialog::getMsr2DataParam()
return fMsr2DataParam;
}
//----------------------------------------------------------------------------------------------------
/**
* <p>SLOT: called when in the 'Run List Input', the 'First' text field is activated. It clears any
* entries in 'Run List' and 'Run List File Name'. It furthermore sets the run tag.
*
* \param str string content of the QTextEdit field.
*/
void PMsr2DataDialog::runFirstEntered(const QString &str)
{
if (str.length() == 0)
return;
fRunTag = 0;
if (!fRunList_lineEdit->text().isEmpty())
fRunList_lineEdit->clear();
if (!fRunListFileName_lineEdit->text().isEmpty())
fRunListFileName_lineEdit->clear();
}
//----------------------------------------------------------------------------------------------------
/**
* <p>SLOT: called when in the 'Run List Input', the 'Last' text field is activated. It clears any
* entries in 'Run List' and 'Run List File Name'. It furthermore sets the run tag.
*
* \param str string content of the QTextEdit field.
*/
void PMsr2DataDialog::runLastEntered(const QString &str)
{
if (str.length() == 0)
return;
fRunTag = 0;
if (!fRunList_lineEdit->text().isEmpty())
fRunList_lineEdit->clear();
if (!fRunListFileName_lineEdit->text().isEmpty())
fRunListFileName_lineEdit->clear();
if (fLast_lineEdit->text().length() == 1)
fLast_lineEdit->update();
}
//----------------------------------------------------------------------------------------------------
/**
* <p>SLOT: called when in the 'Run List Input', the 'Run List' text field is activated. It clears any
@ -207,12 +145,8 @@ void PMsr2DataDialog::runListEntered(const QString &str)
if (str.length() == 0)
return;
fRunTag = 1;
fRunTag = 0;
if (!fFirst_lineEdit->text().isEmpty())
fFirst_lineEdit->clear();
if (!fLast_lineEdit->text().isEmpty())
fLast_lineEdit->clear();
if (!fRunListFileName_lineEdit->text().isEmpty())
fRunListFileName_lineEdit->clear();
}
@ -229,12 +163,8 @@ void PMsr2DataDialog::runListFileNameEntered(const QString &str)
if (str.length() == 0)
return;
fRunTag = 2;
fRunTag = 1;
if (!fFirst_lineEdit->text().isEmpty())
fFirst_lineEdit->clear();
if (!fLast_lineEdit->text().isEmpty())
fLast_lineEdit->clear();
if (!fRunList_lineEdit->text().isEmpty())
fRunList_lineEdit->clear();
}

View File

@ -51,8 +51,6 @@ class PMsr2DataDialog : public QDialog, private Ui::PMsr2DataDialog
virtual PMsr2DataParam* getMsr2DataParam();
public slots:
void runFirstEntered(const QString&);
void runLastEntered(const QString&);
void runListEntered(const QString&);
void runListFileNameEntered(const QString&);
void templateRunEntered(const QString&);
@ -65,7 +63,7 @@ class PMsr2DataDialog : public QDialog, private Ui::PMsr2DataDialog
void globalPlusOptionSet(bool checked);
private:
int fRunTag; ///< -1 = not valid, 0 = first last, 1 = run list, 2 = run list file name
int fRunTag; ///< -1 = not valid, 0 = run list, 1 = run list file name
PMsr2DataParam *fMsr2DataParam; ///< data structure used to handle the necessary input for msr2data.
QString fHelpUrl; ///< help url for the Fourier block
};

View File

@ -1853,6 +1853,8 @@ void PTextEdit::musrMsr2Data()
// init fMsr2DataParam
fMsr2DataParam->keepMinuit2Output = fAdmin->getKeepMinuit2OutputFlag();
fMsr2DataParam->titleFromDataFile = fAdmin->getTitleFromDataFileFlag();
fMsr2DataParam->estimateN0 = fAdmin->getEstimateN0Flag();
fMsr2DataParam->perRunBlockChisq = fAdmin->getChisqPerRunBlockFlag();
PMsr2DataDialog *dlg = new PMsr2DataDialog(fMsr2DataParam, fAdmin->getHelpUrl("msr2data"));
@ -1874,6 +1876,8 @@ void PTextEdit::musrMsr2Data()
fMsr2DataParam = dlg->getMsr2DataParam();
fAdmin->setKeepMinuit2OutputFlag(fMsr2DataParam->keepMinuit2Output);
fAdmin->setTitleFromDataFileFlag(fMsr2DataParam->titleFromDataFile);
fAdmin->setEstimateN0Flag(fMsr2DataParam->estimateN0);
fAdmin->setChisqPerRunBlockFlag(fMsr2DataParam->perRunBlockChisq);
// analyze parameters
switch (dlg->getRunTag()) {
@ -1883,20 +1887,10 @@ void PTextEdit::musrMsr2Data()
QMessageBox::Ok, QMessageBox::NoButton);
return;
break;
case 0: // first last
first = QString("%1").arg(fMsr2DataParam->firstRun);
last = QString("%1").arg(fMsr2DataParam->lastRun);
if (first.isEmpty() || last.isEmpty()) {
QMessageBox::critical(this, "**ERROR**",
"If you choose the first/last option,\nfirst AND last needs to be provided.",
QMessageBox::Ok, QMessageBox::NoButton);
return;
}
break;
case 1: // run list
case 0: // run list
runList = fMsr2DataParam->runList;
break;
case 2: // run list file name
case 1: // run list file name
runListFileName = fMsr2DataParam->runListFileName;
fi.setFile(QFileInfo(*fFilenames.find( currentEditor() )).absolutePath() + "/" + runListFileName);
if (!fi.exists()) {
@ -1923,10 +1917,6 @@ void PTextEdit::musrMsr2Data()
// run list argument
switch (dlg->getRunTag()) {
case 0:
cmd.append(first);
cmd.append(last);
break;
case 1:
end = 0;
while (!runList.section(' ', end, end, QString::SectionSkipEmpty).isEmpty()) {
end++;
@ -1947,7 +1937,7 @@ void PTextEdit::musrMsr2Data()
cmd.append(str);
}
break;
case 2:
case 1:
cmd.append(runListFileName);
break;
default:
@ -2012,6 +2002,16 @@ void PTextEdit::musrMsr2Data()
cmd.append("-t");
}
// estimate N0 (for single histo and muMinus). Add flag only if a fit is done
if (fMsr2DataParam->estimateN0 && (fMsr2DataParam->fitOnly || fMsr2DataParam->templateRunNo != -1)) {
cmd.append("-e");
}
// write per-run-block chisq. Add flag only if a fit is done
if (fMsr2DataParam->perRunBlockChisq && (fMsr2DataParam->fitOnly || fMsr2DataParam->templateRunNo != -1)) {
cmd.append("-p");
}
// DB output wished
if (!fMsr2DataParam->dbOutputFileName.isEmpty()) {
str = "-o" + fMsr2DataParam->dbOutputFileName;
@ -2056,19 +2056,7 @@ void PTextEdit::musrMsr2Data()
if (!fMsr2DataParam->global) { // standard fits
switch(dlg->getRunTag()) {
case 0: // first run / last run list
if (fMsr2DataParam->firstRun != -1) {
for (int i=fMsr2DataParam->firstRun; i<=fMsr2DataParam->lastRun; i++) {
if (fMsr2DataParam->msrFileExtension.isEmpty())
fln = QString("%1").arg(i) + ".msr";
else
fln = QString("%1").arg(i) + fMsr2DataParam->msrFileExtension + ".msr";
load(QFileInfo(*fFilenames.find( currentEditor() )).absolutePath() + "/" + fln);
}
}
break;
case 1: // run list
case 0: // run list
list = getRunList(runList, ok);
if (!ok)
return;
@ -2082,7 +2070,7 @@ void PTextEdit::musrMsr2Data()
load(QFileInfo(*fFilenames.find( currentEditor() )).absolutePath() + "/" + fln);
}
break;
case 2: // run list file
case 1: // run list file
file = new QFile(QFileInfo(*fFilenames.find( currentEditor() )).absolutePath() + "/" + fMsr2DataParam->runListFileName);
if (!file->open(QIODevice::ReadOnly)) {
str = QString("Couldn't open run list file %1, sorry.").arg(fMsr2DataParam->runListFileName);
@ -2118,13 +2106,10 @@ void PTextEdit::musrMsr2Data()
// get the first run number needed to build the global fit file name
fln = QString("");
switch(dlg->getRunTag()) {
case 0: // first/last run
fln = QString("%1").arg(fMsr2DataParam->firstRun) + QString("+global") + fMsr2DataParam->msrFileExtension + QString(".msr");
break;
case 1: // run list
case 0: // run list
fln = runList.section(" ", 0, 0, QString::SectionSkipEmpty) + QString("+global") + fMsr2DataParam->msrFileExtension + QString(".msr");
break;
case 2: // run list file name
case 1: // run list file name
file = new QFile(QFileInfo(*fFilenames.find( currentEditor() )).absolutePath() + "/" + fMsr2DataParam->runListFileName);
if (!file->open(QIODevice::ReadOnly)) {
str = QString("Couldn't open run list file %1, sorry.").arg(fMsr2DataParam->runListFileName);
@ -2403,6 +2388,7 @@ void PTextEdit::musrDump()
QVector<QString> cmd;
QString str = fAdmin->getExecPath() + "/dump_header";
cmd.append(str);
cmd.append("-fn");
cmd.append(fileName);
PDumpOutputHandler dumpOutputHandler(cmd);

View File

@ -9,8 +9,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>552</width>
<height>599</height>
<width>584</width>
<height>578</height>
</rect>
</property>
<property name="windowTitle">
@ -25,8 +25,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>551</width>
<height>131</height>
<width>581</width>
<height>111</height>
</rect>
</property>
<property name="font">
@ -47,93 +47,13 @@
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>10</x>
<x>11</x>
<y>30</y>
<width>531</width>
<height>97</height>
<width>561</width>
<height>70</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="fFirst_label">
<property name="text">
<string>First</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="fFirst_lineEdit">
<property name="toolTip">
<string>start run number</string>
</property>
<property name="whatsThis">
<string>start run number</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="fLast_label">
<property name="text">
<string>Last</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="fLast_lineEdit">
<property name="toolTip">
<string>end run number</string>
</property>
<property name="whatsThis">
<string>end run number</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>200</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="fOrFirstLast_label">
<property name="text">
<string>&lt;b&gt;OR&lt;/b&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::AutoText</enum>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
@ -232,8 +152,8 @@ p, li { white-space: pre-wrap; }
<property name="geometry">
<rect>
<x>0</x>
<y>130</y>
<width>551</width>
<y>110</y>
<width>581</width>
<height>71</height>
</rect>
</property>
@ -245,8 +165,8 @@ p, li { white-space: pre-wrap; }
<rect>
<x>10</x>
<y>30</y>
<width>531</width>
<height>29</height>
<width>561</width>
<height>31</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_5">
@ -262,9 +182,12 @@ p, li { white-space: pre-wrap; }
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<width>30</width>
<height>20</height>
</size>
</property>
@ -297,8 +220,8 @@ p, li { white-space: pre-wrap; }
<property name="geometry">
<rect>
<x>0</x>
<y>200</y>
<width>551</width>
<y>180</y>
<width>581</width>
<height>80</height>
</rect>
</property>
@ -311,7 +234,7 @@ p, li { white-space: pre-wrap; }
<x>10</x>
<y>30</y>
<width>531</width>
<height>29</height>
<height>31</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_6">
@ -364,8 +287,8 @@ p, li { white-space: pre-wrap; }
<property name="geometry">
<rect>
<x>0</x>
<y>280</y>
<width>551</width>
<y>260</y>
<width>581</width>
<height>80</height>
</rect>
</property>
@ -378,7 +301,7 @@ p, li { white-space: pre-wrap; }
<x>10</x>
<y>30</y>
<width>531</width>
<height>29</height>
<height>31</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_7">
@ -419,8 +342,8 @@ p, li { white-space: pre-wrap; }
<property name="geometry">
<rect>
<x>0</x>
<y>360</y>
<width>551</width>
<y>340</y>
<width>581</width>
<height>172</height>
</rect>
</property>
@ -432,7 +355,7 @@ p, li { white-space: pre-wrap; }
<rect>
<x>6</x>
<y>20</y>
<width>541</width>
<width>571</width>
<height>116</height>
</rect>
</property>
@ -473,6 +396,13 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="fEstimateN0_checkBox">
<property name="text">
<string>Estimate N0</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
@ -517,6 +447,13 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="fWritePerRunBlockChisq_checkBox">
<property name="text">
<string>Write per-run-block Chisq</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
@ -601,21 +538,24 @@ p, li { white-space: pre-wrap; }
<rect>
<x>170</x>
<y>140</y>
<width>371</width>
<width>401</width>
<height>23</height>
</rect>
</property>
<property name="whatsThis">
<string>parameter numbers to be exported, e.g. 1-16, or 1 3-7, etc.</string>
</property>
<property name="frame">
<bool>true</bool>
</property>
</widget>
</widget>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>5</x>
<y>540</y>
<width>541</width>
<y>520</y>
<width>571</width>
<height>51</height>
</rect>
</property>
@ -669,8 +609,6 @@ p, li { white-space: pre-wrap; }
</widget>
</widget>
<tabstops>
<tabstop>fFirst_lineEdit</tabstop>
<tabstop>fLast_lineEdit</tabstop>
<tabstop>fRunList_lineEdit</tabstop>
<tabstop>fRunListFileName_lineEdit</tabstop>
<tabstop>fMsrFileExtension_lineEdit</tabstop>
@ -744,38 +682,6 @@ p, li { white-space: pre-wrap; }
</hint>
</hints>
</connection>
<connection>
<sender>fFirst_lineEdit</sender>
<signal>textChanged(QString)</signal>
<receiver>PMsr2DataDialog</receiver>
<slot>runFirstEntered(QString)</slot>
<hints>
<hint type="sourcelabel">
<x>82</x>
<y>44</y>
</hint>
<hint type="destinationlabel">
<x>113</x>
<y>504</y>
</hint>
</hints>
</connection>
<connection>
<sender>fLast_lineEdit</sender>
<signal>textChanged(QString)</signal>
<receiver>PMsr2DataDialog</receiver>
<slot>runLastEntered(QString)</slot>
<hints>
<hint type="sourcelabel">
<x>229</x>
<y>44</y>
</hint>
<hint type="destinationlabel">
<x>348</x>
<y>500</y>
</hint>
</hints>
</connection>
<connection>
<sender>fRunList_lineEdit</sender>
<signal>textChanged(QString)</signal>

View File

@ -41,8 +41,6 @@
* parameters see <code>msr2data --help</code> and the online documentation.
*/
typedef struct {
int firstRun; ///< first run number of a sequence of runs (usage 2 of msr2data)
int lastRun; ///< last run number of a sequence of runs (usage 2 of msr2data)
QString runList; ///< list of run numbers (usage 3 of msr2data)
QString runListFileName; ///< run list filename (usage 4 of msr2data)
QString msrFileExtension; ///< msr filename extension, e.g. '0100_h13.msr' -> '_h13'
@ -57,6 +55,8 @@ typedef struct {
bool chainFit; ///< flag: true = chain fit, i.e. the template for a fit is the preceeding run. false = the template is always the source for the new msr-file
bool openFilesAfterFitting; ///< flag: true = open msr-file after fit in musredit. false = do not open msr-file after fit.
bool titleFromDataFile; ///< flag indicating if the title for the msr-file shall be extracted from the data-file ('-t' in msr2data)
bool estimateN0; ///< flag indicating if the N0 shall be estimated for single histogram fitting
bool perRunBlockChisq; ///< flag indicating if per-run-block-chisq shall be dumped into the msr-file
bool createMsrFileOnly; ///< flag: true = just create the msr-files without any fitting ('msr-<template>' in msr2data)
bool fitOnly; ///< flag: true = just perform the fits wihtout generating any msr-files ('fit' in msr2data).
bool global; ///< flag: true = 'global' option

View File

@ -2,4 +2,3 @@
CLEANFILES = *~ core moc_* ui_*

View File

@ -296,6 +296,7 @@ bool PAdminXMLParser::characters(const QString& str)
flag = true;
else
flag = false;
fAdmin->fMsr2DataParam.estimateN0 = flag;
fAdmin->setEstimateN0Flag(flag);
break;
case eChisqPreRunBlock:
@ -303,6 +304,7 @@ bool PAdminXMLParser::characters(const QString& str)
flag = true;
else
flag = false;
fAdmin->fMsr2DataParam.perRunBlockChisq = flag;
fAdmin->setChisqPerRunBlockFlag(flag);
break;
case eRecentFile:
@ -641,8 +643,6 @@ PAdmin::PAdmin() : QObject()
fEstimateN0 = true;
fChisqPreRunBlock = false;
fMsr2DataParam.firstRun = -1;
fMsr2DataParam.lastRun = -1;
fMsr2DataParam.runList = QString("");
fMsr2DataParam.runListFileName = QString("");
fMsr2DataParam.msrFileExtension = QString("");
@ -651,10 +651,12 @@ PAdmin::PAdmin() : QObject()
fMsr2DataParam.writeDbHeader = true;
fMsr2DataParam.ignoreDataHeaderInfo = false;
fMsr2DataParam.keepMinuit2Output = false;
fMsr2DataParam.estimateN0 = fEstimateN0;
fMsr2DataParam.writeColumnData = false;
fMsr2DataParam.recreateDbFile = false;
fMsr2DataParam.chainFit = true;
fMsr2DataParam.openFilesAfterFitting = true;
fMsr2DataParam.perRunBlockChisq = fChisqPreRunBlock;
fMsr2DataParam.titleFromDataFile = true;
fMsr2DataParam.createMsrFileOnly = false;
fMsr2DataParam.fitOnly = false;

View File

@ -0,0 +1,331 @@
/****************************************************************************
PChangeDefaultPathsDialog.cpp
Author: Andreas Suter
e-mail: andreas.suter@psi.ch
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2010-2017 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 <QMessageBox>
#include <QFileDialog>
#include <QListWidgetItem>
#include "PChangeDefaultPathsDialog.h"
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
/**
* @brief PDefaultPathsXMLParser::PDefaultPathsXMLParser
* @param defaultPaths
*/
PDefaultPathsXMLParser::PDefaultPathsXMLParser(PDefaultPaths *defaultPaths) :
fDefaultPaths(defaultPaths)
{
fKeyWord = eEmpty;
}
//--------------------------------------------------------------------------
/**
* <p>Routine called at the beginning of the XML parsing process.
*/
bool PDefaultPathsXMLParser::startDocument()
{
return true;
}
//--------------------------------------------------------------------------
/**
* <p>Routine called when a new XML tag is found. Here it is used
* to set a tag for filtering afterwards the content.
*
* \param qName name of the XML tag.
*/
bool PDefaultPathsXMLParser::startElement( const QString&, const QString&,
const QString& qName,
const QXmlAttributes& )
{
if (qName == "data_path") {
fKeyWord = eDataPath;
}
return true;
}
//--------------------------------------------------------------------------
/**
* <p>Routine called when the end XML tag is found. It is used to
* put the filtering tag to 'empty'.
*
* \param qName name of the element.
*/
bool PDefaultPathsXMLParser::endElement( const QString&, const QString&, const QString & )
{
fKeyWord = eEmpty;
return true;
}
//--------------------------------------------------------------------------
/**
* <p>This routine delivers the content of an XML tag. It fills the
* content into the load data structure.
*
* \param str keeps the content of the XML tag.
*/
bool PDefaultPathsXMLParser::characters(const QString& str)
{
switch (fKeyWord) {
case eDataPath:
fDefaultPaths->appendDefaultPath(str);
break;
default:
break;
}
return true;
}
//--------------------------------------------------------------------------
/**
* <p>Called at the end of the XML parse process. It checks if default paths
* contain system variables, and if so expand them for the further use.
*/
bool PDefaultPathsXMLParser::endDocument()
{
return true;
}
//--------------------------------------------------------------------------
/**
* <p>Report XML warnings.
*
* \param exception holds the information of the XML warning
*/
bool PDefaultPathsXMLParser::warning( const QXmlParseException & exception )
{
QString msg;
msg = QString("**WARNING** while parsing musrfit_startup.xml in line no %1\n").arg(exception.lineNumber());
msg += QString("**WARNING MESSAGE** ") + exception.message();
qWarning() << endl << msg << endl;
QMessageBox::warning(0, "WARNING", msg, QMessageBox::Ok, QMessageBox::NoButton);
return true;
}
//--------------------------------------------------------------------------
/**
* <p>Report recoverable XML errors.
*
* \param exception holds the information of the XML recoverable errors.
*/
bool PDefaultPathsXMLParser::error( const QXmlParseException & exception )
{
QString msg;
msg = QString("**ERROR** while parsing musrfit_startup.xml in line no %1\n").arg(exception.lineNumber());
msg += QString("**ERROR MESSAGE** ") + exception.message();
qWarning() << endl << msg << endl;
QMessageBox::critical(0, "ERROR", msg, QMessageBox::Ok, QMessageBox::NoButton);
return true;
}
//--------------------------------------------------------------------------
/**
* <p>Report fatal XML errors.
*
* \param exception holds the information of the XML fatal errors.
*/
bool PDefaultPathsXMLParser::fatalError( const QXmlParseException & exception )
{
QString msg;
msg = QString("**FATAL ERROR** while parsing musrfit_startup.xml in line no %1\n").arg(exception.lineNumber());
msg += QString("**FATAL ERROR MESSAGE** ") + exception.message();
qWarning() << endl << msg << endl;
QMessageBox::critical(0, "FATAL ERROR", msg, QMessageBox::Ok, QMessageBox::NoButton);
return true;
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
PDefaultPaths::PDefaultPaths() : QObject()
{
fValid = true;
// XML Parser part
// 1st: check local directory
QString path = QString("./");
QString fln = QString("musrfit_startup.xml");
QString pathFln = path + fln;
QProcessEnvironment procEnv = QProcessEnvironment::systemEnvironment();
if (!QFile::exists(pathFln)) {
// 2nd: check $HOME/.musrfit/musrfit_startup.xml
path = procEnv.value("HOME", "");
pathFln = path + "/.musrfit/" + fln;
if (!QFile::exists(pathFln)) {
// 3rd: check $MUSRFITPATH/musrfit_startup.xml
path = procEnv.value("MUSRFITPATH", "");
pathFln = path + "/" + fln;
if (!QFile::exists(pathFln)) {
// 4th: check $ROOTSYS/bin/musrfit_startup.xml
path = procEnv.value("ROOTSYS", "");
pathFln = path + "/bin/" + fln;
}
}
}
fPrefPathName = pathFln;
// read musrfit_startup.xml and extract default data file search paths
PDefaultPathsXMLParser handler(this);
QFile xmlFile(fPrefPathName);
QXmlInputSource source( &xmlFile );
QXmlSimpleReader reader;
reader.setContentHandler( &handler );
reader.setErrorHandler( &handler );
if (!reader.parse( source )) {
fValid = false;
QMessageBox::critical(0, "ERROR",
"Error parsing musrfit_startup.xml settings file.\nProbably a few things will not work porperly.\nPlease fix this first.",
QMessageBox::Ok, QMessageBox::NoButton);
return;
}
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
/**
* <p>Constructor.
*
* \param fAdmin keeps all the needed flags
*/
PChangeDefaultPathsDialog::PChangeDefaultPathsDialog()
{
fDefaultPath = 0;
fDefaultPath = new PDefaultPaths();
if (!fDefaultPath->isValid())
return;
QStringList *strList = fDefaultPath->getDefaultPathList();
if (strList == 0)
return;
setupUi(this);
setModal(true);
// populate default search paths
for (int i=0; i<strList->count(); i++) {
fSearchPath_listWidget->addItem(strList->at(i));
}
QObject::connect(fDelete_pushButton, SIGNAL(clicked()), this, SLOT(deleteItem()));
QObject::connect(fAdd_pushButton, SIGNAL(clicked()), this, SLOT(addItem()));
QObject::connect(buttonBox, SIGNAL(accepted()), this, SLOT(saveDefaultPathList()));
}
//----------------------------------------------------------------------------------------------------
/**
* @brief PChangeDefaultPathsDialog::addItem
*/
void PChangeDefaultPathsDialog::addItem()
{
// call QFileDialog in order to get the proper directory
QString dirName = QFileDialog::getExistingDirectory(this, tr("Data File Directory"), "",
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
if (dirName == "")
return;
// insert the new directory in fSearchPath_listWidget
QListWidgetItem *item = new QListWidgetItem;
if (item == 0) {
QMessageBox::critical(this, "ERROR", "Couldn't invoke QListWidgetItem! Won't do anything.");
return;
}
item->setText(dirName);
fSearchPath_listWidget->insertItem(fSearchPath_listWidget->currentRow()+1, item);
}
//----------------------------------------------------------------------------------------------------
/**
* @brief PChangeDefaultPathsDialog::deleteItem
*/
void PChangeDefaultPathsDialog::deleteItem()
{
QListWidgetItem *item = fSearchPath_listWidget->takeItem(fSearchPath_listWidget->currentRow());
if (item != 0)
delete item;
}
//----------------------------------------------------------------------------------------------------
/**
* @brief PChangeDefaultPathsDialog::saveDefaultPathList
*/
void PChangeDefaultPathsDialog::saveDefaultPathList()
{
// read the used musrfit_startup.xml
QFile fileIn(fDefaultPath->getPrefPathName());
if (!fileIn.open(QIODevice::ReadOnly | QIODevice::Text)) {
QMessageBox::critical(this, "ERROR", QString("Cannot read '%1'. Won't do anything.").arg(fDefaultPath->getPrefPathName()));
return;
}
QTextStream in(&fileIn);
QStringList fileContent;
while (!in.atEnd()) {
fileContent << in.readLine();
}
fileIn.close();
// write the new musrfit_startup.xml
QFile fileOut(fDefaultPath->getPrefPathName());
if (!fileOut.open(QIODevice::WriteOnly | QIODevice::Text)) {
QMessageBox::critical(this, "ERROR", QString("Cannot write to '%1'.").arg(fDefaultPath->getPrefPathName()));
return;
}
QTextStream out(&fileOut);
QString str;
bool first = true;
for (int i=0; i<fileContent.count(); i++) {
str = fileContent[i];
if (!str.trimmed().startsWith("<data_path>")) {
out << fileContent[i] << endl;
} else {
if (first) {
first = false;
for (int j=0; j<fSearchPath_listWidget->count(); j++)
out << " <data_path>" << fSearchPath_listWidget->item(j)->text() << "</data_path>" << endl;
}
}
}
fileOut.close();
}
//----------------------------------------------------------------------------------------------------
// END
//----------------------------------------------------------------------------------------------------

View File

@ -0,0 +1,104 @@
/****************************************************************************
PChangeDefaultPathsDialog.h
Author: Andreas Suter
e-mail: andreas.suter@psi.ch
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2010-2017 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 _PCHANGEDEFAULTPATHSDIALOG_H_
#define _PCHANGEDEFAULTPATHSDIALOG_H_
#include <QDialog>
#include <QMessageBox>
#include <QtXml>
#include "ui_PChangeDefaultPathsDialog.h"
class PDefaultPaths;
//---------------------------------------------------------------------------
class PDefaultPathsXMLParser : public QXmlDefaultHandler
{
public:
PDefaultPathsXMLParser(PDefaultPaths *defaultPaths);
virtual ~PDefaultPathsXMLParser() {}
private:
enum EAdminKeyWords {eEmpty, eDataPath};
bool startDocument();
bool startElement( const QString&, const QString&, const QString& ,
const QXmlAttributes& );
bool endElement( const QString&, const QString&, const QString& );
bool characters(const QString&);
bool endDocument();
bool warning( const QXmlParseException & exception );
bool error( const QXmlParseException & exception );
bool fatalError( const QXmlParseException & exception );
EAdminKeyWords fKeyWord; ///< key word tag to know how to handle the content
PDefaultPaths *fDefaultPaths; ///< keeps the default search paths for the data files
};
//---------------------------------------------------------------------------
class PDefaultPaths : public QObject
{
public:
PDefaultPaths();
virtual ~PDefaultPaths() {}
virtual bool isValid() { return fValid; }
virtual void appendDefaultPath(QString str) { fDefaultPath << str; }
virtual QStringList *getDefaultPathList() { return &fDefaultPath; }
virtual QString getPrefPathName() { return fPrefPathName; }
private:
friend class PDefaultPathsXMLParser;
bool fValid;
QString fPrefPathName;
QStringList fDefaultPath;
};
//---------------------------------------------------------------------------
class PChangeDefaultPathsDialog : public QDialog, private Ui::PChangeDefaultPathsDialog
{
Q_OBJECT
public:
PChangeDefaultPathsDialog();
private slots:
void deleteItem();
void addItem();
void saveDefaultPathList();
private:
PDefaultPaths *fDefaultPath;
};
#endif // _PCHANGEDEFAULTPATHSDIALOG_H_

View File

@ -60,6 +60,11 @@ PDumpOutputHandler::PDumpOutputHandler(QVector<QString> &cmd)
// QProcess related code
fProc = new QProcess( this );
// make sure that the system environment variables are properly set
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
env.insert("LD_LIBRARY_PATH", env.value("ROOTSYS") + "/lib:" + env.value("LD_LIBRARY_PATH"));
fProc->setProcessEnvironment(env);
// Set up the command and arguments.
QString program = cmd[0];
QStringList arguments;
@ -69,6 +74,7 @@ PDumpOutputHandler::PDumpOutputHandler(QVector<QString> &cmd)
connect( fProc, SIGNAL( readyReadStandardOutput() ), this, SLOT( readFromStdOut() ) );
connect( fProc, SIGNAL( readyReadStandardError() ), this, SLOT( readFromStdErr() ) );
fProc->start(program, arguments);
if ( !fProc->waitForStarted() ) {
// error handling

View File

@ -54,18 +54,6 @@ PMsr2DataDialog::PMsr2DataDialog(PMsr2DataParam *msr2DataParam, const QString he
fRunTag = -1;
fFirst_lineEdit->setValidator( new QIntValidator(fFirst_lineEdit) );
if (fMsr2DataParam->firstRun != -1) {
str = QString("%1").arg(fMsr2DataParam->firstRun);
fFirst_lineEdit->setText(str);
}
fLast_lineEdit->setValidator( new QIntValidator(fLast_lineEdit) );
if (fMsr2DataParam->lastRun != -1) {
str = QString("%1").arg(fMsr2DataParam->lastRun);
fLast_lineEdit->setText(str);
}
if (!fMsr2DataParam->runListFileName.isEmpty()) {
fRunListFileName_lineEdit->setText(fMsr2DataParam->runListFileName);
}
@ -95,10 +83,12 @@ PMsr2DataDialog::PMsr2DataDialog(PMsr2DataParam *msr2DataParam, const QString he
fWriteDataHeader_checkBox->setChecked(fMsr2DataParam->writeDbHeader);
fIgnoreDataHeaderInfo_checkBox->setChecked(fMsr2DataParam->ignoreDataHeaderInfo);
fKeepMinuit2Output_checkBox->setChecked(fMsr2DataParam->keepMinuit2Output);
fEstimateN0_checkBox->setChecked(fMsr2DataParam->estimateN0);
fWriteColumnData_checkBox->setChecked(fMsr2DataParam->writeColumnData);
fRecreateDataFile_checkBox->setChecked(fMsr2DataParam->recreateDbFile);
fChainFit_checkBox->setChecked(fMsr2DataParam->chainFit);
fOpenFilesAfterFitting_checkBox->setChecked(fMsr2DataParam->openFilesAfterFitting);
fWritePerRunBlockChisq_checkBox->setChecked(fMsr2DataParam->perRunBlockChisq);
fTitleFromData_checkBox->setChecked(fMsr2DataParam->titleFromDataFile);
fCreateMsrFileOnly_checkBox->setChecked(fMsr2DataParam->createMsrFileOnly);
fFitOnly_checkBox->setChecked(fMsr2DataParam->fitOnly);
@ -117,16 +107,6 @@ PMsr2DataDialog::PMsr2DataDialog(PMsr2DataParam *msr2DataParam, const QString he
*/
PMsr2DataParam* PMsr2DataDialog::getMsr2DataParam()
{
if (fFirst_lineEdit->text().isEmpty()) {
fMsr2DataParam->firstRun = -1;
} else {
fMsr2DataParam->firstRun = fFirst_lineEdit->text().toInt();
}
if (fLast_lineEdit->text().isEmpty()) {
fMsr2DataParam->lastRun = -1;
} else {
fMsr2DataParam->lastRun = fLast_lineEdit->text().toInt();
}
fMsr2DataParam->runList = fRunList_lineEdit->text();
fMsr2DataParam->runListFileName = fRunListFileName_lineEdit->text();
fMsr2DataParam->msrFileExtension = fMsrFileExtension_lineEdit->text();
@ -140,10 +120,12 @@ PMsr2DataParam* PMsr2DataDialog::getMsr2DataParam()
fMsr2DataParam->writeDbHeader = fWriteDataHeader_checkBox->isChecked();
fMsr2DataParam->ignoreDataHeaderInfo = fIgnoreDataHeaderInfo_checkBox->isChecked();
fMsr2DataParam->keepMinuit2Output = fKeepMinuit2Output_checkBox->isChecked();
fMsr2DataParam->estimateN0 = fEstimateN0_checkBox->isChecked();
fMsr2DataParam->writeColumnData = fWriteColumnData_checkBox->isChecked();
fMsr2DataParam->recreateDbFile = fRecreateDataFile_checkBox->isChecked();
fMsr2DataParam->chainFit = fChainFit_checkBox->isChecked();
fMsr2DataParam->openFilesAfterFitting = fOpenFilesAfterFitting_checkBox->isChecked();
fMsr2DataParam->perRunBlockChisq = fWritePerRunBlockChisq_checkBox->isChecked();
fMsr2DataParam->titleFromDataFile = fTitleFromData_checkBox->isChecked();
fMsr2DataParam->createMsrFileOnly = fCreateMsrFileOnly_checkBox->isChecked();
fMsr2DataParam->fitOnly = fFitOnly_checkBox->isChecked();
@ -153,50 +135,6 @@ PMsr2DataParam* PMsr2DataDialog::getMsr2DataParam()
return fMsr2DataParam;
}
//----------------------------------------------------------------------------------------------------
/**
* <p>SLOT: called when in the 'Run List Input', the 'First' text field is activated. It clears any
* entries in 'Run List' and 'Run List File Name'. It furthermore sets the run tag.
*
* \param str string content of the QTextEdit field.
*/
void PMsr2DataDialog::runFirstEntered(const QString &str)
{
if (str.length() == 0)
return;
fRunTag = 0;
if (!fRunList_lineEdit->text().isEmpty())
fRunList_lineEdit->clear();
if (!fRunListFileName_lineEdit->text().isEmpty())
fRunListFileName_lineEdit->clear();
}
//----------------------------------------------------------------------------------------------------
/**
* <p>SLOT: called when in the 'Run List Input', the 'Last' text field is activated. It clears any
* entries in 'Run List' and 'Run List File Name'. It furthermore sets the run tag.
*
* \param str string content of the QTextEdit field.
*/
void PMsr2DataDialog::runLastEntered(const QString &str)
{
if (str.length() == 0)
return;
fRunTag = 0;
if (!fRunList_lineEdit->text().isEmpty())
fRunList_lineEdit->clear();
if (!fRunListFileName_lineEdit->text().isEmpty())
fRunListFileName_lineEdit->clear();
if (fLast_lineEdit->text().length() == 1)
fLast_lineEdit->update();
}
//----------------------------------------------------------------------------------------------------
/**
* <p>SLOT: called when in the 'Run List Input', the 'Run List' text field is activated. It clears any
@ -209,12 +147,8 @@ void PMsr2DataDialog::runListEntered(const QString &str)
if (str.length() == 0)
return;
fRunTag = 1;
fRunTag = 0;
if (!fFirst_lineEdit->text().isEmpty())
fFirst_lineEdit->clear();
if (!fLast_lineEdit->text().isEmpty())
fLast_lineEdit->clear();
if (!fRunListFileName_lineEdit->text().isEmpty())
fRunListFileName_lineEdit->clear();
}
@ -231,12 +165,8 @@ void PMsr2DataDialog::runListFileNameEntered(const QString &str)
if (str.length() == 0)
return;
fRunTag = 2;
fRunTag = 1;
if (!fFirst_lineEdit->text().isEmpty())
fFirst_lineEdit->clear();
if (!fLast_lineEdit->text().isEmpty())
fLast_lineEdit->clear();
if (!fRunList_lineEdit->text().isEmpty())
fRunList_lineEdit->clear();
}

View File

@ -51,8 +51,6 @@ class PMsr2DataDialog : public QDialog, private Ui::PMsr2DataDialog
virtual PMsr2DataParam* getMsr2DataParam();
public slots:
void runFirstEntered(const QString&);
void runLastEntered(const QString&);
void runListEntered(const QString&);
void runListFileNameEntered(const QString&);
void templateRunEntered(const QString&);
@ -65,7 +63,7 @@ class PMsr2DataDialog : public QDialog, private Ui::PMsr2DataDialog
void globalPlusOptionSet(bool checked);
private:
int fRunTag; ///< -1 = not valid, 0 = first last, 1 = run list, 2 = run list file name
int fRunTag; ///< -1 = not valid, 0 = run list, 1 = run list file name
PMsr2DataParam *fMsr2DataParam; ///< data structure used to handle the necessary input for msr2data.
QString fHelpUrl; ///< help url for the Fourier block
};

View File

@ -27,6 +27,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "PChangeDefaultPathsDialog.h"
#include "PPrefsDialog.h"
//----------------------------------------------------------------------------------------------------
@ -66,6 +67,8 @@ PPrefsDialog::PPrefsDialog(PAdmin *admin) : fAdmin(admin)
fTimeout_lineEdit->setText(QString("%1").arg(fAdmin->getTimeout()));
fTimeout_lineEdit->setValidator(new QIntValidator(fTimeout_lineEdit));
QObject::connect(fDefaultPath_pushButton, SIGNAL(clicked()), this, SLOT(handleDefaultPaths()));
}
//----------------------------------------------------------------------------------------------------
@ -106,6 +109,22 @@ void PPrefsDialog::dumpRoot()
fDumpAscii_checkBox->setChecked(false);
}
//----------------------------------------------------------------------------------------------------
/**
*<p>SLOT: called when the QPushButton 'Change Default Search Paths' is clicked. Will call a
* dialog which allows to deal with the default search paths to look for data files.
*/
void PPrefsDialog::handleDefaultPaths()
{
PChangeDefaultPathsDialog *dlg = new PChangeDefaultPathsDialog();
if (dlg->exec() == QDialog::Accepted) {
}
delete dlg;
}
//----------------------------------------------------------------------------------------------------
// END
//----------------------------------------------------------------------------------------------------

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2010-2016 by Andreas Suter *
* Copyright (C) 2010-2017 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *
@ -59,6 +59,7 @@ class PPrefsDialog : public QDialog, private Ui::PPrefsDialog
public slots:
void dumpAscii();
void dumpRoot();
void handleDefaultPaths();
private:
PAdmin *fAdmin;

View File

@ -850,7 +850,9 @@ void PTextEdit::fileOpen()
}
// in case there is a 1st empty tab "noname", remove it
if (fTabWidget->tabText(0) == "noname") { // has to be the first, otherwise do nothing
QString tabStr = fTabWidget->tabText(0);
tabStr.remove('&'); // this is needed since the QTabWidget adds short-cut info as '&' to the tab name
if (tabStr == "noname") { // has to be the first, otherwise do nothing
fFileSystemWatcher->removePath("noname");
delete fTabWidget->widget(0);
@ -864,12 +866,15 @@ void PTextEdit::fileOpen()
void PTextEdit::fileOpenRecent()
{
QAction *action = qobject_cast<QAction *>(sender());
if (action) {
// check if this file is already open and if so, switch the tab
QFileInfo finfo1, finfo2;
QString tabFln;
bool alreadyOpen = false;
finfo1.setFile(action->text());
QString fln = action->text();
fln.remove('&');
finfo1.setFile(fln);
for (int i=0; i<fTabWidget->count(); i++) {
tabFln = *fFilenames.find( dynamic_cast<PSubTextEdit*>(fTabWidget->widget(i)));
@ -881,17 +886,25 @@ void PTextEdit::fileOpenRecent()
}
}
if (!alreadyOpen)
load(action->text());
else
if (!alreadyOpen) {
// make sure the file exists
if (!finfo1.exists()) {
QMessageBox::critical(this, "ERROR", QString("File '%1' does not exist.\nWill not do anything.").arg(fln));
return;
}
load(fln);
} else {
fileReload();
}
}
// in case there is a 1st empty tab "noname", remove it
if (fTabWidget->tabText(0) == "noname") { // has to be the first, otherwise do nothing
fFileSystemWatcher->removePath("noname");
// in case there is a 1st empty tab "noname", remove it
fln = fTabWidget->tabText(0);
fln.remove("&");
if (fln == "noname") { // has to be the first, otherwise do nothing
fFileSystemWatcher->removePath("noname");
delete fTabWidget->widget(0);
delete fTabWidget->widget(0);
}
}
}
@ -1866,6 +1879,8 @@ void PTextEdit::musrMsr2Data()
// init fMsr2DataParam
fMsr2DataParam->keepMinuit2Output = fAdmin->getKeepMinuit2OutputFlag();
fMsr2DataParam->titleFromDataFile = fAdmin->getTitleFromDataFileFlag();
fMsr2DataParam->estimateN0 = fAdmin->getEstimateN0Flag();
fMsr2DataParam->perRunBlockChisq = fAdmin->getChisqPerRunBlockFlag();
PMsr2DataDialog *dlg = new PMsr2DataDialog(fMsr2DataParam, fAdmin->getHelpUrl("msr2data"));
@ -1887,6 +1902,8 @@ void PTextEdit::musrMsr2Data()
fMsr2DataParam = dlg->getMsr2DataParam();
fAdmin->setKeepMinuit2OutputFlag(fMsr2DataParam->keepMinuit2Output);
fAdmin->setTitleFromDataFileFlag(fMsr2DataParam->titleFromDataFile);
fAdmin->setEstimateN0Flag(fMsr2DataParam->estimateN0);
fAdmin->setChisqPerRunBlockFlag(fMsr2DataParam->perRunBlockChisq);
// analyze parameters
switch (dlg->getRunTag()) {
@ -1896,20 +1913,10 @@ void PTextEdit::musrMsr2Data()
QMessageBox::Ok, QMessageBox::NoButton);
return;
break;
case 0: // first last
first = QString("%1").arg(fMsr2DataParam->firstRun);
last = QString("%1").arg(fMsr2DataParam->lastRun);
if (first.isEmpty() || last.isEmpty()) {
QMessageBox::critical(this, "**ERROR**",
"If you choose the first/last option,\nfirst AND last needs to be provided.",
QMessageBox::Ok, QMessageBox::NoButton);
return;
}
break;
case 1: // run list
case 0: // run list
runList = fMsr2DataParam->runList;
break;
case 2: // run list file name
case 1: // run list file name
runListFileName = fMsr2DataParam->runListFileName;
fi.setFile(QFileInfo(*fFilenames.find( currentEditor() )).absolutePath() + "/" + runListFileName);
if (!fi.exists()) {
@ -1936,10 +1943,6 @@ void PTextEdit::musrMsr2Data()
// run list argument
switch (dlg->getRunTag()) {
case 0:
cmd.append(first);
cmd.append(last);
break;
case 1:
end = 0;
while (!runList.section(' ', end, end, QString::SectionSkipEmpty).isEmpty()) {
end++;
@ -1960,7 +1963,7 @@ void PTextEdit::musrMsr2Data()
cmd.append(str);
}
break;
case 2:
case 1:
cmd.append(runListFileName);
break;
default:
@ -2025,6 +2028,16 @@ void PTextEdit::musrMsr2Data()
cmd.append("-t");
}
// estimate N0 (makes sence for single histo and muMinus fits only). Add flag only if a fit is done
if (fMsr2DataParam->estimateN0 && (fMsr2DataParam->fitOnly || fMsr2DataParam->templateRunNo != -1)) {
cmd.append("-e");
}
// write per-run-block chisq. Add flag only if a fit is done
if (fMsr2DataParam->perRunBlockChisq && (fMsr2DataParam->fitOnly || fMsr2DataParam->templateRunNo != -1)) {
cmd.append("-p");
}
// DB output wished
if (!fMsr2DataParam->dbOutputFileName.isEmpty()) {
str = "-o" + fMsr2DataParam->dbOutputFileName;
@ -2068,19 +2081,7 @@ void PTextEdit::musrMsr2Data()
if (!fMsr2DataParam->global) { // standard fits
switch(dlg->getRunTag()) {
case 0: // first run / last run list
if (fMsr2DataParam->firstRun != -1) {
for (int i=fMsr2DataParam->firstRun; i<=fMsr2DataParam->lastRun; i++) {
if (fMsr2DataParam->msrFileExtension.isEmpty())
fln = QString("%1").arg(i) + ".msr";
else
fln = QString("%1").arg(i) + fMsr2DataParam->msrFileExtension + ".msr";
load(QFileInfo(*fFilenames.find( currentEditor() )).absolutePath() + "/" + fln);
}
}
break;
case 1: // run list
case 0: // run list
list = getRunList(runList, ok);
if (!ok)
return;
@ -2094,7 +2095,7 @@ void PTextEdit::musrMsr2Data()
load(QFileInfo(*fFilenames.find( currentEditor() )).absolutePath() + "/" + fln);
}
break;
case 2: // run list file
case 1: // run list file
file = new QFile(QFileInfo(*fFilenames.find( currentEditor() )).absolutePath() + "/" + fMsr2DataParam->runListFileName);
if (!file->open(QIODevice::ReadOnly)) {
str = QString("Couldn't open run list file %1, sorry.").arg(fMsr2DataParam->runListFileName);
@ -2130,13 +2131,10 @@ void PTextEdit::musrMsr2Data()
// get the first run number needed to build the global fit file name
fln = QString("");
switch(dlg->getRunTag()) {
case 0: // first/last run
fln = QString("%1").arg(fMsr2DataParam->firstRun) + QString("+global") + fMsr2DataParam->msrFileExtension + QString(".msr");
break;
case 1: // run list
case 0: // run list
fln = runList.section(" ", 0, 0, QString::SectionSkipEmpty) + QString("+global") + fMsr2DataParam->msrFileExtension + QString(".msr");
break;
case 2: // run list file name
case 1: // run list file name
file = new QFile(QFileInfo(*fFilenames.find( currentEditor() )).absolutePath() + "/" + fMsr2DataParam->runListFileName);
if (!file->open(QIODevice::ReadOnly)) {
str = QString("Couldn't open run list file %1, sorry.").arg(fMsr2DataParam->runListFileName);
@ -2237,7 +2235,7 @@ void PTextEdit::musrView()
tr("Quit") );
return;
}
}
}
//----------------------------------------------------------------------------------------------------
/**
@ -2490,6 +2488,7 @@ void PTextEdit::musrDump()
QVector<QString> cmd;
QString str = fAdmin->getExecPath() + "/dump_header";
cmd.append(str);
cmd.append("-fn");
cmd.append(fileName);
PDumpOutputHandler dumpOutputHandler(cmd);

View File

@ -0,0 +1,114 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PChangeDefaultPathsDialog</class>
<widget class="QDialog" name="PChangeDefaultPathsDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>528</width>
<height>363</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<widget class="QWidget" name="">
<property name="geometry">
<rect>
<x>9</x>
<y>10</y>
<width>512</width>
<height>341</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QListWidget" name="fSearchPath_listWidget"/>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>328</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="fAdd_pushButton">
<property name="text">
<string>Add</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="fDelete_pushButton">
<property name="text">
<string>Delete</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>PChangeDefaultPathsDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>228</x>
<y>332</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>PChangeDefaultPathsDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>296</x>
<y>338</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -9,7 +9,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>552</width>
<width>585</width>
<height>594</height>
</rect>
</property>
@ -25,8 +25,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>551</width>
<height>131</height>
<width>581</width>
<height>111</height>
</rect>
</property>
<property name="font">
@ -44,96 +44,16 @@
<property name="checkable">
<bool>false</bool>
</property>
<widget class="QWidget" name="layoutWidget">
<widget class="QWidget" name="">
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>531</width>
<height>97</height>
<width>561</width>
<height>70</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="fFirst_label">
<property name="text">
<string>First</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="fFirst_lineEdit">
<property name="toolTip">
<string>start run number</string>
</property>
<property name="whatsThis">
<string>start run number</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="fLast_label">
<property name="text">
<string>Last</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="fLast_lineEdit">
<property name="toolTip">
<string>end run number</string>
</property>
<property name="statusTip">
<string>end run number</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>200</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="fOrFirstLast_label">
<property name="text">
<string>&lt;b&gt;OR&lt;/b&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::AutoText</enum>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
@ -219,8 +139,8 @@
<property name="geometry">
<rect>
<x>0</x>
<y>130</y>
<width>551</width>
<y>110</y>
<width>581</width>
<height>71</height>
</rect>
</property>
@ -232,8 +152,8 @@
<rect>
<x>10</x>
<y>30</y>
<width>531</width>
<height>29</height>
<width>561</width>
<height>31</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_5">
@ -249,9 +169,12 @@
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<width>30</width>
<height>20</height>
</size>
</property>
@ -284,8 +207,8 @@
<property name="geometry">
<rect>
<x>0</x>
<y>200</y>
<width>551</width>
<y>180</y>
<width>581</width>
<height>80</height>
</rect>
</property>
@ -297,8 +220,8 @@
<rect>
<x>10</x>
<y>30</y>
<width>531</width>
<height>29</height>
<width>561</width>
<height>31</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_6">
@ -346,8 +269,8 @@
<property name="geometry">
<rect>
<x>0</x>
<y>280</y>
<width>551</width>
<y>260</y>
<width>581</width>
<height>80</height>
</rect>
</property>
@ -359,8 +282,8 @@
<rect>
<x>10</x>
<y>30</y>
<width>531</width>
<height>29</height>
<width>561</width>
<height>31</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_7">
@ -401,9 +324,9 @@
<property name="geometry">
<rect>
<x>0</x>
<y>360</y>
<width>551</width>
<height>171</height>
<y>340</y>
<width>581</width>
<height>191</height>
</rect>
</property>
<property name="title">
@ -414,8 +337,8 @@
<rect>
<x>6</x>
<y>20</y>
<width>541</width>
<height>116</height>
<width>560</width>
<height>131</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_9">
@ -451,6 +374,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="fEstimateN0_checkBox">
<property name="text">
<string>Estimate N0</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
@ -485,6 +415,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="fWritePerRunBlockChisq_checkBox">
<property name="text">
<string>Write per-run-block Chisq</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
@ -551,7 +488,7 @@
<property name="geometry">
<rect>
<x>9</x>
<y>143</y>
<y>160</y>
<width>141</width>
<height>16</height>
</rect>
@ -566,9 +503,9 @@
<widget class="QLineEdit" name="fParamList_lineEdit">
<property name="geometry">
<rect>
<x>150</x>
<y>140</y>
<width>395</width>
<x>164</x>
<y>157</y>
<width>401</width>
<height>23</height>
</rect>
</property>
@ -582,7 +519,7 @@
<rect>
<x>5</x>
<y>540</y>
<width>541</width>
<width>571</width>
<height>51</height>
</rect>
</property>
@ -636,8 +573,6 @@
</widget>
</widget>
<tabstops>
<tabstop>fFirst_lineEdit</tabstop>
<tabstop>fLast_lineEdit</tabstop>
<tabstop>fRunList_lineEdit</tabstop>
<tabstop>fRunListFileName_lineEdit</tabstop>
<tabstop>fMsrFileExtension_lineEdit</tabstop>
@ -712,38 +647,6 @@
</hint>
</hints>
</connection>
<connection>
<sender>fFirst_lineEdit</sender>
<signal>textChanged(QString)</signal>
<receiver>PMsr2DataDialog</receiver>
<slot>runFirstEntered(QString)</slot>
<hints>
<hint type="sourcelabel">
<x>82</x>
<y>44</y>
</hint>
<hint type="destinationlabel">
<x>113</x>
<y>504</y>
</hint>
</hints>
</connection>
<connection>
<sender>fLast_lineEdit</sender>
<signal>textChanged(QString)</signal>
<receiver>PMsr2DataDialog</receiver>
<slot>runLastEntered(QString)</slot>
<hints>
<hint type="sourcelabel">
<x>229</x>
<y>44</y>
</hint>
<hint type="destinationlabel">
<x>348</x>
<y>500</y>
</hint>
</hints>
</connection>
<connection>
<sender>fRunList_lineEdit</sender>
<signal>textChanged(QString)</signal>

View File

@ -45,7 +45,7 @@
<x>10</x>
<y>10</y>
<width>421</width>
<height>25</height>
<height>35</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
@ -74,6 +74,19 @@
</item>
</layout>
</widget>
<widget class="QPushButton" name="fDefaultPath_pushButton">
<property name="geometry">
<rect>
<x>10</x>
<y>50</y>
<width>421</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>Change Default Search Paths</string>
</property>
</widget>
</widget>
<widget class="QWidget" name="fMusrfit_tab">
<attribute name="title">
@ -121,9 +134,9 @@
<widget class="QCheckBox" name="fTitleFromData_checkBox">
<property name="geometry">
<rect>
<x>170</x>
<x>190</x>
<y>10</y>
<width>171</width>
<width>241</width>
<height>23</height>
</rect>
</property>
@ -134,9 +147,9 @@
<widget class="QCheckBox" name="fPerRunBlockChisq_checkBox">
<property name="geometry">
<rect>
<x>170</x>
<x>190</x>
<y>35</y>
<width>191</width>
<width>241</width>
<height>22</height>
</rect>
</property>
@ -147,9 +160,9 @@
<widget class="QCheckBox" name="fEstimateN0_checkBox">
<property name="geometry">
<rect>
<x>170</x>
<x>190</x>
<y>60</y>
<width>161</width>
<width>241</width>
<height>22</height>
</rect>
</property>
@ -167,7 +180,7 @@
<rect>
<x>10</x>
<y>10</y>
<width>141</width>
<width>421</width>
<height>22</height>
</rect>
</property>
@ -180,7 +193,7 @@
<rect>
<x>10</x>
<y>40</y>
<width>231</width>
<width>421</width>
<height>21</height>
</rect>
</property>

View File

@ -41,8 +41,6 @@
* parameters see <code>msr2data --help</code> and the online documentation.
*/
typedef struct {
int firstRun; ///< first run number of a sequence of runs (usage 2 of msr2data)
int lastRun; ///< last run number of a sequence of runs (usage 2 of msr2data)
QString runList; ///< list of run numbers (usage 3 of msr2data)
QString runListFileName; ///< run list filename (usage 4 of msr2data)
QString msrFileExtension; ///< msr filename extension, e.g. '0100_h13.msr' -> '_h13'
@ -57,6 +55,8 @@ typedef struct {
bool chainFit; ///< flag: true = chain fit, i.e. the template for a fit is the preceeding run. false = the template is always the source for the new msr-file
bool openFilesAfterFitting; ///< flag: true = open msr-file after fit in musredit. false = do not open msr-file after fit.
bool titleFromDataFile; ///< flag indicating if the title for the msr-file shall be extracted from the data-file ('-t' in msr2data)
bool estimateN0; ///< flag indicating if the N0 shall be estimated for single histogram fitting
bool perRunBlockChisq; ///< flag indicating if per-run-block-chisq shall be dumped into the msr-file
bool createMsrFileOnly; ///< flag: true = just create the msr-files without any fitting ('msr-<template>' in msr2data)
bool fitOnly; ///< flag: true = just perform the fits wihtout generating any msr-files ('fit' in msr2data).
bool global; ///< flag: true = 'global' option

View File

@ -104,6 +104,7 @@ HEADERS = musredit.h \
PGetFourierBlockDialog.h \
PGetPlotBlockDialog.h \
PMsr2DataDialog.h \
PChangeDefaultPathsDialog.h \
PMusrEditAbout.h
SOURCES = PHelp.cpp \
@ -128,6 +129,7 @@ SOURCES = PHelp.cpp \
PGetFourierBlockDialog.cpp \
PGetPlotBlockDialog.cpp \
PMsr2DataDialog.cpp \
PChangeDefaultPathsDialog.cpp \
PMusrEditAbout.cpp \
main.cpp
@ -147,7 +149,8 @@ FORMS = forms/PFindDialog.ui \
forms/PGetNonMusrRunBlockDialog.ui \
forms/PGetFourierBlockDialog.ui \
forms/PGetPlotBlockDialog.ui \
forms/PMsr2DataDialog.ui
forms/PMsr2DataDialog.ui \
forms/PChangeDefaultPathsDialog.ui
RESOURCES = musredit.qrc

View File

@ -88,7 +88,7 @@ void* musrfit_timeout(void *args)
void musrfit_syntax()
{
cout << endl << "usage: musrfit [<msr-file> [-k, --keep-mn2-ouput] [-c, --chisq-only] [-t, --title-from-data-file]";
cout << endl << " [-e, --estimateN0 <flag>] [-p, --per-run-block-chisq <flag>]";
cout << endl << " [-e, --estimateN0] [-p, --per-run-block-chisq]";
cout << endl << " [--dump <type>] [--timeout <timeout_tag>] | --version | --help";
cout << endl << " <msr-file>: msr input file";
cout << endl << " 'musrfit <msr-file>' will execute musrfit";