added '-t' option to musrgui
This commit is contained in:
parent
c8fc4a95fe
commit
622a1d704d
@ -81,6 +81,8 @@ bool PAdminXMLParser::startElement( const QString&, const QString&,
|
||||
fKeyWord = eFileFormat;
|
||||
} else if (qName == "lifetime_correction") {
|
||||
fKeyWord = eLifetimeCorrection;
|
||||
} else if (qName == "title_from_data_file") {
|
||||
fKeyWord = eTitleFromDataFile;
|
||||
} else if (qName == "msr_default_file_path") {
|
||||
fKeyWord = eMsrDefaultFilePath;
|
||||
} else if (qName == "help_main") {
|
||||
@ -137,6 +139,7 @@ bool PAdminXMLParser::endElement( const QString&, const QString&, const QString
|
||||
bool PAdminXMLParser::characters(const QString& str)
|
||||
{
|
||||
QString help;
|
||||
bool flag;
|
||||
|
||||
switch (fKeyWord) {
|
||||
case eExecPath:
|
||||
@ -155,13 +158,19 @@ bool PAdminXMLParser::characters(const QString& str)
|
||||
fAdmin->setFileFormat(QString(str.ascii()).stripWhiteSpace());
|
||||
break;
|
||||
case eLifetimeCorrection:
|
||||
bool flag;
|
||||
if (str == "y")
|
||||
flag = true;
|
||||
else
|
||||
flag = false;
|
||||
fAdmin->setLifetimeCorrectionFlag(flag);
|
||||
break;
|
||||
case eTitleFromDataFile:
|
||||
if (str == "y")
|
||||
flag = true;
|
||||
else
|
||||
flag = false;
|
||||
fAdmin->setTitleFromDataFileFlag(flag);
|
||||
break;
|
||||
case eMsrDefaultFilePath:
|
||||
fAdmin->setMsrDefaultFilePath(QString(str.ascii()).stripWhiteSpace());
|
||||
break;
|
||||
@ -294,6 +303,9 @@ PAdmin::PAdmin()
|
||||
|
||||
fHelpMain = QString("");
|
||||
|
||||
fLifetimeCorrection = true;
|
||||
fTitleFromDataFile = false;
|
||||
|
||||
// XML Parser part
|
||||
QString fln = "./musrgui_startup.xml";
|
||||
if (!QFile::exists(fln)) {
|
||||
|
@ -58,7 +58,7 @@ class PAdminXMLParser : public QXmlDefaultHandler
|
||||
|
||||
private:
|
||||
enum EAdminKeyWords {eEmpty, eExecPath, eDefaultSavePath, eBeamline, eInstitute, eFileFormat,
|
||||
eLifetimeCorrection, eMsrDefaultFilePath, eHelpMain, eTheoFuncPixmapPath,
|
||||
eLifetimeCorrection, eTitleFromDataFile, eMsrDefaultFilePath, eHelpMain, eTheoFuncPixmapPath,
|
||||
eFunc, eFuncName, eFuncComment, eFuncLabel, eFuncPixmap, eFuncParams};
|
||||
|
||||
bool startDocument();
|
||||
@ -90,6 +90,7 @@ class PAdmin
|
||||
QString getInstitute() { return fInstitute; }
|
||||
QString getFileFormat() { return fFileFormat; }
|
||||
bool getLifetimeCorrectionFlag() { return fLifetimeCorrection; }
|
||||
bool getTitleFromDataFileFlag() { return fTitleFromDataFile; }
|
||||
QString getMsrDefaultFilePath() { return fMsrDefaultFilePath; }
|
||||
QString getHelpMain() { return fHelpMain; }
|
||||
QString getTheoFuncPixmapPath() { return fTheoFuncPixmapPath; }
|
||||
@ -103,6 +104,7 @@ class PAdmin
|
||||
void setInstitute(const QString str) { fInstitute = str; }
|
||||
void setFileFormat(const QString str) { fFileFormat = str; }
|
||||
void setLifetimeCorrectionFlag(const bool flag) { fLifetimeCorrection = flag; }
|
||||
void setTitleFromDataFileFlag(const bool flag) { fTitleFromDataFile = flag; }
|
||||
void setMsrDefaultFilePath(const QString str) { fMsrDefaultFilePath = str; }
|
||||
void setHelpMain(const QString str) { fHelpMain = str; }
|
||||
void setTheoFuncPixmapPath (const QString str) { fTheoFuncPixmapPath = str; }
|
||||
@ -120,6 +122,7 @@ class PAdmin
|
||||
QString fInstitute;
|
||||
QString fFileFormat;
|
||||
bool fLifetimeCorrection;
|
||||
bool fTitleFromDataFile;
|
||||
|
||||
QString fHelpMain;
|
||||
|
||||
|
@ -88,6 +88,7 @@ PMsr2DataDialog::PMsr2DataDialog(PMsr2DataParam *msr2DataParam) : fMsr2DataParam
|
||||
fRecreateDbFile_checkBox->setChecked(fMsr2DataParam->recreateDbFile);
|
||||
fChainFit_checkBox->setChecked(fMsr2DataParam->chainFit);
|
||||
fOpenAfterFitting_checkBox->setChecked(fMsr2DataParam->openFilesAfterFitting);
|
||||
fTitleFromData_checkBox->setChecked(fMsr2DataParam->titleFromDataFile);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@ -122,6 +123,7 @@ PMsr2DataParam* PMsr2DataDialog::getMsr2DataParam()
|
||||
fMsr2DataParam->recreateDbFile = fRecreateDbFile_checkBox->isChecked();
|
||||
fMsr2DataParam->chainFit = fChainFit_checkBox->isChecked();
|
||||
fMsr2DataParam->openFilesAfterFitting = fOpenAfterFitting_checkBox->isChecked();
|
||||
fMsr2DataParam->titleFromDataFile = fTitleFromData_checkBox->isChecked();
|
||||
|
||||
return fMsr2DataParam;
|
||||
}
|
||||
|
@ -35,7 +35,7 @@
|
||||
/**
|
||||
* <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)
|
||||
fKeepMn2Output_checkBox->setChecked(true);
|
||||
@ -52,6 +52,8 @@ PPrefsDialog::PPrefsDialog(const bool keep_mn2_output, const int dump_tag)
|
||||
fDumpAscii_checkBox->setChecked(false);
|
||||
fDumpRoot_checkBox->setChecked(false);
|
||||
}
|
||||
|
||||
fTitleFromData_checkBox->setChecked(title_from_data_file);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
|
@ -39,9 +39,10 @@
|
||||
class PPrefsDialog : public PPrefsDialogBase
|
||||
{
|
||||
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 titleFromDataFileFlag() { return fTitleFromData_checkBox->isChecked(); }
|
||||
int getDump();
|
||||
|
||||
public slots:
|
||||
|
@ -114,6 +114,7 @@ PTextEdit::PTextEdit( QWidget *parent, const char *name )
|
||||
fFileWatcher = 0;
|
||||
|
||||
fKeepMinuit2Output = false;
|
||||
fTitleFromDataFile = fAdmin->getTitleFromDataFileFlag();
|
||||
fDump = 0; // 0 = no dump, 1 = ascii dump, 2 = root dump
|
||||
|
||||
setupFileActions();
|
||||
@ -1287,6 +1288,10 @@ void PTextEdit::musrFit()
|
||||
if (fKeepMinuit2Output)
|
||||
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
|
||||
switch (fDump) {
|
||||
case 1: // ascii dump
|
||||
@ -1374,6 +1379,7 @@ void PTextEdit::musrMsr2Data()
|
||||
fMsr2DataParam->recreateDbFile = false;
|
||||
fMsr2DataParam->chainFit = true;
|
||||
fMsr2DataParam->openFilesAfterFitting = false;
|
||||
fMsr2DataParam->titleFromDataFile = fTitleFromDataFile;
|
||||
}
|
||||
|
||||
PMsr2DataDialog *dlg = new PMsr2DataDialog(fMsr2DataParam);
|
||||
@ -1505,6 +1511,11 @@ void PTextEdit::musrMsr2Data()
|
||||
cmd.append("-k");
|
||||
}
|
||||
|
||||
// replace msr-file title by data file title
|
||||
if (fMsr2DataParam->titleFromDataFile) {
|
||||
cmd.append("-t");
|
||||
}
|
||||
|
||||
// DB output wished
|
||||
if (!fMsr2DataParam->dbOutputFileName.isEmpty()) {
|
||||
str = "-o" + fMsr2DataParam->dbOutputFileName;
|
||||
@ -1680,10 +1691,11 @@ void PTextEdit::musrT0()
|
||||
*/
|
||||
void PTextEdit::musrPrefs()
|
||||
{
|
||||
PPrefsDialog *dlg = new PPrefsDialog(fKeepMinuit2Output, fDump);
|
||||
PPrefsDialog *dlg = new PPrefsDialog(fKeepMinuit2Output, fDump, fTitleFromDataFile);
|
||||
|
||||
if (dlg->exec() == QDialog::Accepted) {
|
||||
fKeepMinuit2Output = dlg->keepMinuit2Output();
|
||||
fTitleFromDataFile = dlg->titleFromDataFileFlag();
|
||||
fDump = dlg->getDump();
|
||||
}
|
||||
}
|
||||
|
@ -123,6 +123,7 @@ private:
|
||||
PAdmin *fAdmin;
|
||||
|
||||
bool fKeepMinuit2Output;
|
||||
bool fTitleFromDataFile;
|
||||
int fDump;
|
||||
|
||||
PMsr2DataParam *fMsr2DataParam;
|
||||
|
@ -502,25 +502,6 @@
|
||||
<string>will try to extract information from the summary file (LEM)</string>
|
||||
</property>
|
||||
</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">
|
||||
<property name="name">
|
||||
<cstring>fWriteDbHeader_checkBox</cstring>
|
||||
@ -540,13 +521,32 @@
|
||||
<string>will add a default header to the DB-file</string>
|
||||
</property>
|
||||
</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">
|
||||
<property name="name">
|
||||
<cstring>fRecreateDbFile_checkBox</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>230</x>
|
||||
<x>220</x>
|
||||
<y>50</y>
|
||||
<width>150</width>
|
||||
<height>22</height>
|
||||
@ -565,7 +565,7 @@
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>230</x>
|
||||
<x>220</x>
|
||||
<y>70</y>
|
||||
<width>170</width>
|
||||
<height>22</height>
|
||||
@ -575,6 +575,22 @@
|
||||
<string>Open Files after Fitting</string>
|
||||
</property>
|
||||
</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>
|
||||
<images>
|
||||
|
@ -100,6 +100,22 @@
|
||||
<string>will generate a ROOT dump file after the fit with the data and the theory</string>
|
||||
</property>
|
||||
</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 class="QLayoutWidget">
|
||||
|
@ -49,6 +49,7 @@ typedef struct {
|
||||
bool recreateDbFile;
|
||||
bool chainFit;
|
||||
bool openFilesAfterFitting;
|
||||
bool titleFromDataFile;
|
||||
} PMsr2DataParam;
|
||||
|
||||
typedef struct {
|
||||
|
@ -14,6 +14,7 @@
|
||||
<institute>psi</institute>
|
||||
<file_format>root-npp</file_format>
|
||||
<lifetime_correction>y</lifetime_correction>
|
||||
<title_from_data_file>n</title_from_data_file>
|
||||
</msr_file_defaults>
|
||||
<help_section>
|
||||
<help_main>
|
||||
|
Loading…
x
Reference in New Issue
Block a user