added the 'global' option to msr2data GUI from within musrgui/musredit

This commit is contained in:
suter_a 2010-06-22 17:45:01 +00:00
parent 440d22bc99
commit e7d8a0c5f1
11 changed files with 268 additions and 180 deletions

View File

@ -100,6 +100,7 @@ PMsr2DataDialog::PMsr2DataDialog(PMsr2DataParam *msr2DataParam, const QString he
fTitleFromData_checkBox->setChecked(fMsr2DataParam->titleFromDataFile);
fCreateMsrFileOnly_checkBox->setChecked(fMsr2DataParam->createMsrFileOnly);
fFitOnly_checkBox->setChecked(fMsr2DataParam->fitOnly);
fGlobal_checkBox->setChecked(fMsr2DataParam->global);
}
//----------------------------------------------------------------------------------------------------
@ -137,6 +138,7 @@ PMsr2DataParam* PMsr2DataDialog::getMsr2DataParam()
fMsr2DataParam->titleFromDataFile = fTitleFromData_checkBox->isChecked();
fMsr2DataParam->createMsrFileOnly = fCreateMsrFileOnly_checkBox->isChecked();
fMsr2DataParam->fitOnly = fFitOnly_checkBox->isChecked();
fMsr2DataParam->global = fGlobal_checkBox->isChecked();
return fMsr2DataParam;
}
@ -260,7 +262,7 @@ void PMsr2DataDialog::createMsrFileOnlyChanged(int buttonState)
//----------------------------------------------------------------------------------------------------
/**
* <p>SLOT: called when the 'Fit Only' QCheckBox under 'Options' is activated.
* Sets at the same time the create-msr-file-only flag to false. Clears the 'Template Run Number'
* Sets at the same time the create-msr-file-only and global flags to false. Clears the 'Template Run Number'
* field.
*
* \param buttonState state of the button.
@ -269,10 +271,25 @@ void PMsr2DataDialog::fitOnlyChanged(int buttonState)
{
if (buttonState == Qt::Checked) {
fCreateMsrFileOnly_checkBox->setChecked(false);
fGlobal_checkBox->setChecked(false);
fTemplateRunNumber_lineEdit->clear();
}
}
//----------------------------------------------------------------------------------------------------
/**
* <p>SLOT: called when the 'Global' QCheckBox under 'Options' is activated.
* Sets at the same time the fit-only flag to false.
*
* \param buttonState state of the button.
*/
void PMsr2DataDialog::globalChanged(int buttonState)
{
if (buttonState == Qt::Checked) {
fFitOnly_checkBox->setChecked(false);
}
}
//----------------------------------------------------------------------------------------------------
/**
* <p>Generates a help content window showing the description for msr2data.

View File

@ -60,6 +60,7 @@ class PMsr2DataDialog : public QDialog, private Ui::PMsr2DataDialog
void templateRunEntered(const QString&);
void createMsrFileOnlyChanged(int);
void fitOnlyChanged(int);
void globalChanged(int);
void helpContent();
private:

View File

@ -1722,6 +1722,7 @@ void PTextEdit::musrMsr2Data()
fMsr2DataParam->titleFromDataFile = fTitleFromDataFile;
fMsr2DataParam->createMsrFileOnly = false;
fMsr2DataParam->fitOnly = false;
fMsr2DataParam->global = false;
}
PMsr2DataDialog *dlg = new PMsr2DataDialog(fMsr2DataParam, fAdmin->getHelpUrl("msr2data"));
@ -1887,22 +1888,22 @@ void PTextEdit::musrMsr2Data()
cmd.append("data");
}
// recreate db file
if (fMsr2DataParam->recreateDbFile) {
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->global) {
cmd.append("global");
}
/*
for (unsigned int i=0; i<cmd.size(); i++) {
cout << endl << ">> " << cmd[i].toLatin1();
}
cout << endl;
*/
// 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;
}
}
}
PFitOutputHandler fitOutputHandler(QFileInfo(*fFilenames.find( currentEditor() )).absolutePath(), cmd);
fitOutputHandler.setModal(true);

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>542</width>
<height>522</height>
<width>552</width>
<height>551</height>
</rect>
</property>
<property name="windowTitle">
@ -22,7 +22,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>541</width>
<width>551</width>
<height>131</height>
</rect>
</property>
@ -46,8 +46,8 @@
<rect>
<x>10</x>
<y>30</y>
<width>511</width>
<height>94</height>
<width>531</width>
<height>97</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
@ -195,7 +195,7 @@
<rect>
<x>0</x>
<y>130</y>
<width>541</width>
<width>551</width>
<height>71</height>
</rect>
</property>
@ -207,8 +207,8 @@
<rect>
<x>10</x>
<y>30</y>
<width>511</width>
<height>28</height>
<width>531</width>
<height>29</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_5">
@ -256,7 +256,7 @@
<rect>
<x>0</x>
<y>200</y>
<width>541</width>
<width>551</width>
<height>80</height>
</rect>
</property>
@ -268,8 +268,8 @@
<rect>
<x>10</x>
<y>30</y>
<width>511</width>
<height>28</height>
<width>531</width>
<height>29</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_6">
@ -311,7 +311,7 @@
<rect>
<x>0</x>
<y>280</y>
<width>541</width>
<width>551</width>
<height>80</height>
</rect>
</property>
@ -323,8 +323,8 @@
<rect>
<x>10</x>
<y>30</y>
<width>511</width>
<height>28</height>
<width>531</width>
<height>29</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_7">
@ -362,20 +362,20 @@
<rect>
<x>0</x>
<y>360</y>
<width>541</width>
<height>111</height>
<width>551</width>
<height>141</height>
</rect>
</property>
<property name="title">
<string>Options</string>
</property>
<widget class="QWidget" name="layoutWidget">
<widget class="QWidget" name="">
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>521</width>
<height>81</height>
<y>31</y>
<width>540</width>
<height>108</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_8">
@ -452,6 +452,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="fGlobal_checkBox">
<property name="text">
<string>Global</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
@ -461,8 +468,8 @@
<property name="geometry">
<rect>
<x>0</x>
<y>470</y>
<width>541</width>
<y>500</y>
<width>551</width>
<height>51</height>
</rect>
</property>
@ -549,7 +556,7 @@
<hints>
<hint type="sourcelabel">
<x>538</x>
<y>488</y>
<y>534</y>
</hint>
<hint type="destinationlabel">
<x>508</x>
@ -564,8 +571,8 @@
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>453</x>
<y>506</y>
<x>456</x>
<y>541</y>
</hint>
<hint type="destinationlabel">
<x>380</x>
@ -580,8 +587,8 @@
<slot>helpContent()</slot>
<hints>
<hint type="sourcelabel">
<x>57</x>
<y>488</y>
<x>59</x>
<y>534</y>
</hint>
<hint type="destinationlabel">
<x>96</x>
@ -589,38 +596,6 @@
</hint>
</hints>
</connection>
<connection>
<sender>fFitOnly_checkBox</sender>
<signal>stateChanged(int)</signal>
<receiver>PMsr2DataDialog</receiver>
<slot>fitOnlyChanged(int)</slot>
<hints>
<hint type="sourcelabel">
<x>406</x>
<y>460</y>
</hint>
<hint type="destinationlabel">
<x>301</x>
<y>484</y>
</hint>
</hints>
</connection>
<connection>
<sender>fCreateMsrFileOnly_checkBox</sender>
<signal>stateChanged(int)</signal>
<receiver>PMsr2DataDialog</receiver>
<slot>createMsrFileOnlyChanged(int)</slot>
<hints>
<hint type="sourcelabel">
<x>377</x>
<y>429</y>
</hint>
<hint type="destinationlabel">
<x>150</x>
<y>487</y>
</hint>
</hints>
</connection>
<connection>
<sender>fFirst_lineEdit</sender>
<signal>textChanged(QString)</signal>
@ -701,6 +676,54 @@
</hint>
</hints>
</connection>
<connection>
<sender>fFitOnly_checkBox</sender>
<signal>stateChanged(int)</signal>
<receiver>PMsr2DataDialog</receiver>
<slot>fitOnlyChanged(int)</slot>
<hints>
<hint type="sourcelabel">
<x>406</x>
<y>460</y>
</hint>
<hint type="destinationlabel">
<x>301</x>
<y>484</y>
</hint>
</hints>
</connection>
<connection>
<sender>fCreateMsrFileOnly_checkBox</sender>
<signal>stateChanged(int)</signal>
<receiver>PMsr2DataDialog</receiver>
<slot>createMsrFileOnlyChanged(int)</slot>
<hints>
<hint type="sourcelabel">
<x>547</x>
<y>442</y>
</hint>
<hint type="destinationlabel">
<x>150</x>
<y>487</y>
</hint>
</hints>
</connection>
<connection>
<sender>fGlobal_checkBox</sender>
<signal>stateChanged(int)</signal>
<receiver>PMsr2DataDialog</receiver>
<slot>globalChanged(int)</slot>
<hints>
<hint type="sourcelabel">
<x>398</x>
<y>479</y>
</hint>
<hint type="destinationlabel">
<x>372</x>
<y>520</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>helpContent()</slot>
@ -711,5 +734,6 @@
<slot>runListEntered(QString)</slot>
<slot>runListFileNameEntered(QString)</slot>
<slot>templateRunEntered(QString)</slot>
<slot>globalChanged(int)</slot>
</slots>
</ui>

View File

@ -52,12 +52,13 @@ typedef struct {
bool summaryFilePresent; ///< flag indicating if a LEM summary file is present (== !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; ///< true = recreate db-file, false = append to present db-file
bool chainFit; ///< true = chain fit, i.e. the template for a fit is the preceeding run. false = the template is always the source for the new msr-file
bool openFilesAfterFitting; ///< true = open msr-file after fit in musredit. false = do not open msr-file after fit.
bool recreateDbFile; ///< flag: true = recreate db-file, false = append to present db-file
bool chainFit; ///< flag: true = chain fit, i.e. the template for a fit is the preceeding run. false = the template is always the source for the new msr-file
bool openFilesAfterFitting; ///< flag: true = open msr-file after fit in musredit. false = do not open msr-file after fit.
bool titleFromDataFile; ///< flag indicating if the title for the msr-file shall be extracted from the data-file ('-t' in msr2data)
bool createMsrFileOnly; ///< true = just create the msr-files without any fitting ('msr-<template>' in msr2data)
bool fitOnly; ///< true = just perform the fits wihtout generating any msr-files ('fit' 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 global; ///< flag: true = 'global' option
} PMsr2DataParam;
//-------------------------------------------------------------------------------------------------

View File

@ -39,6 +39,10 @@
*/
PFitOutputHandler::PFitOutputHandler(QString workingDirectory, QValueVector<QString> &cmd)
{
qDebug("workingDirectory = %s", workingDirectory.latin1());
for (int i=0; i<cmd.size(); i++)
qDebug("%s ", cmd[i].latin1());
if (cmd.empty())
return;

View File

@ -91,6 +91,7 @@ PMsr2DataDialog::PMsr2DataDialog(PMsr2DataParam *msr2DataParam) : fMsr2DataParam
fTitleFromData_checkBox->setChecked(fMsr2DataParam->titleFromDataFile);
fCreateMsrFileOnly_checkBox->setChecked(fMsr2DataParam->createMsrFileOnly);
fFitOnly_checkBox->setChecked(fMsr2DataParam->fitOnly);
fGlobal_checkBox->setChecked(fMsr2DataParam->global);
}
//----------------------------------------------------------------------------------------------------
@ -128,6 +129,7 @@ PMsr2DataParam* PMsr2DataDialog::getMsr2DataParam()
fMsr2DataParam->titleFromDataFile = fTitleFromData_checkBox->isChecked();
fMsr2DataParam->createMsrFileOnly = fCreateMsrFileOnly_checkBox->isChecked();
fMsr2DataParam->fitOnly = fFitOnly_checkBox->isChecked();
fMsr2DataParam->global = fGlobal_checkBox->isChecked();
return fMsr2DataParam;
}
@ -238,10 +240,22 @@ void PMsr2DataDialog::fitOnlyChanged(int buttonState)
{
if (buttonState == QButton::On) {
fCreateMsrFileOnly_checkBox->setChecked(false);
fGlobal_checkBox->setChecked(false);
fTemplateRunNumber_lineEdit->clear();
}
}
//----------------------------------------------------------------------------------------------------
/**
* <p>
*/
void PMsr2DataDialog::globalChanged(int buttonState)
{
if (buttonState == QButton::On) {
fFitOnly_checkBox->setChecked(false);
}
}
//----------------------------------------------------------------------------------------------------
// END
//----------------------------------------------------------------------------------------------------

View File

@ -51,6 +51,7 @@ class PMsr2DataDialog : public PMsr2DataDialogBase
void templateRunEntered(const QString&);
void createMsrFileOnlyChanged(int);
void fitOnlyChanged(int);
void globalChanged(int);
private:
int fRunTag; // -1 = not valid, 0 = first last, 1 = run list, 2 = run list file name

View File

@ -1468,6 +1468,7 @@ void PTextEdit::musrMsr2Data()
fMsr2DataParam->titleFromDataFile = fTitleFromDataFile;
fMsr2DataParam->createMsrFileOnly = false;
fMsr2DataParam->fitOnly = false;
fMsr2DataParam->global = false;
}
PMsr2DataDialog *dlg = new PMsr2DataDialog(fMsr2DataParam);
@ -1628,22 +1629,22 @@ void PTextEdit::musrMsr2Data()
cmd.append("data");
}
// recreate db file
if (fMsr2DataParam->recreateDbFile) {
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;
}
// check global option
if (fMsr2DataParam->global) {
cmd.append("global");
}
/*
for (unsigned int i=0; i<cmd.size(); i++) {
cout << endl << ">> " << cmd[i].latin1();
}
cout << endl;
*/
// 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;
}
}
}
PFitOutputHandler fitOutputHandler(QFileInfo(*fFilenames.find( currentEditor() )).dirPath(), cmd);
fitOutputHandler.setModal(true);

View File

@ -200,92 +200,6 @@
</property>
</widget>
</widget>
<widget class="QLayoutWidget">
<property name="name">
<cstring>Layout1</cstring>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>530</y>
<width>580</width>
<height>33</height>
</rect>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<widget class="QPushButton">
<property name="name">
<cstring>fHelp_button</cstring>
</property>
<property name="text">
<string>&amp;Help</string>
</property>
<property name="accel">
<string>F1</string>
</property>
<property name="autoDefault">
<bool>true</bool>
</property>
</widget>
<spacer>
<property name="name">
<cstring>Horizontal Spacing2</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
<widget class="QPushButton">
<property name="name">
<cstring>fOk_button</cstring>
</property>
<property name="text">
<string>&amp;OK</string>
</property>
<property name="accel">
<string></string>
</property>
<property name="autoDefault">
<bool>true</bool>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
<widget class="QPushButton">
<property name="name">
<cstring>fCancel_button</cstring>
</property>
<property name="text">
<string>&amp;Cancel</string>
</property>
<property name="accel">
<string></string>
</property>
<property name="autoDefault">
<bool>true</bool>
</property>
</widget>
</hbox>
</widget>
<widget class="QGroupBox">
<property name="name">
<cstring>fExtension_groupBox</cstring>
@ -458,7 +372,7 @@
<x>10</x>
<y>400</y>
<width>581</width>
<height>110</height>
<height>120</height>
</rect>
</property>
<property name="title">
@ -623,6 +537,108 @@
<string>Fit Only</string>
</property>
</widget>
<widget class="QCheckBox">
<property name="name">
<cstring>fGlobal_checkBox</cstring>
</property>
<property name="geometry">
<rect>
<x>400</x>
<y>90</y>
<width>106</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Global</string>
</property>
</widget>
</widget>
<widget class="QLayoutWidget">
<property name="name">
<cstring>Layout1</cstring>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>530</y>
<width>580</width>
<height>33</height>
</rect>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<widget class="QPushButton">
<property name="name">
<cstring>fHelp_button</cstring>
</property>
<property name="text">
<string>&amp;Help</string>
</property>
<property name="accel">
<string>F1</string>
</property>
<property name="autoDefault">
<bool>true</bool>
</property>
</widget>
<spacer>
<property name="name">
<cstring>Horizontal Spacing2</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
<widget class="QPushButton">
<property name="name">
<cstring>fOk_button</cstring>
</property>
<property name="text">
<string>&amp;OK</string>
</property>
<property name="accel">
<string></string>
</property>
<property name="autoDefault">
<bool>true</bool>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
<widget class="QPushButton">
<property name="name">
<cstring>fCancel_button</cstring>
</property>
<property name="text">
<string>&amp;Cancel</string>
</property>
<property name="accel">
<string></string>
</property>
<property name="autoDefault">
<bool>true</bool>
</property>
</widget>
</hbox>
</widget>
</widget>
<images>
@ -685,6 +701,12 @@
<receiver>PMsr2DataDialogBase</receiver>
<slot>templateRunEntered(const QString&amp;)</slot>
</connection>
<connection>
<sender>fGlobal_checkBox</sender>
<signal>stateChanged(int)</signal>
<receiver>PMsr2DataDialogBase</receiver>
<slot>globalChanged(int)</slot>
</connection>
</connections>
<tabstops>
<tabstop>fFirst_lineEdit</tabstop>
@ -716,6 +738,7 @@
<slot>createMsrFileOnlyChanged(int)</slot>
<slot>fitOnlyChanged(int)</slot>
<slot>templateRunEntered(const QString&amp;)</slot>
<slot>globalChanged(int)</slot>
</slots>
<layoutdefaults spacing="6" margin="11"/>
</UI>

View File

@ -52,6 +52,7 @@ typedef struct {
bool titleFromDataFile;
bool createMsrFileOnly;
bool fitOnly;
bool global;
} PMsr2DataParam;
typedef struct {