102 QPlainTextEdit(parent),
166 QString str = toPlainText();
167 int idx = str.indexOf(
"fittype");
172 for (
int i=idx+7; i<str.length(); i++) {
174 idx = QString(str[i]).toInt(&ok);
222 std::unique_ptr<PGetTitleBlockDialog> dlg = std::make_unique<PGetTitleBlockDialog>(
fAdmin->getHelpUrl(
"title"));
227 if (dlg->exec() == QDialog::Accepted) {
228 QString title = dlg->getTitle();
229 insertPlainText(title+
"\n");
240 std::unique_ptr<PGetParameterBlockDialog> dlg = std::make_unique<PGetParameterBlockDialog>(
fAdmin->getHelpUrl(
"parameters"));
245 if (dlg->exec() == QDialog::Accepted) {
246 insertPlainText(dlg->getParams());
307 QString str =
"????";
310 for (
unsigned int i=0; i<
fAdmin->getTheoryCounts(); i++) {
311 if (name ==
fAdmin->getTheoryItem(i)->label) {
325 str = theoItem->
name +
" ";
326 if (theoItem->
name ==
"userFcn") {
327 str +=
"libMyLibrary.so TMyFunction ";
331 for (
int i=0; i<theoItem->
params; i++) {
332 str += QString(
"%1").arg(i+1) +
" ";
341 insertPlainText(str);
351 std::unique_ptr<PGetTheoryBlockDialog> dlg = std::make_unique<PGetTheoryBlockDialog>(
fAdmin,
fAdmin->getHelpUrl(
"theory"));
356 if (dlg->exec() == QDialog::Accepted) {
357 insertPlainText(dlg->getTheoryBlock());
358 insertPlainText(
"\n");
369 std::unique_ptr<PGetFunctionsBlockDialog> dlg = std::make_unique<PGetFunctionsBlockDialog>(
fAdmin->getHelpUrl(
"functions"));
374 if (dlg->exec() == QDialog::Accepted) {
375 insertPlainText(dlg->getFunctionsBlock());
376 insertPlainText(
"\n\n");
387 std::unique_ptr<PGetAsymmetryRunBlockDialog> dlg = std::make_unique<PGetAsymmetryRunBlockDialog>(
fAdmin->getHelpUrl(
"run"));
392 if (dlg->exec() == QDialog::Accepted) {
393 QString str, workStr;
394 bool valid =
true, present =
true;
399 str += dlg->getRunHeaderInfo();
402 str +=
"fittype 2 (asymmetry fit)\n";
405 workStr = dlg->getAlphaParameter(present);
411 workStr = dlg->getBetaParameter(present);
417 workStr = dlg->getMap(valid);
421 QMessageBox::critical(
this,
"ERROR",
422 "Given map not valid, will add a default map line",
423 QMessageBox::Ok, QMessageBox::NoButton);
424 str +=
"map 0 0 0 0 0 0 0 0 0 0\n";
428 str += dlg->getForward();
431 str += dlg->getBackward();
434 workStr = dlg->getBackground(valid);
437 QMessageBox::critical(
this,
"ERROR",
438 "Either <b>background</b> or <b>backgr.fix</b> is needed!\nWill set <b>background</b> to 0..10, please correct!",
439 QMessageBox::Ok, QMessageBox::NoButton);
443 workStr = dlg->getData(valid);
447 QMessageBox::critical(
this,
"ERROR",
448 "Not all Data entries are present.Fix is needed!\nWill not set anything!",
449 QMessageBox::Ok, QMessageBox::NoButton);
453 workStr = dlg->getT0(present);
457 QMessageBox::warning(
this,
"ERROR",
458 "T0's not given, assume that they are present in the data file!",
459 QMessageBox::Ok, QMessageBox::NoButton);
463 workStr = dlg->getFitRange(valid);
466 QMessageBox::critical(
this,
"ERROR",
467 "No valid fit range is given.Fix is needed!\nWill add a default one!",
468 QMessageBox::Ok, QMessageBox::NoButton);
472 workStr = dlg->getPacking(present);
475 QMessageBox::critical(
this,
"ERROR",
476 "No valid packing/binning is given.Fix is needed!\nWill add a default one!",
477 QMessageBox::Ok, QMessageBox::NoButton);
481 insertPlainText(str);
492 std::unique_ptr<PGetSingleHistoRunBlockDialog> dlg = std::make_unique<PGetSingleHistoRunBlockDialog>(
fAdmin->getHelpUrl(
"run"));
497 if (dlg->exec() == QDialog::Accepted) {
498 QString str, workStr;
499 bool valid =
true, present =
true;
504 str += dlg->getRunHeaderInfo();
507 str +=
"fittype 0 (single histogram fit)\n";
510 workStr = dlg->getMap(valid);
514 QMessageBox::critical(
this,
"ERROR",
515 "Given map not valid, will add a default map line",
516 QMessageBox::Ok, QMessageBox::NoButton);
517 str +=
"map 0 0 0 0 0 0 0 0 0 0\n";
521 str += dlg->getForward();
524 str += dlg->getNorm();
527 workStr = dlg->getMuonLifetimeParam(present);
533 workStr = dlg->getLifetimeCorrection(present);
539 workStr = dlg->getBackground(valid);
542 QMessageBox::critical(
this,
"ERROR",
543 "Either <b>background</b>, <b>backgr.fix</b>, or <b>backgr.fit</b> is needed!\nWill set <b>background</b> to 0..10, please correct!",
544 QMessageBox::Ok, QMessageBox::NoButton);
548 workStr = dlg->getT0(present);
552 QMessageBox::warning(
this,
"ERROR",
553 "T0's not given, assume that they are present in the data file!",
554 QMessageBox::Ok, QMessageBox::NoButton);
558 workStr = dlg->getData(valid);
562 QMessageBox::critical(
this,
"ERROR",
563 "Not all Data entries are present.Fix is needed!\nWill not set anything!",
564 QMessageBox::Ok, QMessageBox::NoButton);
568 workStr = dlg->getFitRange(valid);
571 QMessageBox::critical(
this,
"ERROR",
572 "No valid fit range is given.Fix is needed!\nWill add a default one!",
573 QMessageBox::Ok, QMessageBox::NoButton);
577 workStr = dlg->getPacking(present);
580 QMessageBox::critical(
this,
"ERROR",
581 "No valid packing/binning is given.Fix is needed!\nWill add a default one!",
582 QMessageBox::Ok, QMessageBox::NoButton);
586 insertPlainText(str);
596 std::unique_ptr<PGetNonMusrRunBlockDialog> dlg = std::make_unique<PGetNonMusrRunBlockDialog>(
fAdmin->getHelpUrl(
"run"));
601 if (dlg->exec() == QDialog::Accepted) {
602 QString str, workStr;
608 str += dlg->getRunHeaderInfo();
611 str +=
"fittype 8 (non musr fit)\n";
614 workStr = dlg->getMap(valid);
618 QMessageBox::critical(
this,
"ERROR",
619 "Given map not valid, will add a default map line",
620 QMessageBox::Ok, QMessageBox::NoButton);
621 str +=
"map 0 0 0 0 0 0 0 0 0 0\n";
625 workStr = dlg->getXYData(valid);
629 QMessageBox::critical(
this,
"ERROR",
630 "Not all xy-data entries are present.Fix is needed!\nWill not set anything!",
631 QMessageBox::Ok, QMessageBox::NoButton);
635 workStr = dlg->getFitRange(valid);
638 QMessageBox::critical(
this,
"ERROR",
639 "No valid fit range is given.Fix is needed!\nWill add a default one!",
640 QMessageBox::Ok, QMessageBox::NoButton);
644 str +=
"packing 1\n";
647 insertPlainText(str);
703 insertPlainText(
"###############################################################\n");
704 insertPlainText(
"COMMANDS\n");
705 insertPlainText(
"SET BATCH\n");
706 insertPlainText(
"STRATEGY 1\n");
707 insertPlainText(
"MINIMIZE\n");
708 insertPlainText(
"#MINOS\n");
709 insertPlainText(
"SAVE\n");
710 insertPlainText(
"END RETURN\n\n");
720 std::unique_ptr<PGetFourierBlockDialog> dlg = std::make_unique<PGetFourierBlockDialog>(
fAdmin->getHelpUrl(
"fourier"));
725 if (dlg->exec() == QDialog::Accepted) {
726 insertPlainText(dlg->getFourierBlock()+
"\n");
737 std::unique_ptr<PGetPlotBlockDialog> dlg = std::make_unique<PGetPlotBlockDialog>(
fAdmin->getHelpUrl(
"plot"));
742 if (dlg->exec() == QDialog::Accepted) {
743 insertPlainText(dlg->getPlotBlock()+
"\n");
811 QDateTime dt = QDateTime::currentDateTime();
812 insertPlainText(
"###############################################################\n");
813 insertPlainText(
"STATISTIC --- " + dt.toString(
"yyyy-MM-dd hh:mm:ss") +
"\n");
814 insertPlainText(
"chisq = ????, NDF = ????, chisq/NDF = ????\n\n");
Administration and configuration management for musredit.
Dialog for creating asymmetry RUN blocks in msr files.
Dialog for creating FOURIER blocks in msr files.
Dialog for creating FUNCTIONS blocks in msr files.
Dialog for creating non-muSR RUN blocks in msr files.
Dialog for creating FITPARAMETER blocks in msr files.
Dialog for creating PLOT blocks in msr files.
Dialog for creating single histogram RUN blocks in msr files.
Dialog for creating THEORY blocks in msr files.
Dialog for creating and editing TITLE blocks in msr files.
Definition of the PMsrHighlighter class for musredit.
Enhanced text editor widget for editing msr files in musredit.
Central administration class for musredit configuration management.
Custom syntax highlighter for .msr (musrfit configuration) file syntax.
void insertTheoryBlock()
Slot: Inserts a THEORY block via dialog.
void insertPlotBlock()
Slot: Inserts a PLOT block via dialog.
void insertFourierBlock()
Slot: Inserts a FOURIER block via dialog.
void insertFunctionBlock()
Slot: Inserts a FUNCTIONS block via dialog.
void insertTitle()
Slot: Inserts a title block via dialog.
PAdmin * fAdmin
Pointer to administration object with theory functions, help URLs, and configuration.
void insertParameterBlock()
Slot: Inserts a FITPARAMETER block via dialog.
void insertNonMusrRunBlock()
Slot: Inserts a non-µSR RUN block via dialog.
void insertStatisticBlock()
Slot: Inserts a default STATISTIC block.
void insertTheoryFunction(QString name)
Slot: Inserts a specific theory function.
void insertCommandBlock()
Slot: Inserts a default COMMANDS block.
PSubTextEdit(PAdmin *admin=0, QWidget *parent=0)
Constructs the enhanced text editor.
int getFitType()
Retrieves the fit type from the current msr file content.
void insertSingleHistRunBlock()
Slot: Inserts a single histogram RUN block via dialog.
void insertAsymRunBlock()
Slot: Inserts an asymmetry RUN block via dialog.
Structure holding information about a musrfit theory function.
QString name
Internal function name used in msr files (e.g., "asymmetry", "simplExpo").
QString comment
Human-readable description of the theory function.
int params
Number of parameters required by this theory function.