adopted to the new features in musrview and some additional little improvements.

This commit is contained in:
suter_a 2016-12-18 10:41:34 +01:00
parent 5d80c342e0
commit 265fe18f36
12 changed files with 133 additions and 30 deletions

View File

@ -87,6 +87,8 @@ bool PAdminXMLParser::startElement( const QString&, const QString&,
fKeyWord = eTitleFromDataFile; fKeyWord = eTitleFromDataFile;
} else if (qName == "musrview_show_fourier") { } else if (qName == "musrview_show_fourier") {
fKeyWord = eMusrviewShowFourier; fKeyWord = eMusrviewShowFourier;
} else if (qName == "musrview_show_avg") {
fKeyWord = eMusrviewShowAvg;
} else if (qName == "enable_musrt0") { } else if (qName == "enable_musrt0") {
fKeyWord = eEnableMusrT0; fKeyWord = eEnableMusrT0;
} else if (qName == "keep_minuit2_output") { } else if (qName == "keep_minuit2_output") {
@ -251,6 +253,13 @@ bool PAdminXMLParser::characters(const QString& str)
flag = false; flag = false;
fAdmin->setMusrviewShowFourierFlag(flag); fAdmin->setMusrviewShowFourierFlag(flag);
break; break;
case eMusrviewShowAvg:
if (str == "y")
flag = true;
else
flag = false;
fAdmin->setMusrviewShowAvgFlag(flag);
break;
case eEnableMusrT0: case eEnableMusrT0:
if (str == "y") if (str == "y")
flag = true; flag = true;
@ -614,6 +623,7 @@ PAdmin::PAdmin() : QObject()
fFileFormat = QString(""); fFileFormat = QString("");
fMusrviewShowFourier = false; fMusrviewShowFourier = false;
fMusrviewShowAvg = false;
fTitleFromDataFile = false; fTitleFromDataFile = false;
fEnableMusrT0 = false; fEnableMusrT0 = false;
@ -837,6 +847,12 @@ int PAdmin::savePrefs(QString pref_fln)
else else
data[i] = " <musrview_show_fourier>n</musrview_show_fourier>"; data[i] = " <musrview_show_fourier>n</musrview_show_fourier>";
} }
if (data[i].contains("<musrview_show_avg>") && data[i].contains("</musrview_show_avg>")) {
if (fMusrviewShowAvg)
data[i] = " <musrview_show_avg>y</musrview_show_avg>";
else
data[i] = " <musrview_show_avg>n</musrview_show_avg>";
}
if (data[i].contains("<enable_musrt0>") && data[i].contains("</enable_musrt0>")) { if (data[i].contains("<enable_musrt0>") && data[i].contains("</enable_musrt0>")) {
if (fEnableMusrT0) if (fEnableMusrT0)
data[i] = " <enable_musrt0>y</enable_musrt0>"; data[i] = " <enable_musrt0>y</enable_musrt0>";

View File

@ -69,7 +69,8 @@ class PAdminXMLParser : public QXmlDefaultHandler
private: private:
enum EAdminKeyWords {eEmpty, eTimeout, eKeepMinuit2Output, eDumpAscii, eDumpRoot, enum EAdminKeyWords {eEmpty, eTimeout, eKeepMinuit2Output, eDumpAscii, eDumpRoot,
eTitleFromDataFile, eChisqPreRunBlock, eEstimateN0, eMusrviewShowFourier, eEnableMusrT0, eTitleFromDataFile, eChisqPreRunBlock, eEstimateN0,
eMusrviewShowFourier, eMusrviewShowAvg, eEnableMusrT0,
eFontName, eFontSize, eExecPath, eDefaultSavePath, eFontName, eFontSize, eExecPath, eDefaultSavePath,
eRecentFile, eBeamline, eInstitute, eFileFormat, eLifetimeCorrection, eMsrDefaultFilePath, eRecentFile, eBeamline, eInstitute, eFileFormat, eLifetimeCorrection, eMsrDefaultFilePath,
eTheoFuncPixmapPath, eFunc, eFuncName, eFuncComment, eFuncLabel, eTheoFuncPixmapPath, eFunc, eFuncName, eFuncComment, eFuncLabel,
@ -119,6 +120,7 @@ class PAdmin : public QObject
QString getDefaultSavePath() { return fDefaultSavePath; } QString getDefaultSavePath() { return fDefaultSavePath; }
bool getTitleFromDataFileFlag() { return fTitleFromDataFile; } bool getTitleFromDataFileFlag() { return fTitleFromDataFile; }
bool getMusrviewShowFourierFlag() { return fMusrviewShowFourier; } bool getMusrviewShowFourierFlag() { return fMusrviewShowFourier; }
bool getMusrviewShowAvgFlag() { return fMusrviewShowAvg; }
bool getEnableMusrT0Flag() { return fEnableMusrT0; } bool getEnableMusrT0Flag() { return fEnableMusrT0; }
bool getKeepMinuit2OutputFlag() { return fKeepMinuit2Output; } bool getKeepMinuit2OutputFlag() { return fKeepMinuit2Output; }
bool getDumpAsciiFlag() { return fDumpAscii; } bool getDumpAsciiFlag() { return fDumpAscii; }
@ -142,6 +144,7 @@ class PAdmin : public QObject
void setTimeout(const int ival) { fTimeout = ival; } void setTimeout(const int ival) { fTimeout = ival; }
void setTitleFromDataFileFlag(const bool flag) { fTitleFromDataFile = flag; } void setTitleFromDataFileFlag(const bool flag) { fTitleFromDataFile = flag; }
void setMusrviewShowFourierFlag(const bool flag) { fMusrviewShowFourier = flag; } void setMusrviewShowFourierFlag(const bool flag) { fMusrviewShowFourier = flag; }
void setMusrviewShowAvgFlag(const bool flag) { fMusrviewShowAvg = flag; }
void setEnableMusrT0Flag(const bool flag) { fEnableMusrT0 = flag; } void setEnableMusrT0Flag(const bool flag) { fEnableMusrT0 = flag; }
void setKeepMinuit2OutputFlag(const bool flag) { fKeepMinuit2Output = flag; } void setKeepMinuit2OutputFlag(const bool flag) { fKeepMinuit2Output = flag; }
void setDumpAsciiFlag(const bool flag) { fDumpAscii = flag; } void setDumpAsciiFlag(const bool flag) { fDumpAscii = flag; }
@ -185,6 +188,7 @@ class PAdmin : public QObject
QVector<QString> fRecentFile; ///< keep vector of recent path-file names QVector<QString> fRecentFile; ///< keep vector of recent path-file names
bool fMusrviewShowFourier; ///< flag indicating if musrview should show at startup data (=false) or Fourier of data (=true). bool fMusrviewShowFourier; ///< flag indicating if musrview should show at startup data (=false) or Fourier of data (=true).
bool fMusrviewShowAvg; ///< flag indicating if musrview should show at startup averaged (=true) or original (=false) data/Fourier.
bool fKeepMinuit2Output; ///< flag indicating if the Minuit2 output shall be kept (default: no) 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 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 fDumpRoot; ///< flag indicating if musrfit shall make an root-dump file (for debugging purposes, default: no).

View File

@ -62,6 +62,7 @@ PPrefsDialog::PPrefsDialog(PAdmin *admin) : fAdmin(admin)
fPerRunBlockChisq_checkBox->setChecked(fAdmin->getChisqPerRunBlockFlag()); fPerRunBlockChisq_checkBox->setChecked(fAdmin->getChisqPerRunBlockFlag());
fEstimateN0_checkBox->setChecked(fAdmin->getEstimateN0Flag()); fEstimateN0_checkBox->setChecked(fAdmin->getEstimateN0Flag());
fFourier_checkBox->setChecked(fAdmin->getMusrviewShowFourierFlag()); fFourier_checkBox->setChecked(fAdmin->getMusrviewShowFourierFlag());
fAvg_checkBox->setChecked(fAdmin->getMusrviewShowAvgFlag());
fTimeout_lineEdit->setText(QString("%1").arg(fAdmin->getTimeout())); fTimeout_lineEdit->setText(QString("%1").arg(fAdmin->getTimeout()));
fTimeout_lineEdit->setValidator(new QIntValidator(fTimeout_lineEdit)); fTimeout_lineEdit->setValidator(new QIntValidator(fTimeout_lineEdit));

View File

@ -47,6 +47,7 @@ class PPrefsDialog : public QDialog, private Ui::PPrefsDialog
PPrefsDialog(PAdmin *admin); PPrefsDialog(PAdmin *admin);
bool getMusrviewShowFourierFlag() { return fFourier_checkBox->isChecked(); } bool getMusrviewShowFourierFlag() { return fFourier_checkBox->isChecked(); }
bool getMusrviewShowAvgFlag() { return fAvg_checkBox->isChecked(); }
bool getKeepMinuit2OutputFlag() { return fKeepMn2Output_checkBox->isChecked(); } bool getKeepMinuit2OutputFlag() { return fKeepMn2Output_checkBox->isChecked(); }
bool getTitleFromDataFileFlag() { return fTitleFromData_checkBox->isChecked(); } bool getTitleFromDataFileFlag() { return fTitleFromData_checkBox->isChecked(); }
bool getEnableMusrT0Flag() { return fEnableMusrT0_checkBox->isChecked(); } bool getEnableMusrT0Flag() { return fEnableMusrT0_checkBox->isChecked(); }

View File

@ -1699,6 +1699,12 @@ void PTextEdit::musrCalcChisq()
if ( !currentEditor() ) if ( !currentEditor() )
return; return;
int result = 0;
if (fAdmin->getEstimateN0Flag())
result = QMessageBox::question(this, "Estimate N0 active",
"Do you wish a chisq/mlh evaluation with an automatic N0 estimate?",
QMessageBox::Yes, QMessageBox::No);
QString tabLabel = fTabWidget->tabText(fTabWidget->currentIndex()); QString tabLabel = fTabWidget->tabText(fTabWidget->currentIndex());
if (tabLabel == "noname") { if (tabLabel == "noname") {
QMessageBox::critical(this, "**ERROR**", "For a fit a real msr-file is needed."); QMessageBox::critical(this, "**ERROR**", "For a fit a real msr-file is needed.");
@ -1716,8 +1722,8 @@ void PTextEdit::musrCalcChisq()
cmd.append(str); cmd.append(str);
cmd.append(QFileInfo(*fFilenames.find( currentEditor())).fileName() ); cmd.append(QFileInfo(*fFilenames.find( currentEditor())).fileName() );
cmd.append("--chisq-only"); cmd.append("--chisq-only");
cmd.append("--estimateN0"); if (fAdmin->getEstimateN0Flag() && (result == QMessageBox::Yes))
cmd.append("no"); cmd.append("--estimateN0");
PFitOutputHandler fitOutputHandler(QFileInfo(*fFilenames.find( currentEditor() )).absolutePath(), cmd); PFitOutputHandler fitOutputHandler(QFileInfo(*fFilenames.find( currentEditor() )).absolutePath(), cmd);
fitOutputHandler.setModal(true); fitOutputHandler.setModal(true);
fitOutputHandler.exec(); fitOutputHandler.exec();
@ -1770,19 +1776,11 @@ void PTextEdit::musrFit()
// check estimate N0 flag // check estimate N0 flag
if (fAdmin->getEstimateN0Flag()) { if (fAdmin->getEstimateN0Flag()) {
cmd.append("--estimateN0"); cmd.append("--estimateN0");
cmd.append("yes");
} else {
cmd.append("--estimateN0");
cmd.append("no");
} }
// check per-run-block-chisq flag // check per-run-block-chisq flag
if (fAdmin->getChisqPerRunBlockFlag()) { if (fAdmin->getChisqPerRunBlockFlag()) {
cmd.append("--per-run-block-chisq"); cmd.append("--per-run-block-chisq");
cmd.append("yes");
} else {
cmd.append("--per-run-block-chisq");
cmd.append("no");
} }
// add timeout // add timeout
@ -2203,6 +2201,8 @@ void PTextEdit::musrView()
cmd += str + "\" --timeout " + numStr; cmd += str + "\" --timeout " + numStr;
if (fAdmin->getMusrviewShowFourierFlag()) if (fAdmin->getMusrviewShowFourierFlag())
cmd += " -f "; cmd += " -f ";
if (fAdmin->getMusrviewShowAvgFlag())
cmd += " -a ";
cmd += " &"; cmd += " &";
int status=system(cmd.toLatin1()); int status=system(cmd.toLatin1());

View File

@ -33,7 +33,7 @@
<item> <item>
<widget class="QTabWidget" name="fTabWidget"> <widget class="QTabWidget" name="fTabWidget">
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>2</number>
</property> </property>
<widget class="QWidget" name="fGeneral_tab"> <widget class="QWidget" name="fGeneral_tab">
<attribute name="title"> <attribute name="title">
@ -175,6 +175,19 @@
<string>start with Fourier</string> <string>start with Fourier</string>
</property> </property>
</widget> </widget>
<widget class="QCheckBox" name="fAvg_checkBox">
<property name="geometry">
<rect>
<x>10</x>
<y>40</y>
<width>261</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>start with averaged data/Fourier</string>
</property>
</widget>
</widget> </widget>
<widget class="QWidget" name="fMusrt0_tab"> <widget class="QWidget" name="fMusrt0_tab">
<attribute name="title"> <attribute name="title">

View File

@ -37,6 +37,8 @@ using namespace std;
#include <QTextStream> #include <QTextStream>
#include <QVector> #include <QVector>
#include <QProcessEnvironment>
#include "PAdmin.h" #include "PAdmin.h"
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
@ -87,6 +89,8 @@ bool PAdminXMLParser::startElement( const QString&, const QString&,
fKeyWord = eTitleFromDataFile; fKeyWord = eTitleFromDataFile;
} else if (qName == "musrview_show_fourier") { } else if (qName == "musrview_show_fourier") {
fKeyWord = eMusrviewShowFourier; fKeyWord = eMusrviewShowFourier;
} else if (qName == "musrview_show_avg") {
fKeyWord = eMusrviewShowAvg;
} else if (qName == "enable_musrt0") { } else if (qName == "enable_musrt0") {
fKeyWord = eEnableMusrT0; fKeyWord = eEnableMusrT0;
} else if (qName == "keep_minuit2_output") { } else if (qName == "keep_minuit2_output") {
@ -251,6 +255,13 @@ bool PAdminXMLParser::characters(const QString& str)
flag = false; flag = false;
fAdmin->setMusrviewShowFourierFlag(flag); fAdmin->setMusrviewShowFourierFlag(flag);
break; break;
case eMusrviewShowAvg:
if (str == "y")
flag = true;
else
flag = false;
fAdmin->setMusrviewShowAvgFlag(flag);
break;
case eEnableMusrT0: case eEnableMusrT0:
if (str == "y") if (str == "y")
flag = true; flag = true;
@ -477,7 +488,7 @@ bool PAdminXMLParser::endDocument()
str = expandPath(fAdmin->getDefaultSavePath()); str = expandPath(fAdmin->getDefaultSavePath());
if (!str.isEmpty()) if (!str.isEmpty())
fAdmin->setDefaultSavePath(str); fAdmin->setDefaultSavePath(str);
} }
if (fAdmin->getMsrDefaultFilePath().indexOf('$') >= 0) { if (fAdmin->getMsrDefaultFilePath().indexOf('$') >= 0) {
str = expandPath(fAdmin->getMsrDefaultFilePath()); str = expandPath(fAdmin->getMsrDefaultFilePath());
@ -567,13 +578,21 @@ QString PAdminXMLParser::expandPath(const QString &str)
QString msg; QString msg;
QString newStr=""; QString newStr="";
QProcessEnvironment procEnv = QProcessEnvironment::systemEnvironment();
QStringList list = str.split("/"); QStringList list = str.split("/");
for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
token = *it; token = *it;
if (token.contains("$")) { if (token.contains("$")) {
token.remove('$'); token.remove('$');
path = std::getenv(token.toLatin1()); if (!procEnv.contains(token)) {
msg = QString("Couldn't find '%1'. Some things might not work properly").arg(token);
QMessageBox::warning(0, "**WARNING**", msg, QMessageBox::Ok, QMessageBox::NoButton);
newStr = "";
break;
}
path = procEnv.value(token, "");
if (path.isEmpty()) { if (path.isEmpty()) {
msg = QString("Couldn't expand '%1'. Some things might not work properly").arg(token); msg = QString("Couldn't expand '%1'. Some things might not work properly").arg(token);
QMessageBox::warning(0, "**WARNING**", msg, QMessageBox::Ok, QMessageBox::NoButton); QMessageBox::warning(0, "**WARNING**", msg, QMessageBox::Ok, QMessageBox::NoButton);
@ -614,6 +633,7 @@ PAdmin::PAdmin() : QObject()
fFileFormat = QString(""); fFileFormat = QString("");
fMusrviewShowFourier = false; fMusrviewShowFourier = false;
fMusrviewShowAvg = false;
fTitleFromDataFile = false; fTitleFromDataFile = false;
fEnableMusrT0 = false; fEnableMusrT0 = false;
@ -646,17 +666,18 @@ PAdmin::PAdmin() : QObject()
QString path = QString("./"); QString path = QString("./");
QString fln = QString("musredit_startup.xml"); QString fln = QString("musredit_startup.xml");
QString pathFln = path + fln; QString pathFln = path + fln;
QProcessEnvironment procEnv = QProcessEnvironment::systemEnvironment();
if (!QFile::exists(pathFln)) { if (!QFile::exists(pathFln)) {
// 2nd: check $HOME/.musrfit/musredit/musredit_startup.xml // 2nd: check $HOME/.musrfit/musredit/musredit_startup.xml
path = std::getenv("HOME"); path = procEnv.value("HOME", "");
pathFln = path + "/.musrfit/musredit/" + fln; pathFln = path + "/.musrfit/musredit/" + fln;
if (!QFile::exists(pathFln)) { if (!QFile::exists(pathFln)) {
// 3rd: check $MUSRFITPATH/musredit_startup.xml // 3rd: check $MUSRFITPATH/musredit_startup.xml
path = std::getenv("MUSRFITPATH"); path = procEnv.value("MUSRFITPATH", "");
pathFln = path + "/" + fln; pathFln = path + "/" + fln;
if (!QFile::exists(pathFln)) { if (!QFile::exists(pathFln)) {
// 4th: check $ROOTSYS/bin/musredit_startup.xml // 4th: check $ROOTSYS/bin/musredit_startup.xml
path = std::getenv("ROOTSYS"); path = procEnv.value("ROOTSYS", "");
pathFln = path + "/bin/" + fln; pathFln = path + "/bin/" + fln;
} }
} }
@ -837,12 +858,24 @@ int PAdmin::savePrefs(QString pref_fln)
else else
data[i] = " <musrview_show_fourier>n</musrview_show_fourier>"; data[i] = " <musrview_show_fourier>n</musrview_show_fourier>";
} }
if (data[i].contains("<musrview_show_avg>") && data[i].contains("</musrview_show_avg>")) {
if (fMusrviewShowAvg)
data[i] = " <musrview_show_avg>y</musrview_show_avg>";
else
data[i] = " <musrview_show_avg>n</musrview_show_avg>";
}
if (data[i].contains("<enable_musrt0>") && data[i].contains("</enable_musrt0>")) { if (data[i].contains("<enable_musrt0>") && data[i].contains("</enable_musrt0>")) {
if (fEnableMusrT0) if (fEnableMusrT0)
data[i] = " <enable_musrt0>y</enable_musrt0>"; data[i] = " <enable_musrt0>y</enable_musrt0>";
else else
data[i] = " <enable_musrt0>n</enable_musrt0>"; data[i] = " <enable_musrt0>n</enable_musrt0>";
} }
if (data[i].contains("<font_name>") && data[i].contains("</font_name>")) {
data[i] = QString(" <font_name>%1</font_name>").arg(fFontName);
}
if (data[i].contains("<font_size>") && data[i].contains("</font_size>")) {
data[i] = QString(" <font_size>%1</font_size>").arg(fFontSize);
}
} }
// write prefs // write prefs

View File

@ -69,7 +69,8 @@ class PAdminXMLParser : public QXmlDefaultHandler
private: private:
enum EAdminKeyWords {eEmpty, eTimeout, eKeepMinuit2Output, eDumpAscii, eDumpRoot, enum EAdminKeyWords {eEmpty, eTimeout, eKeepMinuit2Output, eDumpAscii, eDumpRoot,
eTitleFromDataFile, eChisqPreRunBlock, eEstimateN0, eMusrviewShowFourier, eEnableMusrT0, eTitleFromDataFile, eChisqPreRunBlock, eEstimateN0,
eMusrviewShowFourier, eMusrviewShowAvg, eEnableMusrT0,
eFontName, eFontSize, eExecPath, eDefaultSavePath, eFontName, eFontSize, eExecPath, eDefaultSavePath,
eRecentFile, eBeamline, eInstitute, eFileFormat, eLifetimeCorrection, eMsrDefaultFilePath, eRecentFile, eBeamline, eInstitute, eFileFormat, eLifetimeCorrection, eMsrDefaultFilePath,
eTheoFuncPixmapPath, eFunc, eFuncName, eFuncComment, eFuncLabel, eTheoFuncPixmapPath, eFunc, eFuncName, eFuncComment, eFuncLabel,
@ -119,6 +120,7 @@ class PAdmin : public QObject
QString getDefaultSavePath() { return fDefaultSavePath; } QString getDefaultSavePath() { return fDefaultSavePath; }
bool getTitleFromDataFileFlag() { return fTitleFromDataFile; } bool getTitleFromDataFileFlag() { return fTitleFromDataFile; }
bool getMusrviewShowFourierFlag() { return fMusrviewShowFourier; } bool getMusrviewShowFourierFlag() { return fMusrviewShowFourier; }
bool getMusrviewShowAvgFlag() { return fMusrviewShowAvg; }
bool getEnableMusrT0Flag() { return fEnableMusrT0; } bool getEnableMusrT0Flag() { return fEnableMusrT0; }
bool getKeepMinuit2OutputFlag() { return fKeepMinuit2Output; } bool getKeepMinuit2OutputFlag() { return fKeepMinuit2Output; }
bool getDumpAsciiFlag() { return fDumpAscii; } bool getDumpAsciiFlag() { return fDumpAscii; }
@ -142,6 +144,7 @@ class PAdmin : public QObject
void setTimeout(const int ival) { fTimeout = ival; } void setTimeout(const int ival) { fTimeout = ival; }
void setTitleFromDataFileFlag(const bool flag) { fTitleFromDataFile = flag; } void setTitleFromDataFileFlag(const bool flag) { fTitleFromDataFile = flag; }
void setMusrviewShowFourierFlag(const bool flag) { fMusrviewShowFourier = flag; } void setMusrviewShowFourierFlag(const bool flag) { fMusrviewShowFourier = flag; }
void setMusrviewShowAvgFlag(const bool flag) { fMusrviewShowAvg = flag; }
void setEnableMusrT0Flag(const bool flag) { fEnableMusrT0 = flag; } void setEnableMusrT0Flag(const bool flag) { fEnableMusrT0 = flag; }
void setKeepMinuit2OutputFlag(const bool flag) { fKeepMinuit2Output = flag; } void setKeepMinuit2OutputFlag(const bool flag) { fKeepMinuit2Output = flag; }
void setDumpAsciiFlag(const bool flag) { fDumpAscii = flag; } void setDumpAsciiFlag(const bool flag) { fDumpAscii = flag; }
@ -185,6 +188,7 @@ class PAdmin : public QObject
QVector<QString> fRecentFile; ///< keep vector of recent path-file names QVector<QString> fRecentFile; ///< keep vector of recent path-file names
bool fMusrviewShowFourier; ///< flag indicating if musrview should show at startup data (=false) or Fourier of data (=true). bool fMusrviewShowFourier; ///< flag indicating if musrview should show at startup data (=false) or Fourier of data (=true).
bool fMusrviewShowAvg; ///< flag indicating if musrview should show at startup averaged (=true) or original (=false) data/Fourier.
bool fKeepMinuit2Output; ///< flag indicating if the Minuit2 output shall be kept (default: no) 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 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 fDumpRoot; ///< flag indicating if musrfit shall make an root-dump file (for debugging purposes, default: no).

View File

@ -62,6 +62,7 @@ PPrefsDialog::PPrefsDialog(PAdmin *admin) : fAdmin(admin)
fPerRunBlockChisq_checkBox->setChecked(fAdmin->getChisqPerRunBlockFlag()); fPerRunBlockChisq_checkBox->setChecked(fAdmin->getChisqPerRunBlockFlag());
fEstimateN0_checkBox->setChecked(fAdmin->getEstimateN0Flag()); fEstimateN0_checkBox->setChecked(fAdmin->getEstimateN0Flag());
fFourier_checkBox->setChecked(fAdmin->getMusrviewShowFourierFlag()); fFourier_checkBox->setChecked(fAdmin->getMusrviewShowFourierFlag());
fAvg_checkBox->setChecked(fAdmin->getMusrviewShowAvgFlag());
fTimeout_lineEdit->setText(QString("%1").arg(fAdmin->getTimeout())); fTimeout_lineEdit->setText(QString("%1").arg(fAdmin->getTimeout()));
fTimeout_lineEdit->setValidator(new QIntValidator(fTimeout_lineEdit)); fTimeout_lineEdit->setValidator(new QIntValidator(fTimeout_lineEdit));

View File

@ -47,6 +47,7 @@ class PPrefsDialog : public QDialog, private Ui::PPrefsDialog
PPrefsDialog(PAdmin *admin); PPrefsDialog(PAdmin *admin);
bool getMusrviewShowFourierFlag() { return fFourier_checkBox->isChecked(); } bool getMusrviewShowFourierFlag() { return fFourier_checkBox->isChecked(); }
bool getMusrviewShowAvgFlag() { return fAvg_checkBox->isChecked(); }
bool getKeepMinuit2OutputFlag() { return fKeepMn2Output_checkBox->isChecked(); } bool getKeepMinuit2OutputFlag() { return fKeepMn2Output_checkBox->isChecked(); }
bool getTitleFromDataFileFlag() { return fTitleFromData_checkBox->isChecked(); } bool getTitleFromDataFileFlag() { return fTitleFromData_checkBox->isChecked(); }
bool getEnableMusrT0Flag() { return fEnableMusrT0_checkBox->isChecked(); } bool getEnableMusrT0Flag() { return fEnableMusrT0_checkBox->isChecked(); }

View File

@ -848,6 +848,13 @@ void PTextEdit::fileOpen()
++it; ++it;
} }
// 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");
delete fTabWidget->widget(0);
}
} }
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
@ -879,6 +886,13 @@ void PTextEdit::fileOpenRecent()
else else
fileReload(); 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");
delete fTabWidget->widget(0);
}
} }
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
@ -1699,6 +1713,11 @@ void PTextEdit::musrCalcChisq()
if ( !currentEditor() ) if ( !currentEditor() )
return; return;
int result = 0;
if (fAdmin->getEstimateN0Flag())
result = QMessageBox::question(this, "Estimate N0 active",
"Do you wish a chisq/mlh evaluation with an automatic N0 estimate?");
QString tabLabel = fTabWidget->tabText(fTabWidget->currentIndex()); QString tabLabel = fTabWidget->tabText(fTabWidget->currentIndex());
if (tabLabel == "noname") { if (tabLabel == "noname") {
QMessageBox::critical(this, "**ERROR**", "For a fit a real msr-file is needed."); QMessageBox::critical(this, "**ERROR**", "For a fit a real msr-file is needed.");
@ -1716,8 +1735,8 @@ void PTextEdit::musrCalcChisq()
cmd.append(str); cmd.append(str);
cmd.append(QFileInfo(*fFilenames.find( currentEditor())).fileName() ); cmd.append(QFileInfo(*fFilenames.find( currentEditor())).fileName() );
cmd.append("--chisq-only"); cmd.append("--chisq-only");
cmd.append("--estimateN0"); if (fAdmin->getEstimateN0Flag() && (result == QMessageBox::Yes))
cmd.append("no"); cmd.append("--estimateN0");
PFitOutputHandler fitOutputHandler(QFileInfo(*fFilenames.find( currentEditor() )).absolutePath(), cmd); PFitOutputHandler fitOutputHandler(QFileInfo(*fFilenames.find( currentEditor() )).absolutePath(), cmd);
fitOutputHandler.setModal(true); fitOutputHandler.setModal(true);
fitOutputHandler.exec(); fitOutputHandler.exec();
@ -1770,19 +1789,11 @@ void PTextEdit::musrFit()
// check estimate N0 flag // check estimate N0 flag
if (fAdmin->getEstimateN0Flag()) { if (fAdmin->getEstimateN0Flag()) {
cmd.append("--estimateN0"); cmd.append("--estimateN0");
cmd.append("yes");
} else {
cmd.append("--estimateN0");
cmd.append("no");
} }
// check per-run-block-chisq flag // check per-run-block-chisq flag
if (fAdmin->getChisqPerRunBlockFlag()) { if (fAdmin->getChisqPerRunBlockFlag()) {
cmd.append("--per-run-block-chisq"); cmd.append("--per-run-block-chisq");
cmd.append("yes");
} else {
cmd.append("--per-run-block-chisq");
cmd.append("no");
} }
// add timeout // add timeout
@ -2205,6 +2216,10 @@ void PTextEdit::musrView()
if (fAdmin->getMusrviewShowFourierFlag()) if (fAdmin->getMusrviewShowFourierFlag())
arg << "-f"; arg << "-f";
// start with averaged data/Fourier?
if (fAdmin->getMusrviewShowAvgFlag())
arg << "-a";
QProcess *proc = new QProcess(this); QProcess *proc = new QProcess(this);
// make sure that the system environment variables are properly set // make sure that the system environment variables are properly set
@ -2333,6 +2348,7 @@ void PTextEdit::musrPrefs()
if (dlg->exec() == QDialog::Accepted) { if (dlg->exec() == QDialog::Accepted) {
fAdmin->setMusrviewShowFourierFlag(dlg->getMusrviewShowFourierFlag()); fAdmin->setMusrviewShowFourierFlag(dlg->getMusrviewShowFourierFlag());
fAdmin->setMusrviewShowAvgFlag(dlg->getMusrviewShowAvgFlag());
fAdmin->setKeepMinuit2OutputFlag(dlg->getKeepMinuit2OutputFlag()); fAdmin->setKeepMinuit2OutputFlag(dlg->getKeepMinuit2OutputFlag());
fAdmin->setTitleFromDataFileFlag(dlg->getTitleFromDataFileFlag()); fAdmin->setTitleFromDataFileFlag(dlg->getTitleFromDataFileFlag());
fAdmin->setEnableMusrT0Flag(dlg->getEnableMusrT0Flag()); fAdmin->setEnableMusrT0Flag(dlg->getEnableMusrT0Flag());

View File

@ -17,7 +17,7 @@
<string>Preferences</string> <string>Preferences</string>
</property> </property>
<property name="windowIcon"> <property name="windowIcon">
<iconset resource="../musredit.qrc"> <iconset>
<normaloff>:/images/musrfit.xpm</normaloff>:/images/musrfit.xpm</iconset> <normaloff>:/images/musrfit.xpm</normaloff>:/images/musrfit.xpm</iconset>
</property> </property>
<widget class="QWidget" name="layoutWidget"> <widget class="QWidget" name="layoutWidget">
@ -175,6 +175,19 @@
<string>start with Fourier</string> <string>start with Fourier</string>
</property> </property>
</widget> </widget>
<widget class="QCheckBox" name="fAvg_checkBox">
<property name="geometry">
<rect>
<x>10</x>
<y>40</y>
<width>231</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>start with averaged data/Fourier</string>
</property>
</widget>
</widget> </widget>
<widget class="QWidget" name="fMusrt0_tab"> <widget class="QWidget" name="fMusrt0_tab">
<attribute name="title"> <attribute name="title">