changed musredit/musrgui msr2data interface such that it is hopefully closer to the command line (MUSR-162, MUSR-173)

This commit is contained in:
nemu
2011-07-15 05:43:41 +00:00
parent 5672c43d2e
commit 2a4f5bf78a
18 changed files with 228 additions and 91 deletions

View File

@ -25,6 +25,7 @@ FIXED bug reported in MUSR-183: missing background for 2nd histo in asymmetry fi
FIXED Makefiles so that the NeXus support will not be built if it has not been enabled during the configure stage FIXED Makefiles so that the NeXus support will not be built if it has not been enabled during the configure stage
FIXED ASCII export from musrview in case of a Fourier-Power- or Fourier-Phase-difference plot FIXED ASCII export from musrview in case of a Fourier-Power- or Fourier-Phase-difference plot
FIXED bug in asymmetry fit with fixed background FIXED bug in asymmetry fit with fixed background
CHANGED musredit/musrgui msr2data interface such that it is hopefully closer to the command line (MUSR-162, MUSR-173)
CHANGED the behavior of msr2data so that CHANGED the behavior of msr2data so that
* it proceeds to the next run if a fit did not converge (and does not stop as before) * it proceeds to the next run if a fit did not converge (and does not stop as before)
* it always tries to read the data files if the nosummary option is not present * it always tries to read the data files if the nosummary option is not present

View File

@ -117,8 +117,8 @@ bool PAdminXMLParser::startElement( const QString&, const QString&,
fKeyWord = eChainFit; fKeyWord = eChainFit;
} else if (qName == "write_data_header") { } else if (qName == "write_data_header") {
fKeyWord = eWriteDataHeader; fKeyWord = eWriteDataHeader;
} else if (qName == "summary_files_present") { } else if (qName == "ignore_data_header_info") {
fKeyWord = eSummaryFilesPresent; fKeyWord = eIgnoreDataHeaderInfo;
} else if (qName == "keep_minuit2_output") { } else if (qName == "keep_minuit2_output") {
fKeyWord = eKeepMinuit2Output; fKeyWord = eKeepMinuit2Output;
} else if (qName == "write_column_data") { } else if (qName == "write_column_data") {
@ -133,6 +133,8 @@ bool PAdminXMLParser::startElement( const QString&, const QString&,
fKeyWord = eFitOnly; fKeyWord = eFitOnly;
} else if (qName == "global") { } else if (qName == "global") {
fKeyWord = eGlobal; fKeyWord = eGlobal;
} else if (qName == "global_plus") {
fKeyWord = eGlobalPlus;
} else if (qName == "func_pixmap_path") { } else if (qName == "func_pixmap_path") {
fKeyWord = eTheoFuncPixmapPath; fKeyWord = eTheoFuncPixmapPath;
} else if (qName == "func") { } else if (qName == "func") {
@ -288,12 +290,12 @@ bool PAdminXMLParser::characters(const QString& str)
flag = false; flag = false;
fAdmin->fMsr2DataParam.writeDbHeader = flag; fAdmin->fMsr2DataParam.writeDbHeader = flag;
break; break;
case eSummaryFilesPresent: case eIgnoreDataHeaderInfo:
if (str == "y") if (str == "y")
flag = true; flag = true;
else else
flag = false; flag = false;
fAdmin->fMsr2DataParam.summaryFilePresent = flag; fAdmin->fMsr2DataParam.ignoreDataHeaderInfo = flag;
break; break;
case eKeepMinuit2Output: case eKeepMinuit2Output:
if (str == "y") if (str == "y")
@ -344,6 +346,13 @@ bool PAdminXMLParser::characters(const QString& str)
flag = false; flag = false;
fAdmin->fMsr2DataParam.global = flag; fAdmin->fMsr2DataParam.global = flag;
break; break;
case eGlobalPlus:
if (str == "y")
flag = true;
else
flag = false;
fAdmin->fMsr2DataParam.globalPlus = flag;
break;
case eTheoFuncPixmapPath: case eTheoFuncPixmapPath:
fAdmin->setTheoFuncPixmapPath(QString(str.toLatin1()).trimmed()); fAdmin->setTheoFuncPixmapPath(QString(str.toLatin1()).trimmed());
break; break;
@ -544,7 +553,7 @@ PAdmin::PAdmin()
fMsr2DataParam.templateRunNo = -1; fMsr2DataParam.templateRunNo = -1;
fMsr2DataParam.dbOutputFileName = QString(""); fMsr2DataParam.dbOutputFileName = QString("");
fMsr2DataParam.writeDbHeader = true; fMsr2DataParam.writeDbHeader = true;
fMsr2DataParam.summaryFilePresent = true; fMsr2DataParam.ignoreDataHeaderInfo = false;
fMsr2DataParam.keepMinuit2Output = false; fMsr2DataParam.keepMinuit2Output = false;
fMsr2DataParam.writeColumnData = false; fMsr2DataParam.writeColumnData = false;
fMsr2DataParam.recreateDbFile = false; fMsr2DataParam.recreateDbFile = false;
@ -554,6 +563,7 @@ PAdmin::PAdmin()
fMsr2DataParam.createMsrFileOnly = false; fMsr2DataParam.createMsrFileOnly = false;
fMsr2DataParam.fitOnly = false; fMsr2DataParam.fitOnly = false;
fMsr2DataParam.global = false; fMsr2DataParam.global = false;
fMsr2DataParam.globalPlus = false;
// XML Parser part // XML Parser part
QString fln = "musredit_startup.xml"; QString fln = "musredit_startup.xml";

View File

@ -75,8 +75,8 @@ class PAdminXMLParser : public QXmlDefaultHandler
eTheoFuncPixmapPath, eFunc, eFuncName, eFuncComment, eFuncLabel, eTheoFuncPixmapPath, eFunc, eFuncName, eFuncComment, eFuncLabel,
eFuncPixmap, eFuncParams, eHelpMain, eHelpTitle, eHelpParameters, eHelpTheory, eHelpFunctions, eFuncPixmap, eFuncParams, eHelpMain, eHelpTitle, eHelpParameters, eHelpTheory, eHelpFunctions,
eHelpRun, eHelpCommand, eHelpFourier, eHelpPlot, eHelpStatistic, eHelpMsr2Data, eHelpRun, eHelpCommand, eHelpFourier, eHelpPlot, eHelpStatistic, eHelpMsr2Data,
eChainFit, eWriteDataHeader, eSummaryFilesPresent, eKeepMinuit2Output, eWriteColumnData, eChainFit, eWriteDataHeader, eIgnoreDataHeaderInfo, eKeepMinuit2Output, eWriteColumnData,
eRecreateDataFile, eOpenFileAfterFitting, eCreateMsrFileOnly, eFitOnly, eGlobal}; eRecreateDataFile, eOpenFileAfterFitting, eCreateMsrFileOnly, eFitOnly, eGlobal, eGlobalPlus};
bool startDocument(); bool startDocument();
bool startElement( const QString&, const QString&, const QString& , bool startElement( const QString&, const QString&, const QString& ,

View File

@ -64,7 +64,6 @@ class PHelp : public QMainWindow
QWebView *fView; ///< web viewer QWebView *fView; ///< web viewer
QLineEdit *fLocationEdit; ///< url address line edit QLineEdit *fLocationEdit; ///< url address line edit
int fProgress; ///< progress value (0-100) while loading an url int fProgress; ///< progress value (0-100) while loading an url
}; };
#endif // _PHELP_H_ #endif // _PHELP_H_

View File

@ -91,7 +91,7 @@ PMsr2DataDialog::PMsr2DataDialog(PMsr2DataParam *msr2DataParam, const QString he
} }
fWriteDataHeader_checkBox->setChecked(fMsr2DataParam->writeDbHeader); fWriteDataHeader_checkBox->setChecked(fMsr2DataParam->writeDbHeader);
fSummaryPresent_checkBox->setChecked(fMsr2DataParam->summaryFilePresent); fIgnoreDataHeaderInfo_checkBox->setChecked(fMsr2DataParam->ignoreDataHeaderInfo);
fKeepMinuit2Output_checkBox->setChecked(fMsr2DataParam->keepMinuit2Output); fKeepMinuit2Output_checkBox->setChecked(fMsr2DataParam->keepMinuit2Output);
fWriteColumnData_checkBox->setChecked(fMsr2DataParam->writeColumnData); fWriteColumnData_checkBox->setChecked(fMsr2DataParam->writeColumnData);
fRecreateDataFile_checkBox->setChecked(fMsr2DataParam->recreateDbFile); fRecreateDataFile_checkBox->setChecked(fMsr2DataParam->recreateDbFile);
@ -101,6 +101,10 @@ PMsr2DataDialog::PMsr2DataDialog(PMsr2DataParam *msr2DataParam, const QString he
fCreateMsrFileOnly_checkBox->setChecked(fMsr2DataParam->createMsrFileOnly); fCreateMsrFileOnly_checkBox->setChecked(fMsr2DataParam->createMsrFileOnly);
fFitOnly_checkBox->setChecked(fMsr2DataParam->fitOnly); fFitOnly_checkBox->setChecked(fMsr2DataParam->fitOnly);
fGlobal_checkBox->setChecked(fMsr2DataParam->global); fGlobal_checkBox->setChecked(fMsr2DataParam->global);
fGlobalPlus_checkBox->setChecked(fMsr2DataParam->globalPlus);
connect(fGlobal_checkBox, SIGNAL(clicked(bool)), this, SLOT(globalOptionSet(bool)));
connect(fGlobalPlus_checkBox, SIGNAL(clicked(bool)), this, SLOT(globalPlusOptionSet(bool)));
} }
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
@ -129,7 +133,7 @@ PMsr2DataParam* PMsr2DataDialog::getMsr2DataParam()
} }
fMsr2DataParam->dbOutputFileName = fDataOutputFileName_lineEdit->text(); fMsr2DataParam->dbOutputFileName = fDataOutputFileName_lineEdit->text();
fMsr2DataParam->writeDbHeader = fWriteDataHeader_checkBox->isChecked(); fMsr2DataParam->writeDbHeader = fWriteDataHeader_checkBox->isChecked();
fMsr2DataParam->summaryFilePresent = fSummaryPresent_checkBox->isChecked(); fMsr2DataParam->ignoreDataHeaderInfo = fIgnoreDataHeaderInfo_checkBox->isChecked();
fMsr2DataParam->keepMinuit2Output = fKeepMinuit2Output_checkBox->isChecked(); fMsr2DataParam->keepMinuit2Output = fKeepMinuit2Output_checkBox->isChecked();
fMsr2DataParam->writeColumnData = fWriteColumnData_checkBox->isChecked(); fMsr2DataParam->writeColumnData = fWriteColumnData_checkBox->isChecked();
fMsr2DataParam->recreateDbFile = fRecreateDataFile_checkBox->isChecked(); fMsr2DataParam->recreateDbFile = fRecreateDataFile_checkBox->isChecked();
@ -139,6 +143,7 @@ PMsr2DataParam* PMsr2DataDialog::getMsr2DataParam()
fMsr2DataParam->createMsrFileOnly = fCreateMsrFileOnly_checkBox->isChecked(); fMsr2DataParam->createMsrFileOnly = fCreateMsrFileOnly_checkBox->isChecked();
fMsr2DataParam->fitOnly = fFitOnly_checkBox->isChecked(); fMsr2DataParam->fitOnly = fFitOnly_checkBox->isChecked();
fMsr2DataParam->global = fGlobal_checkBox->isChecked(); fMsr2DataParam->global = fGlobal_checkBox->isChecked();
fMsr2DataParam->globalPlus = fGlobalPlus_checkBox->isChecked();
return fMsr2DataParam; return fMsr2DataParam;
} }
@ -271,7 +276,6 @@ void PMsr2DataDialog::fitOnlyChanged(int buttonState)
{ {
if (buttonState == Qt::Checked) { if (buttonState == Qt::Checked) {
fCreateMsrFileOnly_checkBox->setChecked(false); fCreateMsrFileOnly_checkBox->setChecked(false);
fGlobal_checkBox->setChecked(false);
fTemplateRunNumber_lineEdit->clear(); fTemplateRunNumber_lineEdit->clear();
} }
} }
@ -294,6 +298,34 @@ void PMsr2DataDialog::helpContent()
} }
} }
//----------------------------------------------------------------------------------------------------
/**
* <p>Unchecks global+ if global is checked since global/global+ are excluding options
*
* \param checked true, if the check-box is checked
*/
void PMsr2DataDialog::globalOptionSet(bool checked)
{
if (checked) {
if (fGlobalPlus_checkBox->isChecked())
fGlobalPlus_checkBox->setChecked(false);
}
}
//----------------------------------------------------------------------------------------------------
/**
* <p>Unchecks global if global+ is checked since global/global+ are excluding options
*
* \param checked true, if the check-box is checked
*/
void PMsr2DataDialog::globalPlusOptionSet(bool checked)
{
if (checked) {
if (fGlobal_checkBox->isChecked())
fGlobal_checkBox->setChecked(false);
}
}
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
// END // END
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------

View File

@ -62,6 +62,10 @@ class PMsr2DataDialog : public QDialog, private Ui::PMsr2DataDialog
void fitOnlyChanged(int); void fitOnlyChanged(int);
void helpContent(); void helpContent();
private slots:
void globalOptionSet(bool checked);
void globalPlusOptionSet(bool checked);
private: private:
int fRunTag; ///< -1 = not valid, 0 = first last, 1 = run list, 2 = run list file name int fRunTag; ///< -1 = not valid, 0 = first last, 1 = run list, 2 = run list file name
PMsr2DataParam *fMsr2DataParam; ///< data structure used to handle the necessary input for msr2data. PMsr2DataParam *fMsr2DataParam; ///< data structure used to handle the necessary input for msr2data.

View File

@ -1837,8 +1837,8 @@ void PTextEdit::musrMsr2Data()
if (!fMsr2DataParam->writeDbHeader) if (!fMsr2DataParam->writeDbHeader)
cmd.append("noheader"); cmd.append("noheader");
// no summary flag? // ignore data header info flag present?
if (!fMsr2DataParam->summaryFilePresent) if (fMsr2DataParam->ignoreDataHeaderInfo)
cmd.append("nosummary"); cmd.append("nosummary");
// template run no fitting but: (i) no fit only flag, (ii) no create msr-file only flag // template run no fitting but: (i) no fit only flag, (ii) no create msr-file only flag
@ -1869,8 +1869,8 @@ void PTextEdit::musrMsr2Data()
cmd.append("-k"); cmd.append("-k");
} }
// replace msr-file title by data file title // replace msr-file title by data file title. Add flag only if a fit is done
if (fMsr2DataParam->titleFromDataFile) { if (fMsr2DataParam->titleFromDataFile && (fMsr2DataParam->fitOnly || fMsr2DataParam->templateRunNo != -1)) {
cmd.append("-t"); cmd.append("-t");
} }
@ -1890,18 +1890,22 @@ void PTextEdit::musrMsr2Data()
cmd.append("global"); cmd.append("global");
} }
// recreate db file // global+ flag check
if (fMsr2DataParam->recreateDbFile) { if (fMsr2DataParam->globalPlus) {
if (QFile::exists(fMsr2DataParam->dbOutputFileName)) { if (fMsr2DataParam->chainFit) {
if (!QFile::remove(fMsr2DataParam->dbOutputFileName)) { cmd.append("global+");
str = QString("Couldn't delete db-file '%1'. Will **NOT** proceed.").arg(fMsr2DataParam->dbOutputFileName); } else {
QMessageBox::critical(this, "**ERROR**", str, cmd.append("global+!");
QMessageBox::Ok, QMessageBox::NoButton);
return;
}
} }
} }
// recreate db file
if (fMsr2DataParam->recreateDbFile) {
cmd.append("new");
}
// qDebug() << ">> " << cmd << endl;
PFitOutputHandler fitOutputHandler(QFileInfo(*fFilenames.find( currentEditor() )).absolutePath(), cmd); PFitOutputHandler fitOutputHandler(QFileInfo(*fFilenames.find( currentEditor() )).absolutePath(), cmd);
fitOutputHandler.setModal(true); fitOutputHandler.setModal(true);
fFileSystemWatcherActive = false; fFileSystemWatcherActive = false;

View File

@ -2,6 +2,9 @@
<ui version="4.0"> <ui version="4.0">
<class>PMsr2DataDialog</class> <class>PMsr2DataDialog</class>
<widget class="QDialog" name="PMsr2DataDialog"> <widget class="QDialog" name="PMsr2DataDialog">
<property name="windowModality">
<enum>Qt::WindowModal</enum>
</property>
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
@ -372,13 +375,13 @@
<widget class="QWidget" name="layoutWidget"> <widget class="QWidget" name="layoutWidget">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>10</x> <x>6</x>
<y>31</y> <y>20</y>
<width>540</width> <width>541</width>
<height>108</height> <height>116</height>
</rect> </rect>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_8"> <layout class="QHBoxLayout" name="horizontalLayout_9">
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_3"> <layout class="QVBoxLayout" name="verticalLayout_3">
<item> <item>
@ -389,9 +392,9 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QCheckBox" name="fSummaryPresent_checkBox"> <widget class="QCheckBox" name="fIgnoreDataHeaderInfo_checkBox">
<property name="text"> <property name="text">
<string>Summary Files Present</string> <string>Ignore Data Header Info</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -453,11 +456,22 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QCheckBox" name="fGlobal_checkBox"> <layout class="QHBoxLayout" name="horizontalLayout_8">
<property name="text"> <item>
<string>Global</string> <widget class="QCheckBox" name="fGlobal_checkBox">
</property> <property name="text">
</widget> <string>Global</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="fGlobalPlus_checkBox">
<property name="text">
<string>Global+</string>
</property>
</widget>
</item>
</layout>
</item> </item>
</layout> </layout>
</item> </item>
@ -467,9 +481,9 @@
<widget class="QWidget" name="layoutWidget"> <widget class="QWidget" name="layoutWidget">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>5</x>
<y>500</y> <y>500</y>
<width>551</width> <width>541</width>
<height>51</height> <height>51</height>
</rect> </rect>
</property> </property>
@ -532,7 +546,7 @@
<tabstop>fChainFit_checkBox</tabstop> <tabstop>fChainFit_checkBox</tabstop>
<tabstop>fDataOutputFileName_lineEdit</tabstop> <tabstop>fDataOutputFileName_lineEdit</tabstop>
<tabstop>fWriteDataHeader_checkBox</tabstop> <tabstop>fWriteDataHeader_checkBox</tabstop>
<tabstop>fSummaryPresent_checkBox</tabstop> <tabstop>fIgnoreDataHeaderInfo_checkBox</tabstop>
<tabstop>fKeepMinuit2Output_checkBox</tabstop> <tabstop>fKeepMinuit2Output_checkBox</tabstop>
<tabstop>fWriteColumnData_checkBox</tabstop> <tabstop>fWriteColumnData_checkBox</tabstop>
<tabstop>fRecreateDataFile_checkBox</tabstop> <tabstop>fRecreateDataFile_checkBox</tabstop>
@ -540,6 +554,8 @@
<tabstop>fTitleFromData_checkBox</tabstop> <tabstop>fTitleFromData_checkBox</tabstop>
<tabstop>fCreateMsrFileOnly_checkBox</tabstop> <tabstop>fCreateMsrFileOnly_checkBox</tabstop>
<tabstop>fFitOnly_checkBox</tabstop> <tabstop>fFitOnly_checkBox</tabstop>
<tabstop>fGlobal_checkBox</tabstop>
<tabstop>fGlobalPlus_checkBox</tabstop>
<tabstop>fOk_pushButton</tabstop> <tabstop>fOk_pushButton</tabstop>
<tabstop>fCancel_pushButton</tabstop> <tabstop>fCancel_pushButton</tabstop>
<tabstop>fHelp_pushButton</tabstop> <tabstop>fHelp_pushButton</tabstop>
@ -683,8 +699,8 @@
<slot>fitOnlyChanged(int)</slot> <slot>fitOnlyChanged(int)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>406</x> <x>544</x>
<y>460</y> <y>445</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>301</x> <x>301</x>
@ -699,8 +715,8 @@
<slot>createMsrFileOnlyChanged(int)</slot> <slot>createMsrFileOnlyChanged(int)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>547</x> <x>544</x>
<y>440</y> <y>423</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>150</x> <x>150</x>

View File

@ -49,7 +49,7 @@ typedef struct {
int templateRunNo; ///< fit template run number int templateRunNo; ///< fit template run number
QString dbOutputFileName; ///< output file name for the generated (trumf-like) db-file. QString dbOutputFileName; ///< output file name for the generated (trumf-like) db-file.
bool writeDbHeader; ///< flag indicating if a db header shall be generated (== !noheader in msr2data) bool writeDbHeader; ///< flag indicating if a db header shall be generated (== !noheader in msr2data)
bool summaryFilePresent; ///< flag indicating if a LEM summary file is present (== !nosummary in msr2data) bool ignoreDataHeaderInfo; ///< flag indicating if data header info (like temp.) shall be ignored (== nosummary in msr2data)
bool keepMinuit2Output; ///< flag indicating if the minuit2 output shall be kept ('-k' in msr2data) bool keepMinuit2Output; ///< flag indicating if the minuit2 output shall be kept ('-k' in msr2data)
bool writeColumnData; ///< flag indicating if instead of a db-file a column data ascii file shall be written ('data' in msr2data) bool writeColumnData; ///< flag indicating if instead of a db-file a column data ascii file shall be written ('data' in msr2data)
bool recreateDbFile; ///< flag: true = recreate db-file, false = append to present db-file bool recreateDbFile; ///< flag: true = recreate db-file, false = append to present db-file
@ -59,6 +59,7 @@ typedef struct {
bool createMsrFileOnly; ///< flag: true = just create the msr-files without any fitting ('msr-<template>' in msr2data) 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 fitOnly; ///< flag: true = just perform the fits wihtout generating any msr-files ('fit' in msr2data).
bool global; ///< flag: true = 'global' option bool global; ///< flag: true = 'global' option
bool globalPlus; ///< flag: true = 'global+' option
} PMsr2DataParam; } PMsr2DataParam;
//------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------

View File

@ -37,7 +37,7 @@
<msr2data_defaults> <msr2data_defaults>
<chain_fit>y</chain_fit> <chain_fit>y</chain_fit>
<write_data_header>y</write_data_header> <write_data_header>y</write_data_header>
<summary_files_present>y</summary_files_present> <ignore_data_header_info>n</ignore_data_header_info>
<keep_minuit2_output>n</keep_minuit2_output> <keep_minuit2_output>n</keep_minuit2_output>
<write_column_data>n</write_column_data> <write_column_data>n</write_column_data>
<recreate_data_file>n</recreate_data_file> <recreate_data_file>n</recreate_data_file>
@ -45,6 +45,7 @@
<create_msr_file_only>n</create_msr_file_only> <create_msr_file_only>n</create_msr_file_only>
<fit_only>n</fit_only> <fit_only>n</fit_only>
<global>n</global> <global>n</global>
<global_plus>n</global_plus>
</msr2data_defaults> </msr2data_defaults>
<func_pixmap_path>$HOME/analysis/musrfit/src/musredit/latex_images</func_pixmap_path> <func_pixmap_path>$HOME/analysis/musrfit/src/musredit/latex_images</func_pixmap_path>
<theory_functions> <theory_functions>

View File

@ -97,8 +97,8 @@ bool PAdminXMLParser::startElement( const QString&, const QString&,
fKeyWord = eChainFit; fKeyWord = eChainFit;
} else if (qName == "write_data_header") { } else if (qName == "write_data_header") {
fKeyWord = eWriteDataHeader; fKeyWord = eWriteDataHeader;
} else if (qName == "summary_files_present") { } else if (qName == "ignore_data_header_info") {
fKeyWord = eSummaryFilesPresent; fKeyWord = eIgnoreDataHeaderInfo;
} else if (qName == "keep_minuit2_output") { } else if (qName == "keep_minuit2_output") {
fKeyWord = eKeepMinuit2Output; fKeyWord = eKeepMinuit2Output;
} else if (qName == "write_column_data") { } else if (qName == "write_column_data") {
@ -113,6 +113,8 @@ bool PAdminXMLParser::startElement( const QString&, const QString&,
fKeyWord = eFitOnly; fKeyWord = eFitOnly;
} else if (qName == "global") { } else if (qName == "global") {
fKeyWord = eGlobal; fKeyWord = eGlobal;
} else if (qName == "global_plus") {
fKeyWord = eGlobalPlus;
} else if (qName == "func_pixmap_path") { } else if (qName == "func_pixmap_path") {
fKeyWord = eTheoFuncPixmapPath; fKeyWord = eTheoFuncPixmapPath;
} else if (qName == "func") { } else if (qName == "func") {
@ -236,12 +238,12 @@ bool PAdminXMLParser::characters(const QString& str)
flag = false; flag = false;
fAdmin->fMsr2DataParam.writeDbHeader = flag; fAdmin->fMsr2DataParam.writeDbHeader = flag;
break; break;
case eSummaryFilesPresent: case eIgnoreDataHeaderInfo:
if (str == "y") if (str == "y")
flag = true; flag = true;
else else
flag = false; flag = false;
fAdmin->fMsr2DataParam.summaryFilePresent = flag; fAdmin->fMsr2DataParam.ignoreDataHeaderInfo = flag;
break; break;
case eKeepMinuit2Output: case eKeepMinuit2Output:
if (str == "y") if (str == "y")
@ -292,6 +294,13 @@ bool PAdminXMLParser::characters(const QString& str)
flag = false; flag = false;
fAdmin->fMsr2DataParam.global = flag; fAdmin->fMsr2DataParam.global = flag;
break; break;
case eGlobalPlus:
if (str == "y")
flag = true;
else
flag = false;
fAdmin->fMsr2DataParam.globalPlus = flag;
break;
case eTheoFuncPixmapPath: case eTheoFuncPixmapPath:
fAdmin->setTheoFuncPixmapPath(QString(str.ascii()).stripWhiteSpace()); fAdmin->setTheoFuncPixmapPath(QString(str.ascii()).stripWhiteSpace());
break; break;
@ -490,7 +499,7 @@ PAdmin::PAdmin()
fMsr2DataParam.templateRunNo = -1; fMsr2DataParam.templateRunNo = -1;
fMsr2DataParam.dbOutputFileName = QString(""); fMsr2DataParam.dbOutputFileName = QString("");
fMsr2DataParam.writeDbHeader = true; fMsr2DataParam.writeDbHeader = true;
fMsr2DataParam.summaryFilePresent = true; fMsr2DataParam.ignoreDataHeaderInfo = false;
fMsr2DataParam.keepMinuit2Output = false; fMsr2DataParam.keepMinuit2Output = false;
fMsr2DataParam.writeColumnData = false; fMsr2DataParam.writeColumnData = false;
fMsr2DataParam.recreateDbFile = false; fMsr2DataParam.recreateDbFile = false;
@ -500,6 +509,7 @@ PAdmin::PAdmin()
fMsr2DataParam.createMsrFileOnly = false; fMsr2DataParam.createMsrFileOnly = false;
fMsr2DataParam.fitOnly = false; fMsr2DataParam.fitOnly = false;
fMsr2DataParam.global = false; fMsr2DataParam.global = false;
fMsr2DataParam.globalPlus = false;
// XML Parser part // XML Parser part
QString fln = "./musrgui_startup.xml"; QString fln = "./musrgui_startup.xml";

View File

@ -63,8 +63,8 @@ class PAdminXMLParser : public QXmlDefaultHandler
eBeamline, eInstitute, eFileFormat, eLifetimeCorrection, eMsrDefaultFilePath, eBeamline, eInstitute, eFileFormat, eLifetimeCorrection, eMsrDefaultFilePath,
eHelpMain, eTheoFuncPixmapPath, eFunc, eFuncName, eFuncComment, eFuncLabel, eHelpMain, eTheoFuncPixmapPath, eFunc, eFuncName, eFuncComment, eFuncLabel,
eFuncPixmap, eFuncParams, eFuncPixmap, eFuncParams,
eChainFit, eWriteDataHeader, eSummaryFilesPresent, eKeepMinuit2Output, eWriteColumnData, eChainFit, eWriteDataHeader, eIgnoreDataHeaderInfo, eKeepMinuit2Output, eWriteColumnData,
eRecreateDataFile, eOpenFileAfterFitting, eCreateMsrFileOnly, eFitOnly, eGlobal}; eRecreateDataFile, eOpenFileAfterFitting, eCreateMsrFileOnly, eFitOnly, eGlobal, eGlobalPlus};
bool startDocument(); bool startDocument();
bool startElement( const QString&, const QString&, const QString& , bool startElement( const QString&, const QString&, const QString& ,

View File

@ -82,7 +82,7 @@ PMsr2DataDialog::PMsr2DataDialog(PMsr2DataParam *msr2DataParam) : fMsr2DataParam
} }
fWriteDbHeader_checkBox->setChecked(fMsr2DataParam->writeDbHeader); fWriteDbHeader_checkBox->setChecked(fMsr2DataParam->writeDbHeader);
fSummaryPresent_checkBox->setChecked(fMsr2DataParam->summaryFilePresent); fIgnoreDataHeaderInfo_checkBox->setChecked(fMsr2DataParam->ignoreDataHeaderInfo);
fKeepMinuit2Output_checkBox->setChecked(fMsr2DataParam->keepMinuit2Output); fKeepMinuit2Output_checkBox->setChecked(fMsr2DataParam->keepMinuit2Output);
fWriteColumnData_checkBox->setChecked(fMsr2DataParam->writeColumnData); fWriteColumnData_checkBox->setChecked(fMsr2DataParam->writeColumnData);
fRecreateDbFile_checkBox->setChecked(fMsr2DataParam->recreateDbFile); fRecreateDbFile_checkBox->setChecked(fMsr2DataParam->recreateDbFile);
@ -92,6 +92,10 @@ PMsr2DataDialog::PMsr2DataDialog(PMsr2DataParam *msr2DataParam) : fMsr2DataParam
fCreateMsrFileOnly_checkBox->setChecked(fMsr2DataParam->createMsrFileOnly); fCreateMsrFileOnly_checkBox->setChecked(fMsr2DataParam->createMsrFileOnly);
fFitOnly_checkBox->setChecked(fMsr2DataParam->fitOnly); fFitOnly_checkBox->setChecked(fMsr2DataParam->fitOnly);
fGlobal_checkBox->setChecked(fMsr2DataParam->global); fGlobal_checkBox->setChecked(fMsr2DataParam->global);
fGlobalPlus_checkBox->setChecked(fMsr2DataParam->globalPlus);
connect(fGlobal_checkBox, SIGNAL(toggled(bool)), this, SLOT(globalOptionSet(bool)));
connect(fGlobalPlus_checkBox, SIGNAL(toggled(bool)), this, SLOT(globalPlusOptionSet(bool)));
} }
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
@ -120,7 +124,7 @@ PMsr2DataParam* PMsr2DataDialog::getMsr2DataParam()
} }
fMsr2DataParam->dbOutputFileName = fDbOutputFileName_lineEdit->text(); fMsr2DataParam->dbOutputFileName = fDbOutputFileName_lineEdit->text();
fMsr2DataParam->writeDbHeader = fWriteDbHeader_checkBox->isChecked(); fMsr2DataParam->writeDbHeader = fWriteDbHeader_checkBox->isChecked();
fMsr2DataParam->summaryFilePresent = fSummaryPresent_checkBox->isChecked(); fMsr2DataParam->ignoreDataHeaderInfo = fIgnoreDataHeaderInfo_checkBox->isChecked();
fMsr2DataParam->keepMinuit2Output = fKeepMinuit2Output_checkBox->isChecked(); fMsr2DataParam->keepMinuit2Output = fKeepMinuit2Output_checkBox->isChecked();
fMsr2DataParam->writeColumnData = fWriteColumnData_checkBox->isChecked(); fMsr2DataParam->writeColumnData = fWriteColumnData_checkBox->isChecked();
fMsr2DataParam->recreateDbFile = fRecreateDbFile_checkBox->isChecked(); fMsr2DataParam->recreateDbFile = fRecreateDbFile_checkBox->isChecked();
@ -240,11 +244,38 @@ void PMsr2DataDialog::fitOnlyChanged(int buttonState)
{ {
if (buttonState == QButton::On) { if (buttonState == QButton::On) {
fCreateMsrFileOnly_checkBox->setChecked(false); fCreateMsrFileOnly_checkBox->setChecked(false);
fGlobal_checkBox->setChecked(false);
fTemplateRunNumber_lineEdit->clear(); fTemplateRunNumber_lineEdit->clear();
} }
} }
//----------------------------------------------------------------------------------------------------
/**
* <p>Unchecks global+ if global is checked since global/global+ are excluding options
*
* \param checked true, if the check-box is checked
*/
void PMsr2DataDialog::globalOptionSet(bool checked)
{
if (checked) {
if (fGlobalPlus_checkBox->isChecked())
fGlobalPlus_checkBox->setChecked(false);
}
}
//----------------------------------------------------------------------------------------------------
/**
* <p>Unchecks global if global+ is checked since global/global+ are excluding options
*
* \param checked true, if the check-box is checked
*/
void PMsr2DataDialog::globalPlusOptionSet(bool checked)
{
if (checked) {
if (fGlobal_checkBox->isChecked())
fGlobal_checkBox->setChecked(false);
}
}
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
// END // END
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------

View File

@ -52,6 +52,10 @@ class PMsr2DataDialog : public PMsr2DataDialogBase
void createMsrFileOnlyChanged(int); void createMsrFileOnlyChanged(int);
void fitOnlyChanged(int); void fitOnlyChanged(int);
private slots:
void globalOptionSet(bool checked);
void globalPlusOptionSet(bool checked);
private: private:
int fRunTag; // -1 = not valid, 0 = first last, 1 = run list, 2 = run list file name int fRunTag; // -1 = not valid, 0 = first last, 1 = run list, 2 = run list file name
PMsr2DataParam *fMsr2DataParam; PMsr2DataParam *fMsr2DataParam;

View File

@ -1564,8 +1564,8 @@ void PTextEdit::musrMsr2Data()
if (!fMsr2DataParam->writeDbHeader) if (!fMsr2DataParam->writeDbHeader)
cmd.append("noheader"); cmd.append("noheader");
// no summary flag? // ignore data header info flag present?
if (!fMsr2DataParam->summaryFilePresent) if (fMsr2DataParam->ignoreDataHeaderInfo)
cmd.append("nosummary"); cmd.append("nosummary");
// template run no fitting but: (i) no fit only flag, (ii) no create msr-file only flag // template run no fitting but: (i) no fit only flag, (ii) no create msr-file only flag
@ -1596,8 +1596,8 @@ void PTextEdit::musrMsr2Data()
cmd.append("-k"); cmd.append("-k");
} }
// replace msr-file title by data file title // replace msr-file title by data file title. Add flag only if a fit is done
if (fMsr2DataParam->titleFromDataFile) { if (fMsr2DataParam->titleFromDataFile && (fMsr2DataParam->fitOnly || fMsr2DataParam->templateRunNo != -1)) {
cmd.append("-t"); cmd.append("-t");
} }
@ -1617,16 +1617,18 @@ void PTextEdit::musrMsr2Data()
cmd.append("global"); cmd.append("global");
} }
// global+ flag check
if (fMsr2DataParam->globalPlus) {
if (fMsr2DataParam->chainFit) {
cmd.append("global+");
} else {
cmd.append("global+!");
}
}
// recreate db file // recreate db file
if (fMsr2DataParam->recreateDbFile) { if (fMsr2DataParam->recreateDbFile) {
if (QFile::exists(fMsr2DataParam->dbOutputFileName)) { cmd.append("new");
if (!QFile::remove(fMsr2DataParam->dbOutputFileName)) {
str = QString("Couldn't delete db-file '%1'. Will **NOT** proceed.").arg(fMsr2DataParam->dbOutputFileName);
QMessageBox::critical(this, "**ERROR**", str,
QMessageBox::Ok, QMessageBox::NoButton);
return;
}
}
} }
PFitOutputHandler fitOutputHandler(QFileInfo(*fFilenames.find( currentEditor() )).dirPath(), cmd); PFitOutputHandler fitOutputHandler(QFileInfo(*fFilenames.find( currentEditor() )).dirPath(), cmd);

View File

@ -397,25 +397,6 @@
<string>will keep the Minuit2 output files</string> <string>will keep the Minuit2 output files</string>
</property> </property>
</widget> </widget>
<widget class="QCheckBox">
<property name="name">
<cstring>fSummaryPresent_checkBox</cstring>
</property>
<property name="geometry">
<rect>
<x>20</x>
<y>50</y>
<width>180</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Summary Files Present</string>
</property>
<property name="toolTip" stdset="0">
<string>will try to extract information from the summary file (LEM)</string>
</property>
</widget>
<widget class="QCheckBox"> <widget class="QCheckBox">
<property name="name"> <property name="name">
<cstring>fWriteDbHeader_checkBox</cstring> <cstring>fWriteDbHeader_checkBox</cstring>
@ -537,6 +518,22 @@
<string>Fit Only</string> <string>Fit Only</string>
</property> </property>
</widget> </widget>
<widget class="QCheckBox">
<property name="name">
<cstring>fGlobalPlus_checkBox</cstring>
</property>
<property name="geometry">
<rect>
<x>480</x>
<y>90</y>
<width>80</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Global+</string>
</property>
</widget>
<widget class="QCheckBox"> <widget class="QCheckBox">
<property name="name"> <property name="name">
<cstring>fGlobal_checkBox</cstring> <cstring>fGlobal_checkBox</cstring>
@ -545,7 +542,7 @@
<rect> <rect>
<x>400</x> <x>400</x>
<y>90</y> <y>90</y>
<width>106</width> <width>70</width>
<height>22</height> <height>22</height>
</rect> </rect>
</property> </property>
@ -553,6 +550,25 @@
<string>Global</string> <string>Global</string>
</property> </property>
</widget> </widget>
<widget class="QCheckBox">
<property name="name">
<cstring>fIgnoreDataHeaderInfo_checkBox</cstring>
</property>
<property name="geometry">
<rect>
<x>20</x>
<y>50</y>
<width>180</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Ignore Data Header Info</string>
</property>
<property name="toolTip" stdset="0">
<string>will try to extract information from the summary file (LEM)</string>
</property>
</widget>
</widget> </widget>
<widget class="QLayoutWidget"> <widget class="QLayoutWidget">
<property name="name"> <property name="name">
@ -643,7 +659,7 @@
</widget> </widget>
<images> <images>
<image name="image0"> <image name="image0">
<data format="PNG" length="340">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000011b49444154388db594c16ec4200c44c71207bea791f600df1f0e91d8efe180440fad776dea0089b6b9a021100f8f89291f19a8001c506a81775ee918628378f291697b6c8d47744f3e32a102ae7fb9a79dbcf3ef22bf8b59975a00fc14e5f91862ebf739b9c9740eadb9d848975ad61c330e36218b59fae5d8722a37e59449bd07d01757da62fce722a08b5e72fc1f8c09c090f1dd916639b6f4d7636bcfc94915e33eaf67a3c574cab8bf5d4b5b4ca7391eb10e21b6947662c7ac3fc23888dec11fb5d6df4ac5c8a972bc9a862b7ac9b175fcd1fc52afe014706e4388ed9932c979542084ad49e6662acefaaf771e29edc41f51bf3bb49969af18f606e085839d5fcab17426b564dbffe6a78ccffaef9b31d4491496d51cdf49c53749ce1f9de06199f60000000049454e44ae426082</data> <data format="PNG" length="342">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000011d49444154388db594b192c3200c445733295cf21de72e257cbf29dd91efa0a4e38a4489c4c9803d3937cc62b096c75a94f60414000b904b865b9cd2c1870af1a43dd17a5f2b8f689eb42742016eedcb2d6ee416f729f25acc3a970ce05994e7830fb5dd77939b4ce7d09a8bf5742e79ce31e36013b298a5df8e2da772538a89d47b006d71a52dc67f2e02bae829c7ffc1980074195f1d6994634bffdcd7fa189c54316ef37a345a4c878cdbdbb5b4c57498e31e6bef438d712376ccfa2b8cbde81dfc516bfda554f49c2ac7b36938a3a71c5bc7efcd4ff50a4e01e7d6fb501f31919c4701bc5fab646ea6e2a8ffbac521c68df823ea77873633ec15ddde00bc71b0f3533996cea4966cdbdffc90f151fffd30863a89c2329be32ba9f8057c4e21e9a95dc13d0000000049454e44ae426082</data>
</image> </image>
</images> </images>
<connections> <connections>
@ -712,7 +728,7 @@
<tabstop>fChainFit_checkBox</tabstop> <tabstop>fChainFit_checkBox</tabstop>
<tabstop>fDbOutputFileName_lineEdit</tabstop> <tabstop>fDbOutputFileName_lineEdit</tabstop>
<tabstop>fWriteDbHeader_checkBox</tabstop> <tabstop>fWriteDbHeader_checkBox</tabstop>
<tabstop>fSummaryPresent_checkBox</tabstop> <tabstop>fIgnoreDataHeaderInfo_checkBox</tabstop>
<tabstop>fKeepMinuit2Output_checkBox</tabstop> <tabstop>fKeepMinuit2Output_checkBox</tabstop>
<tabstop>fWriteColumnData_checkBox</tabstop> <tabstop>fWriteColumnData_checkBox</tabstop>
<tabstop>fRecreateDbFile_checkBox</tabstop> <tabstop>fRecreateDbFile_checkBox</tabstop>
@ -720,6 +736,8 @@
<tabstop>fTitleFromData_checkBox</tabstop> <tabstop>fTitleFromData_checkBox</tabstop>
<tabstop>fCreateMsrFileOnly_checkBox</tabstop> <tabstop>fCreateMsrFileOnly_checkBox</tabstop>
<tabstop>fFitOnly_checkBox</tabstop> <tabstop>fFitOnly_checkBox</tabstop>
<tabstop>fGlobal_checkBox</tabstop>
<tabstop>fGlobalPlus_checkBox</tabstop>
<tabstop>fOk_button</tabstop> <tabstop>fOk_button</tabstop>
<tabstop>fCancel_button</tabstop> <tabstop>fCancel_button</tabstop>
<tabstop>fHelp_button</tabstop> <tabstop>fHelp_button</tabstop>
@ -732,6 +750,8 @@
<slot>createMsrFileOnlyChanged(int)</slot> <slot>createMsrFileOnlyChanged(int)</slot>
<slot>fitOnlyChanged(int)</slot> <slot>fitOnlyChanged(int)</slot>
<slot>templateRunEntered(const QString&amp;)</slot> <slot>templateRunEntered(const QString&amp;)</slot>
<slot access="private">globalOptionSet(bool checked)</slot>
<slot access="private">globalPlusOptionSet(bool checked)</slot>
</slots> </slots>
<layoutdefaults spacing="6" margin="11"/> <layoutdefaults spacing="6" margin="11"/>
</UI> </UI>

View File

@ -43,7 +43,7 @@ typedef struct {
int templateRunNo; int templateRunNo;
QString dbOutputFileName; QString dbOutputFileName;
bool writeDbHeader; bool writeDbHeader;
bool summaryFilePresent; bool ignoreDataHeaderInfo;
bool keepMinuit2Output; bool keepMinuit2Output;
bool writeColumnData; bool writeColumnData;
bool recreateDbFile; bool recreateDbFile;
@ -53,6 +53,7 @@ typedef struct {
bool createMsrFileOnly; bool createMsrFileOnly;
bool fitOnly; bool fitOnly;
bool global; bool global;
bool globalPlus; ///< flag: true = 'global+' option
} PMsr2DataParam; } PMsr2DataParam;
typedef struct { typedef struct {

View File

@ -30,7 +30,7 @@
<msr2data_defaults> <msr2data_defaults>
<chain_fit>y</chain_fit> <chain_fit>y</chain_fit>
<write_data_header>y</write_data_header> <write_data_header>y</write_data_header>
<summary_files_present>y</summary_files_present> <ignore_data_header_info>n</ignore_data_header_info>
<keep_minuit2_output>n</keep_minuit2_output> <keep_minuit2_output>n</keep_minuit2_output>
<write_column_data>n</write_column_data> <write_column_data>n</write_column_data>
<recreate_data_file>n</recreate_data_file> <recreate_data_file>n</recreate_data_file>
@ -38,6 +38,7 @@
<create_msr_file_only>n</create_msr_file_only> <create_msr_file_only>n</create_msr_file_only>
<fit_only>n</fit_only> <fit_only>n</fit_only>
<global>n</global> <global>n</global>
<global_plus>n</global_plus>
</msr2data_defaults> </msr2data_defaults>
<func_pixmap_path>$HOME/analysis/musrfit/src/musrgui/latex_images</func_pixmap_path> <func_pixmap_path>$HOME/analysis/musrfit/src/musrgui/latex_images</func_pixmap_path>
<theory_functions> <theory_functions>