diff --git a/src/musrgui/PAdmin.cpp b/src/musrgui/PAdmin.cpp new file mode 100644 index 00000000..88378b76 --- /dev/null +++ b/src/musrgui/PAdmin.cpp @@ -0,0 +1,181 @@ +/**************************************************************************** + + PAdmin.cpp + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id$ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2009 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include + +#include "PAdmin.h" + +//-------------------------------------------------------------------------- +// implementation of PAdminXMLParser class +//-------------------------------------------------------------------------- +/** + *

XML Parser class for the musrgui administration file. + * + * \param admin pointer to an admin class instance. + */ +PAdminXMLParser::PAdminXMLParser(PAdmin *admin) : fAdmin(admin) +{ + fKeyWord = eEmpty; +} + +//-------------------------------------------------------------------------- +/** + *

Routine called at the beginning of the XML parsing process. + */ +bool PAdminXMLParser::startDocument() +{ + return true; +} + +//-------------------------------------------------------------------------- +/** + *

Routine called when a new XML tag is found. Here it is used + * to set a tag for filtering afterwards the content. + * + * \param qName name of the XML tag. + */ +bool PAdminXMLParser::startElement( const QString&, const QString&, + const QString& qName, + const QXmlAttributes& ) +{ + if (qName == "exec_path") { + fKeyWord = eExecPath; + } else if (qName == "default_save_path") { + fKeyWord = eDefaultSavePath; + } else if (qName == "beamline") { + fKeyWord = eBeamline; + } else if (qName == "institute") { + fKeyWord = eInstitute; + } else if (qName == "file_format") { + fKeyWord = eFileFormat; + } else if (qName == "msr_default_file_path") { + fKeyWord = eMsrDefaultFilePath; + } else if (qName == "show_mlog") { + fKeyWord = eShowMlog; + } + + return true; +} + +//-------------------------------------------------------------------------- +/** + *

Routine called when the end XML tag is found. It is used to + * put the filtering tag to 'empty'. + */ +bool PAdminXMLParser::endElement( const QString&, const QString&, const QString& ) +{ + fKeyWord = eEmpty; + + return true; +} + +//-------------------------------------------------------------------------- +/** + *

This routine delivers the content of an XML tag. It fills the + * content into the load data structure. + */ +bool PAdminXMLParser::characters(const QString& str) +{ + switch (fKeyWord) { + case eExecPath: + fAdmin->setExecPath(QString(str.ascii()).stripWhiteSpace()); + break; + case eDefaultSavePath: + fAdmin->setDefaultSavePath(QString(str.ascii()).stripWhiteSpace()); + break; + case eBeamline: + fAdmin->setBeamline(QString(str.ascii()).stripWhiteSpace()); + break; + case eInstitute: + fAdmin->setInstitute(QString(str.ascii()).stripWhiteSpace()); + break; + case eFileFormat: + fAdmin->setFileFormat(QString(str.ascii()).stripWhiteSpace()); + break; + case eMsrDefaultFilePath: + fAdmin->setMsrDefaultFilePath(QString(str.ascii()).stripWhiteSpace()); + break; + case eShowMlog: + if (str == "n") + fAdmin->setShowMlog(false); + else + fAdmin->setShowMlog(true); + break; + default: + break; + } + + return true; +} + +//-------------------------------------------------------------------------- +/** + *

Called at the end of the XML parse process. + */ +bool PAdminXMLParser::endDocument() +{ + // check if all necessary items are found + + return true; +} + +//-------------------------------------------------------------------------- +// implementation of PAdmin class +//-------------------------------------------------------------------------- +/** + *

+ */ +PAdmin::PAdmin() +{ + fExecPath = QString(""); + fDefaultSavePath = QString(""); + + fBeamline = QString(""); + fInstitute = QString(""); + fFileFormat = QString(""); + + fShowMlog = true; + + // XML Parser part + QString fln = "/home/nemu/analysis/bin/musrgui_startup.xml"; + if (QFile::exists(fln)) { // administrations file present + PAdminXMLParser handler(this); + QFile xmlFile(fln); + QXmlInputSource source( &xmlFile ); + QXmlSimpleReader reader; + reader.setContentHandler( &handler ); + reader.parse( source ); + } +} + +//-------------------------------------------------------------------------- +// END +//-------------------------------------------------------------------------- diff --git a/src/musrgui/PAdmin.h b/src/musrgui/PAdmin.h new file mode 100644 index 00000000..b298cb3b --- /dev/null +++ b/src/musrgui/PAdmin.h @@ -0,0 +1,102 @@ +/**************************************************************************** + + PAdmin.h + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id$ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2009 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef _PADMIN_H_ +#define _PADMIN_H_ + +#include +#include +#include + +class PAdmin; + +//--------------------------------------------------------------------------- +class PAdminXMLParser : public QXmlDefaultHandler +{ + public: + PAdminXMLParser(PAdmin*); + virtual ~PAdminXMLParser() {} + + private: + enum EAdminKeyWords {eEmpty, eExecPath, eDefaultSavePath, eBeamline, eInstitute, eFileFormat, + eMsrDefaultFilePath, eShowMlog}; + + bool startDocument(); + bool startElement( const QString&, const QString&, const QString& , + const QXmlAttributes& ); + bool endElement( const QString&, const QString&, const QString& ); + + bool characters(const QString&); + bool endDocument(); + + EAdminKeyWords fKeyWord; + PAdmin *fAdmin; +}; + +//--------------------------------------------------------------------------- +class PAdmin +{ + public: + PAdmin(); + virtual ~PAdmin() {} + + QString getExecPath() { return fExecPath; } + QString getDefaultSavePath() { return fDefaultSavePath; } + QString getBeamline() { return fBeamline; } + QString getInstitute() { return fInstitute; } + QString getFileFormat() { return fFileFormat; } + QString getMsrDefaultFilePath() { return fMsrDefaultFilePath; } + bool getShowMlog() { return fShowMlog; } + + protected: + void setExecPath(const QString str) { fExecPath = str; } + void setDefaultSavePath(const QString str) { fDefaultSavePath = str; } + void setBeamline(const QString str) { fBeamline = str; } + void setInstitute(const QString str) { fInstitute = str; } + void setFileFormat(const QString str) { fFileFormat = str; } + void setMsrDefaultFilePath(const QString str) { fMsrDefaultFilePath = str; } + void setShowMlog(const bool flag) { fShowMlog = flag; } + + private: + friend class PAdminXMLParser; + + QString fExecPath; + QString fDefaultSavePath; + + QString fBeamline; + QString fInstitute; + QString fFileFormat; + + QString fMsrDefaultFilePath; + bool fShowMlog; +}; + +#endif // _PADMIN_H_ diff --git a/src/musrgui/PFitOutputHandler.cpp b/src/musrgui/PFitOutputHandler.cpp new file mode 100644 index 00000000..916f71eb --- /dev/null +++ b/src/musrgui/PFitOutputHandler.cpp @@ -0,0 +1,110 @@ +/**************************************************************************** + + PFitOutputHandler.cpp + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id$ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2009 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include "PFitOutputHandler.h" + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +PFitOutputHandler::PFitOutputHandler(QValueVector &cmd) +{ + if (cmd.empty()) + return; + + // Layout + vbox = new QVBox( this ); + vbox->resize(800, 500); + output = new QTextEdit( vbox ); + output->setMinimumSize(800, 455); + output->setReadOnly(true); + quitButton = new QPushButton( tr("Done"), vbox ); + connect( quitButton, SIGNAL(clicked()), + this, SLOT(accept()) ); + resize( 800, 500 ); + + // QProcess related code + proc = new QProcess( this ); + + // Set up the command and arguments. + for (unsigned int i=0; iaddArgument(cmd[i]); + + connect( proc, SIGNAL(readyReadStdout()), this, SLOT(readFromStdOut()) ); + connect( proc, SIGNAL(readyReadStderr()), this, SLOT(readFromStdErr()) ); +// connect( proc, SIGNAL(processExited()), this, SLOT(scrollToTop()) ); + + if ( !proc->start() ) { + // error handling + QMessageBox::critical( 0, + tr("Fatal error"), + tr("Could not start the musrfit command: "+cmd[0]), + tr("Quit") ); + done(0); + } +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PFitOutputHandler::readFromStdOut() +{ + // Read and process the data. + // Bear in mind that the data might be output in chunks. + output->append( proc->readStdout() ); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PFitOutputHandler::readFromStdErr() +{ + // Read and process the data. + // Bear in mind that the data might be output in chunks. + output->append( proc->readStderr() ); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +/* +void PFitOutputHandler::scrollToTop() +{ + output->setContentsPos( 0, 0 ); +} +*/ + +//---------------------------------------------------------------------------------------------------- +// END +//---------------------------------------------------------------------------------------------------- diff --git a/src/musrgui/PFitOutputHandler.h b/src/musrgui/PFitOutputHandler.h new file mode 100644 index 00000000..cae42a5a --- /dev/null +++ b/src/musrgui/PFitOutputHandler.h @@ -0,0 +1,66 @@ +/**************************************************************************** + + PFitOutputHandler.h + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id$ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2009 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef _PFITOUTPUTHANDLER_H_ +#define _PFITOUTPUTHANDLER_H_ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +class PFitOutputHandler : public QDialog +{ + Q_OBJECT + +public: + PFitOutputHandler(QValueVector &cmd); + ~PFitOutputHandler() {} + +public slots: + void readFromStdOut(); + void readFromStdErr(); +// void scrollToTop(); + +private: + QProcess *proc; + QVBox *vbox; + QTextEdit *output; + QPushButton *quitButton; +}; + +#endif // _PFITOUTPUTHANDLER_H_ diff --git a/src/musrgui/PGetDefaultDialog.cpp b/src/musrgui/PGetDefaultDialog.cpp new file mode 100644 index 00000000..18c77128 --- /dev/null +++ b/src/musrgui/PGetDefaultDialog.cpp @@ -0,0 +1,101 @@ +/**************************************************************************** + + PGetDefaultDialog.cpp + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id$ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2009 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include +#include + +#include "PGetDefaultDialog.h" + +#define INSTITUTE_PSI 0 +#define INSTITUTE_RAL 1 +#define INSTITUTE_TRIUMF 2 +#define INSTITUTE_JPARC 3 + +#define FILE_FORMAT_NEXUS 0 +#define FILE_FORMAT_ROOT_NPP 1 +#define FILE_FORMAT_ROOT_PPC 2 +#define FILE_FORMAT_PSIBIN 3 +#define FILE_FORMAT_MUD 4 +#define FILE_FORMAT_WKM 5 +#define FILE_FORMAT_ASCII 6 +#define FILE_FORMAT_DB 7 + + +//--------------------------------------------------------------------------- +/** + *

+ */ +PGetDefaultDialog::PGetDefaultDialog(QWidget *parent, const char *name, + bool modal, WFlags f) : + PGetDefaultDialogBase(parent, name, modal, f) +{ + fInstitute = fInstitute_comboBox->currentText(); + fFileFormat = fFileFormat_comboBox->currentText(); +} + +//--------------------------------------------------------------------------- +/** + *

+ */ +void PGetDefaultDialog::runFileNameChanged(const QString &text) +{ + fRunFileName = text; +} + +//--------------------------------------------------------------------------- +/** + *

+ */ +void PGetDefaultDialog::beamlineChanged(const QString &text) +{ + fBeamline = text; +} + +//--------------------------------------------------------------------------- +/** + *

+ */ +void PGetDefaultDialog::instituteChanged(const QString &text) +{ + fInstitute = text; +} + +//--------------------------------------------------------------------------- +/** + *

+ */ +void PGetDefaultDialog::fileFormatChanged(const QString &text) +{ + fFileFormat = text; +} +//--------------------------------------------------------------------------- +// END +//--------------------------------------------------------------------------- diff --git a/src/musrgui/PGetDefaultDialog.h b/src/musrgui/PGetDefaultDialog.h new file mode 100644 index 00000000..35374fe3 --- /dev/null +++ b/src/musrgui/PGetDefaultDialog.h @@ -0,0 +1,67 @@ +/**************************************************************************** + + PGetDefaultDialog.h + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id$ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2009 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef _PGETDEFAULTDIALOG_H_ +#define _PGETDEFAULTDIALOG_H_ + +#include +#include + +#include "forms/PGetDefaultDialogBase.h" + +class PGetDefaultDialog : public PGetDefaultDialogBase +{ + Q_OBJECT + + public: + PGetDefaultDialog(QWidget *parent = 0, const char *name = 0, + bool modal = TRUE, WFlags f = 0); + virtual ~PGetDefaultDialog() {} + + virtual const QString getRunFileName() const { return fRunFileName; } + virtual const QString getBeamline() const { return fBeamline; } + virtual const QString getInstitute() const { return fInstitute; } + virtual const QString getFileFormat() const { return fFileFormat; } + + private: + QString fRunFileName; + QString fBeamline; + QString fInstitute; + QString fFileFormat; + + private slots: + void runFileNameChanged(const QString&); + void beamlineChanged(const QString&); + void instituteChanged(const QString&); + void fileFormatChanged(const QString&); +}; + +#endif // _PGETDEFAULTDIALOG_H_ diff --git a/src/musrgui/PTextEdit.cpp b/src/musrgui/PTextEdit.cpp new file mode 100644 index 00000000..48ffc388 --- /dev/null +++ b/src/musrgui/PTextEdit.cpp @@ -0,0 +1,844 @@ +/**************************************************************************** + + PTextEdit.cpp + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id$ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2009 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "PTextEdit.h" +#include "PAdmin.h" +#include "PFitOutputHandler.h" +#include "PGetDefaultDialog.h" + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +PTextEdit::PTextEdit( QWidget *parent, const char *name ) + : QMainWindow( parent, name ) +{ + fAdmin = new PAdmin(); + + fShowMlog = true; + + setupFileActions(); + setupEditActions(); + setupTextActions(); + setupMusrActions(); + setupHelpActions(); + + fTabWidget = new QTabWidget( this ); + setCentralWidget( fTabWidget ); + + textFamily("Courier"); + textSize("11"); // 11pt + + if ( qApp->argc() != 1 ) { + for ( int i = 1; i < qApp->argc(); ++i ) + load( qApp->argv()[ i ] ); + } else { + fileNew(); + } +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::setupFileActions() +{ + QToolBar *tb = new QToolBar( this ); + tb->setLabel( "File Actions" ); + QPopupMenu *menu = new QPopupMenu( this ); + menuBar()->insertItem( tr( "&File" ), menu ); + + QAction *a; + a = new QAction( QPixmap::fromMimeSource( "filenew.xpm" ), tr( "&New..." ), CTRL + Key_N, this, "fileNew" ); + connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); + a->addTo( tb ); + a->addTo( menu ); + a = new QAction( QPixmap::fromMimeSource( "fileopen.xpm" ), tr( "&Open..." ), CTRL + Key_O, this, "fileOpen" ); + connect( a, SIGNAL( activated() ), this, SLOT( fileOpen() ) ); + a->addTo( tb ); + a->addTo( menu ); + menu->insertSeparator(); + a = new QAction( QPixmap::fromMimeSource( "filesave.xpm" ), tr( "&Save..." ), CTRL + Key_S, this, "fileSave" ); + connect( a, SIGNAL( activated() ), this, SLOT( fileSave() ) ); + a->addTo( tb ); + a->addTo( menu ); + a = new QAction( tr( "Save &As..." ), 0, this, "fileSaveAs" ); + connect( a, SIGNAL( activated() ), this, SLOT( fileSaveAs() ) ); + a->addTo( menu ); + menu->insertSeparator(); + a = new QAction( QPixmap::fromMimeSource( "fileprint.xpm" ), tr( "&Print..." ), CTRL + Key_P, this, "filePrint" ); + connect( a, SIGNAL( activated() ), this, SLOT( filePrint() ) ); + a->addTo( tb ); + a->addTo( menu ); + a = new QAction( tr( "&Close" ), CTRL + Key_W, this, "fileClose" ); + connect( a, SIGNAL( activated() ), this, SLOT( fileClose() ) ); + a->addTo( menu ); + a = new QAction( tr( "E&xit" ), CTRL + Key_Q, this, "fileExit" ); + connect( a, SIGNAL( activated() ), this, SLOT( fileExit() ) ); + a->addTo( menu ); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::setupEditActions() +{ + QToolBar *tb = new QToolBar( this ); + tb->setLabel( "Edit Actions" ); + QPopupMenu *menu = new QPopupMenu( this ); + menuBar()->insertItem( tr( "&Edit" ), menu ); + + QAction *a; + a = new QAction( QPixmap::fromMimeSource( "editundo.xpm" ), tr( "&Undo" ), CTRL + Key_Z, this, "editUndo" ); + connect( a, SIGNAL( activated() ), this, SLOT( editUndo() ) ); + a->addTo( tb ); + a->addTo( menu ); + a = new QAction( QPixmap::fromMimeSource( "editredo.xpm" ), tr( "&Redo" ), CTRL + Key_Y, this, "editRedo" ); + connect( a, SIGNAL( activated() ), this, SLOT( editRedo() ) ); + a->addTo( tb ); + a->addTo( menu ); + menu->insertSeparator(); + a = new QAction( tr( "Select &All" ), CTRL + Key_A, this, "editSelectAll" ); + connect( a, SIGNAL( activated() ), this, SLOT( editSelectAll() ) ); + a->addTo( menu ); + menu->insertSeparator(); + a = new QAction( QPixmap::fromMimeSource( "editcopy.xpm" ), tr( "&Copy" ), CTRL + Key_C, this, "editCopy" ); + connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) ); + a->addTo( tb ); + a->addTo( menu ); + a = new QAction( QPixmap::fromMimeSource( "editcut.xpm" ), tr( "Cu&t" ), CTRL + Key_X, this, "editCut" ); + connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) ); + a->addTo( tb ); + a->addTo( menu ); + a = new QAction( QPixmap::fromMimeSource( "editpaste.xpm" ), tr( "&Paste" ), CTRL + Key_V, this, "editPaste" ); + connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) ); + a->addTo( tb ); + a->addTo( menu ); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::setupTextActions() +{ + QToolBar *tb = new QToolBar( this ); + tb->setLabel( "Format Actions" ); + + fComboFont = new QComboBox( TRUE, tb ); + QFontDatabase db; + fComboFont->insertStringList( db.families() ); + connect( fComboFont, SIGNAL( activated( const QString & ) ), + this, SLOT( textFamily( const QString & ) ) ); + fComboFont->lineEdit()->setText( "Courier" ); + + fComboSize = new QComboBox( TRUE, tb ); + QValueList sizes = db.standardSizes(); + QValueList::Iterator it = sizes.begin(); + for ( ; it != sizes.end(); ++it ) + fComboSize->insertItem( QString::number( *it ) ); + connect( fComboSize, SIGNAL( activated( const QString & ) ), + this, SLOT( textSize( const QString & ) ) ); + fComboSize->lineEdit()->setText( "11" ); // 11pt font size +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::setupMusrActions() +{ + QToolBar *tb = new QToolBar( this ); + tb->setLabel( "Musr Actions" ); + QPopupMenu *menu = new QPopupMenu( this ); + menuBar()->insertItem( tr( "&MusrFit" ), menu ); + + QAction *a; + a = new QAction( QPixmap::fromMimeSource( "musrasym.xpm" ), tr( "&Asymetry Default" ), CTRL + SHIFT + Key_A, this, "musrGetAsymetryDefault" ); + connect( a, SIGNAL( activated() ), this, SLOT( musrGetAsymetryDefault() ) ); + a->addTo( tb ); + a->addTo( menu ); + + a = new QAction( QPixmap::fromMimeSource( "musrsinglehisto.xpm" ), tr( "Single &Histo Default" ), CTRL + SHIFT + Key_H, this, "musrGetSinglHistoDefault" ); + connect( a, SIGNAL( activated() ), this, SLOT( musrGetSingleHistoDefault() ) ); + a->addTo( tb ); + a->addTo( menu ); + + a = new QAction( QPixmap::fromMimeSource( "musrcalcchisq.xpm" ), tr( "Calc Chisq" ), CTRL + SHIFT + Key_C, this, "cacluates for the given parameters chiSq/maxLH" ); + connect( a, SIGNAL( activated() ), this, SLOT( musrCalcChisq() ) ); + a->addTo( tb ); + a->addTo( menu ); + + a = new QAction( QPixmap::fromMimeSource( "musrfit.xpm" ), tr( "&Fit" ), CTRL + SHIFT + Key_F, this, "musrFit" ); + connect( a, SIGNAL( activated() ), this, SLOT( musrFit() ) ); + a->addTo( tb ); + a->addTo( menu ); + + a = new QAction( QPixmap::fromMimeSource( "musrview.xpm" ), tr( "&View" ), CTRL + SHIFT + Key_V, this, "musrView" ); + connect( a, SIGNAL( activated() ), this, SLOT( musrView() ) ); + 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 ); + + a = new QAction( QPixmap::fromMimeSource( "musrprefs.xpm" ), tr( "&Preferences" ), 0, this, "musrPrefs" ); + connect( a, SIGNAL( activated() ), this, SLOT( musrPrefs() ) ); + a->addTo( tb ); + a->addTo( menu ); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::setupHelpActions() +{ + QPopupMenu *menu = new QPopupMenu( this ); + menuBar()->insertItem( tr( "&Help" ), menu); + + QAction *a; + a = new QAction(tr( "Contents ..." ), 0, this, "help contents"); + connect( a, SIGNAL( activated() ), this, SLOT( helpContents() )); + a->addTo( menu ); + + a = new QAction(tr( "About ..." ), 0, this, "about"); + connect( a, SIGNAL( activated() ), this, SLOT( helpAbout() )); + a->addTo( menu ); + + a = new QAction(tr( "About Qt..." ), 0, this, "about Qt"); + connect( a, SIGNAL( activated() ), this, SLOT( helpAboutQt() )); + a->addTo( menu ); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::load( const QString &f ) +{ + if ( !QFile::exists( f ) ) + return; + QTextEdit *edit = new QTextEdit( fTabWidget ); + edit->setTextFormat( PlainText ); + edit->setFamily("Courier"); + edit->setPointSize(11); // 11pt + edit->setFont(QFont("Courier", 11)); + fTabWidget->addTab( edit, QFileInfo( f ).fileName() ); + QFile file( f ); + if ( !file.open( IO_ReadOnly ) ) + return; + QTextStream ts( &file ); + QString txt = ts.read(); + edit->setText( txt ); + doConnections( edit ); + fTabWidget->showPage( edit ); + edit->viewport()->setFocus(); + fFilenames.replace( edit, f ); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +QTextEdit *PTextEdit::currentEditor() const +{ + if ( fTabWidget->currentPage() && fTabWidget->currentPage()->inherits( "QTextEdit" ) ) + return (QTextEdit*)fTabWidget->currentPage(); + return 0; +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::doConnections( QTextEdit *e ) +{ + connect( e, SIGNAL( currentFontChanged( const QFont & ) ), + this, SLOT( fontChanged( const QFont & ) ) ); + + connect( e, SIGNAL( textChanged() ), this, SLOT( textChanged() )); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::fileNew() +{ + QTextEdit *edit = new QTextEdit( fTabWidget ); + edit->setTextFormat( PlainText ); + edit->setFamily("Courier"); + edit->setPointSize(11); // 11pt + doConnections( edit ); + fTabWidget->addTab( edit, tr( "noname" ) ); + fTabWidget->showPage( edit ); + edit->viewport()->setFocus(); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::fileOpen() +{ + QStringList flns = QFileDialog::getOpenFileNames( + tr( "msr-Files (*.msr *.mlog);;All Files (*)" ), + tr( fAdmin->getDefaultSavePath() ), this); + + QStringList::Iterator it = flns.begin(); + while( it != flns.end() ) { + load(*it); + ++it; + } +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::fileSave() +{ + if ( !currentEditor() ) + return; + + if ( fFilenames.find( currentEditor() ) == fFilenames.end() ) { + fileSaveAs(); + } else { + QFile file( *fFilenames.find( currentEditor() ) ); + if ( !file.open( IO_WriteOnly ) ) + return; + QTextStream ts( &file ); + ts << currentEditor()->text(); + + // remove trailing '*' modification indicators + QString fln = *fFilenames.find( currentEditor() ); + fTabWidget->setTabLabel(fTabWidget->currentPage(), QFileInfo(fln).fileName()); + } +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::fileSaveAs() +{ + if ( !currentEditor() ) + return; + + QString fn = QFileDialog::getSaveFileName( QString::null, tr( "msr-Files (*.msr *.mlog);;All Files (*)" ), this ); + if ( !fn.isEmpty() ) { + fFilenames.replace( currentEditor(), fn ); + fileSave(); + fTabWidget->setTabLabel( currentEditor(), QFileInfo( fn ).fileName() ); + } +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::filePrint() +{ + if ( !currentEditor() ) + return; +#ifndef QT_NO_PRINTER + QPrinter printer( QPrinter::HighResolution ); + printer.setFullPage(TRUE); + if ( printer.setup( this ) ) { + QPainter p( &printer ); + // Check that there is a valid device to print to. + if ( !p.device() ) return; + QPaintDeviceMetrics metrics( p.device() ); + int dpiy = metrics.logicalDpiY(); + int margin = (int) ( (2/2.54)*dpiy ); // 2 cm margins + QRect view( margin, margin, metrics.width() - 2*margin, metrics.height() - 2*margin ); + QFont font( currentEditor()->QWidget::font() ); + font.setPointSize( 10 ); // we define 10pt to be a nice base size for printing + + QSimpleRichText richText( currentEditor()->text(), font, + currentEditor()->context(), + currentEditor()->styleSheet(), + currentEditor()->mimeSourceFactory(), + view.height() ); + richText.setWidth( &p, view.width() ); + int page = 1; + do { + richText.draw( &p, margin, margin, view, colorGroup() ); + view.moveBy( 0, view.height() ); + p.translate( 0 , -view.height() ); + p.setFont( font ); + p.drawText( view.right() - p.fontMetrics().width( QString::number( page ) ), + view.bottom() + p.fontMetrics().ascent() + 5, QString::number( page ) ); + if ( view.top() - margin >= richText.height() ) + break; + printer.newPage(); + page++; + } while (TRUE); + } +#endif +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::fileClose() +{ + // check if the has modification + int idx = fTabWidget->currentPageIndex(); + if (fTabWidget->label(idx).find("*")>0) { + int result = QMessageBox::warning(this, "**WARNING**", + "Do you really want to close this file.\nChanges will be lost", + QMessageBox::Yes, QMessageBox::Cancel); + if (result == QMessageBox::Cancel) + return; + } + + delete currentEditor(); + if ( currentEditor() ) + currentEditor()->viewport()->setFocus(); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::fileExit() +{ + // check if there are still some modified files open + for (int i=0; i < fTabWidget->count(); i++) { + if (fTabWidget->label(i).find("*") > 0) { + int result = QMessageBox::warning(this, "**WARNING**", + "Do you really want to exit from the applcation.\nChanges will be lost", + QMessageBox::Yes, QMessageBox::Cancel); + if (result == QMessageBox::Cancel) + return; + break; + } + } + + qApp->quit(); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::editUndo() +{ + if ( !currentEditor() ) + return; + currentEditor()->undo(); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::editRedo() +{ + if ( !currentEditor() ) + return; + currentEditor()->redo(); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::editSelectAll() +{ + if ( !currentEditor() ) + return; + currentEditor()->selectAll(); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::editCut() +{ + if ( !currentEditor() ) + return; + currentEditor()->cut(); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::editCopy() +{ + if ( !currentEditor() ) + return; + currentEditor()->copy(); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::editPaste() +{ + if ( !currentEditor() ) + return; + currentEditor()->paste(); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::textFamily( const QString &f ) +{ + if ( !currentEditor() ) + return; + currentEditor()->setFamily( f ); + currentEditor()->viewport()->setFocus(); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::textSize( const QString &p ) +{ + if ( !currentEditor() ) + return; + currentEditor()->setPointSize( p.toInt() ); + currentEditor()->viewport()->setFocus(); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::musrGetAsymetryDefault() +{ + QString runFileName, beamline, institute, fileFormat; + + PGetDefaultDialog *dlg = new PGetDefaultDialog(); + // set defaults + dlg->fBeamline_lineEdit->setText(fAdmin->getBeamline()); + + for (int i=0; ifInstitute_comboBox->count(); i++) { + if (dlg->fInstitute_comboBox->text(i).lower() == fAdmin->getInstitute().lower()) { + dlg->fInstitute_comboBox->setCurrentItem(i); + break; + } + } + + for (int i=0; ifFileFormat_comboBox->count(); i++) { + if (dlg->fFileFormat_comboBox->text(i).lower() == fAdmin->getFileFormat().lower()) { + dlg->fFileFormat_comboBox->setCurrentItem(i); + break; + } + } + dlg->exec(); + + if (dlg->result() != QDialog::Accepted) { + delete dlg; + return; + } + + runFileName = dlg->getRunFileName(); + beamline = dlg->getBeamline(); + institute = dlg->getInstitute(); + fileFormat = dlg->getFileFormat(); + delete dlg; + + QFile file(fAdmin->getMsrDefaultFilePath()+"/asymDefault.msr"); + if (file.open(IO_ReadOnly)) { + // make a new file tab + fileNew(); + QTextStream ts( &file ); + QString line; + while ( !ts.atEnd() ) { + line = ts.readLine(); // line of text excluding '\n' + if (line.startsWith("RUN")) { + QString runHeader = "RUN " + runFileName + " " + beamline.upper() + " " + institute + " " + fileFormat.upper() + " (name beamline institute data-file-format)\n"; + currentEditor()->insert(runHeader); + } else { // just copy the text + currentEditor()->insert(line+"\n"); + } + } + currentEditor()->setContentsPos(0, 0); + + file.close(); + } else { + QMessageBox::critical(this, "**ERROR**", + "Couldn't find default asymmetry file template :-(", + QMessageBox::Ok, QMessageBox::NoButton); + } + +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::musrGetSingleHistoDefault() +{ + QString runFileName, beamline, institute, fileFormat; + + PGetDefaultDialog *dlg = new PGetDefaultDialog(); + // set defaults + dlg->fBeamline_lineEdit->setText(fAdmin->getBeamline()); + + for (int i=0; ifInstitute_comboBox->count(); i++) { + if (dlg->fInstitute_comboBox->text(i).lower() == fAdmin->getInstitute().lower()) { + dlg->fInstitute_comboBox->setCurrentItem(i); + break; + } + } + + for (int i=0; ifFileFormat_comboBox->count(); i++) { + if (dlg->fFileFormat_comboBox->text(i).lower() == fAdmin->getFileFormat().lower()) { + dlg->fFileFormat_comboBox->setCurrentItem(i); + break; + } + } + dlg->exec(); + + if (dlg->result() != QDialog::Accepted) { + delete dlg; + return; + } + + runFileName = dlg->getRunFileName(); + beamline = dlg->getBeamline(); + institute = dlg->getInstitute(); + fileFormat = dlg->getFileFormat(); + delete dlg; + + QFile file(fAdmin->getMsrDefaultFilePath()+"/singleHistoDefault.msr"); + if (file.open(IO_ReadOnly)) { + // make a new file tab + fileNew(); + QTextStream ts( &file ); + QString line; + while ( !ts.atEnd() ) { + line = ts.readLine(); // line of text excluding '\n' + if (line.startsWith("RUN")) { + QString runHeader = "RUN " + runFileName + " " + beamline.upper() + " " + institute + " " + fileFormat.upper() + " (name beamline institute data-file-format)\n"; + currentEditor()->insert(runHeader); + } else { // just copy the text + currentEditor()->insert(line+"\n"); + } + } + currentEditor()->setContentsPos(0, 0); + + file.close(); + } else { + QMessageBox::critical(this, "**ERROR**", + "Couldn't find default single histo file template :-(", + QMessageBox::Ok, QMessageBox::NoButton); + } + +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::musrCalcChisq() +{ + if ( !currentEditor() ) + return; + + QValueVector cmd; + QString str; + str = fAdmin->getExecPath() + "/musrfit"; + + cmd.append(str); + cmd.append(*fFilenames.find( currentEditor())); + cmd.append("--chisq-only"); + PFitOutputHandler fitOutputHandler(cmd); + fitOutputHandler.setModal(true); + fitOutputHandler.exec(); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::musrFit() +{ + if ( !currentEditor() ) + return; + + QValueVector cmd; + QString str; + str = fAdmin->getExecPath() + "/musrfit"; + + cmd.append(str); + cmd.append(*fFilenames.find( currentEditor())); + PFitOutputHandler fitOutputHandler(cmd); + fitOutputHandler.setModal(true); + fitOutputHandler.exec(); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::musrView() +{ + if ( !currentEditor() ) + return; + + QMessageBox::information( this, "musrView", + "Will call musrview.\n" + "NOT IMPLEMENTED YET :-(" ); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::musrT0() +{ + if ( !currentEditor() ) + return; + + QMessageBox::information( this, "musrT0", + "Will call musrt0.\n" + "NOT IMPLEMENTED YET :-(" ); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::musrPrefs() +{ + QMessageBox::information( this, "musrPrefs", + "Will call musr related perferences dialog.\n" + "NOT IMPLEMENTED YET :-(" ); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::helpContents() +{ + QMessageBox::information( this, "helpContents", + "Will deliver eventually a help content.\n" + "NOT IMPLEMENTED YET :-(" ); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::helpAbout() +{ + QMessageBox::about(this, "MuSR-GUI", + "andreas.suter@psi.ch"); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::helpAboutQt() +{ + QMessageBox::aboutQt(this); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::fontChanged( const QFont &f ) +{ + currentEditor()->selectAll(); + fComboFont->lineEdit()->setText( f.family() ); + fComboSize->lineEdit()->setText( QString::number( f.pointSize() ) ); + currentEditor()->setFamily( f.family() ); + currentEditor()->setPointSize( f.pointSize() ); + currentEditor()->viewport()->setFocus(); + currentEditor()->selectAll(false); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PTextEdit::textChanged() +{ + if (!currentEditor()) + return; + + QString tabLabel = fTabWidget->label(fTabWidget->currentPageIndex()); + + if ((fTabWidget->label(fTabWidget->currentPageIndex()).find("*") > 0) && + !currentEditor()->isModified()) { + tabLabel.truncate(tabLabel.length()-1); + fTabWidget->setTabLabel(fTabWidget->currentPage(), tabLabel); + } + + if ((fTabWidget->label(fTabWidget->currentPageIndex()).find("*") < 0) && + currentEditor()->isModified()) + fTabWidget->setTabLabel(fTabWidget->currentPage(), tabLabel+"*"); +} + +//---------------------------------------------------------------------------------------------------- +// END +//---------------------------------------------------------------------------------------------------- diff --git a/src/musrgui/PTextEdit.h b/src/musrgui/PTextEdit.h new file mode 100644 index 00000000..07706e44 --- /dev/null +++ b/src/musrgui/PTextEdit.h @@ -0,0 +1,108 @@ +/**************************************************************************** + + PTextEdit.h + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id$ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2009 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef _PTEXTEDIT_H_ +#define _PTEXTEDIT_H_ + +#include +#include + +class PAdmin; +class QAction; +class QComboBox; +class QTabWidget; +class QTextEdit; + +class PTextEdit : public QMainWindow +{ + Q_OBJECT + +public: + PTextEdit( QWidget *parent = 0, const char *name = 0 ); + +private: + void setupFileActions(); + void setupEditActions(); + void setupTextActions(); + void setupMusrActions(); + void setupHelpActions(); + void load( const QString &f ); + QTextEdit *currentEditor() const; + void doConnections( QTextEdit *e ); + +private slots: + void fileNew(); + void fileOpen(); + void fileSave(); + void fileSaveAs(); + void filePrint(); + void fileClose(); + void fileExit(); + + void editUndo(); + void editRedo(); + void editSelectAll(); + void editCut(); + void editCopy(); + void editPaste(); + + void textFamily( const QString &f ); + void textSize( const QString &p ); + + void musrGetAsymetryDefault(); + void musrGetSingleHistoDefault(); + void musrCalcChisq(); + void musrFit(); + void musrView(); + void musrT0(); + void musrPrefs(); + + void helpContents(); + void helpAboutQt(); + void helpAbout(); + + void fontChanged( const QFont &f ); + void textChanged(); + +private: + PAdmin *fAdmin; + + bool fShowMlog; + + QComboBox *fComboFont; + QComboBox *fComboSize; + + QTabWidget *fTabWidget; + QMap fFilenames; +}; + + +#endif // _PTEXTEDIT_H_ diff --git a/src/musrgui/asymDefault.msr b/src/musrgui/asymDefault.msr new file mode 100644 index 00000000..4aca2c7f --- /dev/null +++ b/src/musrgui/asymDefault.msr @@ -0,0 +1,59 @@ +TITLE +############################################################### +FITPARAMETER +# Nr. Name Value Step Pos_Error Bounderies + 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 + 4 field 100.0 0.1 none 0 none + 5 rate 0.36 0.02 none 0 100 + +############################################################### +THEORY +asymmetry 2 +TFieldCos 3 fun1 (phase frequency) +simplExpo 5 + +############################################################### +FUNCTIONS +fun1 = par4 * gamma_mu + +############################################################### +RUN lem07_his_0147 MUE4 PSI ROOT-NPP (name beamline institute data-file-format) +fittype 2 (asymmetry fit) +alpha 1 +map 0 0 0 0 0 0 0 0 0 0 +forward 1 +backward 3 +background 65000 66500 65000 66500 +data 3413 63000 3413 63000 +t0 3413 3413 +fit 0.00 8.00 (fw bw) +packing 75 + +############################################################### +COMMANDS +SET BATCH +MINIMIZE +MINOS +SAVE +END RETURN + +############################################################### +FOURIER +units Gauss # fourier in field units +fourier_power 12 +apodization NONE # NONE, WEAK, MEDIUM, STRONG +plot power +phase 8.5 +#range_for_phase_correction 50.0 70.0 +range 0.0 200.0 + +############################################################### +PLOT 2 (asymmetry plot) +runs 1 +range 0.00 8.00 -0.30 0.30 + +############################################################### +STATISTIC --- 2008-04-04 07:44:31 + chisq = 569.50931, NDF = 542, chisq/NDF = 1.05075518 diff --git a/src/musrgui/editcopy.xpm b/src/musrgui/editcopy.xpm new file mode 100644 index 00000000..cc6fb7a6 --- /dev/null +++ b/src/musrgui/editcopy.xpm @@ -0,0 +1,36 @@ +/* XPM */ +static char *magick[] = { +/* columns rows colors chars-per-pixel */ +"22 22 8 1", +" c Gray100", +". c #8b8bfd", +"X c #3c3cfd", +"o c #000082", +"O c Gray0", +"+ c None", +"@ c Gray0", +"# c Gray0", +/* pixels */ +"++++++++++++++++++++++", +"++++++++++++++++++++++", +"OOOOOOOO++++++++++++++", +"O OO+++++++++++++", +"O OOOO O O++++++++++++", +"O O O+++++++++++", +"O OOOO Ooooooooo++++++", +"O Oo oo+++++", +"O OOOOO o OOOO oXo++++", +"O o o.Xo+++", +"O OOOOO o OOOO o .Xo++", +"O o oooooo+", +"O OOOOO o OOOO o+", +"O o o+", +"O OOOOO o OOOOOOOOO o+", +"O o o+", +"OOOOOOOOo OOOOOOOOO o+", +"++++++++o o+", +"++++++++o OOOOOOOOO o+", +"++++++++o o+", +"++++++++ooooooooooooo+", +"++++++++++++++++++++++" +}; diff --git a/src/musrgui/editcut.xpm b/src/musrgui/editcut.xpm new file mode 100644 index 00000000..2391adda --- /dev/null +++ b/src/musrgui/editcut.xpm @@ -0,0 +1,32 @@ +/* XPM */ +static char *magick[] = { +/* columns rows colors chars-per-pixel */ +"22 22 4 1", +" c Gray100", +". c #000082", +"X c Gray0", +"o c None", +/* pixels */ +"oooooooooooooooooooooo", +"oooooooXoooooXoooooooo", +"oooooooXoooooXoooooooo", +"oooooooXoooooXoooooooo", +"oooooooXooooXXoooooooo", +"oooooooXXoooXooooooooo", +"ooooooooXoooXooooooooo", +"ooooooooXXoXXooooooooo", +"oooooooooXXXoooooooooo", +"oooooooooXXXoooooooooo", +"ooooooooooXooooooooooo", +"ooooooooo.X.oooooooooo", +"oooooooo..o...oooooooo", +"ooooooo.o.o.oo.ooooooo", +"oooooo.oo.o.ooo.oooooo", +"ooooo.ooo.o.oooo.ooooo", +"oooo.oooo.o.oooo.ooooo", +"oooo.oooo.oo.ooo.ooooo", +"oooo.oooo.oo.oo.oooooo", +"oooo.ooo.oooo..ooooooo", +"ooooo...oooooooooooooo", +"oooooooooooooooooooooo" +}; diff --git a/src/musrgui/editpaste.xpm b/src/musrgui/editpaste.xpm new file mode 100644 index 00000000..3f775920 --- /dev/null +++ b/src/musrgui/editpaste.xpm @@ -0,0 +1,36 @@ +/* XPM */ +static char *magick[] = { +/* columns rows colors chars-per-pixel */ +"22 22 8 1", +" c Gray100", +". c Yellow", +"X c #c6c3c6", +"o c #848284", +"O c #848200", +"+ c #000084", +"@ c Gray0", +"# c None", +/* pixels */ +"######################", +"#######@@@@@##########", +"##@@@@@@...@@@@@@#####", +"#@@@@@@.....@@@@@@####", +"@@oOo@@.@@@.@@oOo@@###", +"@oOo@XXXXXXXXX@oOo@###", +"@OoO@XXXXXXXXX@OoO@###", +"@oOo@@@@@@@@@@@oOo@###", +"@OoOoOoOoOoOoOoOoO@###", +"@oOoOoOoOoOoOoOoOo@###", +"@OoOoOoO++++++++++@###", +"@oOoOoOo+ + +###", +"@OoOoOoO+ +++++ + +##", +"@oOoOoOo+ + +#", +"@OoOoOoO+ +++++ + +", +"@oOoOoOo+ ++++++", +"@OoOoOoO+ +++++ +", +"@oOoOoOo+ +", +"@OoOoOoO+ ++++++++++ +", +"#@@@@@@@+ +", +"########++++++++++++++", +"######################" +}; diff --git a/src/musrgui/editredo.xpm b/src/musrgui/editredo.xpm new file mode 100644 index 00000000..46dc0331 --- /dev/null +++ b/src/musrgui/editredo.xpm @@ -0,0 +1,36 @@ +/* XPM */ +static char *magick[] = { +/* columns rows colors chars-per-pixel */ +"22 22 8 1", +" c Gray100", +". c #848284", +"X c #000084", +"o c Gray0", +"O c None", +"+ c Gray0", +"@ c Gray0", +"# c Gray0", +/* pixels */ +"OOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOO", +"OOOO.XXXXXXOOOOOOOOOOO", +"OOOXXXXXXXXXXOOOOOOXOO", +"OO.XXOOOOOOXXXXOOOXXOO", +"OOXXOOOOOOOOOXXXOXXXOO", +"OOXXOOOOOOOOOOXXXXXXOO", +"OOXXOOOOOOOOOOOXXXXXOO", +"OOXXOOOOOOOOOOXXXXXXOO", +"OOXXOOOOOOOOOXXXXXXXOO", +"OO.XXOOOOOOOXXXXXXXXOO", +"OOOXXX.OOOOOOOOOOOOOOO", +"OOOOXXXOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOO" +}; diff --git a/src/musrgui/editundo.xpm b/src/musrgui/editundo.xpm new file mode 100644 index 00000000..229c1636 --- /dev/null +++ b/src/musrgui/editundo.xpm @@ -0,0 +1,36 @@ +/* XPM */ +static char *magick[] = { +/* columns rows colors chars-per-pixel */ +"22 22 8 1", +" c Gray100", +". c #848284", +"X c #000084", +"o c Gray0", +"O c None", +"+ c Gray0", +"@ c Gray0", +"# c Gray0", +/* pixels */ +"OOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOXXXXXX.OOOO", +"OOXOOOOOOXXXXXXXXXXOOO", +"OOXXOOOXXXXOOOOOOXX.OO", +"OOXXXOXXXOOOOOOOOOXXOO", +"OOXXXXXXOOOOOOOOOOXXOO", +"OOXXXXXOOOOOOOOOOOXXOO", +"OOXXXXXXOOOOOOOOOOXXOO", +"OOXXXXXXXOOOOOOOOOXXOO", +"OOXXXXXXXXOOOOOOOXX.OO", +"OOOOOOOOOOOOOOO.XXXOOO", +"OOOOOOOOOOOOOOOXXXOOOO", +"OOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOO" +}; diff --git a/src/musrgui/filenew.xpm b/src/musrgui/filenew.xpm new file mode 100644 index 00000000..884d7cbb --- /dev/null +++ b/src/musrgui/filenew.xpm @@ -0,0 +1,36 @@ +/* XPM */ +static char *magick[] = { +/* columns rows colors chars-per-pixel */ +"22 22 8 1", +" c Gray100", +". c Gray76", +"X c Gray53", +"o c Gray36", +"O c Gray18", +"+ c Gray0", +"@ c None", +"# c Gray0", +/* pixels */ +"@@@@@@@@@@@@@@@@@@@@@@", +"@@@@++++++++++@@@@@@@@", +"@@@@+ +O+@@@@@@@", +"@@@@+ +oO+@@@@@@", +"@@@@+ +XoO+@@@@@", +"@@@@+ +.XoO+@@@@", +"@@@@+ + .XoO+@@@", +"@@@@+ +++++++@@@", +"@@@@+ +@@@", +"@@@@+ +@@@", +"@@@@+ +@@@", +"@@@@+ +@@@", +"@@@@+ +@@@", +"@@@@+ +@@@", +"@@@@+ +@@@", +"@@@@+ +@@@", +"@@@@+ +@@@", +"@@@@+ +@@@", +"@@@@+ +@@@", +"@@@@+++++++++++++++@@@", +"@@@@@@@@@@@@@@@@@@@@@@", +"@@@@@@@@@@@@@@@@@@@@@@" +}; diff --git a/src/musrgui/fileopen.xpm b/src/musrgui/fileopen.xpm new file mode 100644 index 00000000..82effcf7 --- /dev/null +++ b/src/musrgui/fileopen.xpm @@ -0,0 +1,36 @@ +/* XPM */ +static char *magick[] = { +/* columns rows colors chars-per-pixel */ +"22 22 8 1", +" c Gray100", +". c Yellow", +"X c #848200", +"o c Gray0", +"O c None", +"+ c Gray0", +"@ c Gray0", +"# c Gray0", +/* pixels */ +"OOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOooooOOOOoO", +"OOOOOOOOOOOoOOOOooOooO", +"OOOOOOOOOOOOOOOOOOoooO", +"OOOOOOOOOOOOOOOOOooooO", +"OooooOOOOOOOOOOOoooooO", +"o. . ooooooooooOOOOOOO", +"o . . . . . . oOOOOOOO", +"o. . . . . . .oOOOOOOO", +"o . . . . . . oOOOOOOO", +"o. . . ooooooooooooooo", +"o . . ooXXXXXXXXXXXXoo", +"o. . ooXXXXXXXXXXXXooO", +"o . ooXXXXXXXXXXXXooOO", +"o. ooXXXXXXXXXXXXooOOO", +"o ooXXXXXXXXXXXXooOOOO", +"oooXXXXXXXXXXXXooOOOOO", +"ooXXXXXXXXXXXXooOOOOOO", +"oooooooooooooooOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOO" +}; diff --git a/src/musrgui/fileprint.xpm b/src/musrgui/fileprint.xpm new file mode 100644 index 00000000..8701d460 --- /dev/null +++ b/src/musrgui/fileprint.xpm @@ -0,0 +1,117 @@ +/* XPM */ +static char *magick[] = { +/* columns rows colors chars-per-pixel */ +"22 22 89 1", +" c Gray0", +". c #101008081010", +"X c #101010101010", +"o c #101010101818", +"O c #181810101818", +"+ c #181818181818", +"@ c #181818182121", +"# c #212118182121", +"$ c Gray13", +"% c #212121212929", +"& c #292921212929", +"* c Gray16", +"= c #292929293131", +"- c #313129293131", +"; c #313131313131", +": c #313131313939", +"> c #393931313939", +", c #393939393939", +"< c #393939394242", +"1 c #424239394242", +"2 c Gray26", +"3 c #4a4a4a4a5252", +"4 c #5a5a52525a5a", +"5 c #5a5a5a5a6363", +"6 c #6b6b63636b6b", +"7 c Gray42", +"8 c #6b6b6b6b7373", +"9 c #73736b6b7373", +"0 c #7b7b73737b7b", +"q c #7b7b73738484", +"w c #0808ffff0808", +"e c #2929ffff2929", +"r c #3131ffff3131", +"t c #5a5acece5a5a", +"y c #6b6bffff6363", +"u c #7b7bffff7b7b", +"i c #84847b7b8484", +"p c #84847b7b8c8c", +"a c #8c8c7b7b9494", +"s c #848484848c8c", +"d c #8c8c84848c8c", +"f c Gray55", +"g c #8c8c84849494", +"h c #8c8c8c8c9494", +"j c #94948c8c9494", +"k c #94948c8c9c9c", +"l c Gray58", +"z c #949494949c9c", +"x c #9c9c94949c9c", +"c c Gray61", +"v c #9c9c9494a5a5", +"b c #9c9c9c9ca5a5", +"n c #a5a59c9ca5a5", +"m c #a5a59c9cadad", +"M c #adad9c9cadad", +"N c #a5a5a5a5a5a5", +"B c #a5a5a5a5adad", +"V c #adada5a5adad", +"C c Gray68", +"Z c #adadadadb5b5", +"A c #b5b5adadb5b5", +"S c Gray71", +"D c Gray74", +"F c #9494c6c69494", +"G c #9c9ccecea5a5", +"H c #bdbdd6d6bdbd", +"J c #c0c0c0c0c0c0", +"K c #c6c6c6c6c6c6", +"L c #cecec6c6cece", +"P c #cececececece", +"I c #cecececed6d6", +"U c #d6d6ceced6d6", +"Y c #d6d6cecedede", +"T c Gray84", +"R c #d6d6d6d6dede", +"E c #deded6d6dede", +"W c Gray87", +"Q c #deded6d6e7e7", +"! c #dedededee7e7", +"~ c #d6d6ffffd6d6", +"^ c #e7e7dedee7e7", +"/ c #e7e7e7e7e7e7", +"( c #e7e7e7e7efef", +") c #efefe7e7efef", +"_ c #efefefefefef", +"` c #e7e7ffffe7e7", +"' c Gray97", +"] c Gray100", +"[ c None", +/* pixels */ +"[[[[[[SDPPPPKKDDCD[[[[", +"[[[[[[D_/////___WD[[[[", +"[[[[[[DKKKPPKKKKDK[[[[", +"[[[[[[SDDDDSDDSSCD[[[[", +"[[[[[KCKDKKKDDDKS[[[[[", +"[[[[[DDSDDDDDDKKS[[[[[", +"[[[[[DSKDDDDDKDKC[[[[[", +"[[[[[KDDDDDDDDDDS[[[[[", +"[[[[[CP/WWWWWWTWNNZ[[[", +"[[[Dc9STPTPTPTWWj427S[", +"[[Dziq0000000pag8<%@2N", +"[DcE(!ERRRRUYGtFn2##O<", +"Db)]]]]]]]]]~ewePa;@X#", +"V']]]]]]]]]]`yru]Q0@ #", +"BRILITRRW^!E!RHUILhO @", +"jAZVBmBnmmNmnmMvzh6o #", +"jZZmBnnnbnbbbbvxxg6o +", +"lmmnbnbbbvcvxxxvjs6O 3", +"jBnnvcvxvcvxvxzjhd8o+C", +"lsdgfgdhgdhhjhjkhg6+l[", +"S9%@$%&&&=--::>>:-:l[[", +"[[C511,:;;;**%++.2c[[[" +}; diff --git a/src/musrgui/filesave.xpm b/src/musrgui/filesave.xpm new file mode 100644 index 00000000..71cbd331 --- /dev/null +++ b/src/musrgui/filesave.xpm @@ -0,0 +1,36 @@ +/* XPM */ +static char *magick[] = { +/* columns rows colors chars-per-pixel */ +"22 22 8 1", +" c Gray100", +". c #cab5d1", +"X c #c1c1c1", +"o c #848200", +"O c Gray0", +"+ c None", +"@ c Gray0", +"# c Gray0", +/* pixels */ +"++++++++++++++++++++++", +"+OOOOOOOOOOOOOOOOOOOO+", +"+OooOXXXXXXXXXXXXOXXO+", +"+OooOXXXXXXXXXXXXOXXO+", +"+OooOXXXXXXXXX.XXOOOO+", +"+OooOXXX..XXXXXXXOooO+", +"+OooOXXX..XXXXXXXOooO+", +"+OooOXXXXXXXXXXXXOooO+", +"+OooOXXXXXXXXXXXXOooO+", +"+OooOXXXXXXXXXXXXOooO+", +"+OooOXXXXXXXXXXXXOooO+", +"+OoooOOOOOOOOOOOOoooO+", +"+OooooooooooooooooooO+", +"+OooooooooooooooooooO+", +"+OoooOOOOOOOOOOOOOooO+", +"+OoooOOOOOOOOOXXXOooO+", +"+OoooOOOOOOOOOXXXOooO+", +"+OoooOOOOOOOOOXXXOooO+", +"+OoooOOOOOOOOOXXXOooO+", +"+OoooOOOOOOOOOXXXOooO+", +"++OOOOOOOOOOOOOOOOOO++", +"++++++++++++++++++++++" +}; diff --git a/src/musrgui/forms/PGetDefaultDialogBase.ui b/src/musrgui/forms/PGetDefaultDialogBase.ui new file mode 100644 index 00000000..a528e091 --- /dev/null +++ b/src/musrgui/forms/PGetDefaultDialogBase.ui @@ -0,0 +1,338 @@ + +PGetDefaultDialogBase + + + PGetDefaultDialogBase + + + + 0 + 0 + 511 + 222 + + + + RUN + + + true + + + + fRunFileName_textLabel + + + + 20 + 20 + 100 + 20 + + + + Run File Name + + + + + fBeamline_textLabel + + + + 20 + 60 + 71 + 20 + + + + Beamline + + + + + fInstitute_textLabel + + + + 20 + 100 + 71 + 20 + + + + Institute + + + + + textLabel4 + + + + 20 + 140 + 80 + 20 + + + + File Format + + + + + Layout1 + + + + 20 + 180 + 476 + 33 + + + + + unnamed + + + 0 + + + 6 + + + + buttonHelp + + + &Help + + + F1 + + + true + + + + + Horizontal Spacing2 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + buttonOk + + + &OK + + + + + + true + + + true + + + + + buttonCancel + + + &Cancel + + + + + + true + + + + + + + fBeamline_lineEdit + + + + 130 + 60 + 360 + 24 + + + + + + + NeXuS + + + + + ROOT-NPP + + + + + ROOT-PPC + + + + + PSIBIN + + + + + MUD + + + + + WKM + + + + + ASCII + + + + + DB + + + + fFileFormat_comboBox + + + + 130 + 140 + 99 + 24 + + + + + + + PSI + + + + + RAL + + + + + TRIUMF + + + + + JPARC + + + + fInstitute_comboBox + + + + 130 + 100 + 99 + 24 + + + + + + fRunFileName_lineEdit + + + + 130 + 20 + 360 + 24 + + + + + + + buttonOk + clicked() + PGetDefaultDialogBase + accept() + + + buttonCancel + clicked() + PGetDefaultDialogBase + reject() + + + fRunFileName_lineEdit + textChanged(const QString&) + PGetDefaultDialogBase + runFileNameChanged(const QString&) + + + fBeamline_lineEdit + textChanged(const QString&) + PGetDefaultDialogBase + beamlineChanged(const QString&) + + + fInstitute_comboBox + activated(const QString&) + PGetDefaultDialogBase + instituteChanged(const QString&) + + + fFileFormat_comboBox + activated(const QString&) + PGetDefaultDialogBase + fileFormatChanged(const QString&) + + + + fRunFileName_lineEdit + fBeamline_lineEdit + fInstitute_comboBox + fFileFormat_comboBox + buttonOk + buttonCancel + buttonHelp + + + runFileNameChanged(const QString&) + beamlineChanged(const QString&) + instituteChanged(const QString&) + fileFormatChanged(const QString&) + + + diff --git a/src/musrgui/main.cpp b/src/musrgui/main.cpp new file mode 100644 index 00000000..d9761925 --- /dev/null +++ b/src/musrgui/main.cpp @@ -0,0 +1,49 @@ +/**************************************************************************** + + main.cpp + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id$ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2009 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include + +#include "PTextEdit.h" + +#include "PFitOutputHandler.h" + +int main( int argc, char ** argv ) +{ + QApplication a( argc, argv ); + + PTextEdit * mw = new PTextEdit(); + mw->setCaption( "MusrFit Editor" ); + mw->resize( 800, 800 ); + mw->show(); + + a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) ); + return a.exec(); +} diff --git a/src/musrgui/musrasym.xpm b/src/musrgui/musrasym.xpm new file mode 100644 index 00000000..64bfb2f4 --- /dev/null +++ b/src/musrgui/musrasym.xpm @@ -0,0 +1,29 @@ +/* XPM */ +static char * musrasym_xpm[] = { +"22 22 4 1", +" c None", +". c #3D20CF", +"+ c #FF0000", +"@ c #000000", +" ", +" . .. . . . .", +" . . . . . . .. ..", +". . . . . . . .", +". . .. . . . .", +"..... . . . .", +". . . . . . .", +". . .. . . .", +" ", +" ++ ", +"+ + ", +" + ", +" + ", +" + ", +" + ++ ", +" + + + +", +"@@@@@@@+@@@@+@@@@+@@+ ", +" + + ++ ", +" ++ ", +" ", +" ", +" "}; diff --git a/src/musrgui/musrcalcchisq.xpm b/src/musrgui/musrcalcchisq.xpm new file mode 100644 index 00000000..63088af1 --- /dev/null +++ b/src/musrgui/musrcalcchisq.xpm @@ -0,0 +1,28 @@ +/* XPM */ +static char * musrcalcchisq_xpm[] = { +"22 22 3 1", +" c None", +". c #FF0000", +"+ c #000000", +" ... ", +" +... . ", +" .+ ...+. ", +" ... . ... ", +" ... ... ", +" ... ... ", +"+ . . ", +" . ", +" +++ ", +" ++..+ ", +" + ..+ . ", +" .+.+ . ", +"++ + +. + ... ", +"+++ ++ + ...++... ", +" ++ ++ +++++.. ... ", +" +++ ... .+ ", +" ++ . ", +" ++ ...", +" +++ ...", +" ++ + ...", +" ++ +++ . ", +"++ +++ "}; diff --git a/src/musrgui/musrfit.xpm b/src/musrgui/musrfit.xpm new file mode 100644 index 00000000..de1b652d --- /dev/null +++ b/src/musrgui/musrfit.xpm @@ -0,0 +1,28 @@ +/* XPM */ +static char * musrfit_xpm[] = { +"22 22 3 1", +" c None", +". c #FF0000", +"+ c #000000", +" ... ", +" +... . ", +" .+ ...+. ", +" ... . ... ", +" ... ... ", +" ... ... ", +"+ . .+ ", +" .+ ", +" . ", +" ... ", +" ... . ", +" ...+ . ", +" . + ... ", +" ...++... ", +"++++ + +++++... ... ", +"+ + + ... .+ ", +"+ + + . ", +"++++ + + ...", +"+ + + ...", +"+ + + ...", +"+ + + . ", +" "}; diff --git a/src/musrgui/musrgui.pro b/src/musrgui/musrgui.pro new file mode 100644 index 00000000..05cd4959 --- /dev/null +++ b/src/musrgui/musrgui.pro @@ -0,0 +1,46 @@ +TEMPLATE = app + +TARGET = musrgui +target.path = $$(HOME)/analysis/bin +INSTALLS += target + +# install path for the XML configuration file +unix: xml.path = $$(HOME)/analysis/bin/ +win32: xml.path = $$(HOME)/analysis/bin/ +xml.files = musrgui_startup.xml +INSTALLS += xml + +CONFIG += qt warn_on debug + + + +HEADERS = PTextEdit.h \ + PAdmin.h \ + PFitOutputHandler.h \ + PGetDefaultDialog.h + +SOURCES = PTextEdit.cpp \ + PAdmin.cpp \ + PFitOutputHandler.cpp \ + PGetDefaultDialog.cpp \ + main.cpp + +FORMS = forms/PGetDefaultDialogBase.ui + +IMAGES = editcopy.xpm \ + editcut.xpm \ + editpaste.xpm \ + editredo.xpm \ + editundo.xpm \ + filenew.xpm \ + fileopen.xpm \ + fileprint.xpm \ + filesave.xpm \ + musrasym.xpm \ + musrsinglehisto.xpm \ + musrcalcchisq.xpm \ + musrfit.xpm \ + musrview.xpm \ + musrt0.xpm \ + musrprefs.xpm + diff --git a/src/musrgui/musrgui_startup.xml b/src/musrgui/musrgui_startup.xml new file mode 100644 index 00000000..0bd956ad --- /dev/null +++ b/src/musrgui/musrgui_startup.xml @@ -0,0 +1,38 @@ + + + + $Id$ + This is handling default setting parameters for the musrgui. + + + /home/nemu/analysis/bin + /mnt/home/nemu/analysis + /afs/psi.ch/user/s/suter_a/development/musrgui + y + + + mue4 + psi + root-npp + + + + y + + + n + + + n + + + + + + + + + + + + diff --git a/src/musrgui/musrprefs.xpm b/src/musrgui/musrprefs.xpm new file mode 100644 index 00000000..f52e3e32 --- /dev/null +++ b/src/musrgui/musrprefs.xpm @@ -0,0 +1,28 @@ +/* XPM */ +static char * musrprefs_xpm[] = { +"22 22 3 1", +" c None", +". c #3D20CF", +"+ c #000000", +"... ... ... ... ... ", +". . . . . . . ", +"... ... ... ... ... ", +". . . . . . ", +". . . ... . ... ", +" ", +" + + ", +" + + + ", +"+ ++++ ++ + ", +" + + + + ", +" + + ", +" ", +" + + ", +" + + + ++ ++ + ", +"+ + +++ + + + + + ", +" + + + + ", +" + + ", +" ", +" + + + ", +" + + + + + ", +"+ + +++++++++ + ++ +", +" + ++ ++ + + "}; diff --git a/src/musrgui/musrsinglehisto.xpm b/src/musrgui/musrsinglehisto.xpm new file mode 100644 index 00000000..bc1e3ec2 --- /dev/null +++ b/src/musrgui/musrsinglehisto.xpm @@ -0,0 +1,29 @@ +/* XPM */ +static char * musrsinglehisto_xpm[] = { +"22 22 4 1", +" c None", +". c #3D20CF", +"+ c #FF0000", +"@ c #000000", +" ", +". . . .. ..... ... ", +".++ . . . . . . .", +". + . . . . . .", +"..... . .. . . .", +". +. . . . . .", +". . . . . . . .", +". .+. .. . ... ", +"@ + ", +"@ + ", +"@ + ", +"@ ++ ", +"@ + ", +"@ + ", +"@ + ", +"@ + ", +"@ ++ ", +"@ + ", +"@ ++ ", +"@ ++ ", +"@ ++ ", +"@@@@@@@@@@@@@@@@@@@+++"}; diff --git a/src/musrgui/musrt0.xpm b/src/musrgui/musrt0.xpm new file mode 100644 index 00000000..6a14ac0e --- /dev/null +++ b/src/musrgui/musrt0.xpm @@ -0,0 +1,28 @@ +/* XPM */ +static char * musrt0_xpm[] = { +"22 22 3 1", +" c None", +". c #3D20CF", +"+ c #000000", +"..... .. ", +" . . . ", +" . . . ", +" . . . ", +" . + . . ++ ", +" . + . .+ ++ ", +" . + .. + + ", +" + + +++ ", +" + + + ", +" + + ++ ", +" + + + ", +" + + + ", +" + + ++ ", +" + + ++++ ", +" + + + ", +" + + ++", +" + + ", +" + + ", +" + + ", +" + ++ + ", +"++ + + ", +" "}; diff --git a/src/musrgui/musrview.xpm b/src/musrgui/musrview.xpm new file mode 100644 index 00000000..fad71c57 --- /dev/null +++ b/src/musrgui/musrview.xpm @@ -0,0 +1,28 @@ +/* XPM */ +static char * musrview_xpm[] = { +"22 22 3 1", +" c None", +". c #000000", +"+ c #FF0000", +" .. ... .. ", +" ", +"......................", +" . ", +" . . ... ", +" ++ . ", +" ++ . ..... ", +" + + . ", +" + ... . ..... ", +" + . + . . ", +" +. + . . . ....", +" +. + . . ", +" + . + . . ... . ", +" + . + . . ", +" +. + . . ", +" +. + ... ", +" ++ . ", +" . ", +"......................", +" ", +" ....... .... .... ", +" "}; diff --git a/src/musrgui/singleHistoDefault.msr b/src/musrgui/singleHistoDefault.msr new file mode 100644 index 00000000..263d48d5 --- /dev/null +++ b/src/musrgui/singleHistoDefault.msr @@ -0,0 +1,60 @@ +TITLE +############################################################### +FITPARAMETER +# Nr. Name Value Step Pos_Error Bounderies + 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 + 4 N0_L 150.0 0.01 none + 5 Bkg_L 4.9 0.01 none + 6 Phase_L 7.0 1.5 none -50 50 + +############################################################### +THEORY +asymmetry 1 +simplExpo 2 (rate) +TFieldCos map1 fun1 (phase frequency) + +############################################################### +FUNCTIONS +fun1 = par3 * gamma_mu + +############################################################### +RUN lem07_his_0111 MUE4 PSI ROOT-NPP (name beamline institute data-file-format) +fittype 0 (single histogram fit) +norm 4 +backgr.fit 5 +lifetimecorrection +map 6 0 0 0 0 0 0 0 0 0 +forward 1 +data 3413 65000 +t0 3413 +fit 0.20 8.2 +packing 50 + +############################################################### +COMMANDS +SET BATCH +MINIMIZE +MINOS +SAVE +END RETURN + +############################################################### +PLOT 0 (single histo plot) +runs 1 +range 0.00 7.00 -0.30 0.30 + +############################################################### +FOURIER +units Gauss # fourier in field units +fourier_power 12 +apodization NONE # NONE, WEAK, MEDIUM, STRONG +plot power +phase 8.5 +#range_for_phase_correction 50.0 70.0 +range 0.0 200.0 + +############################################################### +STATISTIC --- 2008-06-09 14:09:39 + chisq = 1446.93547, NDF = 1377, chisq/NDF = 1.05078829