|
musredit 1.0.0
|
Dialog for executing and monitoring musrfit fitting processes. More...
#include <PFitOutputHandler.h>


Public Member Functions | |
| PFitOutputHandler (QString workingDirectory, QVector< QString > &cmd) | |
| Constructs the fit output handler dialog and starts the musrfit process. | |
| virtual | ~PFitOutputHandler () |
| Destructor - ensures the musrfit process is terminated. | |
Private Slots | |
| virtual void | readFromStdOut () |
| Slot to read and display standard output from musrfit. | |
| virtual void | readFromStdErr () |
| Slot to read and display standard error from musrfit. | |
| virtual void | quitButtonPressed () |
| Slot called when the Quit/Done button is pressed. | |
| virtual void | processDone (int exitCode, QProcess::ExitStatus exitStatus) |
| Slot called when the musrfit process finishes. | |
Private Attributes | |
Process Management | |
Members for managing the musrfit process. | |
| qint64 | fProcPID |
| Process ID of the running musrfit process. | |
| std::unique_ptr< QProcess > | fProc |
| QProcess object managing the musrfit execution. | |
UI Components | |
Dialog user interface elements. | |
| std::unique_ptr< QVBoxLayout > | fVbox |
| Vertical layout manager for dialog widgets. | |
| std::unique_ptr< QPlainTextEdit > | fOutput |
| Read-only text widget displaying musrfit output (max 1000 lines). | |
| std::unique_ptr< QPushButton > | fQuitButton |
| Button showing "Fitting..." during fit, "Done" after completion. | |
Dialog for executing and monitoring musrfit fitting processes.
This class provides a dialog that executes musrfit as a child process and displays its output in real-time. It allows users to monitor the fitting progress, including MINUIT2 iterations, chi-square values, warnings, and error messages.
Definition at line 97 of file PFitOutputHandler.h.
| PFitOutputHandler::PFitOutputHandler | ( | QString | workingDirectory, |
| QVector< QString > & | cmd ) |
Constructs the fit output handler dialog and starts the musrfit process.
Initializes the dialog UI and starts the musrfit fitting process. The constructor performs the following steps:
| workingDirectory | Directory where musrfit will run and save output files (mlog files, MINUIT2 output, etc.). |
| cmd | Command vector where cmd[0] is the musrfit executable path and subsequent elements are command-line arguments (msr filename, options). |
Definition at line 76 of file PFitOutputHandler.cpp.
|
virtual |
Destructor - ensures the musrfit process is terminated.
Performs cleanup by ensuring the musrfit child process is properly terminated. The termination sequence is:
This multi-stage approach ensures the process doesn't become orphaned, even if musrfit doesn't respond to normal termination signals (e.g., if stuck in a long calculation).
Definition at line 144 of file PFitOutputHandler.cpp.
|
privatevirtualslot |
Slot called when the musrfit process finishes.
Slot called when the musrfit process finishes execution.
| exitCode | The exit code returned by musrfit. |
| exitStatus | The exit status (normal or crash). |
This slot is connected to QProcess::finished signal and is called when musrfit terminates, whether normally or due to a crash. It updates the button text from "Fitting..." to "Done" to indicate the fit has completed.
If the process crashed (exitStatus == QProcess::CrashExit), a debug message is logged with the exit code for diagnostic purposes.
| exitCode | The exit code returned by musrfit (0 typically indicates success). |
| exitStatus | The exit status: QProcess::NormalExit for normal termination, QProcess::CrashExit if the process crashed. |
Definition at line 215 of file PFitOutputHandler.cpp.
|
privatevirtualslot |
Slot called when the Quit/Done button is pressed.
Handles user request to close the dialog. The behavior depends on whether the fit is still running:
After ensuring the process is stopped (or was already stopped), accepts the dialog (closes it with QDialog::Accepted result).
Definition at line 237 of file PFitOutputHandler.cpp.
|
privatevirtualslot |
Slot to read and display standard error from musrfit.
Slot to capture and display standard error from musrfit.
Reads all available data from the musrfit process's standard error stream and appends it to the text display widget. This slot is connected to the QProcess::readyReadStandardError signal and may be called multiple times as error output arrives in chunks.
Error output typically includes warnings about parameter bounds, convergence issues, file access problems, and other diagnostic messages.
Definition at line 193 of file PFitOutputHandler.cpp.
|
privatevirtualslot |
Slot to read and display standard output from musrfit.
Slot to capture and display standard output from musrfit.
Reads all available data from the musrfit process's standard output stream and appends it to the text display widget. This slot is connected to the QProcess::readyReadStandardOutput signal and may be called multiple times as output arrives in chunks during the fitting process.
The output typically includes MINUIT2 iteration progress, parameter values, and chi-square information.
Definition at line 174 of file PFitOutputHandler.cpp.
|
private |
Read-only text widget displaying musrfit output (max 1000 lines).
Definition at line 142 of file PFitOutputHandler.h.
|
private |
QProcess object managing the musrfit execution.
Definition at line 134 of file PFitOutputHandler.h.
|
private |
Process ID of the running musrfit process.
Definition at line 133 of file PFitOutputHandler.h.
|
private |
Button showing "Fitting..." during fit, "Done" after completion.
Definition at line 143 of file PFitOutputHandler.h.
|
private |
Vertical layout manager for dialog widgets.
Definition at line 141 of file PFitOutputHandler.h.