improve doxygen documentation of PMusrCanvas.*

This commit is contained in:
2025-11-14 09:36:18 +01:00
parent 218e2125e3
commit 26d55bc048
2 changed files with 235 additions and 67 deletions

View File

@@ -50,65 +50,89 @@
#include "PRunListCollection.h"
#endif // __MAKECLING__
#define YINFO 0.1
#define YTITLE 0.95
#define XTHEO 0.75
//--------------------------------------------------------------------------
// Layout constants
//--------------------------------------------------------------------------
#define YINFO 0.1 ///< Y-position of info/legend pad
#define YTITLE 0.95 ///< Y-position of title pad
#define XTHEO 0.75 ///< X-position of theory pad
//--------------------------------------------------------------------------
// Current Plot Views
#define PV_DATA 1
#define PV_FOURIER_REAL 2
#define PV_FOURIER_IMAG 3
#define PV_FOURIER_REAL_AND_IMAG 4
#define PV_FOURIER_PWR 5
#define PV_FOURIER_PHASE 6
#define PV_FOURIER_PHASE_OPT_REAL 7
//--------------------------------------------------------------------------
#define PV_DATA 1 ///< Plot view: time-domain data
#define PV_FOURIER_REAL 2 ///< Plot view: real part of Fourier transform
#define PV_FOURIER_IMAG 3 ///< Plot view: imaginary part of Fourier transform
#define PV_FOURIER_REAL_AND_IMAG 4 ///< Plot view: real and imaginary parts simultaneously
#define PV_FOURIER_PWR 5 ///< Plot view: power spectrum
#define PV_FOURIER_PHASE 6 ///< Plot view: phase spectrum
#define PV_FOURIER_PHASE_OPT_REAL 7 ///< Plot view: phase-optimized real part
// Canvas menu id's
#define P_MENU_ID_DATA 10001
#define P_MENU_ID_FOURIER 10002
#define P_MENU_ID_DIFFERENCE 10003
#define P_MENU_ID_AVERAGE 10004
#define P_MENU_ID_EXPORT_DATA 10005
//--------------------------------------------------------------------------
// Canvas menu IDs
//--------------------------------------------------------------------------
#define P_MENU_ID_DATA 10001 ///< Menu ID for Data view
#define P_MENU_ID_FOURIER 10002 ///< Menu ID for Fourier submenu
#define P_MENU_ID_DIFFERENCE 10003 ///< Menu ID for Difference view (data-theory)
#define P_MENU_ID_AVERAGE 10004 ///< Menu ID for Average view
#define P_MENU_ID_EXPORT_DATA 10005 ///< Menu ID for Export Data function
#define P_MENU_PLOT_OFFSET 1000
#define P_MENU_PLOT_OFFSET 1000 ///< Offset for plot-specific menu IDs
#define P_MENU_ID_FOURIER_REAL 100
#define P_MENU_ID_FOURIER_IMAG 101
#define P_MENU_ID_FOURIER_REAL_AND_IMAG 102
#define P_MENU_ID_FOURIER_PWR 103
#define P_MENU_ID_FOURIER_PHASE 104
#define P_MENU_ID_FOURIER_PHASE_OPT_REAL 105
#define P_MENU_ID_FOURIER_PHASE_PLUS 106
#define P_MENU_ID_FOURIER_PHASE_MINUS 107
//--------------------------------------------------------------------------
// Fourier submenu IDs
//--------------------------------------------------------------------------
#define P_MENU_ID_FOURIER_REAL 100 ///< Fourier menu: real part
#define P_MENU_ID_FOURIER_IMAG 101 ///< Fourier menu: imaginary part
#define P_MENU_ID_FOURIER_REAL_AND_IMAG 102 ///< Fourier menu: real and imaginary
#define P_MENU_ID_FOURIER_PWR 103 ///< Fourier menu: power spectrum
#define P_MENU_ID_FOURIER_PHASE 104 ///< Fourier menu: phase spectrum
#define P_MENU_ID_FOURIER_PHASE_OPT_REAL 105 ///< Fourier menu: phase-optimized real
#define P_MENU_ID_FOURIER_PHASE_PLUS 106 ///< Fourier menu: increment phase
#define P_MENU_ID_FOURIER_PHASE_MINUS 107 ///< Fourier menu: decrement phase
//------------------------------------------------------------------------
/**
* <p>
* \brief Helper class for managing plot axis ranges.
*
* Stores and manages X and Y axis ranges for plots, allowing explicit
* range specification from MSR file PLOT blocks or automatic range
* determination based on data.
*/
class PMusrCanvasPlotRange : public TObject
{
public:
/// Default constructor
PMusrCanvasPlotRange();
/// Destructor
virtual ~PMusrCanvasPlotRange() {}
/// Sets X-axis range and marks it as present
virtual void SetXRange(Double_t xmin, Double_t xmax);
/// Sets Y-axis range and marks it as present
virtual void SetYRange(Double_t ymin, Double_t ymax);
/// Returns true if X-axis range has been explicitly set
virtual Bool_t IsXRangePresent() { return fXRangePresent; }
/// Returns true if Y-axis range has been explicitly set
virtual Bool_t IsYRangePresent() { return fYRangePresent; }
/// Returns minimum X value
virtual Double_t GetXmin() { return fXmin; }
/// Returns maximum X value
virtual Double_t GetXmax() { return fXmax; }
/// Returns minimum Y value
virtual Double_t GetYmin() { return fYmin; }
/// Returns maximum Y value
virtual Double_t GetYmax() { return fYmax; }
private:
Bool_t fXRangePresent;
Bool_t fYRangePresent;
Double_t fXmin;
Double_t fXmax;
Double_t fYmin;
Double_t fYmax;
Bool_t fXRangePresent; ///< Flag: true if X-range explicitly set
Bool_t fYRangePresent; ///< Flag: true if Y-range explicitly set
Double_t fXmin; ///< Minimum X value
Double_t fXmax; ///< Maximum X value
Double_t fYmin; ///< Minimum Y value
Double_t fYmax; ///< Maximum Y value
ClassDef(PMusrCanvasPlotRange, 1)
};
@@ -197,42 +221,137 @@ typedef std::vector<PMusrCanvasAsciiDump> PMusrCanvasAsciiDumpVector;
//--------------------------------------------------------------------------
/**
* <p>The preprocessor tag __MAKECLING__ is used to hide away from rootcling
* the overly complex spirit header files.
* \brief ROOT-based canvas for interactive visualization of muSR data and fits.
*
* PMusrCanvas provides comprehensive visualization capabilities for muSR data analysis:
*
* **Display Modes:**
* - Time-domain data with fitted theory curves
* - Difference plots (data - theory)
* - Fourier transforms (real, imaginary, power, phase)
* - Phase-optimized real Fourier spectra
* - Averaged data across multiple runs
*
* **Supported Fit Types:**
* - Single histogram fits
* - Asymmetry fits (forward-backward, alpha-beta-LR)
* - Beta-NMR asymmetry
* - Non-muSR data (generic X-Y plots with errors)
*
* **Interactive Features:**
* - Menu-driven view switching (Data/Fourier/Difference/Average)
* - Keyboard shortcuts for quick navigation
* - Phase adjustment for Fourier transforms
* - Data export to ASCII format
* - Graphics export (EPS, PDF, PNG, etc.)
* - Automatic timeout for batch processing
*
* **Canvas Layout:**
* The canvas is divided into several pads:
* - Title pad: Displays MSR file title
* - Data/Theory pad: Main plotting area for histograms/graphs
* - Parameter pad: Shows fitted parameter values
* - Theory pad: Lists theory functions used in fit
* - Info/Legend pad: Displays run information and legend
*
* **Integration:**
* - Reads MSR files via PMsrHandler
* - Accesses fit results via PRunListCollection
* - Uses ROOT's TCanvas and graphics primitives
* - Supports both interactive and batch modes
*
* \note The preprocessor tag __MAKECLING__ is used to hide complex
* Boost Spirit headers from rootcling during dictionary generation
*
* \see PMsrHandler for MSR file management
* \see PRunListCollection for fit results
* \see PMsrFourierStructure for Fourier transform parameters
*/
class PMusrCanvas : public TObject, public TQObject
{
public:
/// Default constructor
PMusrCanvas();
//----------------------------------------------------------------------
/**
* \brief Basic constructor for canvas without custom markers/colors.
*
* \param number Plot number from MSR file PLOT block
* \param title Canvas title
* \param wtopx X-position of canvas window (pixels)
* \param wtopy Y-position of canvas window (pixels)
* \param ww Canvas width (pixels)
* \param wh Canvas height (pixels)
* \param batch If true, run in batch mode (no GUI)
* \param fourier If true, start with Fourier view instead of time domain
* \param avg If true, start with averaged view
* \param theoAsData If true, calculate theory only at data points
*/
PMusrCanvas(const Int_t number, const Char_t* title,
Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh, const Bool_t batch,
const Bool_t fourier=false, const Bool_t avg=false, const Bool_t theoAsData=false);
//----------------------------------------------------------------------
/**
* \brief Full constructor with Fourier defaults and custom markers/colors.
*
* \param number Plot number from MSR file PLOT block
* \param title Canvas title
* \param wtopx X-position of canvas window (pixels)
* \param wtopy Y-position of canvas window (pixels)
* \param ww Canvas width (pixels)
* \param wh Canvas height (pixels)
* \param fourierDefault Default Fourier transform parameters
* \param markerList Vector of ROOT marker styles for plots
* \param colorList Vector of ROOT color indices for plots
* \param batch If true, run in batch mode (no GUI)
* \param fourier If true, start with Fourier view instead of time domain
* \param avg If true, start with averaged view
* \param theoAsData If true, calculate theory only at data points
*/
PMusrCanvas(const Int_t number, const Char_t* title,
Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh,
PMsrFourierStructure fourierDefault,
const PIntVector markerList, const PIntVector colorList, const Bool_t batch,
const Bool_t fourier=false, const Bool_t avg=false, const Bool_t theoAsData=false);
/// Destructor - cleans up all histograms, graphs, and ROOT objects
virtual ~PMusrCanvas();
/// Returns true if canvas initialized successfully
virtual Bool_t IsValid() { return fValid; }
#ifndef __MAKECLING__
/// Sets the MSR file handler for accessing fit parameters and configuration
virtual void SetMsrHandler(PMsrHandler *msrHandler);
/// Sets the run list collection for accessing fit data and results
virtual void SetRunListCollection(PRunListCollection *runList) { fRunList = runList; }
#endif // __MAKECLING__
/// Sets timeout in seconds after which Done signal is emitted (0=no timeout)
virtual void SetTimeout(Int_t ival);
/// Updates parameter and theory display pads with current fit results
virtual void UpdateParamTheoryPad();
/// Updates main data/theory plotting pad
virtual void UpdateDataTheoryPad();
/// Updates info/legend pad with run information
virtual void UpdateInfoPad();
/// ROOT signal emitted when canvas is closed or timeout occurs
virtual void Done(Int_t status=0); // *SIGNAL*
/// ROOT slot handling keyboard commands (e.g., 'f' for Fourier, 'd' for data)
virtual void HandleCmdKey(Int_t event, Int_t x, Int_t y, TObject *selected); // SLOT
/// ROOT slot handling menu selections
virtual void HandleMenuPopup(Int_t id); // SLOT
/// ROOT slot called when this is the last canvas being closed
virtual void LastCanvasClosed(); // SLOT
/// ROOT slot called when canvas window is closed
virtual void WindowClosed(); // SLOT
/// Saves canvas to graphics file and emits Done signal
virtual void SaveGraphicsAndQuit(Char_t *fileName, Char_t *graphicsFormat);
/// Exports displayed data to ASCII file
virtual void ExportData(const Char_t *fileName);
private: