fixing typo, adding eventFilters, etc. see (MUSR-44 in the tracker)

This commit is contained in:
nemu 2009-04-20 06:50:06 +00:00
parent 5667d6bb5e
commit 01ee7c0196
11 changed files with 161 additions and 109 deletions

View File

@ -42,8 +42,7 @@ endif
# -- Linux
ifeq ($(OS),LINUX)
CXX = g++
#CXXFLAGS = -O3 -Wall -Wno-trigraphs -fPIC
CXXFLAGS = -O1 -Wall -Wno-trigraphs -fPIC
CXXFLAGS = -O3 -Wall -Wno-trigraphs -fPIC
PMUSRPATH = ../include
MNPATH = $(ROOTSYS)/include
GSLPATH = /usr/include/gsl

View File

@ -1063,7 +1063,7 @@ int PMsrHandler::ParameterInUse(unsigned int paramNo)
* x x x x x -> 5 Parameters, e.g. after a MINOS fit
* without boundaries
* x x x x -> 4 Parameters, e.g. after MIGRAD fit
* without bounderies, or
* without boundaries, or
* when starting
* \endcode
*
@ -1161,7 +1161,7 @@ bool PMsrHandler::HandleFitParameterEntry(PMsrLines &lines)
}
}
// 7 values, i.e. No Name Value Neg_Error Pos_Error Lower_Bounderay Upper_Boundary
// 7 values, i.e. No Name Value Neg_Error Pos_Error Lower_Boundary Upper_Boundary
if (tokens->GetEntries() == 7) {
param.fNoOfParams = 7;

View File

@ -1872,6 +1872,25 @@ void PTheory::CalculateDynKTLF(const double *val, int tag) const
const double Tmax = 20.0; // 20 usec
unsigned int N = static_cast<unsigned int>(16.0*Tmax*val[0]);
// check if rate (Delta/a) is very high
if (fabs(val[1]) > 0.1) {
double tmin = 20.0;
switch (tag) {
case 0: // Gauss
tmin = sqrt(3.0)/val[1];
break;
case 1: // Lorentz
tmin = 2.0/val[1];
break;
default:
break;
}
unsigned int Nrate = static_cast<unsigned int>(25.0 * Tmax / tmin);
if (Nrate > N) {
N = Nrate;
}
}
if (N < 300) // if too view points, i.e. nu0 very small, take 300 points
N = 300;

View File

@ -34,6 +34,8 @@
#include <qmessagebox.h>
#include <qspinbox.h>
#include <qtextedit.h>
#include <qpushbutton.h>
#include <qevent.h>
#include "PGetParameterDialog.h"
@ -43,6 +45,9 @@
*/
PGetParameterDialog::PGetParameterDialog()
{
// setup event filter
installEventFilter(this);
fValue_lineEdit->setValidator( new QDoubleValidator(fValue_lineEdit) );
fStep_lineEdit->setValidator( new QDoubleValidator(fStep_lineEdit) );
@ -175,6 +180,30 @@ void PGetParameterDialog::paramAdd()
fName_lineEdit->setFocus();
}
//----------------------------------------------------------------------------------------------------
/**
* <p>This event filter is filtering out the return key, and if present adds the current parameters
* to the parameter list.
*/
bool PGetParameterDialog::eventFilter( QObject *obj, QEvent *ev )
{
if (obj == this) {
if (ev->type() == QEvent::KeyPress) {
QKeyEvent *k = (QKeyEvent*)ev;
if (k->key() == Qt::Key_Return) {
paramAdd();
return true;
} else {
return false;
}
} else {
return false;
}
} else {
return false;
}
}
//----------------------------------------------------------------------------------------------------
// END
//----------------------------------------------------------------------------------------------------

View File

@ -43,6 +43,9 @@ class PGetParameterDialog : public PGetParameterDialogBase
public slots:
void paramAdd();
protected:
bool eventFilter( QObject *obj, QEvent *ev );
};
#endif // _PGETPARAMETERDIALOG_H_

View File

@ -272,14 +272,15 @@ void PTextEdit::setupMusrActions()
a->addTo( tb );
a->addTo( menu );
a = new QAction( QPixmap::fromMimeSource( "musrsinglehisto.xpm" ), tr( "Single &Histo Default" ), ALT + Key_H, this, "musrGetSinglHistoDefault" );
a = new QAction( QPixmap::fromMimeSource( "musrsinglehisto.xpm" ), tr( "Single &Histogram Default" ), ALT + Key_H, this, "musrGetSinglHistoDefault" );
connect( a, SIGNAL( activated() ), this, SLOT( musrGetSingleHistoDefault() ) );
a->addTo( tb );
a->addTo( menu );
menu->insertSeparator();
tb->addSeparator();
a = new QAction( QPixmap::fromMimeSource( "musrcalcchisq.xpm" ), tr( "Calc Chisq" ), ALT + Key_C, this, "cacluates for the given parameters chiSq/maxLH" );
a = new QAction( QPixmap::fromMimeSource( "musrcalcchisq.xpm" ), tr( "Calculate Chisq" ), ALT + Key_C, this, "cacluates for the given parameters chiSq/maxLH" );
connect( a, SIGNAL( activated() ), this, SLOT( musrCalcChisq() ) );
a->addTo( tb );
a->addTo( menu );
@ -300,6 +301,7 @@ void PTextEdit::setupMusrActions()
a->addTo( menu );
menu->insertSeparator();
tb->addSeparator();
a = new QAction( QPixmap::fromMimeSource( "musrview.xpm" ), tr( "&View" ), ALT + Key_V, this, "musrView" );
connect( a, SIGNAL( activated() ), this, SLOT( musrView() ) );
@ -553,7 +555,7 @@ void PTextEdit::fileClose()
if (fTabWidget->label(idx).find("*")>0) {
int result = QMessageBox::warning(this, "**WARNING**",
"Do you really want to close this file.\nChanges will be lost",
"Exit", "Cancel");
"Close", "Cancel");
if (result == 1) // Cancel
return;
}
@ -863,7 +865,7 @@ void PTextEdit::musrGetSingleHistoDefault()
file.close();
} else {
QMessageBox::critical(this, "**ERROR**",
"Couldn't find default single histo file template :-(",
"Couldn't find default single histogram file template :-(",
QMessageBox::Ok, QMessageBox::NoButton);
}

View File

@ -1,7 +1,7 @@
TITLE
###############################################################
FITPARAMETER
# Nr. Name Value Step Pos_Error Bounderies
# Nr. Name Value Step Pos_Error Boundaries
1 alpha 0.989765 1.0 none 0 none
2 asy 0.26 0.1 none 0 0.33
3 phase 8.5 1.0 none

View File

@ -264,32 +264,6 @@
<string>Alt+A</string>
</property>
</widget>
<widget class="QTextEdit">
<property name="name">
<cstring>fParam_textEdit</cstring>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>110</y>
<width>640</width>
<height>270</height>
</rect>
</property>
<property name="font">
<font>
<family>Courier</family>
</font>
</property>
<property name="text">
<string>###############################################################
FITPARAMETER
# Nr. Name Value Step Pos_Error Bounderies</string>
</property>
<property name="wordWrap">
<enum>WidgetWidth</enum>
</property>
</widget>
<widget class="QPushButton">
<property name="name">
<cstring>fCancel_pushButton</cstring>
@ -362,6 +336,32 @@ FITPARAMETER
<bool>true</bool>
</property>
</widget>
<widget class="QTextEdit">
<property name="name">
<cstring>fParam_textEdit</cstring>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>110</y>
<width>640</width>
<height>270</height>
</rect>
</property>
<property name="font">
<font>
<family>Courier</family>
</font>
</property>
<property name="text">
<string>###############################################################
FITPARAMETER
# Nr. Name Value Step Pos_Error Boundaries</string>
</property>
<property name="wordWrap">
<enum>WidgetWidth</enum>
</property>
</widget>
</widget>
<images>
<image name="image0">
@ -371,7 +371,7 @@ FITPARAMETER
<connections>
<connection>
<sender>fOk_PushButton</sender>
<signal>clicked()</signal>
<signal>released()</signal>
<receiver>PGetParameterDialogBase</receiver>
<slot>accept()</slot>
</connection>

View File

@ -382,54 +382,6 @@
</property>
</widget>
</widget>
<widget class="QGroupBox">
<property name="name">
<cstring>fDbOutputFileName_groupBox</cstring>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>325</y>
<width>580</width>
<height>65</height>
</rect>
</property>
<property name="title">
<string>DB output file name</string>
</property>
<widget class="QLabel">
<property name="name">
<cstring>fDbOutputFileName_textLabel</cstring>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>150</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>DB Output File Name</string>
</property>
</widget>
<widget class="QLineEdit">
<property name="name">
<cstring>fDbOutputFileName_lineEdit</cstring>
</property>
<property name="geometry">
<rect>
<x>170</x>
<y>25</y>
<width>350</width>
<height>24</height>
</rect>
</property>
<property name="toolTip" stdset="0">
<string>e.g. MyPrefectFitCollection.db</string>
</property>
</widget>
</widget>
<widget class="QGroupBox">
<property name="name">
<cstring>fOptions_groupBox</cstring>
@ -464,25 +416,6 @@
<string>will keep the Minuit2 output files</string>
</property>
</widget>
<widget class="QCheckBox">
<property name="name">
<cstring>fWriteDbHeader_checkBox</cstring>
</property>
<property name="geometry">
<rect>
<x>20</x>
<y>30</y>
<width>150</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Write DB Header</string>
</property>
<property name="toolTip" stdset="0">
<string>will add a default header to the DB-file</string>
</property>
</widget>
<widget class="QCheckBox">
<property name="name">
<cstring>fSummaryPresent_checkBox</cstring>
@ -521,6 +454,25 @@
<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>
</property>
<property name="geometry">
<rect>
<x>20</x>
<y>30</y>
<width>150</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Write Data Header</string>
</property>
<property name="toolTip" stdset="0">
<string>will add a default header to the DB-file</string>
</property>
</widget>
<widget class="QCheckBox">
<property name="name">
<cstring>fRecreateDbFile_checkBox</cstring>
@ -529,18 +481,66 @@
<rect>
<x>230</x>
<y>50</y>
<width>140</width>
<width>150</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Recreate DB File</string>
<string>Recreate Data File</string>
</property>
<property name="toolTip" stdset="0">
<string>will recreate the db-file. Default (unchecked) will append data</string>
</property>
</widget>
</widget>
<widget class="QGroupBox">
<property name="name">
<cstring>fDbOutputFileName_groupBox</cstring>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>325</y>
<width>580</width>
<height>65</height>
</rect>
</property>
<property name="title">
<string>Data output file name</string>
</property>
<widget class="QLineEdit">
<property name="name">
<cstring>fDbOutputFileName_lineEdit</cstring>
</property>
<property name="geometry">
<rect>
<x>170</x>
<y>25</y>
<width>350</width>
<height>24</height>
</rect>
</property>
<property name="toolTip" stdset="0">
<string>e.g. MyPrefectFitCollection.db</string>
</property>
</widget>
<widget class="QLabel">
<property name="name">
<cstring>fDbOutputFileName_textLabel</cstring>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>160</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Data Output File Name</string>
</property>
</widget>
</widget>
</widget>
<images>
<image name="image0">

View File

@ -45,7 +45,7 @@
<params>2</params>
</func>
<func>
<name>simplGss</name>
<name>simpleGss</name>
<comment>(rate)</comment>
<label>simple Gauss</label>
<pixmap>simpleGauss.png</pixmap>
@ -82,14 +82,14 @@
<func>
<name>statExpKTLF</name>
<comment>(frequency damping)</comment>
<label>static Gauss KT LF</label>
<label>static Lorentz KT LF</label>
<pixmap></pixmap>
<params>2</params>
</func>
<func>
<name>dynExpKTLF</name>
<comment>(frequency damping hopping-rate)</comment>
<label>static Lorentz KT LF</label>
<label>dynamic Lorentz KT LF</label>
<pixmap></pixmap>
<params>3</params>
</func>

View File

@ -1,7 +1,7 @@
TITLE
###############################################################
FITPARAMETER
# Nr. Name Value Step Pos_Error Bounderies
# Nr. Name Value Step Pos_Error Boundaries
1 Asy 0.26 0.01 none 0 0.33
2 Rate 0.36 0.01 none
3 Field 100.0 1.0 none 0 200