diff --git a/src/musredit_qt5/musrStep/musrStep b/src/musredit_qt5/musrStep/musrStep deleted file mode 100755 index de79630e..00000000 Binary files a/src/musredit_qt5/musrStep/musrStep and /dev/null differ diff --git a/src/musredit_qt5/musrWiz/PAdmin.cpp b/src/musredit_qt5/musrWiz/PAdmin.cpp new file mode 100644 index 00000000..e9e27101 --- /dev/null +++ b/src/musredit_qt5/musrWiz/PAdmin.cpp @@ -0,0 +1,1303 @@ +/**************************************************************************** + + PAdmin.cpp + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2010-2016 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 +using namespace std; + +#include +#include +#include +#include +#include + +#include "PAdmin.h" + +//-------------------------------------------------------------------------- +// implementation of PFuncXMLParser class +//-------------------------------------------------------------------------- +/** + *

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

+ */ +bool PFuncXMLParser::startDocument() +{ + return true; +} + +//-------------------------------------------------------------------------- +/** + *

+ */ +bool PFuncXMLParser::startElement(const QString&, const QString&, + const QString& qName, + const QXmlAttributes& qAttr) +{ + QString errMsg(""); + int ival; + double dval; + bool ok; + + if (qName == "theo_template") { + fTheoTemplate.init(); + } else if (qName == "pre_def_name") { + fKeyWord = eTemplateName; + } else if (qName == "theory") { + fKeyWord = eTemplateTheo; + } else if (qName == "theo_fun") { + fKeyWord = eTemplateFunc; + } else if (qName == "theo_map") { + if (qAttr.count() != 2) { + errMsg = QString("theo_map should have 2 attributes, called 'no', and 'name', found %1").arg(qAttr.count()); + QMessageBox::critical(0, "ERROR", errMsg); + return false; + } + PParam map; + for (int i=0; i + */ +bool PFuncXMLParser::endElement( const QString&, const QString&, const QString &qName ) +{ + fKeyWord = eEmpty; + + if (qName == "theo_template") { + fAdmin->fTheoTemplate.push_back(fTheoTemplate); + } else if (qName == "func") { + fAdmin->fMusrfitFunc.push_back(fFunc); + } else if (qName == "parameter") { + fFunc.addFuncParam(fParam); + } + + return true; +} + +//-------------------------------------------------------------------------- +/** + *

+ */ +bool PFuncXMLParser::characters(const QString &str) +{ + bool ok; + int ival; + double dval; + + switch (fKeyWord) { + case eTemplateName: + fTheoTemplate.setName(str); + break; + case eTemplateTheo: + fTheoTemplate.setTheory(str); + break; + case eTemplateFunc: + fTheoTemplate.appendFunc(str); + break; + case eName: + fFunc.setName(str); + break; + case eAbbrv: + fFunc.setAbbrv(str); + break; + case eNoOfParam: + ival = str.toInt(&ok); + if (ok) + fFunc.setNoOfParam(ival); + break; + case eParamName: + fParam.setParamName(str); + break; + case eParamValue: + dval = str.toDouble(&ok); + if (ok) + fParam.setParamValue(dval); + break; + case eParamMap: + if ((str == "y") || (str == "yes") || (str == "1")) + fParam.setParamMap(true); + break; + default: + break; + } + + return true; +} + +//-------------------------------------------------------------------------- +/** + *

+ */ +bool PFuncXMLParser::endDocument() +{ + return true; +} + +//-------------------------------------------------------------------------- +/** + *

+ */ +bool PFuncXMLParser::warning( const QXmlParseException & exception ) +{ + QString msg; + + msg = QString("**WARNING** while parsing musrfit_funcs.xml in line no %1\n").arg(exception.lineNumber()); + msg += QString("**WARNING MESSAGE** ") + exception.message(); + + qWarning() << endl << msg << endl; + + QMessageBox::warning(0, "WARNING", msg, QMessageBox::Ok, QMessageBox::NoButton); + + return true; +} + +//-------------------------------------------------------------------------- +/** + *

+ */ +bool PFuncXMLParser::error( const QXmlParseException & exception ) +{ + QString msg; + + msg = QString("**ERROR** while parsing musrfit_funcs.xml in line no %1\n").arg(exception.lineNumber()); + msg += QString("**ERROR MESSAGE** ") + exception.message(); + + qWarning() << endl << msg << endl; + + QMessageBox::warning(0, "ERROR", msg, QMessageBox::Ok, QMessageBox::NoButton); + + return true; +} + +//-------------------------------------------------------------------------- +/** + *

+ */ +bool PFuncXMLParser::fatalError( const QXmlParseException & exception ) +{ + QString msg; + + msg = QString("**FATAL ERROR** while parsing musrfit_funcs.xml in line no %1\n").arg(exception.lineNumber()); + msg += QString("**FATAL ERROR MESSAGE** ") + exception.message(); + + qWarning() << endl << msg << endl; + + QMessageBox::warning(0, "FATAL ERROR", msg, QMessageBox::Ok, QMessageBox::NoButton); + + return true; +} + +//-------------------------------------------------------------------------- +// implementation of PInstrumentDefXMLParser class +//-------------------------------------------------------------------------- +/** + *

XML Parser class for the instrument definition file(s). + * + * \param admin pointer to an admin class instance. + */ +PInstrumentDefXMLParser::PInstrumentDefXMLParser(PAdmin *admin) : fAdmin(admin) +{ + fKeyWord = eEmpty; + + fInstituteName = ""; + fInstrument = 0; + fSetup = 0; +} + +//-------------------------------------------------------------------------- +/** + *

Routine called at the beginning of the XML parsing process. + */ +bool PInstrumentDefXMLParser::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 PInstrumentDefXMLParser::startElement( const QString&, const QString&, + const QString& qName, + const QXmlAttributes& qAttr) +{ + bool ok; + double dval; + double ival; + QString str, errMsg; + QStringList strL; + QVector forward; + QVector backward; + + if (qName == "institute") { + fKeyWord = eInstitute; + } else if (qName == "instrument") { + fKeyWord = eInstrument; + if (qAttr.count() != 1) { + errMsg = QString("instrument should have 1 attribute, called 'name', found %1").arg(qAttr.count()); + QMessageBox::critical(0, "ERROR", errMsg); + return false; + } + if (fInstituteName == "") { + errMsg = QString("found instrument without institute set."); + QMessageBox::critical(0, "ERROR", errMsg); + return false; + } + // create an instrument object + fInstrument = new PInstrument(); + fInstrument->setInstitue(fInstituteName); + fInstrument->setName(qAttr.value(0)); + } else if (qName == "run_name_template") { + fKeyWord = eRunNameTemplate; + } else if (qName == "beamline") { + fKeyWord = eBeamline; + } else if (qName == "data_file_format") { + fKeyWord = eDataFileFormat; + } else if (qName == "tf") { + fKeyWord = eTf; + fSetup = new PSetup(); + if (qAttr.count() == 1) + fSetup->setName(qAttr.value(0)); + else + fSetup->setName("Default"); + } else if (qName == "zf") { + fKeyWord = eZf; + fSetup = new PSetup(); + if (qAttr.count() == 1) + fSetup->setName(qAttr.value(0)); + else + fSetup->setName("Default"); + } else if (qName == "lf") { + fKeyWord = eLf; + fSetup = new PSetup(); + if (qAttr.count() == 1) + fSetup->setName(qAttr.value(0)); + else + fSetup->setName("Default"); + } else if (qName == "no_of_detectors") { + fKeyWord = eNoOfDetectors; + } else if (qName == "fgb_offset") { + fKeyWord = eFgbOffset; + } else if (qName == "lgb") { + fKeyWord = eLgb; + } else if (qName == "asym_bkg_range") { + fKeyWord = eBkgRange; + } else if (qName == "logic_detector") { + if (qAttr.count() < 3) + return false; + PDetector detect; + int count=0; + for (int i=0; iaddDetector(detect); + } else if (qName == "logic_asym_detector") { + if (qAttr.count() != 5) + return false; + PDetector detect; + int count=0; + for (int i=0; i<5; i++) { + if (qAttr.localName(i) == "name") { + detect.setName(qAttr.value(i)); // detector name + count++; + } else if (qAttr.localName(i) == "rel_phase") { + str = qAttr.value(i); + dval = str.toDouble(&ok); + if (ok) { + detect.setRelGeomPhase(dval); + count++; + } + } else if (qAttr.localName(i) == "forward") { + str = qAttr.value(i); + strL.clear(); + strL = str.split(' '); + forward.clear(); + for (int j=0; jaddAsymDetector(detect); + } + + return true; +} + +//-------------------------------------------------------------------------- +/** + *

Routine called when the end XML tag is found. It is used to + * put the filtering tag to 'empty'. It also resets the fFunc flag in case + * the entry was a theory function. + * + * \param qName name of the element. + */ +bool PInstrumentDefXMLParser::endElement( const QString&, const QString&, const QString &qName ) +{ + fKeyWord = eEmpty; + + if (qName == "instrument") { + // store instrument + fAdmin->addInstrument(fInstituteName, *fInstrument); + + // delete instrument object + if (fInstrument) { + delete fInstrument; + fInstrument = 0; + } + } else if (qName == "zf") { + // store setup + fInstrument->addSetupZF(*fSetup); + + // delete setup object + if (fSetup) { + delete fSetup; + fSetup = 0; + } + } else if (qName == "tf") { + // store setup + fInstrument->addSetupTF(*fSetup); + + // delete setup object + if (fSetup) { + delete fSetup; + fSetup = 0; + } + } else if (qName == "lf") { + // store setup + fInstrument->addSetupLF(*fSetup); + + // delete setup object + if (fSetup) { + delete fSetup; + fSetup = 0; + } + } + + return true; +} + +//-------------------------------------------------------------------------- +/** + *

This routine delivers the content of an XML tag. It fills the + * content into the load data structure. + * + * \param str keeps the content of the XML tag. + */ +bool PInstrumentDefXMLParser::characters(const QString& str) +{ + bool ok; + int ival, start, end; + QString errMsg; + QStringList strList; + + switch (fKeyWord) { + case eInstitute: + fInstituteName = str; + break; + case eRunNameTemplate: + fInstrument->setRunNameTemplate(str); + break; + case eBeamline: + fInstrument->setBeamline(str); + break; + case eDataFileFormat: + fInstrument->setDataFileFormat(str); + break; + case eNoOfDetectors: + if (fSetup == 0) { + errMsg = "setup object not found."; + QMessageBox::critical(0, "ERROR", errMsg); + return false; + } + ival = str.toInt(&ok); + if (!ok) { + errMsg = QString("Setup Error: No of Detectors = '%1', which is not an int.").arg(str); + QMessageBox::critical(0, "ERROR", errMsg); + return false; + } + fSetup->setNoOfDetectors(ival); + break; + case eFgbOffset: + if (fSetup == 0) + return false; + ival = str.toInt(&ok); + if (!ok) + return false; + fSetup->setFgbOffset(ival); + break; + case eLgb: + if (fSetup == 0) + return false; + ival = str.toInt(&ok); + if (!ok) + return false; + fSetup->setLgb(ival); + break; + case eBkgRange: + strList = str.split(' ', QString::SkipEmptyParts); + if (strList.size() != 2) { + errMsg = QString("Found wrong Asymmetry background range: '%1'").arg(str); + QMessageBox::critical(0, "ERROR", errMsg); + return false; + } + start = strList[0].toInt(&ok); + if (!ok) { + return false; + } + end = strList[1].toInt(&ok); + if (!ok) { + return false; + } + fSetup->setBkgRange(start, end); + break; + default: + break; + } + + return true; +} + +//-------------------------------------------------------------------------- +/** + *

Called at the end of the XML parse process. It checks if default paths + * contain system variables, and if so expand them for the further use. + */ +bool PInstrumentDefXMLParser::endDocument() +{ + if (fInstituteName == "") { + QMessageBox::critical(0, "FATAL ERROR", "Didn't find any institute name in the instrument definitions."); + return false; + } + + return true; +} + +//-------------------------------------------------------------------------- +/** + *

Report XML warnings. + * + * \param exception holds the information of the XML warning + */ +bool PInstrumentDefXMLParser::warning( const QXmlParseException & exception ) +{ + QString msg; + + msg = QString("**WARNING** while parsing instrument_def_XXX.xml in line no %1\n").arg(exception.lineNumber()); + msg += QString("**WARNING MESSAGE** ") + exception.message(); + + qWarning() << endl << msg << endl; + + QMessageBox::warning(0, "WARNING", msg, QMessageBox::Ok, QMessageBox::NoButton); + + return true; +} + +//-------------------------------------------------------------------------- +/** + *

Report recoverable XML errors. + * + * \param exception holds the information of the XML recoverable errors. + */ +bool PInstrumentDefXMLParser::error( const QXmlParseException & exception ) +{ + QString msg; + + msg = QString("**ERROR** while parsing instrument_def_XXX.xml in line no %1\n").arg(exception.lineNumber()); + msg += QString("**ERROR MESSAGE** ") + exception.message(); + + qWarning() << endl << msg << endl; + + QMessageBox::critical(0, "ERROR", msg, QMessageBox::Ok, QMessageBox::NoButton); + + return true; +} + +//-------------------------------------------------------------------------- +/** + *

Report fatal XML errors. + * + * \param exception holds the information of the XML fatal errors. + */ +bool PInstrumentDefXMLParser::fatalError( const QXmlParseException & exception ) +{ + QString msg; + + msg = QString("**FATAL ERROR** while parsing parsing instrument_def_XXX.xml in line no %1\n").arg(exception.lineNumber()); + msg += QString("**FATAL ERROR MESSAGE** ") + exception.message(); + + qWarning() << endl << msg << endl; + + QMessageBox::critical(0, "FATAL ERROR", msg, QMessageBox::Ok, QMessageBox::NoButton); + + return true; +} + +//-------------------------------------------------------------------------- +// implementation of PMusrWizDefault class +//-------------------------------------------------------------------------- +/** + *

Initializes that PMusrWizDefault object. + */ +PMusrWizDefault::PMusrWizDefault() +{ + fInstitute = "UnDef"; + fInstrument = "UnDef"; + fFitType = "UnDef"; +} + +//-------------------------------------------------------------------------- +// implementation of PMusrWizDefaultXMLParser class +//-------------------------------------------------------------------------- +/** + *

XML Parser class for the musrWiz default settings. + * + * \param admin pointer to an admin class instance. + */ +PMusrWizDefaultXMLParser::PMusrWizDefaultXMLParser(PAdmin *admin) : fAdmin(admin) +{ + fKeyWord = eEmpty; +} + +//-------------------------------------------------------------------------- +/** + *

Routine called at the beginning of the XML parsing process. + */ +bool PMusrWizDefaultXMLParser::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 PMusrWizDefaultXMLParser::startElement( const QString&, const QString&, + const QString& qName, + const QXmlAttributes& ) +{ + if (qName == "institute") { + fKeyWord = eInstitute; + } else if (qName == "instrument") { + fKeyWord = eInstrument; + } else if (qName == "fit_type") { + fKeyWord = eFitType; + } + + return true; +} + +//-------------------------------------------------------------------------- +/** + *

Routine called when the end XML tag is found. It is used to + * put the filtering tag to 'empty'. It also resets the fFunc flag in case + * the entry was a theory function. + * + * \param qName name of the element. + */ +bool PMusrWizDefaultXMLParser::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. + * + * \param str keeps the content of the XML tag. + */ +bool PMusrWizDefaultXMLParser::characters(const QString& str) +{ + switch (fKeyWord) { + case eInstitute: + fDefault.setInstitute(str); + break; + case eInstrument: + fDefault.setInstrument(str); + break; + case eFitType: + fDefault.setFitType(str); + break; + default: + break; + } + + return true; +} + +//-------------------------------------------------------------------------- +/** + *

Called at the end of the XML parse process. + */ +bool PMusrWizDefaultXMLParser::endDocument() +{ + fAdmin->fDefault = fDefault; + + return true; +} + +//-------------------------------------------------------------------------- +/** + *

Report XML warnings. + * + * \param exception holds the information of the XML warning + */ +bool PMusrWizDefaultXMLParser::warning( const QXmlParseException & exception ) +{ + QString msg; + + msg = QString("**WARNING** while parsing musrWiz.xml in line no %1\n").arg(exception.lineNumber()); + msg += QString("**WARNING MESSAGE** ") + exception.message(); + + qWarning() << endl << msg << endl; + + QMessageBox::warning(0, "WARNING", msg, QMessageBox::Ok, QMessageBox::NoButton); + + return true; +} + +//-------------------------------------------------------------------------- +/** + *

Report recoverable XML errors. + * + * \param exception holds the information of the XML recoverable errors. + */ +bool PMusrWizDefaultXMLParser::error( const QXmlParseException & exception ) +{ + QString msg; + + msg = QString("**ERROR** while parsing musrWiz.xml in line no %1\n").arg(exception.lineNumber()); + msg += QString("**ERROR MESSAGE** ") + exception.message(); + + qWarning() << endl << msg << endl; + + QMessageBox::critical(0, "ERROR", msg, QMessageBox::Ok, QMessageBox::NoButton); + + return true; +} + +//-------------------------------------------------------------------------- +/** + *

Report fatal XML errors. + * + * \param exception holds the information of the XML fatal errors. + */ +bool PMusrWizDefaultXMLParser::fatalError( const QXmlParseException & exception ) +{ + QString msg; + + msg = QString("**FATAL ERROR** while parsing parsing musrWiz.xml in line no %1\n").arg(exception.lineNumber()); + msg += QString("**FATAL ERROR MESSAGE** ") + exception.message(); + + qWarning() << endl << msg << endl; + + QMessageBox::critical(0, "FATAL ERROR", msg, QMessageBox::Ok, QMessageBox::NoButton); + + return true; +} + +//-------------------------------------------------------------------------- +// implementation of PAdmin class +//-------------------------------------------------------------------------- +/** + *

Initializes that PAdmin object, and calls the XML parser which feeds + * the object variables. + */ +PAdmin::PAdmin() : QObject() +{ + QString path, fln, pathFln; + bool found = false; + int count = 0; + + fValid = true; + + // load musrWiz default settings + // 1st: check local directory + pathFln = QString("./musrWiz.xml"); + if (!QFile::exists(pathFln)) { + // 2nd: check $HOME/.musrfit/musrWiz/musrWiz.xml + path = std::getenv("HOME"); + pathFln = path + "/.musrfit/musrWiz/musrWiz.xml"; + if (QFile::exists(pathFln)) { + found = true; + } + } else { + found = true; + } + if (found) { + if (loadMusrWizDefault(pathFln)) { + QMessageBox::warning(0, "WARNING", "Couldn't find musrWiz.xml file."); + } + } + + // load musrfit funcs + found = false; + // 1st: check local directory + pathFln = QString("./musrfit_funcs.xml"); + if (!QFile::exists(pathFln)) { + // 2nd: check $HOME/.musrfit/musrWiz/musrfit_funcs.xml + path = std::getenv("HOME"); + pathFln = path + "/.musrfit/musrWiz/musrfit_funcs.xml"; + if (QFile::exists(pathFln)) { + found = true; + } + } else { + found = true; + } + if (!found) { + fValid = false; + QMessageBox::critical(0, "FATAL ERROR", "Couldn't find musrfit_funcs.xml."); + return; + } + if (loadMusrfitFunc(pathFln)) { + fValid = false; + QMessageBox::critical(0, "FATAL ERROR", "Couldn't find any musrfit function definitions."); + return; + } + + // load instrument definitions + found = false; + + QStringList instStr; + instStr << "psi" << "triumf" << "isis" << "jparc"; + + for (int i=0; i instrument = fInstitute[idx].getInstruments(); + for (int i=0; i= fTheoTemplate.size())) + return theoTemplate; + + return fTheoTemplate[idx]; +} + +//-------------------------------------------------------------------------- +/** + * + */ +PMusrfitFunc PAdmin::getMusrfitFunc(QString name) +{ + PMusrfitFunc func; + + int idx=-1; + for (int i=0; idump all the instrument defs to stdout. This routine is there for debug + * purposes only. + */ +void PAdmin::dump(int tag) +{ + if (tag == -1) + return; + + if (tag != 1) { + QVector instrument; + QVector setup; + PDetector *detec; + QVector forward; + QString forwardStr; + QVector backward; + QString backwardStr; + + for (int i=0; i +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-"; + qInfo() << "debug> Institute: " << fInstitute[i].getName(); + qInfo() << "debug> ----"; + instrument = fInstitute[i].getInstruments(); + for (int j=0; j ----"; + qInfo() << "debug> Instrument Name: " << instrument[j].getName(); + // all TF setups + setup = instrument[j].getTFSetups(); + for (int k=0; k ----"; + qInfo() << "debug> TF setup, name: " << setup[k].getName(); + qInfo() << "debug> No of Detectors: " << setup[k].getNoOfDetectors(); + qInfo() << "debug> fgb Offset: " << setup[k].getFgbOffset(); + qInfo() << "debug> lgb: " << setup[k].getLgb(); + qInfo() << "debug> asymmetry bkg range: " << setup[k].getBkgStartBin() << " " << setup[k].getBkgEndBin(); + qInfo() << "debug> ----"; + for (int l=0; l detec == 0 for k=" << k << ", l=" << l; + return; + } + forward = detec->getForwards(); + forwardStr = ""; + for (int m=0; m detector : " << detec->getName() << ", " << detec->getRelGeomPhase() << "°, " << forwardStr; + } + qInfo() << "debug> ----"; + for (int l=0; l detec == 0 for k=" << k << ", l=" << l; + return; + } + forward = detec->getForwards(); + forwardStr = ""; + backward = detec->getBackwards(); + backwardStr = ""; + for (int m=0; m detectorAsym : " << detec->getName() << ", " << detec->getRelGeomPhase() << "°, " << forwardStr << "/" << backwardStr << ", alpha=" << detec->getAlpha(); + } + } + // all ZF setups + setup.clear(); + setup = instrument[j].getZFSetups(); + for (int k=0; k ----"; + qInfo() << "debug> ZF setup, name: " << setup[k].getName(); + qInfo() << "debug> No of Detectors: " << setup[k].getNoOfDetectors(); + qInfo() << "debug> fgb Offset: " << setup[k].getFgbOffset(); + qInfo() << "debug> lgb: " << setup[k].getLgb(); + qInfo() << "debug> asymmetry bkg range: " << setup[k].getBkgStartBin() << " " << setup[k].getBkgEndBin(); + qInfo() << "debug> ----"; + for (int l=0; l detec == 0 for k=" << k << ", l=" << l; + return; + } + forward = detec->getForwards(); + forwardStr = ""; + backward = detec->getBackwards(); + backwardStr = ""; + for (int m=0; m detectorAsym : " << detec->getName() << ", " << detec->getRelGeomPhase() << "°, " << forwardStr << "/" << backwardStr << ", alpha=" << detec->getAlpha(); + } + } + // all LF setups + setup.clear(); + setup = instrument[j].getLFSetups(); + for (int k=0; k ----"; + qInfo() << "debug> LF setup, name: " << setup[k].getName(); + qInfo() << "debug> No of Detectors: " << setup[k].getNoOfDetectors(); + qInfo() << "debug> fgb Offset: " << setup[k].getFgbOffset(); + qInfo() << "debug> lgb: " << setup[k].getLgb(); + qInfo() << "debug> asymmetry bkg range: " << setup[k].getBkgStartBin() << " " << setup[k].getBkgEndBin(); + qInfo() << "debug> ----"; + for (int l=0; l detec == 0 for k=" << k << ", l=" << l; + return; + } + forward = detec->getForwards(); + forwardStr = ""; + backward = detec->getBackwards(); + backwardStr = ""; + for (int m=0; m detectorAsym : " << detec->getName() << ", " << detec->getRelGeomPhase() << "°, " << forwardStr << "/" << backwardStr << ", alpha=" << detec->getAlpha(); + } + } + } + qInfo() << "debug> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-"; + } + } else if (tag != 0) { + qInfo() << "debug> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-"; + qInfo() << "debug> Available Musrfit Funcs of the Wizard"; + qInfo() << "debug> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-"; + PMusrfitFunc fun; + for (int i=0; i " << i << ": " << fun.getName() << " / " << fun.getAbbrv(); + qInfo() << "deubg> " << i << ": no of Parameters: " << fun.getNoOfParam(); + for (int j=0; jsize(); j++) { + qInfo() << "debug> " << i << "/" << j << ": param name: " << fun.getFuncParam(j).getParamName() << ", val: " << fun.getFuncParam(j).getParamValue(); + } + qInfo() << "debug> ----"; + } + qInfo() << "debug> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-"; + } +} + +//-------------------------------------------------------------------------- +/** + * + */ +PInstrument *PAdmin::getInstrument(QString institute, QString instrument) +{ + for (int i=0; i +#include +#include + +#include "PTheoTemplate.h" +#include "PMusrfitFunc.h" +#include "PInstrumentDef.h" + +class PAdmin; + +//--------------------------------------------------------------------------- +class PFuncXMLParser : public QXmlDefaultHandler +{ + public: + PFuncXMLParser(PAdmin*); + virtual ~PFuncXMLParser() {} + + private: + enum EFuncKeyWords {eEmpty, + eTemplateName, eTemplateTheo, eTemplateFunc, + eName, eAbbrv, eNoOfParam, eParam, + eParamName, eParamValue, eParamMap}; + + bool startDocument(); + bool startElement(const QString&, const QString&, const QString& , + const QXmlAttributes& qAttr); + bool endElement( const QString&, const QString&, const QString& ); + + bool characters(const QString&); + bool endDocument(); + + bool warning( const QXmlParseException & exception ); + bool error( const QXmlParseException & exception ); + bool fatalError( const QXmlParseException & exception ); + + EFuncKeyWords fKeyWord; ///< key word tag to know how to handle the content + PAdmin *fAdmin; ///< a pointer to the main administration class object + + PTheoTemplate fTheoTemplate; + PMusrfitFunc fFunc; + PFuncParam fParam; +}; + +//--------------------------------------------------------------------------- +class PInstrumentDefXMLParser : public QXmlDefaultHandler +{ + public: + PInstrumentDefXMLParser(PAdmin*); + virtual ~PInstrumentDefXMLParser() {} + + private: + enum EKeyWords {eEmpty, eInstitute, eInstrument, eRunNameTemplate, + eBeamline, eDataFileFormat, eTf, eZf, eLf, + eNoOfDetectors, eFgbOffset, eLgb, eBkgRange, + eLogicDetector}; + + bool startDocument(); + bool startElement(const QString&, const QString&, const QString& , + const QXmlAttributes& qAttr); + bool endElement( const QString&, const QString&, const QString& ); + + bool characters(const QString&); + bool endDocument(); + + bool warning( const QXmlParseException & exception ); + bool error( const QXmlParseException & exception ); + bool fatalError( const QXmlParseException & exception ); + + EKeyWords fKeyWord; ///< key word tag to know how to handle the content + PAdmin *fAdmin; ///< a pointer to the main administration class object + + QString fInstituteName; + PInstrument *fInstrument; + PSetup *fSetup; +}; + +//--------------------------------------------------------------------------- +class PMusrWizDefault +{ + public: + PMusrWizDefault(); + ~PMusrWizDefault() {} + + QString getInstitute() { return fInstitute; } + QString getInstrument() { return fInstrument; } + QString getFitType() { return fFitType; } + + void setInstitute(QString str) { fInstitute = str; } + void setInstrument(QString str) { fInstrument = str; } + void setFitType(QString str) { fFitType = str; } + + private: + QString fInstitute; + QString fInstrument; + QString fFitType; +}; + +//--------------------------------------------------------------------------- +class PMusrWizDefaultXMLParser : public QXmlDefaultHandler +{ + public: + PMusrWizDefaultXMLParser(PAdmin*); + virtual ~PMusrWizDefaultXMLParser() {} + + private: + enum EKeyWords {eEmpty, eInstitute, eInstrument, eFitType}; + + 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(); + + bool warning( const QXmlParseException & exception ); + bool error( const QXmlParseException & exception ); + bool fatalError( const QXmlParseException & exception ); + + EKeyWords fKeyWord; ///< key word tag to know how to handle the content + PAdmin *fAdmin; ///< a pointer to the main administration class object + + PMusrWizDefault fDefault; +}; + +//--------------------------------------------------------------------------- +class PAdmin : public QObject +{ + public: + PAdmin(); + ~PAdmin() {} + + bool IsValid() { return fValid; } + void dump(int tag); + + QString getDefaultInstitute() { return fDefault.getInstitute(); } + QString getDefaultInstrument() { return fDefault.getInstrument(); } + QString getDefaultFitType() { return fDefault.getFitType(); } + + QStringList getInstituteList(); + QStringList getInstrumentList(QString institute); + PInstrument *getInstrument(QString institute, QString instrument); + int getTheoTemplateSize() { return fTheoTemplate.size(); } + QVector getTheoTemplates() { return fTheoTemplate; } + PTheoTemplate getTheoTemplate(int idx); + int getMusrfitFuncSize() { return fMusrfitFunc.size(); } + QVector getMusrfitFunc() { return fMusrfitFunc; } + PMusrfitFunc getMusrfitFunc(QString name); + + protected: + int addInstrument(QString institute, PInstrument instrument); + + private: + friend class PFuncXMLParser; + friend class PInstrumentDefXMLParser; + friend class PMusrWizDefaultXMLParser; + + bool fValid; + + PMusrWizDefault fDefault; + QVector fInstitute; + QVector fTheoTemplate; + QVector fMusrfitFunc; + + int loadMusrWizDefault(QString fln); + int loadMusrfitFunc(QString fln); + int loadInstrumentDef(QString fln); +}; + +#endif // _PADMIN_H_ diff --git a/src/musredit_qt5/musrWiz/PInstrumentDef.cpp b/src/musredit_qt5/musrWiz/PInstrumentDef.cpp new file mode 100644 index 00000000..49235bb6 --- /dev/null +++ b/src/musredit_qt5/musrWiz/PInstrumentDef.cpp @@ -0,0 +1,153 @@ +/*************************************************************************** + + PInstrumentDef.cpp + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + +***************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2007-2016 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 "PInstrumentDef.h" + +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +/** + * + */ +PSetup::PSetup() +{ + fName = ""; + fNoOfDetectors = -1; + fFgbOffset = -1; + fLgb = -1; + fBkgStartBin = -1; + fBkgEndBin = -1; +} + +//-------------------------------------------------------------------------- +/** + * @brief PSetup::getDetector + * @param idx + * @return + */ +PDetector* PSetup::getDetector(int idx) +{ + if (idx >= fLogicDetectors.size()) + return 0; + + return &fLogicDetectors[idx]; +} + +//-------------------------------------------------------------------------- +/** + * @brief PSetup::getAsymDetector + * @param idx + * @return + */ +PDetector* PSetup::getAsymDetector(int idx) +{ + if (idx >= fLogicAsymDetectors.size()) + return 0; + + return &fLogicAsymDetectors[idx]; +} + +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +/** + * + */ +PInstrument::PInstrument() +{ + fRunNameTemplate = ""; + fBeamline = ""; + fDataFileFormat = ""; + fInstitue = ""; + fName = ""; +} + +//-------------------------------------------------------------------------- +/** + * @brief PInstrument::getZFSetup + * @param name + * @return + */ +PSetup* PInstrument::getZFSetup(QString name) +{ + for (int i=0; i +#include + +//--------------------------------------------------------------------------- +class PDetector +{ + public: + PDetector() {} + ~PDetector() {} + + void setName(QString str) { fName = str; } + void setRelGeomPhase(double phase) { fRelGeomPhase = phase; } + void setForwards(QVector num) { fForward = num; } + void setBackwards(QVector num) { fBackward = num; } + void setAlpha(double alpha) { fAlpha = alpha; } + + QString getName() { return fName; } + double getRelGeomPhase() { return fRelGeomPhase; } + QVector getForwards() { return fForward; } + QVector getBackwards() { return fBackward; } + double getAlpha() { return fAlpha; } + + private: + QString fName; + QVector fForward; + QVector fBackward; + double fAlpha; + double fRelGeomPhase; +}; + +//--------------------------------------------------------------------------- +class PSetup +{ + public: + PSetup(); + ~PSetup() {} + + void setName(QString str) { fName = str; } + void setNoOfDetectors(int no) { fNoOfDetectors = no; } + void setFgbOffset(int fgbOffset) { fFgbOffset = fgbOffset; } + void setLgb(int lgb) { fLgb = lgb; } + void setBkgRange(int start, int end) { fBkgStartBin = start; fBkgEndBin = end; } + void addDetector(PDetector detector) { fLogicDetectors.push_back(detector); } + void addAsymDetector(PDetector detector) { fLogicAsymDetectors.push_back(detector); } + + QString getName() { return fName; } + int getNoOfDetectors() { return fNoOfDetectors; } + int getNoOfLogicalDetectors() { return fLogicDetectors.size(); } + int getNoOfLogicalAsymDetectors() { return fLogicAsymDetectors.size(); } + int getFgbOffset() { return fFgbOffset; } + int getLgb() { return fLgb; } + int getBkgStartBin() { return fBkgStartBin; } + int getBkgEndBin() { return fBkgEndBin; } + PDetector* getDetector(int idx); + PDetector* getAsymDetector(int idx); + + private: + QString fName; + int fNoOfDetectors; + int fFgbOffset; + int fLgb; + int fBkgStartBin; + int fBkgEndBin; + + QVector fLogicDetectors; + QVector fLogicAsymDetectors; +}; + +//--------------------------------------------------------------------------- +class PInstrument +{ + public: + PInstrument(); + ~PInstrument() {} + + void setRunNameTemplate(QString str) { fRunNameTemplate = str; } + void setBeamline(QString str) { fBeamline = str; } + void setDataFileFormat(QString str) { fDataFileFormat = str; } + void setInstitue(QString str) { fInstitue = str; } + void setName(QString str) { fName = str; } + + void addSetupZF(PSetup zf) { fZF.push_back(zf); } + void addSetupTF(PSetup tf) { fTF.push_back(tf); } + void addSetupLF(PSetup lf) { fLF.push_back(lf); } + + QString getRunNameTemplate() { return fRunNameTemplate; } + QString getBeamline() { return fBeamline; } + QString getDataFileFormat() { return fDataFileFormat; } + QString getInstitute() { return fInstitue; } + QString getName() { return fName; } + + QVector getZFSetups() { return fZF; } + QVector getTFSetups() { return fTF; } + QVector getLFSetups() { return fLF; } + + PSetup* getZFSetup(QString name=""); + PSetup* getTFSetup(QString name=""); + PSetup* getLFSetup(QString name=""); + + private: + QString fRunNameTemplate; + QString fBeamline; + QString fDataFileFormat; + QString fInstitue; + QString fName; + + QVector fZF; + QVector fTF; + QVector fLF; +}; + +//--------------------------------------------------------------------------- +class PInstitute +{ + public: + PInstitute(); + ~PInstitute() {} + + void setName(QString str) { fName = str; } + void addInstrument(PInstrument instrument) { fInstrument.push_back(instrument); } + + QString getName() { return fName; } + QVector getInstruments() { return fInstrument; } + PInstrument *getInstrument(QString name); + + private: + QString fName; + QVector fInstrument; +}; + +#endif // _PINSTRUMENTDEF_H_ diff --git a/src/musredit_qt5/musrWiz/PMusrWiz.cpp b/src/musredit_qt5/musrWiz/PMusrWiz.cpp new file mode 100644 index 00000000..b374740d --- /dev/null +++ b/src/musredit_qt5/musrWiz/PMusrWiz.cpp @@ -0,0 +1,2573 @@ +/*************************************************************************** + + PMusrWiz.cpp + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + +***************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2007-2017 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 "musrWiz.h" +#include "PTheoTemplate.h" +#include "PMusrfitFunc.h" +#include "PMusrWiz.h" + +//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +/** + * @brief PMsrData::PMsrData + */ +PMsrData::PMsrData() +{ + fTemplate = -1; + + fMsrFileName = QString(""); + fRunNumber = -1; + fInstitute = "PSI"; + fInstrument = "HAL9500"; + fFitType = FIT_TYPE_SINGLE_HISTO; + fTypeOfMeasurement = MEASURE_UNDEF; + fT0Tag = T0_FROM_FILE; + fT0 = -1; + QDate date = QDate::currentDate(); + fYear = QString("%1").arg(date.year()); + + fPacking = 1; + fFitStart = 0.0; + fFitEnd = 10.0; + fCommands = ""; + + fTheo = ""; +} + +//------------------------------------------------------------------------- +/** + * @brief PMsrData::~PMsrData + */ +PMsrData::~PMsrData() +{ + +} + +//------------------------------------------------------------------------- +/** + * @brief PMsrData::getFitTypeString + * @return + */ +QString PMsrData::getFitTypeString() +{ + QString str("UnDef"); + + switch (fFitType) { + case FIT_TYPE_ASYMMETRY: + str = QString("Asymmetry"); + break; + case FIT_TYPE_ASYMMETRY_RRF: + str = QString("Asymmetry RRF"); + break; + case FIT_TYPE_SINGLE_HISTO: + str = QString("Single Histo"); + break; + case FIT_TYPE_SINGLE_HISTO_RRF: + str = QString("Single Histo RRF"); + break; + case FIT_TYPE_MU_MINUS: + str = QString("Mu Minus"); + break; + case FIT_TYPE_NONE_MUSR: + str = QString("None Musr"); + break; + case FIT_TYPE_UNDEF: + default: + break; + } + + return str; +} + +//------------------------------------------------------------------------- +/** + * @brief PMsrData::setParam + * @param idx + * @param param + */ +void PMsrData::setParam(int idx, PParam param) +{ + if (idx >= fParam.size()) + fParam.resize(idx+1); + + fParam[idx] = param; +} + +//------------------------------------------------------------------------- +/** + * @brief PMsrData::setMap + * @param idx + * @param map + */ +void PMsrData::setMap(int idx, PParam map) +{ + if (idx >= fMap.size()) + fMap.resize(idx+1); + + fMap[idx] = map; +} + +//------------------------------------------------------------------------- +/** + * @brief PMsrData::appendParam + * @param param + */ +void PMsrData::appendParam(QVector param) +{ + // check if parameter is aleady present. If yes, ignore it, otherwise add it + bool present = false; + for (int i=0; i map) +{ + // check if map is aleady present. If yes, replace it, otherwise add it + bool present = false; + for (int i=0; i fMap.size())) + return; + + fMap[idx].setName(name); +} + +//------------------------------------------------------------------------- +/** + * @brief PMsrData::setFunc + * @param funNo + * @param str + */ +void PMsrData::setFunc(int funNo, QString str) +{ + if (funNo < 0) + return; + + // check if not already present + for (int i=0; i fParam.size()) + return param; + + return fParam[idx]; +} + +//------------------------------------------------------------------------- +/** + * @brief PMsrData::getMap + * @param idx + * @return + */ +PParam PMsrData::getMap(int idx) +{ + PParam map; + + if (idx >= fMap.size()) + return map; + + return fMap[idx]; +} + +//------------------------------------------------------------------------- +/** + * @brief PMsrData::getFuncNo + * @param idx + * @return + */ +int PMsrData::getFuncNo(int idx) +{ + if ((idx < 0) || (idx >= fFunc.size())) + return -1; + + return fFunc[idx].number; +} + +//------------------------------------------------------------------------- +/** + * @brief PMsrData::isPresent + * @param funStr + * @return + */ +bool PMsrData::isPresent(const QString funStr) +{ + for (int i=0; i fParam[i+1].getNumber()) { + swap = fParam[i]; + fParam[i] = fParam[i+1]; + fParam[i+1] = swap; + swapped = true; + } + } + } + } else if (whichVec == "map") { + PParam swap; + while (swapped) { + swapped = false; + j++; + for (int i=0; i < fMap.size() - j; i++) { + if (fMap[i].getNumber() > fMap[i+1].getNumber()) { + swap = fMap[i]; + fMap[i] = fMap[i+1]; + fMap[i+1] = swap; + swapped = true; + } + } + } + } else if (whichVec == "func") { + PFunc swap; + while (swapped) { + swapped = false; + j++; + for (int i=0; i < fFunc.size() - j; i++) { + if (fFunc[i].number > fFunc[i+1].number) { + swap = fFunc[i]; + fFunc[i] = fFunc[i+1]; + fFunc[i+1] = swap; + swapped = true; + } + } + } + } +} + +//------------------------------------------------------------------------- +/** + * @brief PMsrData::removeFunc + * @param funList + */ +void PMsrData::removeFunc(QVector &funList) +{ + int idx; + for (int i=0; iused Theory"); + QPlainTextEdit *theoTextEdit = new QPlainTextEdit(theo); + theoTextEdit->setReadOnly(true); + QPlainTextEdit *funcTextEdit = 0; + if (!func.isEmpty()) { + funcTextEdit = new QPlainTextEdit(func); + funcTextEdit->setReadOnly(true); + } + QPushButton *cancel = new QPushButton("&Cancel"); + + QVBoxLayout *layout = new QVBoxLayout; + layout->addWidget(label); + layout->addWidget(theoTextEdit); + if (funcTextEdit) + layout->addWidget(funcTextEdit); + layout->addWidget(cancel); + + setLayout(layout); + + connect(cancel, SIGNAL(pressed()), this, SLOT(accept())); +} + +//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +/** + * @brief PIntroPage::PIntroPage + * @param data + * @param parent + */ +PIntroPage::PIntroPage(PAdmin *admin, PMsrData *data, QWidget *parent) : + QWizardPage(parent), + fAdmin(admin), + fMsrData(data) +{ + setTitle("

Introduction

"); + setSubTitle("This wizard will help you to create your msr-file."); + + fMsrFileName = new QLineEdit(); + fMsrFileName->setToolTip("enter msr-file name or leave it empty."); + fMsrFileName->setWhatsThis("If empty the file name will be generate,\nbased on the run number, the fit type\nand the type of measurement."); + + fYear = new QLineEdit(); + fYear->setValidator(new QIntValidator()); + QDate date = QDate::currentDate(); + fYear->setText(QString("%1").arg(date.year())); + fYear->setToolTip("year when the run took place."); + fYear->setWhatsThis("The year is used to generate\nthe RUN header information where\nmusrfit will look for the data."); + + fRunNumber = new QLineEdit(); + fRunNumber->setValidator(new QIntValidator()); + fRunNumber->setText(QString("%1").arg(fMsrData->getRunNumber())); + fRunNumber->setToolTip("enter the run number here."); + + fInstitute = new QComboBox(); + QStringList list = fAdmin->getInstituteList(); // get list form the instrument_def's + list.prepend("UnDef"); + fInstitute->addItems(list); + int idx = fInstitute->findText(fAdmin->getDefaultInstitute()); + if (idx != -1) + fInstitute->setCurrentIndex(idx); + + fInstrument = new QComboBox(); + list.clear(); + list << fAdmin->getInstrumentList(fMsrData->getInstitute()); + list.prepend("UnDef"); + fInstrument->addItems(list); + idx = fInstrument->findText(fAdmin->getDefaultInstrument()); + if (idx != -1) + fInstrument->setCurrentIndex(idx); + + fFitType = new QComboBox(); + list.clear(); + list << "UnDef" << "Single Histo" << "Single Histo RRF" << "Asymmetry" << "Asymmetry RRF" << "Mu Minus" << "None muSR"; + fFitType->addItems(list); + idx = fFitType->findText(fAdmin->getDefaultFitType()); + fFitType->setCurrentIndex(idx); + + fMeasurementType = new QComboBox(); + list.clear(); + list << "UnDef" << "ZF" << "TF" << "LF"; + fMeasurementType->addItems(list); + fMeasurementType->setCurrentIndex(fMsrData->getTypeOfMeasurement()); + + fT0 = new QComboBox(); + list.clear(); + list << "from data file" << "call musrT0" << "enter here"; + fT0->addItems(list); + fT0->setCurrentIndex(fMsrData->getT0Tag()); + fT0->setWhatsThis("choose if you want the t0's from the data file,\ncall musrT0 after the msr-files is generated,\nor enter the values within the wizard."); + + QFormLayout *layout = new QFormLayout; + + layout->addRow("Add msr-file name:", fMsrFileName); + layout->addRow("Year:", fYear); + layout->addRow("Run Number:", fRunNumber); + layout->addRow("Institute:", fInstitute); + layout->addRow("Instrument:", fInstrument); + layout->addRow("Fit Type:", fFitType); + layout->addRow("Type of Measurement:", fMeasurementType); + layout->addRow("T0's:", fT0); + + setLayout(layout); + + registerField("runNumber*", fRunNumber); + + QObject::connect(fInstitute, SIGNAL(activated(int)), this, SLOT(handleInstituteChanged(int))); + QObject::connect(fFitType, SIGNAL(activated(int)), this , SLOT(handleFitType(int))); + QObject::connect(fMeasurementType, SIGNAL(activated(int)), this, SLOT(checkSetup(int))); + QObject::connect(fT0, SIGNAL(activated(int)), this, SLOT(handleT0(int))); +} + +//------------------------------------------------------------------------- +void PIntroPage::handleInstituteChanged(int idx) +{ + QString str = fInstitute->itemText(idx); + QStringList list = fAdmin->getInstrumentList(str); + list.prepend("UnDef"); + + fInstrument->clear(); + fInstrument->addItems(list); +} + +//------------------------------------------------------------------------- +/** + * @brief PIntroPage::handleFitType + * @param idx + */ +void PIntroPage::handleFitType(int idx) +{ + if ( (idx != FIT_TYPE_SINGLE_HISTO) && + (idx != FIT_TYPE_ASYMMETRY) ){ + QMessageBox::warning(0, "WARNING", "Currently only fit type: single histo and asymmetry available."); + fFitType->setCurrentIndex(FIT_TYPE_SINGLE_HISTO); + } +} + +//------------------------------------------------------------------------- +/** + * @brief PIntroPage::checkSetup + * @param idx + */ +void PIntroPage::checkSetup(int idx) +{ + QString measure(""); + PInstrument *instru = fAdmin->getInstrument(fInstitute->currentText(), fInstrument->currentText()); + QVector setup; + switch (idx) { + case MEASURE_ZF: + setup = instru->getZFSetups(); + measure = "ZF"; + break; + case MEASURE_TF: + setup = instru->getTFSetups(); + measure = "TF"; + break; + case MEASURE_LF: + setup = instru->getLFSetups(); + measure = "LF"; + QMessageBox::information(0, "INFO", "Not yet implemented."); + break; + case MEASURE_UNDEF: + default: + break; + } + + if (setup.size() == 0) { + QString msg = QString("Didn't find any setup for:\nInstitute: %1\nInstrument: %2").arg(fInstitute->currentText()).arg(fInstrument->currentText()); + QMessageBox::critical(0, "ERROR", msg); + return; + } else if (setup.size() == 1) { + if (setup[0].getName() == "Default") { + fMsrData->setSetup("Default"); + return; + } + } + + QStringList items; + for (int i=0; isetSetup(setupName); + } +} + +//------------------------------------------------------------------------- +/** + * @brief PIntroPage::handleT0 + * @param idx + */ +void PIntroPage::handleT0(int idx) +{ + bool ok; + if (idx == T0_ENTER_WIZ) { + int t0 = QInputDialog::getInt(this, "Enter T0:", "T0:", 0, 0, 2147483647, 1, &ok); + if (ok) + fMsrData->setT0(t0); + } +} + +//------------------------------------------------------------------------- +/** + * @brief PIntroPage::nextId + * @return + */ +int PIntroPage::nextId() const +{ + return PMusrWiz::ePageTheory; +} + +//------------------------------------------------------------------------- +/** + * @brief PIntroPage::validatePage + * @return + */ +bool PIntroPage::validatePage() +{ + fMsrData->setMsrFileName(fMsrFileName->text()); + fMsrData->setYear(fYear->text()); + fMsrData->setRunNumber(fRunNumber->text().toInt()); + if (fInstitute->currentIndex() == INST_UNDEF) + return false; + fMsrData->setInstitute(fInstitute->currentText()); + if (fInstrument->currentIndex() == 0) // i.e. undefined + return false; + fMsrData->setInstrument(fInstrument->currentText()); + if (fFitType->currentIndex() == FIT_TYPE_UNDEF) + return false; + fMsrData->setFitType(fFitType->currentIndex()); + if (fMeasurementType->currentIndex() == MEASURE_UNDEF) + return false; + fMsrData->setTypeOfMeasurement(fMeasurementType->currentIndex()); + fMsrData->setT0Tag(fT0->currentIndex()); + + return true; +} + +//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +/** + * @brief PTheoPage::PTheoPage + * @param data + * @param parent + */ +PTheoPage::PTheoPage(PAdmin *admin, PMsrData *data, QWidget *parent) : + QWizardPage(parent), + fAdmin(admin), + fMsrData(data) +{ + fTheoBlockNo = 0; + + fTheoValid = false; + fHaveMap = false; + fHaveFunc = false; + + setTitle("

Theory

"); + QString str = QString("Now you will need to enter your theory - fit type: %1").arg(fMsrData->getFitTypeString()); + setSubTitle(str); + + fTheo = new QPlainTextEdit(); + fTheo->setWhatsThis("Enter the theory function here."); + + fEditTemplate = new QCheckBox("Edit Template"); + fEditTemplate->setToolTip("if checked, it allows to edit the template"); + fEditTemplate->hide(); + + fClearAll = new QPushButton(); + fClearAll->setText("Clear All"); + fClearAll->setToolTip("will clear the theory edit field."); + fClearAll->setWhatsThis("will clear the theory edit field."); + + fCheckTheo = new QPushButton(); + fCheckTheo->setText("Check"); + fCheckTheo->setToolTip("check if the theory is valid."); + fCheckTheo->setWhatsThis("Check is the theory string is valid."); + + QVector templ = fAdmin->getTheoTemplates(); + QVector funcs = fAdmin->getMusrfitFunc(); + fTheoSelect = new QComboBox(); + QStringList list; + // all the templates defined in musrfit_func.xml + for (int i=0; iaddItems(list); + fTheoSelect->setWhatsThis("select some predef. theory functions.\nFor all theory functions available check the help"); + + fTheoAdd = new QPushButton("Add"); + + QHBoxLayout *hLayout = new QHBoxLayout(); + hLayout->addWidget(fTheoSelect); + hLayout->addWidget(fTheoAdd); + + QFormLayout *layout = new QFormLayout; + layout->addRow("Enter Theory:", fTheo); + layout->addRow(fEditTemplate); + layout->addRow("Clear Theory:", fClearAll); + layout->addRow("Pre Def. Theory Select:", hLayout); + layout->addRow("Press for Validation:", fCheckTheo); + + setLayout(layout); + + QObject::connect(fEditTemplate, SIGNAL(stateChanged(int)), this, SLOT(templateState(int))); + QObject::connect(fClearAll, SIGNAL(clicked()), this, SLOT(clearAll())); + QObject::connect(fCheckTheo, SIGNAL(clicked()), this, SLOT(checkTheory())); + QObject::connect(fTheoAdd, SIGNAL(clicked()), this, SLOT(addTheory())); +} + +//------------------------------------------------------------------------- +void PTheoPage::initializePage() +{ + QString str = QString("Now you will need to enter your theory. Fit type: %1").arg(fMsrData->getFitTypeString()); + setSubTitle(str); +} + +//------------------------------------------------------------------------- +/** + * @brief PTheoPage::nextId + * @return + */ +int PTheoPage::nextId() const +{ + if (fHaveFunc) + return PMusrWiz::ePageFunctions; + else if (fHaveMap) + return PMusrWiz::ePageMaps; + else + return PMusrWiz::ePageParameters; +} + +//------------------------------------------------------------------------- +/** + * @brief PTheoPage::validatePage + * @return + */ +bool PTheoPage::validatePage() +{ + if (fTheo->toPlainText().isEmpty()) + return false; + + fMsrData->clearParam(); + fFunList.clear(); +// fMsrData->clearFunc(); + fMsrData->clearMap(); + + checkTheory(); + if (!fTheoValid) + return false; + + // transfer theory string + fMsrData->setTheory(fTheo->toPlainText()); + + // transfer found parameters + fMsrData->setParam(fParamList); + + // transfer found maps + fMsrData->setMap(fMapList); + + // transfer found functions + if (fHaveFunc) { + QString funStr; + for (int i=0; iisPresent(funStr)) { + funStr = QString("fun%1 = ??").arg(fFunList[i]); + fMsrData->setFunc(fFunList[i], funStr); + } + } + } + + // check if it is necessary to eliminate functions which are not present anymore + if (fFunList.size() != fMsrData->getNoOfFunc()) { + // remove functions from fMsrData which are NOT found in fFuncList + fMsrData->removeFunc(fFunList); + } + + return true; +} + +//------------------------------------------------------------------------- +/** + * + */ +void PTheoPage::templateState(int state) +{ + if (state == Qt::Checked) { + fTheo->setTextInteractionFlags(Qt::TextEditorInteraction); + fMsrData->setTemplate(-1); + fEditTemplate->hide(); + fEditTemplate->setCheckState(Qt::Unchecked); + } +} + +//------------------------------------------------------------------------- +/** + * + */ +void PTheoPage::clearAll() +{ + fTheo->clear(); + fTheo->setTextInteractionFlags(Qt::TextEditorInteraction); + fEditTemplate->hide(); + fMsrData->setTemplate(-1); +} + +//------------------------------------------------------------------------- +/** + * @brief PTheoPage::addTheory + */ +void PTheoPage::addTheory() +{ + int idx = fTheoSelect->currentIndex(); + bool isTempl = false; + QString item = fTheoSelect->currentText(); + if (item.startsWith("T:")) { + fEditTemplate->show(); + isTempl = true; + } + + QString theo(""); + bool emptyTheo = false; + if (fTheo->toPlainText().isEmpty()) { // empty theory + emptyTheo = true; + theo = getTheoryFunction(idx); + if (theo == "??") + return; + fTheo->setPlainText(theo); + } else { // theory already has some stuff + emptyTheo = false; + theo = getTheoryFunction(idx); + if (theo == "??") + return; + fTheo->appendPlainText("+"); + fTheo->appendPlainText(theo); + } + + if (isTempl && emptyTheo) { + fTheo->setTextInteractionFlags(Qt::TextBrowserInteraction); + fMsrData->setTemplate(idx); + fMsrData->setTemplate(fAdmin->getTheoTemplate(idx)); + } +} + +//------------------------------------------------------------------------- +/** + * @brief PTheoPage::checkTheory + */ +void PTheoPage::checkTheory() +{ + fTheoValid = false; + + // reset all lists: + fParamList.clear(); + fMapList.clear(); + fFunList.clear(); + + // check theory the following way: + // (i) make sure that line by line is a valid function + // (ii) make a collection of parameters with names suggested + // (iii) make a collection of functions if present + // (iv) make a map list if present + + QString str = fTheo->toPlainText(); + QStringList line = str.split("\n"); + bool ok = true; + PMusrfitFunc func; + for (int i=0; igetMusrfitFunc(strList[0]); + if (func.getName() == "UnDef") { // function not found + QString str = QString("**ERROR** in line %1, '%2' is not a recognized musrfit function.").arg(i+1).arg(line[i]); + QMessageBox::critical(0, "Check Theory", str); + // eventually it would be nice to highlight the faulty line + return; + } + ok = analyzeTokens(line[i], func.getNoOfParam()); + if (!ok) { + QString str = QString("**ERROR** in line %1.\n %2 takes %3 parameter.").arg(i+1).arg(func.getName()).arg(func.getNoOfParam()); + QMessageBox::critical(0, "Check Theory", str); + // eventually it would be nice to highlight the faulty line + return; + } + } + } + + if (fMapList.size() > 0) + fHaveMap = true; + else + fHaveMap = false; + + if (fFunList.size() > 0) + fHaveFunc = true; + else + fHaveFunc = false; + + fTheoValid = true; + + QObject *obj = sender(); + if (obj == fCheckTheo) + QMessageBox::information(0, "Check Theory", "Theory seems to be OK."); +} + +//------------------------------------------------------------------------- +/** + * @brief PTheoPage::getTheoryFunction + * @param idx + * @return + */ +QString PTheoPage::getTheoryFunction(int idx) +{ + QString result("??"); + QVector templ = fAdmin->getTheoTemplates(); + QVector func = fAdmin->getMusrfitFunc(); + static int mapCount = 1; + + if (idx >= templ.size()) { // deal with musrfit functions + if (idx >= templ.size() + func.size()) + return result; + result = func[idx-templ.size()].getAbbrv(); + for (int i=0; igetMusrfitFunc(theo); + if (func.getName() == "UnDef") { + // something is fundamentaly wrong + return; + } + + QString str; + par.setNumber(paramNo); + str = QString("%1_%2").arg(func.getFuncParam(paramIdx-1).getParamName()).arg(fTheoBlockNo); + par.setName(str); + par.setValue(func.getFuncParam(paramIdx-1).getParamValue()); + if (par.getName().contains("Ph_")) + par.setStep(10.0); + else + par.setStep(par.getValue() * 0.1); + + // keep parameter entry + fParamList.push_back(par); +} + +//------------------------------------------------------------------------- +/** + * @brief PTheoPage::dealWithMap + * @param theo + * @param mapNo + * @param paramIdx + */ +void PTheoPage::dealWithMap(QString theo, int mapNo, int paramIdx) +{ + // check if mapNo is already in the map list + for (int i=0; igetMusrfitFunc(theo); + if (func.getName() == "UnDef") { + // something is fundamentaly wrong + return; + } + + map.setNumber(mapNo); + str = QString("%1_%2").arg(func.getFuncParam(paramIdx-1).getParamName()).arg(mapNo); + map.setName(str); + fMapList.push_back(map); + } +} + +//------------------------------------------------------------------------- +/** + * @brief PTheoPage::dealWithFun + * @param funNo + */ +void PTheoPage::dealWithFun(int funNo) +{ + // check if funNo is already in the fun list + for (int i=0; iMaps"); + QString str = QString("Here you can fine tune your map template names. Fit type: %1").arg(fMsrData->getFitTypeString()); + setSubTitle(str); + + // sort maps + fMsrData->sort("map"); + + fMapPageLayout = new QFormLayout; + setLayout(fMapPageLayout); + + // make sure that the map list is empty + fMapGuiVec.clear(); + + // fill Map + PParamGui mapGui; + PParam map; + + // check if this is a template. If this is the case, fill fMsrData maps with the template info. + if (fMsrData->isTemplate()) { + PTheoTemplate templ = fMsrData->getTemplate(); + fMsrData->clearMap(); + for (int i=0; isetMap(i, templ.getMap(i)); + } + } + + for (int i=0; igetNoOfMap(); i++) { + map = fMsrData->getMap(i); + mapGui.paramName = new QLineEdit(map.getName()); + mapGui.paramVal = new QLineEdit("3.45"); + mapGui.paramStep = new QLineEdit("0.01"); + mapGui.paramBoundLow = new QLineEdit(); + mapGui.paramBoundHigh = new QLineEdit(); + fMapGuiVec.push_back(mapGui); + } + + QHBoxLayout *hLayout; + + // header + hLayout = new QHBoxLayout(); + mapGui.paramName = new QLineEdit("Name"); + mapGui.paramName->setReadOnly(true); + mapGui.paramVal = new QLineEdit("Value"); + mapGui.paramVal->setReadOnly(true); + mapGui.paramStep = new QLineEdit("Step"); + mapGui.paramStep->setReadOnly(true); + mapGui.paramBoundLow = new QLineEdit("BoundLow"); + mapGui.paramBoundLow->setReadOnly(true); + mapGui.paramBoundHigh = new QLineEdit("BoundHigh"); + mapGui.paramBoundHigh->setReadOnly(true); + hLayout->addWidget(mapGui.paramName); + hLayout->addWidget(mapGui.paramVal); + hLayout->addWidget(mapGui.paramStep); + hLayout->addWidget(mapGui.paramBoundLow); + hLayout->addWidget(mapGui.paramBoundHigh); + + fMapPageLayout->addRow("No", hLayout); + + for (int i=0; iaddWidget(fMapGuiVec[i].paramName); + hLayout->addWidget(fMapGuiVec[i].paramVal); + hLayout->addWidget(fMapGuiVec[i].paramStep); + hLayout->addWidget(fMapGuiVec[i].paramBoundLow); + hLayout->addWidget(fMapGuiVec[i].paramBoundHigh); + + fMapPageLayout->addRow(QString("map%1").arg(i+1), hLayout); + } + + fShowTheo = new QPushButton("Show &Theory"); + fMapPageLayout->addRow(fShowTheo); + + update(); + + connect(fShowTheo, SIGNAL(pressed()), this, SLOT(showTheo())); +} + +//------------------------------------------------------------------------- +/** + * @brief PMapPage::validatePage + * @return + */ +bool PMapPage::validatePage() +{ + // collect the map information + PParam map; + QString str; + double dval; + bool ok; + + for (int i=0; igetMap(i).getNumber()); + str = fMapGuiVec[i].paramName->text(); + map.setName(str); + + dval = fMapGuiVec[i].paramVal->text().toDouble(&ok); + if (ok) + map.setValue(dval); + else + map.setValue(0.0); + + dval = fMapGuiVec[i].paramStep->text().toDouble(&ok); + if (ok) + map.setStep(dval); + else + map.setStep(0.0); + + map.setPosErr("none"); + map.setBoundLow(fMapGuiVec[i].paramBoundLow->text()); + map.setBoundHigh(fMapGuiVec[i].paramBoundHigh->text()); + + fMsrData->setMap(i, map); + } + + return true; +} + +//------------------------------------------------------------------------- +/** + * @brief PMapPage::showTheo + */ +void PMapPage::showTheo() +{ + PShowTheo *showTheo = new PShowTheo(fMsrData->getTheory(), fMsrData->getFuncAll(), this); + showTheo->show(); +} + +//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +/** + * @brief PFuncPage::PFuncPage + */ +PFuncPage::PFuncPage(PMsrData *data, QWidget *parent) : + QWizardPage(parent), + fMsrData(data) +{ + setTitle("

Functions

"); + QString str = QString("Now you will need to enter your functions. Fit type: %1").arg(fMsrData->getFitTypeString()); + setSubTitle(str); + + fFunc = new QPlainTextEdit(); + fFunc->setWhatsThis("Enter the function(s) here."); + + fShowTheo = new QPushButton("Show &Theory"); + + QFormLayout *layout = new QFormLayout; + layout->addRow("Enter Function(s):", fFunc); + layout->addRow(fShowTheo); + + setLayout(layout); + + connect(fShowTheo, SIGNAL(pressed()), this, SLOT(showTheo())); +} + +//------------------------------------------------------------------------- +/** + * @brief PFuncPage::showTheo + */ +void PFuncPage::showTheo() +{ + PShowTheo *showTheo = new PShowTheo(fMsrData->getTheory(), "", this); + showTheo->show(); +} + +//------------------------------------------------------------------------- +/** + * @brief PFuncPage::nextId + * @return + */ +int PFuncPage::nextId() const +{ + if (fMsrData->getNoOfMap() > 0) + return PMusrWiz::ePageMaps; + else + return PMusrWiz::ePageParameters; +} + +//------------------------------------------------------------------------- +/** + * + */ +void PFuncPage::initializePage() +{ + QString str = QString("Now you will need to enter your functions. Fit type: %1").arg(fMsrData->getFitTypeString()); + setSubTitle(str); + + // check if this is a template. If this is the case, fill fMsrData functions with the template info. + if (fMsrData->isTemplate()) { + // fill functions according to the template + PTheoTemplate templ = fMsrData->getTemplate(); + fMsrData->clearFunc(); + for (int i=0; isetFunc(templ.getFuncNo(i), templ.getFunc(i)); + } + } + + fMsrData->sort("func"); + fFunc->clear(); + for (int i=0; igetNoOfFunc(); i++) { + fFunc->appendPlainText(fMsrData->getFunc(fMsrData->getFuncNo(i))); + } +} + +//------------------------------------------------------------------------- +/** + * + */ +void PFuncPage::cleanupPage() +{ + fMsrData->clearFunc(); + + // keep the function information + QString str = fFunc->toPlainText(); + QStringList funList = str.split("\n"); + int funNo=0; + for (int i=0; isetFunc(funNo, funList[i]); + } +} + +//------------------------------------------------------------------------- +/** + * @brief PFuncPage::validatePage + * @return + */ +bool PFuncPage::validatePage() +{ + QVector paramList; + QVector mapList; + + QString str = fFunc->toPlainText(); + QString sstr; + QString tok; + int idx = 0, parNo, mapNo; + bool ok; + + // collect potentially present parameters + PParam param; + while ((idx = str.indexOf("par", idx)) != -1) { + tok = ""; + idx += 3; + while (str[idx].isDigit()) { + tok += str[idx++]; + } + parNo = tok.toInt(&ok); + if (ok) { + param.setNumber(parNo); + sstr = QString("par%1").arg(parNo); + param.setName(sstr); + param.setValue(0.0); + param.setStep(0.1); + paramList.push_back(param); + } + } + fMsrData->appendParam(paramList); + + // collect potentially present maps + str = fFunc->toPlainText(); + PParam map; + idx = 0; + while ((idx = str.indexOf("map", idx)) != -1) { + tok = ""; + idx += 3; + while (str[idx].isDigit()) { + tok += str[idx++]; + } + mapNo = tok.toInt(&ok); + if (ok) { + map.setNumber(mapNo); + sstr = QString("map%1").arg(mapNo); + map.setName(sstr); + mapList.push_back(map); + } + } + fMsrData->appendMap(mapList); + + // keep the function information + str = fFunc->toPlainText(); + QStringList funList = str.split("\n"); + int funNo = 0; + fMsrData->clearFunc(); + for (int i=0; isetFunc(i, funList[i]); + } + + return true; +} + +//------------------------------------------------------------------------- +/** + * @brief PFuncPage::getFuncNo + * @param str + * @return + */ +int PFuncPage::getFuncNo(const QString str) +{ + QString strNo = str; + + // str should have to form fun = , where is an int + if (!str.startsWith("fun")) + return -1; + + strNo.remove(0, 3); // get rid of 'fun' + int idx = strNo.indexOf("="); + if (idx == -1) + return -1; + + strNo.remove(idx, str.length()-idx); + + bool ok; + int ival = strNo.toInt(&ok); + if (!ok) + return -1; + + return ival; +} + +//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +/** + * @brief PParamPage::PParamPage + */ +PParamPage::PParamPage(PMsrData *data, QWidget *parent) : + QWizardPage(parent), + fMsrData(data) +{ + fParameterPageLayout = 0; +} + +//------------------------------------------------------------------------- +/** + * @brief PParamPage::nextId + * @return + */ +int PParamPage::nextId() const +{ + return PMusrWiz::ePageFitInfo; +} + +//------------------------------------------------------------------------- +/** + * @brief PParamPage::initializePage + */ +void PParamPage::initializePage() +{ + // sort parameter vector + fMsrData->sort("param"); + + setTitle("

Fit Parameters

"); + QString str = QString("Here you can fine tune your parameters. Fit type: %1").arg(fMsrData->getFitTypeString()); + setSubTitle(str); + + fParameterPageLayout = new QFormLayout; + setLayout(fParameterPageLayout); + + // make sure that parameter list is empty + fParamGuiVec.clear(); + + // fill parameters + PParamGui paramGui; + PParam param; + + // if a template replace the parameters found so far by the template parameter settings + if (fMsrData->isTemplate()) { + fMsrData->clearParam(); + PTheoTemplate templ = fMsrData->getTemplate(); + for (int i=0; isetParam(i, templ.getParam(i)); + } + } + + for (int i=0; igetNoOfParam(); i++) { + param = fMsrData->getParam(i); + paramGui.paramName = new QLineEdit(param.getName()); + paramGui.paramVal = new QLineEdit(QString("%1").arg(param.getValue())); + paramGui.paramStep = new QLineEdit(QString("%1").arg(param.getStep())); + paramGui.paramBoundLow = new QLineEdit(); + paramGui.paramBoundHigh = new QLineEdit(); + fParamGuiVec.push_back(paramGui); + } + + QHBoxLayout *hLayout; + + // header + hLayout = new QHBoxLayout(); + paramGui.paramName = new QLineEdit("Name"); + paramGui.paramName->setReadOnly(true); + paramGui.paramVal = new QLineEdit("Value"); + paramGui.paramVal->setReadOnly(true); + paramGui.paramStep = new QLineEdit("Step"); + paramGui.paramStep->setReadOnly(true); + paramGui.paramBoundLow = new QLineEdit("BoundLow"); + paramGui.paramBoundLow->setReadOnly(true); + paramGui.paramBoundHigh = new QLineEdit("BoundHigh"); + paramGui.paramBoundHigh->setReadOnly(true); + hLayout->addWidget(paramGui.paramName); + hLayout->addWidget(paramGui.paramVal); + hLayout->addWidget(paramGui.paramStep); + hLayout->addWidget(paramGui.paramBoundLow); + hLayout->addWidget(paramGui.paramBoundHigh); + fParameterPageLayout->addRow("No", hLayout); + + for (int i=0; iaddWidget(fParamGuiVec[i].paramName); + hLayout->addWidget(fParamGuiVec[i].paramVal); + hLayout->addWidget(fParamGuiVec[i].paramStep); + hLayout->addWidget(fParamGuiVec[i].paramBoundLow); + hLayout->addWidget(fParamGuiVec[i].paramBoundHigh); + fParameterPageLayout->addRow(QString("%1").arg(i+1), hLayout); + } + + fShowTheo = new QPushButton("Show &Theory"); + fParameterPageLayout->addRow(fShowTheo); + + update(); + + connect(fShowTheo, SIGNAL(pressed()), this, SLOT(showTheo())); +} + +//------------------------------------------------------------------------- +/** + * @brief PParamPage::validatePage + * @return + */ +bool PParamPage::validatePage() +{ + PParam param; + QString str; + double dval; + bool ok; + + for (int i=0; igetParam(i).getNumber()); + str = fParamGuiVec[i].paramName->text(); + param.setName(str); + + dval = fParamGuiVec[i].paramVal->text().toDouble(&ok); + if (ok) + param.setValue(dval); + else + param.setValue(0.0); + + dval = fParamGuiVec[i].paramStep->text().toDouble(&ok); + if (ok) + param.setStep(dval); + else + param.setStep(0.0); + + param.setPosErr("none"); + param.setBoundLow(fParamGuiVec[i].paramBoundLow->text()); + param.setBoundHigh(fParamGuiVec[i].paramBoundHigh->text()); + + fMsrData->setParam(i, param); + } + + return true; +} + +//------------------------------------------------------------------------- +/** + * @brief PParamPage::showTheo + */ +void PParamPage::showTheo() +{ + PShowTheo *showTheo = new PShowTheo(fMsrData->getTheory(), fMsrData->getFuncAll(), this); + showTheo->show(); +} + +//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +/** + * @brief PFitInfoPage::PFitInfoPage + */ +PFitInfoPage::PFitInfoPage(PMsrData *data, QWidget *parent) : + QWizardPage(parent), + fMsrData(data) +{ + setTitle("

Fit Info

"); + QString str = QString("Collect necessary fit information. Fit type: %1").arg(fMsrData->getFitTypeString()); + setSubTitle(str); + + fFitRangeStart = new QLineEdit("0.0"); + fFitRangeStart->setValidator(new QDoubleValidator()); + fFitRangeEnd = new QLineEdit("9.0"); + fFitRangeEnd->setValidator(new QDoubleValidator()); + + QHBoxLayout *hLayout = new QHBoxLayout(); + hLayout->addWidget(fFitRangeStart); + hLayout->addWidget(fFitRangeEnd); + + fPacking = new QLineEdit("1"); + fPacking->setValidator(new QIntValidator()); + + fCommands = new QPlainTextEdit(); + fCommands->setPlainText("#MAX_LIKELIHOOD\nPRINT_LEVEL 2\nMINIMIZE\nMINOS\nSAVE"); + + QFormLayout *layout = new QFormLayout; + layout->addRow("Fit Range:", hLayout); + layout->addRow("Packing:", fPacking); + layout->addRow("Commands:", fCommands); + + setLayout(layout); +} + +//------------------------------------------------------------------------- +/** + * @brief PFitInfoPage::initializePage + */ +void PFitInfoPage::initializePage() +{ + QString str = QString("Collect necessary fit information. Fit type: %1").arg(fMsrData->getFitTypeString()); + setSubTitle(str); +} + +//------------------------------------------------------------------------- +/** + * @brief PFitInfoPage::nextId + * @return + */ +int PFitInfoPage::nextId() const +{ + return PMusrWiz::ePageConclusion; +} + +//------------------------------------------------------------------------- +/** + * @brief PFitInfoPage::validatePage + * @return + */ +bool PFitInfoPage::validatePage() +{ + bool ok; + int ival = fPacking->text().toInt(&ok); + if (ok) + fMsrData->setPacking(ival); + + double dval = fFitRangeStart->text().toDouble(&ok); + if (ok) + fMsrData->setFitStart(dval); + dval = fFitRangeEnd->text().toDouble(&ok); + if (ok) + fMsrData->setFitEnd(dval); + + fMsrData->setCmd(fCommands->toPlainText()); + + return true; +} + +//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +/** + * @brief PConclusionPage::PConclusionPage + */ +PConclusionPage::PConclusionPage(PAdmin *admin, PMsrData *data, QString *msrFilePath, QWidget *parent) : + QWizardPage(parent), + fMsrFilePath(msrFilePath), + fAdmin(admin), + fMsrData(data) +{ + setTitle("

Create

"); + setSubTitle("Now we create the msr-file."); + + QVBoxLayout *vLayout = new QVBoxLayout; + + fSaveAsMsrFile = new QPushButton("Save As (msr-file path)"); + fSaveAsTemplate = new QPushButton("Save As (template)"); + + vLayout->addWidget(fSaveAsMsrFile); + vLayout->addWidget(fSaveAsTemplate); + + setLayout(vLayout); + + connect(fSaveAsMsrFile, SIGNAL(pressed()), this, SLOT(saveAsMsrFile())); + connect(fSaveAsTemplate, SIGNAL(pressed()), this, SLOT(saveAsTemplate())); +} + +//------------------------------------------------------------------------- +void PConclusionPage::saveAsMsrFile() +{ + QString str = QFileDialog::getExistingDirectory(this, tr("Save in Directory"), "./", + QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); + if (!str.isEmpty()) + *fMsrFilePath = str; +} + +//------------------------------------------------------------------------- +/** + * + */ +void PConclusionPage::saveAsTemplate() +{ + bool newTemplate = false; + + QStringList list; + list << ""; + for (int i=0; igetTheoTemplateSize(); i++) + list << fAdmin->getTheoTemplate(i).getName(); + + bool ok; + QString result = QInputDialog::getItem(this, "Save As Template", "Template Name", list, 0, false, &ok); + if (!ok) + return; + + if (result == "") { + QString text(""); + result = QInputDialog::getText(this, "New Template Name", "Enter Template Name", QLineEdit::Normal, text, &ok); + if (!ok) + return; + // analyze the name: it has to start with 'T: ' + if (!result.startsWith("T: ")) + result.prepend("T: "); + newTemplate = true; + } + + // read musrfit_funcs.xml + QString path = std::getenv("HOME"); + QString pathFln = path + "/.musrfit/musrWiz/musrfit_funcs.xml"; + bool found = false; + if (QFile::exists(pathFln)) { + found = true; + } + if (!found) { + QMessageBox::critical(this, "ERROR", "Couldn't find musrfit_funcs.xml"); + return; + } + + QFile fin(pathFln); + if (!fin.open(QIODevice::ReadOnly | QIODevice::Text)) { + QMessageBox::critical(this, "ERROR", "Couldn't open musrfit_funcs.xml for reading."); + return; + } + + QTextStream in(&fin); + QString data = in.readAll(); + fin.close(); + + int idx, idxEnd; + QString insertStr, errMsg; + if (newTemplate) { // new template + // first find the proper place where to insert the new template + idx = data.lastIndexOf(""); + if (idx == -1) { + QMessageBox::critical(this, "ERROR", "Couldn't find last theo_template. Something is very wrong."); + return; + } + idx = data.indexOf(" + + + + T: 1 [exp x cos](TF) + a 1\nse 2\ntf fun1 4 + fun1=par3+map1 + + + + + + + + T: 2 [exp x cos](TF) + a 1\nse 2\ntf fun1 4\n+\na 5\nse 6\ntf fun1 7 + fun1=par3+map1 + + + + + + + + + + + T: 3 [exp x cos](TF) + a 1\nse 2\ntf fun1 4\n+\na 5\nse 6\ntf fun1 7\n+\na 8\nse 9\ntf fun1 10 + fun1=par3+map1 + + + + + + + + + + + + + + T: 1 [gauss x cos](TF) + a 1\nsg 2\ntf fun1 4 + fun1=par3+map1 + + + + + + + + T: 2 [gauss x cos](TF) + a 1\nsg 2\ntf fun1 4\n+\na 5\nsg 6\ntf fun1 7 + fun1=par3+map1 + + + + + + + + + + + T: 3 [gauss x cos](TF) + a 1\nsg 2\ntf fun1 4\n+\na 5\nsg 6\ntf fun1 7\n+\na 8\nsg 9\ntf fun1 10 + fun1=par3+map1 + + + + + + + + + + + + + + + + + + asymmetry + a + 1 + + Asym + 0.2 + + + + + simplExpo + se + 1 + + Lambda + 0.5 + + + + + simpleGss + sg + 1 + + Sigma + 0.5 + + + + + generExpo + ge + 2 + + Lambda + 0.5 + + + Beta + 1.5 + + + + + TFieldCos + tf + 2 + + Ph + 0.0 + y + + + Freq + 10.0 + + + + + internFld + if + 5 + + Weight + 0.66 + + + Ph + 0.0 + + + Freq + 10.0 + + + LambdaT + 0.5 + + + LambdaL + 0.1 + + + + + Bessel + b + 2 + + Ph + 0.0 + + + Freq + 10.0 + + + + + internBsl + ib + 5 + + Weight + 0.66 + + + Ph + 0.0 + + + Freq + 10.0 + + + LambdaT + 0.5 + + + LambdaL + 0.1 + + + + + statGssKT + stg + 1 + + Sigma + 0.3 + + + + + statGssKTLF + sgktlf + 2 + + Hopp + 0.1 + + + Sigma + 0.3 + + + + + dynGssKTLF + dgktlf + 3 + + Freq + 0.0 + + + Sigma + 0.3 + + + Gamma + 0.5 + + + + + statExpKT + sekt + 1 + + Lambda + 0.3 + + + + + statExpKTLF + sektlf + 2 + + Hopp + 0.1 + + + Lambda + 0.3 + + + + + dynExpKTLF + dektlf + 3 + + Freq + 0.1 + + + Lambda + 0.3 + + + Gamma + 0.5 + + + + + combiLGKT + lgkt + 2 + + Lambda + 0.2 + + + Sigma + 0.3 + + + + + strKT + skt + 2 + + Sigma + 0.3 + + + Beta + 2.0 + + + + + spinGlass + spg + 3 + + Lambda + 0.3 + + + Gamma + 0.1 + + + q + 0.8 + + + + + rdAnisoHf + rahf + 2 + + Nu + 1.5 + + + Lambda + 0.3 + + + + + abragam + ab + 2 + + Sigma + 0.5 + + + Gamma + 0.2 + + + + + skewedGss + skg + 4 + + Ph + 0.0 + + + Freq + 10.0 + + + SigmaPlus + 1.1 + + + SigmaMinus + 0.3 + + + + + staticNKZF + snkzf + 2 + + Delta + 0.5 + + + Rb + 0.2 + + + + + staticNKTF + snktf + 4 + + Ph + 0.0 + + + Frq + 10.5 + + + Delta + 0.5 + + + Rb + 0.2 + + + + + dynamicNKZF + dnkzf + 3 + + Delta + 0.5 + + + Rb + 0.2 + + + Hopp + 1.0 + + + + + dynamicNKTF + dnktf + 5 + + Ph + 0.0 + + + Frq + 10.5 + + + Delta + 0.5 + + + Rb + 0.2 + + + Hopp + 1.0 + + + + + muMinusExpTF + mmsetf + 6 + + N0 + 100.0 + + + Tau + 1.0 + + + Asym + 0.08 + + + Lambda + 1.1 + + + Ph + 0.0 + + + Frq + 10.2 + + + diff --git a/src/musredit_qt5/musrWiz/icons/musrWiz-22x22-dark.svg b/src/musredit_qt5/musrWiz/icons/musrWiz-22x22-dark.svg new file mode 100644 index 00000000..69f78f45 --- /dev/null +++ b/src/musredit_qt5/musrWiz/icons/musrWiz-22x22-dark.svg @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/src/musredit_qt5/musrWiz/icons/musrWiz-22x22.png b/src/musredit_qt5/musrWiz/icons/musrWiz-22x22.png new file mode 100644 index 00000000..17139ff3 Binary files /dev/null and b/src/musredit_qt5/musrWiz/icons/musrWiz-22x22.png differ diff --git a/src/musredit_qt5/musrWiz/icons/musrWiz-22x22.svg b/src/musredit_qt5/musrWiz/icons/musrWiz-22x22.svg new file mode 100644 index 00000000..94ad8bac --- /dev/null +++ b/src/musredit_qt5/musrWiz/icons/musrWiz-22x22.svg @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/src/musredit_qt5/musrWiz/icons/musrWiz-32x32-dark.svg b/src/musredit_qt5/musrWiz/icons/musrWiz-32x32-dark.svg new file mode 100644 index 00000000..05c4e5fa --- /dev/null +++ b/src/musredit_qt5/musrWiz/icons/musrWiz-32x32-dark.svg @@ -0,0 +1,160 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/src/musredit_qt5/musrWiz/icons/musrWiz-32x32.png b/src/musredit_qt5/musrWiz/icons/musrWiz-32x32.png new file mode 100644 index 00000000..5aa3f629 Binary files /dev/null and b/src/musredit_qt5/musrWiz/icons/musrWiz-32x32.png differ diff --git a/src/musredit_qt5/musrWiz/icons/musrWiz-32x32.svg b/src/musredit_qt5/musrWiz/icons/musrWiz-32x32.svg new file mode 100644 index 00000000..1b3cafe5 --- /dev/null +++ b/src/musredit_qt5/musrWiz/icons/musrWiz-32x32.svg @@ -0,0 +1,160 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/src/musredit_qt5/musrWiz/instrument_defs/instrument_def_isis.xml b/src/musredit_qt5/musrWiz/instrument_defs/instrument_def_isis.xml new file mode 100644 index 00000000..7b5e2135 --- /dev/null +++ b/src/musredit_qt5/musrWiz/instrument_defs/instrument_def_isis.xml @@ -0,0 +1,23 @@ + + + ISIS + + + HIFINNNNNNNN + HIFI + NEXUS + + 128 + 0 + 2047 + + + + + + + + + + + \ No newline at end of file diff --git a/src/musredit_qt5/musrWiz/instrument_defs/instrument_def_psi.xml b/src/musredit_qt5/musrWiz/instrument_defs/instrument_def_psi.xml new file mode 100644 index 00000000..f9aa287c --- /dev/null +++ b/src/musredit_qt5/musrWiz/instrument_defs/instrument_def_psi.xml @@ -0,0 +1,145 @@ + + + PSI + + + dYYYY/tdc/tdc_hifi_YYYY_NNNNN + PIE3 + PSI-MDU + + 16 + 50 + 409500 + 500 15000 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + YYYY/lemYY_his_NNNN + MUE4 + MUSR-ROOT + + 8 + 0 + 63000 + 200 1500 + + + + + + + + + 4 + 0 + 63000 + 200 1500 + + + + + + 4 + 0 + 63000 + 200 1500 + + + + 4 + 0 + 63000 + 200 1500 + + + + 8 + 0 + 63000 + 200 1500 + + + + 8 + 0 + 63000 + 200 1500 + + + + + + dYYYY/tdc/deltat_tdc_gps_NNNN + PIM3 + PSI-BIN + + 6 + 10 + 25600 + 50 300 + + + + + + + + + 6 + 10 + 25600 + 50 300 + + + + + + + + + 6 + 10 + 25600 + 50 300 + + + + 6 + 20 + 25600 + 50 300 + + + + diff --git a/src/musredit_qt5/musrWiz/musrWiz.cpp b/src/musredit_qt5/musrWiz/musrWiz.cpp new file mode 100644 index 00000000..57befbf5 --- /dev/null +++ b/src/musredit_qt5/musrWiz/musrWiz.cpp @@ -0,0 +1,138 @@ +#include +#include + +#include +#include +#include +#include + +#include "git-revision.h" +#include "musrWiz.h" +#include "PAdmin.h" +#include "PMusrWiz.h" + +//------------------------------------------------------------------- +/** + * + */ +void PParam::init() +{ + fName = QString("UnDef"); + fNumber = -1; + fValue = 0.0; + fStep = 0.0; + fPosErr = QString("UnDef"); + fBoundLow = QString("UnDef"); + fBoundHigh = QString("UnDef"); +} + +//------------------------------------------------------------------- +/** + * + */ +void musrWiz_syntax() +{ + std::cout << "usage: musrWiz [[--version | -v] | --debug [0|1|2] | --help]" << std::endl << std::endl; + std::cout << " --version | -v : print current git-version." << std::endl; + std::cout << " --debug 0 : dump's the instrument definition(s) at startup." << std::endl; + std::cout << " --debug 1 : dump's the musrfit functions at startup." << std::endl; + std::cout << " --debug 2 : dump's the musrfit functions and instrument definition(s) at startup." << std::endl; + std::cout << " --log : writes a log-file '.musrWiz.log' which contains the path-file-name of" << std::endl; + std::cout << " the created msr-file." << std::endl; + std::cout << " --help : shows this help." << std::endl << std::endl; +} + +//------------------------------------------------------------------- +/** + * + */ +int main(int argc, char *argv[]) +{ + int dump = -1; + bool logFile = false; + + if (argc == 2) { + if (!strcmp(argv[1], "--version") || (!strcmp(argv[1], "-v"))) { + std::cout << std::endl << "musrWiz - alpha - git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << std::endl << std::endl; + return 0; + } else if (!strcmp(argv[1], "--help")) { + musrWiz_syntax(); + return 0; + } else if (!strcmp(argv[1], "--log")) { // thought to be used from within musredit only + logFile = true; + } else { + musrWiz_syntax(); + return 0; + } + } else if (argc == 3) { + dump = atoi(argv[2]); + if ((dump < 0) || (dump > 2)) { + musrWiz_syntax(); + return 0; + } + } + + Q_INIT_RESOURCE(musrWiz); + + QApplication app(argc, argv); + + PAdmin *admin = new PAdmin(); + if (!admin->IsValid()) { + delete admin; + return 1; + } + admin->dump(dump); + + PMsrData *info = new PMsrData(); // this content will eventually be set by the xml-handler + + PMusrWiz wizard(admin, info); + wizard.show(); + + app.exec(); + + int result = wizard.result(); + + if (result == 1) { // if everything went fine up to this point + // check if a log-file shall be written + if (logFile) { + std::ofstream fout(".musrWiz.log", std::ofstream::out); + fout << "path-file-name: " << info->getMsrPathName().toLatin1().data() << "/" << info->getMsrFileName().toLatin1().data() << std::endl; + fout.close(); + } + + // check if musrt0 shall be called. If the option --log is set, only add musrt0 flag to in the .musrWiz.log file + if (info->getT0Tag() == T0_FROM_MUSR_T0) { + if (logFile) { + std::ofstream fout(".musrWiz.log", std::ofstream::app); + fout << "musrt0-tag: yes" << std::endl; + fout.close(); + } else { + QProcessEnvironment pe = QProcessEnvironment::systemEnvironment(); + QString musrt0Path = pe.value("MUSRFITPATH", "??"); + if (musrt0Path == "??") { // not found hence try ROOTSYS + musrt0Path = pe.value("ROOTSYS", "??"); + if (musrt0Path != "??") { + musrt0Path += "/bin"; + } + } + + if (musrt0Path != "??") { + QString musrt0 = musrt0Path + "/musrt0"; + QString pathFln = QString("%1/%2").arg(info->getMsrPathName()).arg(info->getMsrFileName()); + QStringList arguments; + arguments << pathFln; + QProcess::startDetached(musrt0, arguments, "./"); + } else { + QMessageBox::warning(0, "WARNING", "Couldn't find musrt0 :-(.\n Only the msr-file has been generated."); + } + } + } + } + + if (info) + delete info; + if (admin) + delete admin; + + return result; +} diff --git a/src/musredit_qt5/musrWiz/musrWiz.h b/src/musredit_qt5/musrWiz/musrWiz.h new file mode 100644 index 00000000..c04ff7a3 --- /dev/null +++ b/src/musredit_qt5/musrWiz/musrWiz.h @@ -0,0 +1,75 @@ +/*************************************************************************** + + musrWiz.h + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + +***************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2007-2016 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 _MUSRWIZ_H_ +#define _MUSRWIZ_H_ + +#include + +//------------------------------------------------------------------- +class PParam { + public: + PParam() { init(); } + ~PParam() {} + + void init(); + + QString getName() { return fName; } + int getNumber() { return fNumber; } + double getValue() { return fValue; } + double getStep() { return fStep; } + QString getPosErr() { return fPosErr; } + QString getBoundLow() { return fBoundLow; } + QString getBoundHigh() { return fBoundHigh; } + + void setName(QString str) { fName = str; } + void setNumber(int ival) { fNumber = ival; } + void setValue(double dval) { fValue = dval; } + void setStep(double dval) { fStep = dval; } + void setPosErr(QString str) { fPosErr = str; } + void setBoundLow(QString str) { fBoundLow = str; } + void setBoundHigh(QString str) { fBoundHigh = str; } + + private: + QString fName; + int fNumber; + double fValue; + double fStep; + QString fPosErr; + QString fBoundLow; + QString fBoundHigh; +}; + +//------------------------------------------------------------------- +typedef struct { + int number; + QString fun; +} PFunc; + +#endif // _MUSRWIZ_H_ diff --git a/src/musredit_qt5/musrWiz/musrWiz.pro b/src/musredit_qt5/musrWiz/musrWiz.pro new file mode 100644 index 00000000..579c923c --- /dev/null +++ b/src/musredit_qt5/musrWiz/musrWiz.pro @@ -0,0 +1,58 @@ +TEMPLATE = app +TARGET = musrWiz + +# install path for the application +unix:target.path = $$(ROOTSYS)/bin +INSTALLS += target + +# install path for the XML instrument def file +unix:instrumendDef.path = $$(HOME)/.musrfit/musrWiz +instrumendDef.files = instrument_defs/instrument_def_psi.xml +exists( $$(HOME)/.musrfit/musrWiz/instrument_def_psi.xml ) { + unix:instrumendDef.extra = mv $$(HOME)/.musrfit/musrWiz/instrument_def_psi.xml $$(HOME)/.musrfit/musrWiz/instrument_def_psi.xml.backup +} +INSTALLS += instrumendDef + +# install path for the XML musrfit funcs file +unix:musrfitFunc.path = $$(HOME)/.musrfit/musrWiz +musrfitFunc.files = func_defs/musrfit_funcs.xml +exists( $$(HOME)/.musrfit/musrWiz/musrfit_funcs.xml ) { + unix:musrfitFunc.extra = mv $$(HOME)/.musrfit/musrWiz/musrfit_funcs.xml $$(HOME)/.musrfit/musrWiz/musrfit_funcs.xml.backup +} +INSTALLS += musrfitFunc + +# install path for the musrWiz defaults XML +unix:musrWizDefault.path = $$(HOME)/.musrfit/musrWiz +musrWizDefault.files = musrWiz.xml +exists( $$(HOME)/.musrfit/musrWiz/musrWiz.xml ) { + unix:musrWizDefault.extra = mv $$(HOME)/.musrfit/musrWiz/musrWiz.xml $$(HOME)/.musrfit/musrWiz/musrWiz.xml.backup +} +INSTALLS += musrWizDefault + +CONFIG += qt \ + warn_on \ + release \ +#CONFIG += console + +QT += widgets +QT += xml +QT += core +QT += svg + +INCLUDEPATH += "../../include" + +HEADERS = musrWiz.h \ + PTheoTemplate.h \ + PMusrfitFunc.h \ + PInstrumentDef.h \ + PAdmin.h \ + PMusrWiz.h + +SOURCES = PTheoTemplate.cpp \ + PMusrfitFunc.cpp \ + PInstrumentDef.cpp \ + PAdmin.cpp \ + PMusrWiz.cpp \ + musrWiz.cpp + +RESOURCES = musrWiz.qrc diff --git a/src/musredit_qt5/musrWiz/musrWiz.qrc b/src/musredit_qt5/musrWiz/musrWiz.qrc new file mode 100644 index 00000000..fb9507f9 --- /dev/null +++ b/src/musredit_qt5/musrWiz/musrWiz.qrc @@ -0,0 +1,8 @@ + + + icons/musrWiz-22x22.svg + icons/musrWiz-22x22-dark.svg + icons/musrWiz-32x32.svg + icons/musrWiz-32x32-dark.svg + + diff --git a/src/musredit_qt5/musrWiz/musrWiz.xml b/src/musredit_qt5/musrWiz/musrWiz.xml new file mode 100644 index 00000000..1d0225c4 --- /dev/null +++ b/src/musredit_qt5/musrWiz/musrWiz.xml @@ -0,0 +1,8 @@ + + + + PSI + LEM + Single Histo + + diff --git a/src/musredit_qt5/musredit.pro b/src/musredit_qt5/musredit.pro new file mode 100644 index 00000000..4262cdaf --- /dev/null +++ b/src/musredit_qt5/musredit.pro @@ -0,0 +1,20 @@ +TEMPLATE = subdirs + +TARGET = musredit + +SUBDIRS = \ + musrStep \ + musrWiz \ + musredit + +# where to find the sub-projects - give the folders +musrStep.subdir = musrStep +musrWiz.subdir = musrWiz +musredit.subdir = musredit + +# what sub-project depends on others +musredit.depends = musrStep musrWiz + +# build the project sequentially as listed in SUBDIRS ! +CONFIG += ordered +