musredit 1.0.0
Loading...
Searching...
No Matches
PPrefsDialog Class Reference

Preferences dialog for configuring musredit and musrfit settings. More...

#include <PPrefsDialog.h>

Inheritance diagram for PPrefsDialog:
Collaboration diagram for PPrefsDialog:

Public Slots

void dumpAscii ()
 Slot: Handles ASCII dump checkbox selection.
 
void dumpRoot ()
 Slot: Handles ROOT dump checkbox selection.
 
void handleDefaultPaths ()
 Slot: Opens the default paths configuration dialog.
 
void numberOfThreadsChanged (int idx)
 Slot: called when the current index of the number of threads to be used has changed.
 

Public Member Functions

 PPrefsDialog (PAdmin *admin)
 Constructs the preferences dialog.
 
bool getMusrviewShowFourierFlag ()
 Returns the musrview Fourier display preference.
 
bool getMusrviewShowAvgFlag ()
 Returns the musrview average display preference.
 
bool getMusrviewShowOneToOneFlag ()
 Returns the musrview one-to-one plotting preference.
 
bool getKeepMinuit2OutputFlag ()
 Returns the MINUIT2 output preservation preference.
 
bool getTitleFromDataFileFlag ()
 Returns the title-from-data-file preference.
 
bool getEnableMusrT0Flag ()
 Returns the musrT0 enablement preference.
 
bool getKeepRunPerBlockChisqFlag ()
 Returns the per-run chi-square preference.
 
bool getEstimateN0Flag ()
 Returns the N0 estimation preference.
 
bool getYamlOutFlag ()
 Returns the YAML output preference.
 
bool getIgnoreThemeAutoDetection ()
 Returns the theme auto-detection override preference.
 
bool getDarkThemeIconsMenuFlag ()
 Returns the dark theme menu icons preference.
 
bool getDarkThemeIconsToolbarFlag ()
 Returns the dark theme toolbar icons preference.
 
bool getOneToOneFlag ()
 Returns the one-to-one plotting preference.
 
int getDump ()
 Returns the dump format preference.
 
int getTimeout ()
 Returns the fitting timeout preference.
 

Private Attributes

PAdminfAdmin
 Pointer to global administration object storing all preferences.
 

Detailed Description

Preferences dialog for configuring musredit and musrfit settings.

This dialog provides a centralized interface for managing all application preferences. Settings are organized into several categories:

Fitting and Output Options:
  • MINUIT2 output: Keep detailed MINUIT2 fitting output files
  • Dump format: ASCII or ROOT format for dumping fitted data
  • YAML output: Generate YAML format files for fit results
  • Per-run chi-square: Include chi-square values for individual runs
  • Estimate N0: Automatically estimate initial asymmetry from data
  • Timeout: Maximum fitting time in seconds (prevents infinite loops)
Data File Options:
  • Title from data file: Extract msr file title from data file headers
  • Enable musrT0: Use musrT0 tool for t0 determination
  • Default paths: Configure search paths for data files
Visualization (musrview) Options:
  • Show Fourier: Display Fourier transform plots by default
  • Show average: Display averaged data plots
  • One-to-one plotting: Direct data-to-theory comparison mode
Theme and Appearance:
  • Dark theme icons (menu): Use dark-themed icons in menus
  • Dark theme icons (toolbar): Use dark-themed icons in toolbar
  • Ignore theme auto-detection: Disable automatic theme detection
Mutual Exclusivity:
Some options are mutually exclusive:
  • ASCII dump and ROOT dump cannot both be enabled
  • These constraints are enforced through slot handlers

All preferences are stored in the PAdmin global administration object and persisted across application sessions.

Note
The dialog is modal, requiring user interaction before continuing.
Changes take effect after dialog acceptance (OK button).
Some settings (like theme changes) may require application restart.
See also
PAdmin Global preferences storage
PChangeDefaultPathsDialog For managing data file search paths

Definition at line 102 of file PPrefsDialog.h.

Constructor & Destructor Documentation

◆ PPrefsDialog()

PPrefsDialog::PPrefsDialog ( PAdmin * admin)

Constructs the preferences dialog.

Constructor - Initializes the preferences dialog.

Initializes the dialog with current preference values from the PAdmin administration object. Sets up UI controls, validators, and signal-slot connections for option interdependencies.

Parameters
adminPointer to the global PAdmin object containing current preference values. Must not be nullptr. The dialog reads from and writes to this object.
See also
PAdmin For the global preferences storage object

Sets up the preferences dialog user interface and populates all controls with current preference values from the PAdmin administration object. The initialization process includes:

  1. Safety Check: Validates that admin pointer is not nullptr
  2. UI Setup: Loads dialog layout from Qt Designer UI file
  3. Modal Configuration: Sets dialog as modal to ensure completion
  4. Preference Loading: Populates all UI controls with saved values
  5. Validators: Installs integer validator on timeout field
  6. Signal Connections: Establishes slot connections for UI interactions

Preference Categories and Initialization:

Theme Preferences:

  • Dark theme icons for menus (checked/unchecked state)
  • Dark theme icons for toolbars (checked/unchecked state)
  • Theme auto-detection override (checked/unchecked state)

Fitting Options:

  • Keep MINUIT2 output files (boolean checkbox)
  • Dump format selection (ASCII/ROOT, mutually exclusive)
  • Per-run block chi-square calculation (boolean checkbox)
  • Estimate N0 from data (boolean checkbox)
  • Fitting timeout in seconds (integer with validation)

Output Options:

  • Title extraction from data files (boolean checkbox)
  • YAML format output generation (boolean checkbox)

Data Processing:

  • Enable musrT0 tool for t0 determination (boolean checkbox)

Visualization (musrview):

  • Show Fourier transform plots by default (boolean checkbox)
  • Show averaged data plots (boolean checkbox)
  • Enable one-to-one plotting mode (boolean checkbox)

Dump Format Logic: The dump format checkboxes are handled with special logic to ensure mutual exclusivity:

  • If ASCII is set and ROOT is not: check ASCII only
  • If ROOT is set and ASCII is not: check ROOT only
  • Otherwise (both or neither set): uncheck both
Parameters
adminPointer to the global PAdmin administration object containing all current preference values. If nullptr, the constructor returns early without initializing the dialog (defensive programming).
Note
The timeout field accepts only integer input via QIntValidator.
The "Change Default Paths" button is connected to handleDefaultPaths() slot for managing data file search paths.
All checkboxes are initialized from PAdmin getter methods to ensure consistency with saved preferences.
See also
PAdmin Global preferences storage and management
setupUi() Qt Designer generated UI initialization
handleDefaultPaths() Slot for managing data file search paths

Definition at line 116 of file PPrefsDialog.cpp.

Member Function Documentation

◆ dumpAscii

void PPrefsDialog::dumpAscii ( )
slot

Slot: Handles ASCII dump checkbox selection.

Called when the "Dump ASCII" checkbox is toggled. If checked, automatically unchecks "Dump ROOT" since these formats are mutually exclusive.

See also
dumpRoot() Complementary slot for ROOT dump
getDump() Returns the selected dump format

Called when the "Dump ASCII" checkbox state changes. Enforces mutual exclusivity between ASCII and ROOT dump formats by automatically unchecking the ROOT dump checkbox when ASCII dump is selected.

ASCII Dump Format Details:

  • Produces human-readable text files with columnar data
  • Typical format: tab-separated or space-separated values
  • Output includes time bins, data values, theory values, errors
  • Suitable for plotting with gnuplot, Excel, Origin, or custom scripts
  • Files typically have .dat or .txt extensions

Mutual Exclusivity Rationale: Only one dump format can be active because musrfit's –dump option accepts a single format specification. Allowing both would create ambiguity about which format to use.

Note
This slot is typically connected to the clicked() or toggled() signal of the ASCII dump checkbox.
If the user wants both formats, they must run musrfit twice with different dump settings.
See also
dumpRoot() Complementary slot for ROOT dump format
getDump() Returns the selected dump format code

Definition at line 254 of file PPrefsDialog.cpp.

◆ dumpRoot

void PPrefsDialog::dumpRoot ( )
slot

Slot: Handles ROOT dump checkbox selection.

Called when the "Dump ROOT" checkbox is toggled. If checked, automatically unchecks "Dump ASCII" since these formats are mutually exclusive.

See also
dumpAscii() Complementary slot for ASCII dump
getDump() Returns the selected dump format

Called when the "Dump ROOT" checkbox state changes. Enforces mutual exclusivity between ROOT and ASCII dump formats by automatically unchecking the ASCII dump checkbox when ROOT dump is selected.

ROOT Dump Format Details:

  • Produces ROOT framework files (.root extension)
  • Contains structured data objects (TTree, TH1F, TGraph, etc.)
  • Enables advanced analysis with ROOT toolkit
  • Preserves full precision and metadata
  • Suitable for complex statistical analysis, histogramming, fitting
  • Can be opened with ROOT TBrowser or custom ROOT macros

ROOT Dump Advantages:

  • Maintains full numerical precision
  • Supports complex data structures
  • Integration with ROOT's analysis framework
  • Efficient storage for large datasets

Mutual Exclusivity Rationale: Only one dump format can be active because musrfit's –dump option accepts a single format specification. Allowing both would create ambiguity about which format to use.

Note
This slot is typically connected to the clicked() or toggled() signal of the ROOT dump checkbox.
ROOT must be installed and properly configured to read ROOT dump files.
If the user wants both formats, they must run musrfit twice with different dump settings.
See also
dumpAscii() Complementary slot for ASCII dump format
getDump() Returns the selected dump format code

Definition at line 296 of file PPrefsDialog.cpp.

◆ getDarkThemeIconsMenuFlag()

bool PPrefsDialog::getDarkThemeIconsMenuFlag ( )
inline

Returns the dark theme menu icons preference.

Indicates whether dark-themed icon variants should be used in application menus for better visibility on dark backgrounds.

Returns
true if dark theme menu icons should be used.

Definition at line 230 of file PPrefsDialog.h.

◆ getDarkThemeIconsToolbarFlag()

bool PPrefsDialog::getDarkThemeIconsToolbarFlag ( )
inline

Returns the dark theme toolbar icons preference.

Indicates whether dark-themed icon variants should be used in the application toolbar for better visibility on dark backgrounds.

Returns
true if dark theme toolbar icons should be used.

Definition at line 240 of file PPrefsDialog.h.

◆ getDump()

int PPrefsDialog::getDump ( )

Returns the dump format preference.

Returns the selected dump format preference.

Determines the format for dumping fitted data using musrfit's –dump option. The values are:

  • 0: No dumping
  • 1: ASCII format dump
  • 2: ROOT format dump
Returns
int Dump format code (0=none, 1=ASCII, 2=ROOT).
Note
ASCII and ROOT dump formats are mutually exclusive.
See also
dumpAscii() Enforces mutual exclusivity
dumpRoot() Enforces mutual exclusivity

Determines which data dump format is currently selected in the preferences dialog. This corresponds to musrfit's –dump command-line option, which controls how fitted data is exported for external analysis.

Return Values:

  • 0: No dumping - Fitted data is not exported to files
  • 1: ASCII dump - Data is written to human-readable text files with columnar format suitable for plotting tools like gnuplot or Excel
  • 2: ROOT dump - Data is written to ROOT framework files (.root) with structured histograms and trees for analysis with ROOT tools

Use Cases:

  • ASCII dump: Simple plotting, spreadsheet analysis, custom scripts
  • ROOT dump: Advanced analysis with ROOT framework, complex histogramming

The dump formats are mutually exclusive - only one can be active at a time. This exclusivity is enforced by the dumpAscii() and dumpRoot() slot methods.

Returns
int Dump format code:
  • 0 = no dump
  • 1 = ASCII format dump
  • 2 = ROOT format dump
Note
The ASCII format typically produces .dat files with tab-separated columns.
The ROOT format creates .root files with TTree and TH1 objects.
Dump files are created in the same directory as the msr file.
See also
dumpAscii() Slot that enforces mutual exclusivity with ROOT dump
dumpRoot() Slot that enforces mutual exclusivity with ASCII dump

Definition at line 214 of file PPrefsDialog.cpp.

◆ getEnableMusrT0Flag()

bool PPrefsDialog::getEnableMusrT0Flag ( )
inline

Returns the musrT0 enablement preference.

Indicates whether the musrT0 tool should be used for automatic t0 (time zero) determination from data files.

Returns
true if musrT0 tool should be enabled.

Definition at line 180 of file PPrefsDialog.h.

◆ getEstimateN0Flag()

bool PPrefsDialog::getEstimateN0Flag ( )
inline

Returns the N0 estimation preference.

Indicates whether initial asymmetry (N0) should be automatically estimated from data rather than using msr file values.

Returns
true if N0 should be estimated from data.

Definition at line 200 of file PPrefsDialog.h.

◆ getIgnoreThemeAutoDetection()

bool PPrefsDialog::getIgnoreThemeAutoDetection ( )
inline

Returns the theme auto-detection override preference.

Indicates whether automatic system theme detection should be ignored, allowing manual theme configuration.

Returns
true if automatic theme detection should be disabled.

Definition at line 220 of file PPrefsDialog.h.

◆ getKeepMinuit2OutputFlag()

bool PPrefsDialog::getKeepMinuit2OutputFlag ( )
inline

Returns the MINUIT2 output preservation preference.

Indicates whether detailed MINUIT2 fitting output files should be kept after fits complete. Useful for debugging fit convergence issues.

Returns
true if MINUIT2 output files should be preserved.

Definition at line 160 of file PPrefsDialog.h.

◆ getKeepRunPerBlockChisqFlag()

bool PPrefsDialog::getKeepRunPerBlockChisqFlag ( )
inline

Returns the per-run chi-square preference.

Indicates whether chi-square values for individual runs (in multi-run fits) should be calculated and reported separately.

Returns
true if per-run chi-square values should be calculated.

Definition at line 190 of file PPrefsDialog.h.

◆ getMusrviewShowAvgFlag()

bool PPrefsDialog::getMusrviewShowAvgFlag ( )
inline

Returns the musrview average display preference.

Indicates whether averaged data plots should be shown by default when opening data files in musrview.

Returns
true if average plots should be displayed by default.

Definition at line 140 of file PPrefsDialog.h.

◆ getMusrviewShowFourierFlag()

bool PPrefsDialog::getMusrviewShowFourierFlag ( )
inline

Returns the musrview Fourier display preference.

Indicates whether Fourier transform plots should be shown by default when opening data files in musrview.

Returns
true if Fourier plots should be displayed by default.

Definition at line 130 of file PPrefsDialog.h.

◆ getMusrviewShowOneToOneFlag()

bool PPrefsDialog::getMusrviewShowOneToOneFlag ( )
inline

Returns the musrview one-to-one plotting preference.

Indicates whether one-to-one (direct data-to-theory comparison) plotting mode should be used by default in musrview.

Returns
true if one-to-one plotting should be enabled by default.

Definition at line 150 of file PPrefsDialog.h.

◆ getOneToOneFlag()

bool PPrefsDialog::getOneToOneFlag ( )
inline

Returns the one-to-one plotting preference.

Alias for getMusrviewShowOneToOneFlag(). Indicates whether one-to-one plotting mode should be enabled.

Returns
true if one-to-one plotting should be enabled.
See also
getMusrviewShowOneToOneFlag() Primary method for this preference

Definition at line 252 of file PPrefsDialog.h.

◆ getTimeout()

int PPrefsDialog::getTimeout ( )
inline

Returns the fitting timeout preference.

Returns the maximum time (in seconds) that a fit should be allowed to run before being terminated. This prevents infinite loops or extremely slow fits from hanging the application.

Returns
int Timeout in seconds. Default is typically 3600 (1 hour).
Note
A value of 0 typically means no timeout (unlimited time).

Definition at line 283 of file PPrefsDialog.h.

◆ getTitleFromDataFileFlag()

bool PPrefsDialog::getTitleFromDataFileFlag ( )
inline

Returns the title-from-data-file preference.

Indicates whether msr file titles should be automatically extracted from data file headers when available.

Returns
true if titles should be read from data files.

Definition at line 170 of file PPrefsDialog.h.

◆ getYamlOutFlag()

bool PPrefsDialog::getYamlOutFlag ( )
inline

Returns the YAML output preference.

Indicates whether fit results should be exported in YAML format in addition to standard output formats.

Returns
true if YAML output files should be generated.

Definition at line 210 of file PPrefsDialog.h.

◆ handleDefaultPaths

void PPrefsDialog::handleDefaultPaths ( )
slot

Slot: Opens the default paths configuration dialog.

Slot: Opens the default search paths configuration dialog.

Called when the "Change Default Search Paths" button is clicked. Launches the PChangeDefaultPathsDialog to allow users to configure the directories where musrfit searches for data files.

See also
PChangeDefaultPathsDialog For the paths management dialog

Called when the "Change Default Search Paths" button is clicked. Launches the PChangeDefaultPathsDialog which allows users to configure the list of directories where musrfit searches for data files when run numbers are specified without full paths.

Default Search Paths Purpose: When an msr file specifies a run number (e.g., "RUN 2024 PSI" without a full path), musrfit searches through the default path list to locate the corresponding data file. This eliminates the need to specify full paths in every msr file.

Typical Search Path Examples:

  • /data/musr/2024/
  • ~/experiments/muon/raw/
  • /mnt/analysis/data/
  • //network/share/musr-data/

Dialog Workflow:

  1. User clicks "Change Default Search Paths" button
  2. PChangeDefaultPathsDialog opens showing current path list
  3. User adds, removes, or reorders paths
  4. If user accepts (OK), changes are saved to PAdmin
  5. If user cancels, changes are discarded

The dialog is created using std::unique_ptr for automatic memory management. When the dialog goes out of scope, it is automatically destroyed.

Note
Changes to default paths take effect immediately for subsequent file operations.
The path list is typically stored in the user's configuration file and persists across application sessions.
Order matters: paths are searched in the order they appear in the list.
The dialog currently executes but performs no action on acceptance (empty if block) - paths are managed within the child dialog.
See also
PChangeDefaultPathsDialog For the search paths management interface
PAdmin For the global storage of default search paths

Definition at line 344 of file PPrefsDialog.cpp.

◆ numberOfThreadsChanged

void PPrefsDialog::numberOfThreadsChanged ( int idx)
slot

Slot: called when the current index of the number of threads to be used has changed.

Slot: keeps the number of threads to be used for fitting.

Parameters
idxindex of the comboBox

Definition at line 359 of file PPrefsDialog.cpp.

Member Data Documentation

◆ fAdmin

PAdmin* PPrefsDialog::fAdmin
private

Pointer to global administration object storing all preferences.

Definition at line 329 of file PPrefsDialog.h.


The documentation for this class was generated from the following files: