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

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

View File

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

View File

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

View File

@@ -91,7 +91,7 @@ PMsr2DataDialog::PMsr2DataDialog(PMsr2DataParam *msr2DataParam, const QString he
}
fWriteDataHeader_checkBox->setChecked(fMsr2DataParam->writeDbHeader);
fSummaryPresent_checkBox->setChecked(fMsr2DataParam->summaryFilePresent);
fIgnoreDataHeaderInfo_checkBox->setChecked(fMsr2DataParam->ignoreDataHeaderInfo);
fKeepMinuit2Output_checkBox->setChecked(fMsr2DataParam->keepMinuit2Output);
fWriteColumnData_checkBox->setChecked(fMsr2DataParam->writeColumnData);
fRecreateDataFile_checkBox->setChecked(fMsr2DataParam->recreateDbFile);
@@ -101,6 +101,10 @@ PMsr2DataDialog::PMsr2DataDialog(PMsr2DataParam *msr2DataParam, const QString he
fCreateMsrFileOnly_checkBox->setChecked(fMsr2DataParam->createMsrFileOnly);
fFitOnly_checkBox->setChecked(fMsr2DataParam->fitOnly);
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->writeDbHeader = fWriteDataHeader_checkBox->isChecked();
fMsr2DataParam->summaryFilePresent = fSummaryPresent_checkBox->isChecked();
fMsr2DataParam->ignoreDataHeaderInfo = fIgnoreDataHeaderInfo_checkBox->isChecked();
fMsr2DataParam->keepMinuit2Output = fKeepMinuit2Output_checkBox->isChecked();
fMsr2DataParam->writeColumnData = fWriteColumnData_checkBox->isChecked();
fMsr2DataParam->recreateDbFile = fRecreateDataFile_checkBox->isChecked();
@@ -139,6 +143,7 @@ PMsr2DataParam* PMsr2DataDialog::getMsr2DataParam()
fMsr2DataParam->createMsrFileOnly = fCreateMsrFileOnly_checkBox->isChecked();
fMsr2DataParam->fitOnly = fFitOnly_checkBox->isChecked();
fMsr2DataParam->global = fGlobal_checkBox->isChecked();
fMsr2DataParam->globalPlus = fGlobalPlus_checkBox->isChecked();
return fMsr2DataParam;
}
@@ -271,7 +276,6 @@ void PMsr2DataDialog::fitOnlyChanged(int buttonState)
{
if (buttonState == Qt::Checked) {
fCreateMsrFileOnly_checkBox->setChecked(false);
fGlobal_checkBox->setChecked(false);
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
//----------------------------------------------------------------------------------------------------

View File

@@ -62,6 +62,10 @@ class PMsr2DataDialog : public QDialog, private Ui::PMsr2DataDialog
void fitOnlyChanged(int);
void helpContent();
private slots:
void globalOptionSet(bool checked);
void globalPlusOptionSet(bool checked);
private:
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.

View File

@@ -1837,8 +1837,8 @@ void PTextEdit::musrMsr2Data()
if (!fMsr2DataParam->writeDbHeader)
cmd.append("noheader");
// no summary flag?
if (!fMsr2DataParam->summaryFilePresent)
// ignore data header info flag present?
if (fMsr2DataParam->ignoreDataHeaderInfo)
cmd.append("nosummary");
// 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");
}
// replace msr-file title by data file title
if (fMsr2DataParam->titleFromDataFile) {
// replace msr-file title by data file title. Add flag only if a fit is done
if (fMsr2DataParam->titleFromDataFile && (fMsr2DataParam->fitOnly || fMsr2DataParam->templateRunNo != -1)) {
cmd.append("-t");
}
@@ -1890,18 +1890,22 @@ void PTextEdit::musrMsr2Data()
cmd.append("global");
}
// recreate db file
if (fMsr2DataParam->recreateDbFile) {
if (QFile::exists(fMsr2DataParam->dbOutputFileName)) {
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;
}
// global+ flag check
if (fMsr2DataParam->globalPlus) {
if (fMsr2DataParam->chainFit) {
cmd.append("global+");
} else {
cmd.append("global+!");
}
}
// recreate db file
if (fMsr2DataParam->recreateDbFile) {
cmd.append("new");
}
// qDebug() << ">> " << cmd << endl;
PFitOutputHandler fitOutputHandler(QFileInfo(*fFilenames.find( currentEditor() )).absolutePath(), cmd);
fitOutputHandler.setModal(true);
fFileSystemWatcherActive = false;

View File

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

View File

@@ -49,7 +49,7 @@ typedef struct {
int templateRunNo; ///< fit template run number
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 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 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
@@ -59,6 +59,7 @@ typedef struct {
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
bool globalPlus; ///< flag: true = 'global+' option
} PMsr2DataParam;
//-------------------------------------------------------------------------------------------------

View File

@@ -37,7 +37,7 @@
<msr2data_defaults>
<chain_fit>y</chain_fit>
<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>
<write_column_data>n</write_column_data>
<recreate_data_file>n</recreate_data_file>
@@ -45,6 +45,7 @@
<create_msr_file_only>n</create_msr_file_only>
<fit_only>n</fit_only>
<global>n</global>
<global_plus>n</global_plus>
</msr2data_defaults>
<func_pixmap_path>$HOME/analysis/musrfit/src/musredit/latex_images</func_pixmap_path>
<theory_functions>