added enable/disable feature for musrt0 in musrgui
This commit is contained in:
@ -73,6 +73,10 @@ bool PAdminXMLParser::startElement( const QString&, const QString&,
|
||||
fKeyWord = eExecPath;
|
||||
} else if (qName == "default_save_path") {
|
||||
fKeyWord = eDefaultSavePath;
|
||||
} else if (qName == "title_from_data_file") {
|
||||
fKeyWord = eTitleFromDataFile;
|
||||
} else if (qName == "enable_musrt0") {
|
||||
fKeyWord = eEnableMusrT0;
|
||||
} else if (qName == "beamline") {
|
||||
fKeyWord = eBeamline;
|
||||
} else if (qName == "institute") {
|
||||
@ -81,8 +85,6 @@ 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") {
|
||||
@ -148,6 +150,20 @@ bool PAdminXMLParser::characters(const QString& str)
|
||||
case eDefaultSavePath:
|
||||
fAdmin->setDefaultSavePath(QString(str.ascii()).stripWhiteSpace());
|
||||
break;
|
||||
case eTitleFromDataFile:
|
||||
if (str == "y")
|
||||
flag = true;
|
||||
else
|
||||
flag = false;
|
||||
fAdmin->setTitleFromDataFileFlag(flag);
|
||||
break;
|
||||
case eEnableMusrT0:
|
||||
if (str == "y")
|
||||
flag = true;
|
||||
else
|
||||
flag = false;
|
||||
fAdmin->setEnableMusrT0Flag(flag);
|
||||
break;
|
||||
case eBeamline:
|
||||
fAdmin->setBeamline(QString(str.ascii()).stripWhiteSpace());
|
||||
break;
|
||||
@ -164,13 +180,6 @@ bool PAdminXMLParser::characters(const QString& str)
|
||||
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;
|
||||
@ -303,8 +312,9 @@ PAdmin::PAdmin()
|
||||
|
||||
fHelpMain = QString("");
|
||||
|
||||
fLifetimeCorrection = true;
|
||||
fTitleFromDataFile = false;
|
||||
fEnableMusrT0 = false;
|
||||
fLifetimeCorrection = true;
|
||||
|
||||
// XML Parser part
|
||||
QString fln = "./musrgui_startup.xml";
|
||||
|
@ -57,9 +57,10 @@ class PAdminXMLParser : public QXmlDefaultHandler
|
||||
virtual ~PAdminXMLParser() {}
|
||||
|
||||
private:
|
||||
enum EAdminKeyWords {eEmpty, eExecPath, eDefaultSavePath, eBeamline, eInstitute, eFileFormat,
|
||||
eLifetimeCorrection, eTitleFromDataFile, eMsrDefaultFilePath, eHelpMain, eTheoFuncPixmapPath,
|
||||
eFunc, eFuncName, eFuncComment, eFuncLabel, eFuncPixmap, eFuncParams};
|
||||
enum EAdminKeyWords {eEmpty, eExecPath, eDefaultSavePath, eTitleFromDataFile, eEnableMusrT0,
|
||||
eBeamline, eInstitute, eFileFormat, eLifetimeCorrection, eMsrDefaultFilePath,
|
||||
eHelpMain, eTheoFuncPixmapPath, eFunc, eFuncName, eFuncComment, eFuncLabel,
|
||||
eFuncPixmap, eFuncParams};
|
||||
|
||||
bool startDocument();
|
||||
bool startElement( const QString&, const QString&, const QString& ,
|
||||
@ -86,11 +87,12 @@ class PAdmin
|
||||
|
||||
QString getExecPath() { return fExecPath; }
|
||||
QString getDefaultSavePath() { return fDefaultSavePath; }
|
||||
bool getTitleFromDataFileFlag() { return fTitleFromDataFile; }
|
||||
bool getEnableMusrT0Flag() { return fEnableMusrT0; }
|
||||
QString getBeamline() { return fBeamline; }
|
||||
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; }
|
||||
@ -100,11 +102,12 @@ class PAdmin
|
||||
protected:
|
||||
void setExecPath(const QString str) { fExecPath = str; }
|
||||
void setDefaultSavePath(const QString str) { fDefaultSavePath = str; }
|
||||
void setTitleFromDataFileFlag(const bool flag) { fTitleFromDataFile = flag; }
|
||||
void setEnableMusrT0Flag(const bool flag) { fEnableMusrT0 = flag; }
|
||||
void setBeamline(const QString str) { fBeamline = str; }
|
||||
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; }
|
||||
@ -118,11 +121,13 @@ class PAdmin
|
||||
QString fMsrDefaultFilePath;
|
||||
QString fTheoFuncPixmapPath;
|
||||
|
||||
bool fTitleFromDataFile;
|
||||
bool fEnableMusrT0;
|
||||
|
||||
QString fBeamline;
|
||||
QString fInstitute;
|
||||
QString fFileFormat;
|
||||
bool fLifetimeCorrection;
|
||||
bool fTitleFromDataFile;
|
||||
|
||||
QString fHelpMain;
|
||||
|
||||
|
@ -35,7 +35,8 @@
|
||||
/**
|
||||
* <p>
|
||||
*/
|
||||
PPrefsDialog::PPrefsDialog(const bool keep_mn2_output, const int dump_tag, const bool title_from_data_file)
|
||||
PPrefsDialog::PPrefsDialog(const bool keep_mn2_output, const int dump_tag, const bool title_from_data_file,
|
||||
const bool enable_musrt0)
|
||||
{
|
||||
if (keep_mn2_output)
|
||||
fKeepMn2Output_checkBox->setChecked(true);
|
||||
@ -54,6 +55,7 @@ PPrefsDialog::PPrefsDialog(const bool keep_mn2_output, const int dump_tag, const
|
||||
}
|
||||
|
||||
fTitleFromData_checkBox->setChecked(title_from_data_file);
|
||||
fEnableMusrT0_checkBox->setChecked(enable_musrt0);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
|
@ -39,10 +39,12 @@
|
||||
class PPrefsDialog : public PPrefsDialogBase
|
||||
{
|
||||
public:
|
||||
PPrefsDialog(const bool keep_mn2_output, const int dump_tag, const bool title_from_data_file);
|
||||
PPrefsDialog(const bool keep_mn2_output, const int dump_tag, const bool title_from_data_file,
|
||||
const bool enable_musrt0);
|
||||
|
||||
bool keepMinuit2Output() { return fKeepMn2Output_checkBox->isChecked(); }
|
||||
bool titleFromDataFileFlag() { return fTitleFromData_checkBox->isChecked(); }
|
||||
bool getKeepMinuit2OutputFlag() { return fKeepMn2Output_checkBox->isChecked(); }
|
||||
bool getTitleFromDataFileFlag() { return fTitleFromData_checkBox->isChecked(); }
|
||||
bool getEnableMusrT0Flag() { return fEnableMusrT0_checkBox->isChecked(); }
|
||||
int getDump();
|
||||
|
||||
public slots:
|
||||
|
@ -108,6 +108,8 @@ PTextEdit::PTextEdit( QWidget *parent, const char *name )
|
||||
{
|
||||
fAdmin = new PAdmin();
|
||||
|
||||
fMusrT0Action = 0;
|
||||
|
||||
fMsr2DataParam = 0;
|
||||
fFindReplaceData = 0,
|
||||
|
||||
@ -115,6 +117,7 @@ PTextEdit::PTextEdit( QWidget *parent, const char *name )
|
||||
|
||||
fKeepMinuit2Output = false;
|
||||
fTitleFromDataFile = fAdmin->getTitleFromDataFileFlag();
|
||||
fEnableMusrT0 = fAdmin->getEnableMusrT0Flag();
|
||||
fDump = 0; // 0 = no dump, 1 = ascii dump, 2 = root dump
|
||||
|
||||
setupFileActions();
|
||||
@ -149,6 +152,14 @@ PTextEdit::PTextEdit( QWidget *parent, const char *name )
|
||||
*/
|
||||
PTextEdit::~PTextEdit()
|
||||
{
|
||||
if (fAdmin) {
|
||||
delete fAdmin;
|
||||
fAdmin = 0;
|
||||
}
|
||||
if (fMusrT0Action) {
|
||||
delete fMusrT0Action;
|
||||
fMusrT0Action = 0;
|
||||
}
|
||||
if (fMsr2DataParam) {
|
||||
delete fMsr2DataParam;
|
||||
fMsr2DataParam = 0;
|
||||
@ -362,10 +373,11 @@ void PTextEdit::setupMusrActions()
|
||||
a->addTo( tb );
|
||||
a->addTo( menu );
|
||||
|
||||
a = new QAction( QPixmap::fromMimeSource( "musrt0.xpm" ), tr( "&T0" ), 0, this, "musrT0" );
|
||||
connect( a, SIGNAL( activated() ), this, SLOT( musrT0() ) );
|
||||
a->addTo( tb );
|
||||
a->addTo( menu );
|
||||
fMusrT0Action = new QAction( QPixmap::fromMimeSource( "musrt0.xpm" ), tr( "&T0" ), 0, this, "musrT0" );
|
||||
connect( fMusrT0Action, SIGNAL( activated() ), this, SLOT( musrT0() ) );
|
||||
fMusrT0Action->addTo( tb );
|
||||
fMusrT0Action->addTo( menu );
|
||||
fMusrT0Action->setEnabled(fEnableMusrT0);
|
||||
|
||||
a = new QAction( QPixmap::fromMimeSource( "musrprefs.xpm" ), tr( "&Preferences" ), 0, this, "musrPrefs" );
|
||||
connect( a, SIGNAL( activated() ), this, SLOT( musrPrefs() ) );
|
||||
@ -1691,11 +1703,13 @@ void PTextEdit::musrT0()
|
||||
*/
|
||||
void PTextEdit::musrPrefs()
|
||||
{
|
||||
PPrefsDialog *dlg = new PPrefsDialog(fKeepMinuit2Output, fDump, fTitleFromDataFile);
|
||||
PPrefsDialog *dlg = new PPrefsDialog(fKeepMinuit2Output, fDump, fTitleFromDataFile, fEnableMusrT0);
|
||||
|
||||
if (dlg->exec() == QDialog::Accepted) {
|
||||
fKeepMinuit2Output = dlg->keepMinuit2Output();
|
||||
fTitleFromDataFile = dlg->titleFromDataFileFlag();
|
||||
fKeepMinuit2Output = dlg->getKeepMinuit2OutputFlag();
|
||||
fTitleFromDataFile = dlg->getTitleFromDataFileFlag();
|
||||
fEnableMusrT0 = dlg->getEnableMusrT0Flag();
|
||||
fMusrT0Action->setEnabled(fEnableMusrT0);
|
||||
fDump = dlg->getDump();
|
||||
}
|
||||
}
|
||||
|
@ -122,8 +122,11 @@ private slots:
|
||||
private:
|
||||
PAdmin *fAdmin;
|
||||
|
||||
QAction *fMusrT0Action;
|
||||
|
||||
bool fKeepMinuit2Output;
|
||||
bool fTitleFromDataFile;
|
||||
bool fEnableMusrT0;
|
||||
int fDump;
|
||||
|
||||
PMsr2DataParam *fMsr2DataParam;
|
||||
|
@ -24,100 +24,6 @@
|
||||
<property name="modal">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QTabWidget">
|
||||
<property name="name">
|
||||
<cstring>fTabWidget</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>20</y>
|
||||
<width>520</width>
|
||||
<height>110</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QWidget">
|
||||
<property name="name">
|
||||
<cstring>tab</cstring>
|
||||
</property>
|
||||
<attribute name="title">
|
||||
<string>musrfit</string>
|
||||
</attribute>
|
||||
<widget class="QCheckBox">
|
||||
<property name="name">
|
||||
<cstring>fKeepMn2Output_checkBox</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>160</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>keep minuit2 output</string>
|
||||
</property>
|
||||
<property name="toolTip" stdset="0">
|
||||
<string>will keep the Minuit2 output files (correlation matrix, etc.)</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox">
|
||||
<property name="name">
|
||||
<cstring>fDumpAscii_checkBox</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>30</y>
|
||||
<width>95</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>dump ascii</string>
|
||||
</property>
|
||||
<property name="toolTip" stdset="0">
|
||||
<string>will generate an ascii dump file after the fit with the data and the theory</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox">
|
||||
<property name="name">
|
||||
<cstring>fDumpRoot_checkBox</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>50</y>
|
||||
<width>95</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>dump root</string>
|
||||
</property>
|
||||
<property name="toolTip" stdset="0">
|
||||
<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">
|
||||
<property name="name">
|
||||
<cstring>Layout1</cstring>
|
||||
@ -204,6 +110,124 @@
|
||||
</widget>
|
||||
</hbox>
|
||||
</widget>
|
||||
<widget class="QTabWidget">
|
||||
<property name="name">
|
||||
<cstring>fTabWidget</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>20</y>
|
||||
<width>520</width>
|
||||
<height>110</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QWidget">
|
||||
<property name="name">
|
||||
<cstring>tab</cstring>
|
||||
</property>
|
||||
<attribute name="title">
|
||||
<string>musrfit</string>
|
||||
</attribute>
|
||||
<widget class="QCheckBox">
|
||||
<property name="name">
|
||||
<cstring>fDumpAscii_checkBox</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>30</y>
|
||||
<width>95</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>dump ascii</string>
|
||||
</property>
|
||||
<property name="toolTip" stdset="0">
|
||||
<string>will generate an ascii dump file after the fit with the data and the theory</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox">
|
||||
<property name="name">
|
||||
<cstring>fDumpRoot_checkBox</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>50</y>
|
||||
<width>95</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>dump root</string>
|
||||
</property>
|
||||
<property name="toolTip" stdset="0">
|
||||
<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 class="QCheckBox">
|
||||
<property name="name">
|
||||
<cstring>fKeepMn2Output_checkBox</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>160</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>keep minuit2 output</string>
|
||||
</property>
|
||||
<property name="toolTip" stdset="0">
|
||||
<string>will keep the Minuit2 output files (correlation matrix, etc.)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget">
|
||||
<property name="name">
|
||||
<cstring>TabPage</cstring>
|
||||
</property>
|
||||
<attribute name="title">
|
||||
<string>musrt0</string>
|
||||
</attribute>
|
||||
<widget class="QCheckBox">
|
||||
<property name="name">
|
||||
<cstring>fEnableMusrT0_checkBox</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>95</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>enable it</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<images>
|
||||
<image name="image0">
|
||||
|
@ -8,13 +8,14 @@
|
||||
<exec_path>$ROOTSYS/bin</exec_path>
|
||||
<default_save_path>./</default_save_path>
|
||||
<msr_default_file_path>$HOME/analysis/musrfit/src/musrgui</msr_default_file_path>
|
||||
<title_from_data_file>n</title_from_data_file>
|
||||
<enable_musrt0>n</enable_musrt0>
|
||||
</general>
|
||||
<msr_file_defaults>
|
||||
<beamline>mue4</beamline>
|
||||
<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>
|
||||
|
Reference in New Issue
Block a user