added '-t' option to musrgui

This commit is contained in:
nemu
2009-06-25 17:19:01 +00:00
parent c8fc4a95fe
commit 622a1d704d
11 changed files with 93 additions and 26 deletions

View File

@ -81,6 +81,8 @@ bool PAdminXMLParser::startElement( const QString&, const QString&,
fKeyWord = eFileFormat; fKeyWord = eFileFormat;
} else if (qName == "lifetime_correction") { } else if (qName == "lifetime_correction") {
fKeyWord = eLifetimeCorrection; fKeyWord = eLifetimeCorrection;
} else if (qName == "title_from_data_file") {
fKeyWord = eTitleFromDataFile;
} else if (qName == "msr_default_file_path") { } else if (qName == "msr_default_file_path") {
fKeyWord = eMsrDefaultFilePath; fKeyWord = eMsrDefaultFilePath;
} else if (qName == "help_main") { } else if (qName == "help_main") {
@ -137,6 +139,7 @@ bool PAdminXMLParser::endElement( const QString&, const QString&, const QString
bool PAdminXMLParser::characters(const QString& str) bool PAdminXMLParser::characters(const QString& str)
{ {
QString help; QString help;
bool flag;
switch (fKeyWord) { switch (fKeyWord) {
case eExecPath: case eExecPath:
@ -155,13 +158,19 @@ bool PAdminXMLParser::characters(const QString& str)
fAdmin->setFileFormat(QString(str.ascii()).stripWhiteSpace()); fAdmin->setFileFormat(QString(str.ascii()).stripWhiteSpace());
break; break;
case eLifetimeCorrection: case eLifetimeCorrection:
bool flag;
if (str == "y") if (str == "y")
flag = true; flag = true;
else else
flag = false; flag = false;
fAdmin->setLifetimeCorrectionFlag(flag); fAdmin->setLifetimeCorrectionFlag(flag);
break; break;
case eTitleFromDataFile:
if (str == "y")
flag = true;
else
flag = false;
fAdmin->setTitleFromDataFileFlag(flag);
break;
case eMsrDefaultFilePath: case eMsrDefaultFilePath:
fAdmin->setMsrDefaultFilePath(QString(str.ascii()).stripWhiteSpace()); fAdmin->setMsrDefaultFilePath(QString(str.ascii()).stripWhiteSpace());
break; break;
@ -294,6 +303,9 @@ PAdmin::PAdmin()
fHelpMain = QString(""); fHelpMain = QString("");
fLifetimeCorrection = true;
fTitleFromDataFile = false;
// XML Parser part // XML Parser part
QString fln = "./musrgui_startup.xml"; QString fln = "./musrgui_startup.xml";
if (!QFile::exists(fln)) { if (!QFile::exists(fln)) {

View File

@ -58,7 +58,7 @@ class PAdminXMLParser : public QXmlDefaultHandler
private: private:
enum EAdminKeyWords {eEmpty, eExecPath, eDefaultSavePath, eBeamline, eInstitute, eFileFormat, enum EAdminKeyWords {eEmpty, eExecPath, eDefaultSavePath, eBeamline, eInstitute, eFileFormat,
eLifetimeCorrection, eMsrDefaultFilePath, eHelpMain, eTheoFuncPixmapPath, eLifetimeCorrection, eTitleFromDataFile, eMsrDefaultFilePath, eHelpMain, eTheoFuncPixmapPath,
eFunc, eFuncName, eFuncComment, eFuncLabel, eFuncPixmap, eFuncParams}; eFunc, eFuncName, eFuncComment, eFuncLabel, eFuncPixmap, eFuncParams};
bool startDocument(); bool startDocument();
@ -90,6 +90,7 @@ class PAdmin
QString getInstitute() { return fInstitute; } QString getInstitute() { return fInstitute; }
QString getFileFormat() { return fFileFormat; } QString getFileFormat() { return fFileFormat; }
bool getLifetimeCorrectionFlag() { return fLifetimeCorrection; } bool getLifetimeCorrectionFlag() { return fLifetimeCorrection; }
bool getTitleFromDataFileFlag() { return fTitleFromDataFile; }
QString getMsrDefaultFilePath() { return fMsrDefaultFilePath; } QString getMsrDefaultFilePath() { return fMsrDefaultFilePath; }
QString getHelpMain() { return fHelpMain; } QString getHelpMain() { return fHelpMain; }
QString getTheoFuncPixmapPath() { return fTheoFuncPixmapPath; } QString getTheoFuncPixmapPath() { return fTheoFuncPixmapPath; }
@ -103,6 +104,7 @@ class PAdmin
void setInstitute(const QString str) { fInstitute = str; } void setInstitute(const QString str) { fInstitute = str; }
void setFileFormat(const QString str) { fFileFormat = str; } void setFileFormat(const QString str) { fFileFormat = str; }
void setLifetimeCorrectionFlag(const bool flag) { fLifetimeCorrection = flag; } void setLifetimeCorrectionFlag(const bool flag) { fLifetimeCorrection = flag; }
void setTitleFromDataFileFlag(const bool flag) { fTitleFromDataFile = flag; }
void setMsrDefaultFilePath(const QString str) { fMsrDefaultFilePath = str; } void setMsrDefaultFilePath(const QString str) { fMsrDefaultFilePath = str; }
void setHelpMain(const QString str) { fHelpMain = str; } void setHelpMain(const QString str) { fHelpMain = str; }
void setTheoFuncPixmapPath (const QString str) { fTheoFuncPixmapPath = str; } void setTheoFuncPixmapPath (const QString str) { fTheoFuncPixmapPath = str; }
@ -120,6 +122,7 @@ class PAdmin
QString fInstitute; QString fInstitute;
QString fFileFormat; QString fFileFormat;
bool fLifetimeCorrection; bool fLifetimeCorrection;
bool fTitleFromDataFile;
QString fHelpMain; QString fHelpMain;

View File

@ -88,6 +88,7 @@ PMsr2DataDialog::PMsr2DataDialog(PMsr2DataParam *msr2DataParam) : fMsr2DataParam
fRecreateDbFile_checkBox->setChecked(fMsr2DataParam->recreateDbFile); fRecreateDbFile_checkBox->setChecked(fMsr2DataParam->recreateDbFile);
fChainFit_checkBox->setChecked(fMsr2DataParam->chainFit); fChainFit_checkBox->setChecked(fMsr2DataParam->chainFit);
fOpenAfterFitting_checkBox->setChecked(fMsr2DataParam->openFilesAfterFitting); fOpenAfterFitting_checkBox->setChecked(fMsr2DataParam->openFilesAfterFitting);
fTitleFromData_checkBox->setChecked(fMsr2DataParam->titleFromDataFile);
} }
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
@ -122,6 +123,7 @@ PMsr2DataParam* PMsr2DataDialog::getMsr2DataParam()
fMsr2DataParam->recreateDbFile = fRecreateDbFile_checkBox->isChecked(); fMsr2DataParam->recreateDbFile = fRecreateDbFile_checkBox->isChecked();
fMsr2DataParam->chainFit = fChainFit_checkBox->isChecked(); fMsr2DataParam->chainFit = fChainFit_checkBox->isChecked();
fMsr2DataParam->openFilesAfterFitting = fOpenAfterFitting_checkBox->isChecked(); fMsr2DataParam->openFilesAfterFitting = fOpenAfterFitting_checkBox->isChecked();
fMsr2DataParam->titleFromDataFile = fTitleFromData_checkBox->isChecked();
return fMsr2DataParam; return fMsr2DataParam;
} }

View File

@ -35,7 +35,7 @@
/** /**
* <p> * <p>
*/ */
PPrefsDialog::PPrefsDialog(const bool keep_mn2_output, const int dump_tag) PPrefsDialog::PPrefsDialog(const bool keep_mn2_output, const int dump_tag, const bool title_from_data_file)
{ {
if (keep_mn2_output) if (keep_mn2_output)
fKeepMn2Output_checkBox->setChecked(true); fKeepMn2Output_checkBox->setChecked(true);
@ -52,6 +52,8 @@ PPrefsDialog::PPrefsDialog(const bool keep_mn2_output, const int dump_tag)
fDumpAscii_checkBox->setChecked(false); fDumpAscii_checkBox->setChecked(false);
fDumpRoot_checkBox->setChecked(false); fDumpRoot_checkBox->setChecked(false);
} }
fTitleFromData_checkBox->setChecked(title_from_data_file);
} }
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------

View File

@ -39,9 +39,10 @@
class PPrefsDialog : public PPrefsDialogBase class PPrefsDialog : public PPrefsDialogBase
{ {
public: public:
PPrefsDialog(const bool keep_mn2_output, const int dump_tag); PPrefsDialog(const bool keep_mn2_output, const int dump_tag, const bool title_from_data_file);
bool keepMinuit2Output() { return fKeepMn2Output_checkBox->isChecked(); } bool keepMinuit2Output() { return fKeepMn2Output_checkBox->isChecked(); }
bool titleFromDataFileFlag() { return fTitleFromData_checkBox->isChecked(); }
int getDump(); int getDump();
public slots: public slots:

View File

@ -114,6 +114,7 @@ PTextEdit::PTextEdit( QWidget *parent, const char *name )
fFileWatcher = 0; fFileWatcher = 0;
fKeepMinuit2Output = false; fKeepMinuit2Output = false;
fTitleFromDataFile = fAdmin->getTitleFromDataFileFlag();
fDump = 0; // 0 = no dump, 1 = ascii dump, 2 = root dump fDump = 0; // 0 = no dump, 1 = ascii dump, 2 = root dump
setupFileActions(); setupFileActions();
@ -1287,6 +1288,10 @@ void PTextEdit::musrFit()
if (fKeepMinuit2Output) if (fKeepMinuit2Output)
cmd.append("--keep-mn2-output"); cmd.append("--keep-mn2-output");
// check if title of the data file should be used to replace the msr-file title
if (fTitleFromDataFile)
cmd.append("--title-from-data-file");
// check if dump files are wished // check if dump files are wished
switch (fDump) { switch (fDump) {
case 1: // ascii dump case 1: // ascii dump
@ -1374,6 +1379,7 @@ void PTextEdit::musrMsr2Data()
fMsr2DataParam->recreateDbFile = false; fMsr2DataParam->recreateDbFile = false;
fMsr2DataParam->chainFit = true; fMsr2DataParam->chainFit = true;
fMsr2DataParam->openFilesAfterFitting = false; fMsr2DataParam->openFilesAfterFitting = false;
fMsr2DataParam->titleFromDataFile = fTitleFromDataFile;
} }
PMsr2DataDialog *dlg = new PMsr2DataDialog(fMsr2DataParam); PMsr2DataDialog *dlg = new PMsr2DataDialog(fMsr2DataParam);
@ -1505,6 +1511,11 @@ void PTextEdit::musrMsr2Data()
cmd.append("-k"); cmd.append("-k");
} }
// replace msr-file title by data file title
if (fMsr2DataParam->titleFromDataFile) {
cmd.append("-t");
}
// DB output wished // DB output wished
if (!fMsr2DataParam->dbOutputFileName.isEmpty()) { if (!fMsr2DataParam->dbOutputFileName.isEmpty()) {
str = "-o" + fMsr2DataParam->dbOutputFileName; str = "-o" + fMsr2DataParam->dbOutputFileName;
@ -1680,10 +1691,11 @@ void PTextEdit::musrT0()
*/ */
void PTextEdit::musrPrefs() void PTextEdit::musrPrefs()
{ {
PPrefsDialog *dlg = new PPrefsDialog(fKeepMinuit2Output, fDump); PPrefsDialog *dlg = new PPrefsDialog(fKeepMinuit2Output, fDump, fTitleFromDataFile);
if (dlg->exec() == QDialog::Accepted) { if (dlg->exec() == QDialog::Accepted) {
fKeepMinuit2Output = dlg->keepMinuit2Output(); fKeepMinuit2Output = dlg->keepMinuit2Output();
fTitleFromDataFile = dlg->titleFromDataFileFlag();
fDump = dlg->getDump(); fDump = dlg->getDump();
} }
} }

View File

@ -123,6 +123,7 @@ private:
PAdmin *fAdmin; PAdmin *fAdmin;
bool fKeepMinuit2Output; bool fKeepMinuit2Output;
bool fTitleFromDataFile;
int fDump; int fDump;
PMsr2DataParam *fMsr2DataParam; PMsr2DataParam *fMsr2DataParam;

View File

@ -502,25 +502,6 @@
<string>will try to extract information from the summary file (LEM)</string> <string>will try to extract information from the summary file (LEM)</string>
</property> </property>
</widget> </widget>
<widget class="QCheckBox">
<property name="name">
<cstring>fWriteColumnData_checkBox</cstring>
</property>
<property name="geometry">
<rect>
<x>230</x>
<y>30</y>
<width>150</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Write Column Data</string>
</property>
<property name="toolTip" stdset="0">
<string>will write the output data in column like format, to be read by gnuplot ...</string>
</property>
</widget>
<widget class="QCheckBox"> <widget class="QCheckBox">
<property name="name"> <property name="name">
<cstring>fWriteDbHeader_checkBox</cstring> <cstring>fWriteDbHeader_checkBox</cstring>
@ -540,13 +521,32 @@
<string>will add a default header to the DB-file</string> <string>will add a default header to the DB-file</string>
</property> </property>
</widget> </widget>
<widget class="QCheckBox">
<property name="name">
<cstring>fWriteColumnData_checkBox</cstring>
</property>
<property name="geometry">
<rect>
<x>220</x>
<y>30</y>
<width>150</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Write Column Data</string>
</property>
<property name="toolTip" stdset="0">
<string>will write the output data in column like format, to be read by gnuplot ...</string>
</property>
</widget>
<widget class="QCheckBox"> <widget class="QCheckBox">
<property name="name"> <property name="name">
<cstring>fRecreateDbFile_checkBox</cstring> <cstring>fRecreateDbFile_checkBox</cstring>
</property> </property>
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>230</x> <x>220</x>
<y>50</y> <y>50</y>
<width>150</width> <width>150</width>
<height>22</height> <height>22</height>
@ -565,7 +565,7 @@
</property> </property>
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>230</x> <x>220</x>
<y>70</y> <y>70</y>
<width>170</width> <width>170</width>
<height>22</height> <height>22</height>
@ -575,6 +575,22 @@
<string>Open Files after Fitting</string> <string>Open Files after Fitting</string>
</property> </property>
</widget> </widget>
<widget class="QCheckBox">
<property name="name">
<cstring>fTitleFromData_checkBox</cstring>
</property>
<property name="geometry">
<rect>
<x>400</x>
<y>30</y>
<width>160</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Take Data File Title</string>
</property>
</widget>
</widget> </widget>
</widget> </widget>
<images> <images>

View File

@ -100,6 +100,22 @@
<string>will generate a ROOT dump file after the fit with the data and the theory</string> <string>will generate a ROOT dump file after the fit with the data and the theory</string>
</property> </property>
</widget> </widget>
<widget class="QCheckBox">
<property name="name">
<cstring>fTitleFromData_checkBox</cstring>
</property>
<property name="geometry">
<rect>
<x>198</x>
<y>11</y>
<width>140</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>take data file title</string>
</property>
</widget>
</widget> </widget>
</widget> </widget>
<widget class="QLayoutWidget"> <widget class="QLayoutWidget">

View File

@ -49,6 +49,7 @@ typedef struct {
bool recreateDbFile; bool recreateDbFile;
bool chainFit; bool chainFit;
bool openFilesAfterFitting; bool openFilesAfterFitting;
bool titleFromDataFile;
} PMsr2DataParam; } PMsr2DataParam;
typedef struct { typedef struct {

View File

@ -14,6 +14,7 @@
<institute>psi</institute> <institute>psi</institute>
<file_format>root-npp</file_format> <file_format>root-npp</file_format>
<lifetime_correction>y</lifetime_correction> <lifetime_correction>y</lifetime_correction>
<title_from_data_file>n</title_from_data_file>
</msr_file_defaults> </msr_file_defaults>
<help_section> <help_section>
<help_main> <help_main>