musrfit 1.10.0
PFourierCanvas Class Reference

#include <PFourierCanvas.h>

Inheritance diagram for PFourierCanvas:
Collaboration diagram for PFourierCanvas:

Public Member Functions

 PFourierCanvas ()
 
 PFourierCanvas (std::vector< PFourier * > &fourier, PIntVector dataSetTag, const Char_t *title, const Bool_t showAverage, const Bool_t showAveragePerDataSet, const Int_t fourierPlotOpt, Double_t fourierXrange[2], Double_t phase, Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh, const Bool_t batch)
 
 PFourierCanvas (std::vector< PFourier * > &fourier, PIntVector dataSetTag, const Char_t *title, const Bool_t showAverage, const Bool_t showAveragePerDataSet, const Int_t fourierPlotOpt, Double_t fourierXrange[2], Double_t phase, Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh, const PIntVector markerList, const PIntVector colorList, const Bool_t batch)
 
virtual void Done (Int_t status=0)
 
virtual void HandleCmdKey (Int_t event, Int_t x, Int_t y, TObject *selected)
 
virtual void HandleMenuPopup (Int_t id)
 
virtual void LastCanvasClosed ()
 
virtual void UpdateFourierPad ()
 
virtual void UpdateInfoPad ()
 
virtual Bool_t IsValid ()
 
virtual void SetTimeout (Int_t ival)
 
virtual void SaveGraphicsAndQuit (const Char_t *fileName)
 
virtual void ExportData (const Char_t *pathFileName)
 

Private Member Functions

virtual void CreateXaxisTitle ()
 Creates X-axis label based on unit type (Gauss/Tesla/MHz/Mc/s)
 
virtual void CreateStyle ()
 Initializes ROOT plotting style (colors, fonts, margins, etc.)
 
virtual void InitFourierDataSets ()
 Generates all Fourier histograms (Re/Im/Pwr/Phase) from PFourier objects.
 
virtual void InitFourierCanvas (const Char_t *title, Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh)
 
virtual void CleanupAverage ()
 Deletes averaged histogram data to free memory.
 
virtual void HandleAverage ()
 Computes averaged Fourier spectra across runs or per dataset.
 
virtual void CalcPhaseOptReal ()
 Calculates phase-optimized real Fourier for all datasets.
 
virtual void PlotFourier ()
 Draws individual Fourier spectra (non-averaged view)
 
virtual void PlotFourierPhaseValue ()
 Displays current phase value as text overlay on canvas.
 
virtual void PlotAverage ()
 Draws averaged Fourier spectra (averaged view modes)
 
virtual void IncrementFourierPhase ()
 Increases phase by 5° and redraws Re/Im spectra.
 
virtual void DecrementFourierPhase ()
 Decreases phase by 5° and redraws Re/Im spectra.
 
virtual Double_t GetMaximum (TH1F *histo, Double_t xmin=-1.0, Double_t xmax=-1.0)
 
virtual Double_t GetMinimum (TH1F *histo, Double_t xmin=-1.0, Double_t xmax=-1.0)
 
virtual Double_t GetInterpolatedValue (TH1F *histo, Double_t xVal)
 
virtual TString GetDataSetName (TString title)
 

Private Attributes

Int_t fTimeout
 timeout after which the Done signal should be emited. If timeout <= 0, no timeout is taking place
 
Bool_t fBatchMode
 musrview in ROOT batch mode
 
Bool_t fValid
 if true, everything looks OK
 
Bool_t fAveragedView
 tag showing that the averaged view for ALL data or normal view should be presented.
 
Bool_t fAveragedViewPerDataSet
 tag showing that the averaged view for individual data sets or normal view should be presented.
 
PIntVector fDataSetTag
 vector holding the data set tags
 
Int_t fCurrentPlotView
 tag showing what the current plot view is: real, imag, power, phase, ...
 
Double_t fInitialXRange [2]
 keeps the initial x-range
 
Double_t fInitialYRange [2]
 keeps the initial y-range
 
TString fTitle
 
TString fXaxisTitle
 
std::vector< PFourier * > fFourier
 keeps all the Fourier data, ownership is with the caller
 
PFourierCanvasDataList fFourierHistos
 keeps all the Fourier histos
 
PFourierCanvasDataList fFourierAverage
 keeps the average of the Fourier histos
 
Double_t fCurrentFourierPhase
 keeps the current Fourier phase (real/imag)
 
std::unique_ptr< TLatex > fCurrentFourierPhaseText
 used in Re/Im Fourier to show the current phase in the pad
 
std::unique_ptr< TStyle > fStyle
 A collection of all graphics attributes.
 
std::unique_ptr< TTimer > fTimeoutTimer
 timeout timer in order to terminate if no action is taking place for too long
 
PIntVector fMarkerList
 list of markers
 
PIntVector fColorList
 list of colors
 
TRootCanvas * fImp
 ROOT native GUI version of main window with menubar and drawing area.
 
TGMenuBar * fBar
 menu bar
 
TGPopupMenu * fPopupMain
 popup menu MusrFT in the main menu bar
 
std::unique_ptr< TGPopupMenu > fPopupFourier
 popup menu of the MusrFT/Fourier sub menu
 
std::unique_ptr< TCanvas > fMainCanvas
 main canvas
 
std::unique_ptr< TPaveText > fTitlePad
 title pad used to display a title
 
std::unique_ptr< TPad > fFourierPad
 fourier pad used to display the fourier
 
std::unique_ptr< TLegend > fInfoPad
 info pad used to display a legend of the data plotted
 
std::unique_ptr< TLegend > fLegAvgPerDataSet
 legend used for averaged per data set view
 

Detailed Description

Interactive ROOT canvas for visualizing μSR Fourier transform spectra.

PFourierCanvas provides a sophisticated GUI for displaying and analyzing Fourier-transformed μSR data with multiple viewing modes:

  • Real spectrum (absorption mode)
  • Imaginary spectrum (dispersion mode)
  • Real + Imaginary overlay
  • Power spectrum (magnitude)
  • Phase spectrum
  • Phase-optimized real spectrum

Key features:

  • Multi-run visualization with color/marker coding
  • Interactive phase adjustment (±5° increments)
  • Automatic averaging across all runs or per dataset
  • Export to data files
  • Batch mode for non-interactive operation
  • Customizable markers and colors
  • Menu-driven interface with keyboard shortcuts

Usage modes:

  • Interactive: Full GUI with menus for exploring spectra
  • Batch: Automated plot generation for scripts
  • Individual: Display each run separately
  • Averaged: Show ensemble average across all data
  • Per-dataset average: Average within grouped datasets

Architecture: Uses ROOT TQObject for signal/slot mechanism, enabling clean event handling and timeout functionality.

See also
PFourier
PFourierCanvasDataSet

Definition at line 137 of file PFourierCanvas.h.

Constructor & Destructor Documentation

◆ PFourierCanvas() [1/3]

PFourierCanvas::PFourierCanvas ( )

Default constructor - creates empty canvas.

Initializes internal state with default values. Not typically used directly; prefer constructors with data parameters.

◆ PFourierCanvas() [2/3]

PFourierCanvas::PFourierCanvas ( std::vector< PFourier * > & fourier,
PIntVector dataSetTag,
const Char_t * title,
const Bool_t showAverage,
const Bool_t showAveragePerDataSet,
const Int_t fourierPlotOpt,
Double_t fourierXrange[2],
Double_t phase,
Int_t wtopx,
Int_t wtopy,
Int_t ww,
Int_t wh,
const Bool_t batch )

Constructor with automatic marker/color generation.

Creates interactive Fourier canvas with randomly generated markers and colors for each data set.

Parameters
fourierVector of PFourier objects containing transformed data
dataSetTagVector of dataset identifiers for grouping runs
titleCanvas window title
showAverageIf true, display average across all runs
showAveragePerDataSetIf true, average within each dataset group
fourierPlotOptInitial plot mode (real/imag/power/phase/etc.)
fourierXrangeX-axis range [min, max] in output units (G/T/MHz)
phaseInitial phase offset in degrees for Re/Im display
wtopxX position of canvas window (pixels)
wtopyY position of canvas window (pixels)
wwCanvas width (pixels)
whCanvas height (pixels)
batchIf true, run in batch mode (no GUI interaction)

◆ PFourierCanvas() [3/3]

PFourierCanvas::PFourierCanvas ( std::vector< PFourier * > & fourier,
PIntVector dataSetTag,
const Char_t * title,
const Bool_t showAverage,
const Bool_t showAveragePerDataSet,
const Int_t fourierPlotOpt,
Double_t fourierXrange[2],
Double_t phase,
Int_t wtopx,
Int_t wtopy,
Int_t ww,
Int_t wh,
const PIntVector markerList,
const PIntVector colorList,
const Bool_t batch )

Constructor with explicit marker/color specification.

Creates interactive Fourier canvas with user-defined visual styling for each data set. Provides full control over plot appearance.

Parameters
fourierVector of PFourier objects containing transformed data
dataSetTagVector of dataset identifiers for grouping runs
titleCanvas window title
showAverageIf true, display average across all runs
showAveragePerDataSetIf true, average within each dataset group
fourierPlotOptInitial plot mode (real/imag/power/phase/etc.)
fourierXrangeX-axis range [min, max] in output units (G/T/MHz)
phaseInitial phase offset in degrees for Re/Im display
wtopxX position of canvas window (pixels)
wtopyY position of canvas window (pixels)
wwCanvas width (pixels)
whCanvas height (pixels)
markerListROOT marker styles (20-30) for each dataset
colorListROOT color indices for each dataset
batchIf true, run in batch mode (no GUI interaction)

References status.

Member Function Documentation

◆ CalcPhaseOptReal()

void PFourierCanvas::CalcPhaseOptReal ( )
privatevirtual

Calculates phase-optimized real Fourier for all datasets.

calculate the phase opt. real FT

Definition at line 1519 of file PFourierCanvas.cpp.

References fColorList, fFourier, fFourierHistos, fInitialXRange, and fMarkerList.

Referenced by PlotAverage(), and PlotFourier().

◆ CleanupAverage()

void PFourierCanvas::CleanupAverage ( )
privatevirtual

Deletes averaged histogram data to free memory.

Cleanup average Fourier data sets.

Definition at line 1208 of file PFourierCanvas.cpp.

References fFourierAverage.

Referenced by HandleAverage(), HandleCmdKey(), HandleMenuPopup(), and InitFourierDataSets().

◆ CreateStyle()

void PFourierCanvas::CreateStyle ( )
privatevirtual

Initializes ROOT plotting style (colors, fonts, margins, etc.)

Set styles for the canvas. Perhaps one could transfer them to the startup-file in the future.

Definition at line 940 of file PFourierCanvas.cpp.

References fStyle.

◆ CreateXaxisTitle()

void PFourierCanvas::CreateXaxisTitle ( )
privatevirtual

Creates X-axis label based on unit type (Gauss/Tesla/MHz/Mc/s)

Creates the x-axis title based on the Fourier units used.

Definition at line 913 of file PFourierCanvas.cpp.

References fFourier, FOURIER_UNIT_CYCLES, FOURIER_UNIT_FREQ, FOURIER_UNIT_GAUSS, FOURIER_UNIT_TESLA, and fXaxisTitle.

◆ DecrementFourierPhase()

void PFourierCanvas::DecrementFourierPhase ( )
privatevirtual

Decreases phase by 5° and redraws Re/Im spectra.

Decrements the Fourier phase and recalculate the real/imaginary part of the Fourier transform.

Definition at line 1959 of file PFourierCanvas.cpp.

References fCurrentFourierPhase, fCurrentPlotView, fFourierHistos, FOURIER_PLOT_PHASE, FOURIER_PLOT_POWER, and PlotFourierPhaseValue().

Referenced by HandleCmdKey(), and HandleMenuPopup().

◆ Done()

void PFourierCanvas::Done ( Int_t status = 0)
virtual

Signal emitted when user closes canvas or timeout expires.

This signal notifies parent applications that the canvas is terminating. Used for cleanup and application flow control.

Parameters
statusExit status code (0 = normal, non-zero = error)

Emits Done signal to notify parent application of canvas closure.

This ROOT signal mechanism allows parent objects to connect cleanup handlers or application flow logic. Typically called when:

Parameters
statusExit status: 0=normal, non-zero=error/abort

Example connection:

PFourierCanvas *canvas = new PFourierCanvas(...);
QObject::connect(canvas, SIGNAL(Done(Int_t)), app, SLOT(Quit()));
virtual void Done(Int_t status=0)
See also
LastCanvasClosed()
SaveGraphicsAndQuit()

Definition at line 265 of file PFourierCanvas.cpp.

References status.

Referenced by HandleCmdKey(), LastCanvasClosed(), and SaveGraphicsAndQuit().

◆ ExportData()

void PFourierCanvas::ExportData ( const Char_t * pathFileName)
virtual

Exports Fourier spectrum data to ASCII file.

Writes frequency/field values and corresponding spectrum amplitudes in columnar format for external analysis.

Parameters
pathFileNameOutput data file path (typically .dat extension)

Exports currently displayed Fourier spectrum to ASCII data file.

Writes frequency/field values and corresponding spectrum amplitudes in columnar text format suitable for:

  • External plotting tools (Origin, MATLAB, Gnuplot, etc.)
  • Statistical analysis packages (R, Python, etc.)
  • Spreadsheet applications (Excel, LibreOffice)
  • Archival data storage

File format:

  • Header: Column labels (X-axis, dataset names)
  • Data: Space-separated columns
  • Column 1: Frequency/field values
  • Columns 2+: Spectrum values for each dataset

Exported spectrum: Depends on current view mode:

  • Real view → Real parts
  • Imaginary view → Imaginary parts
  • Power view → Power spectra
  • Phase view → Phase spectra
  • Phase-optimized → Phase-corrected real parts
  • Real+Imag view → Both real and imaginary columns

Averaging: If average mode active, exports averaged data instead of individual runs.

X-range: Only exports visible X-axis range (honors zoom).

Parameters
pathFileNameOutput file path (typically .dat extension). Must not be nullptr.

Example output format:

# Field(G) Run1_Real Run2_Real Run3_Real
100.5 0.234 0.221 0.245
101.0 0.198 0.187 0.203
...

Definition at line 709 of file PFourierCanvas.cpp.

References fAveragedView, fCurrentPlotView, fFourierAverage, fFourierHistos, FOURIER_PLOT_IMAG, FOURIER_PLOT_PHASE, FOURIER_PLOT_PHASE_OPT_REAL, FOURIER_PLOT_POWER, FOURIER_PLOT_REAL, and FOURIER_PLOT_REAL_AND_IMAG.

Referenced by HandleMenuPopup().

◆ GetDataSetName()

TString PFourierCanvas::GetDataSetName ( TString title)
privatevirtual

Extracts dataset name from histogram title

Parameters
titleFull histogram title
Returns
Parsed dataset identifier

filters out the data set name from the title

return:

  • data set name
Parameters
titletitle of the Fourier histogram

Definition at line 2121 of file PFourierCanvas.cpp.

Referenced by PlotAverage().

◆ GetInterpolatedValue()

Double_t PFourierCanvas::GetInterpolatedValue ( TH1F * histo,
Double_t xVal )
privatevirtual

Linearly interpolates histogram value at arbitrary x-position

Parameters
histoInput histogram
xValX-coordinate for interpolation
Returns
Interpolated y-value

search for xVal in histo. If xVal is not found exactly, interpolate and return the interpolated y-value.

return:

  • interpolated value if xVal is within histo range, 0 otherwise.
Parameters
histopointer of the histogram
xValx-value to be looked for

Definition at line 2085 of file PFourierCanvas.cpp.

Referenced by HandleAverage().

◆ GetMaximum()

Double_t PFourierCanvas::GetMaximum ( TH1F * histo,
Double_t xmin = -1.0,
Double_t xmax = -1.0 )
privatevirtual

Finds maximum value in histogram within optional x-range

Parameters
histoInput histogram
xminRange minimum (-1.0 = use full range)
xmaxRange maximum (-1.0 = use full range)
Returns
Maximum y-value in range

returns the maximum of a histogram in the range [xmin, xmax]. If xmin = xmax = -1.0, the whole histogram range is used.

return:

  • maximum, or 0.0 if the histo pointer is the null pointer.
Parameters
histopointer of the histogram
xminlower edge for the search interval.
xmaxupper edge for the search interval.

Definition at line 2000 of file PFourierCanvas.cpp.

Referenced by PlotAverage(), and PlotFourier().

◆ GetMinimum()

Double_t PFourierCanvas::GetMinimum ( TH1F * histo,
Double_t xmin = -1.0,
Double_t xmax = -1.0 )
privatevirtual

Finds minimum value in histogram within optional x-range

Parameters
histoInput histogram
xminRange minimum (-1.0 = use full range)
xmaxRange maximum (-1.0 = use full range)
Returns
Minimum y-value in range

returns the minimum of a histogram in the range [xmin, xmax]. If xmin = xmax = -1.0, the whole histogram range is used.

return:

  • minimum, or 0.0 if the histo pointer is the null pointer.
Parameters
histopointer of the histogram
xminlower edge for the search interval.
xmaxupper edge for the search interval.

Definition at line 2043 of file PFourierCanvas.cpp.

Referenced by PlotAverage(), and PlotFourier().

◆ HandleAverage()

void PFourierCanvas::HandleAverage ( )
privatevirtual

Computes averaged Fourier spectra across runs or per dataset.

Average Fourier data sets.

Definition at line 1241 of file PFourierCanvas.cpp.

References CleanupAverage(), fAveragedView, fAveragedViewPerDataSet, fColorList, fDataSetTag, fFourierAverage, fFourierHistos, and GetInterpolatedValue().

Referenced by HandleCmdKey(), HandleMenuPopup(), and PlotAverage().

◆ HandleCmdKey()

void PFourierCanvas::HandleCmdKey ( Int_t event,
Int_t x,
Int_t y,
TObject * selected )
virtual

Slot for handling keyboard events in the canvas.

Processes keyboard shortcuts:

  • '+': Increment phase by 5°
  • '-': Decrement phase by 5°
  • Other keys: Reserved for future use
Parameters
eventROOT event type identifier
xMouse x-coordinate at event time
yMouse y-coordinate at event time
selectedROOT object under cursor (if any)

Processes keyboard shortcuts for canvas control.

This slot receives keyboard events from ROOT and dispatches appropriate actions. Ignored in batch mode.

Keyboard shortcuts:

  • 'q': Quit - emits Done(0) signal to close canvas
  • 'u': Unzoom - reset view to initial X/Y range
  • 'a': Toggle all-data average view on/off
  • 'd': Toggle per-dataset average view on/off
  • 'c': Toggle crosshair cursor on/off
  • '+': Increment phase by 5° (Re/Im views only)
  • '-': Decrement phase by 5° (Re/Im views only)

Phase adjustment: Only affects Real and Imaginary Fourier views. Phase value is displayed as text overlay on canvas.

Average toggling: 'a' and 'd' are mutually exclusive. Activating one deactivates the other. Switching triggers histogram recomputation via HandleAverage().

Parameters
eventROOT event type (must be kKeyPress to process)
xASCII code of pressed key
yMouse y-coordinate (unused)
selectedObject under cursor (unused)
See also
IncrementFourierPhase()
DecrementFourierPhase()
HandleAverage()
PlotFourier()
PlotAverage()

Definition at line 306 of file PFourierCanvas.cpp.

References CleanupAverage(), DecrementFourierPhase(), Done(), fAveragedView, fAveragedViewPerDataSet, fBatchMode, fFourierPad, fMainCanvas, fPopupMain, HandleAverage(), IncrementFourierPhase(), P_MENU_ID_AVERAGE, P_MENU_ID_AVERAGE_PER_DATA_SET, PlotAverage(), and PlotFourier().

◆ HandleMenuPopup()

void PFourierCanvas::HandleMenuPopup ( Int_t id)
virtual

Slot for handling menu selection events.

Processes menu item selections:

  • View mode changes (Real/Imag/Power/Phase/etc.)
  • Averaging toggles (All/Per-dataset/Off)
  • Data export
  • Phase adjustments
Parameters
idMenu item identifier (P_MENU_ID_* constants)

Processes menu selection events from the MusrFT menu bar.

Handles all menu item clicks including:

  • Fourier view mode selection (Real/Imag/Power/Phase/etc.)
  • Averaging mode toggles (All/Per-dataset/Off)
  • Phase adjustment (±5°)
  • Data export

Menu structure:

  • MusrFT/Fourier: View mode submenu
    • Real, Imaginary, Real+Imag, Power, Phase, Phase-Optimized
    • Phase +/- adjustments
  • MusrFT/Average: All-data average toggle
  • MusrFT/Average Per Data Set: Per-dataset average toggle
  • MusrFT/Export Data: Save to ASCII file

View changes trigger canvas redraw with new histogram type. Averaging changes recompute histograms via HandleAverage().

Ignored in batch mode.

Parameters
idMenu item identifier (P_MENU_ID_* constants)
See also
HandleAverage()
PlotFourier()
PlotAverage()
ExportData()

Definition at line 404 of file PFourierCanvas.cpp.

References CleanupAverage(), DecrementFourierPhase(), ExportData(), fAveragedView, fAveragedViewPerDataSet, fBatchMode, fCurrentPlotView, fImp, FOURIER_PLOT_IMAG, FOURIER_PLOT_PHASE, FOURIER_PLOT_PHASE_OPT_REAL, FOURIER_PLOT_POWER, FOURIER_PLOT_REAL, fPopupFourier, fPopupMain, gFiletypes, HandleAverage(), IncrementFourierPhase(), P_MENU_ID_AVERAGE, P_MENU_ID_AVERAGE_PER_DATA_SET, P_MENU_ID_EXPORT_DATA, P_MENU_ID_FOURIER, P_MENU_ID_FOURIER_IMAG, P_MENU_ID_FOURIER_PHASE, P_MENU_ID_FOURIER_PHASE_MINUS, P_MENU_ID_FOURIER_PHASE_OPT_REAL, P_MENU_ID_FOURIER_PHASE_PLUS, P_MENU_ID_FOURIER_PWR, P_MENU_ID_FOURIER_REAL, P_MENU_ID_FOURIER_REAL_AND_IMAG, PlotAverage(), and PlotFourier().

◆ IncrementFourierPhase()

void PFourierCanvas::IncrementFourierPhase ( )
privatevirtual

Increases phase by 5° and redraws Re/Im spectra.

Increments the Fourier phase and recalculate the real/imaginary part of the Fourier transform.

Definition at line 1926 of file PFourierCanvas.cpp.

References fCurrentFourierPhase, fCurrentPlotView, fFourierHistos, FOURIER_PLOT_PHASE, FOURIER_PLOT_POWER, and PlotFourierPhaseValue().

Referenced by HandleCmdKey(), and HandleMenuPopup().

◆ InitFourierCanvas()

void PFourierCanvas::InitFourierCanvas ( const Char_t * title,
Int_t wtopx,
Int_t wtopy,
Int_t ww,
Int_t wh )
privatevirtual

Creates ROOT canvas with menu bar, pads, and event connections

Parameters
titleWindow title
wtopxWindow x-position
wtopyWindow y-position
wwWindow width
whWindow height

Initialize the class, and sets up the necessary objects.

Parameters
titleTitle to be displayed
wtopxtop x coordinate (in pixels) to place the canvas.
wtopytop y coordinate (in pixels) to place the canvas.
wwwidth (in pixels) of the canvas.
whheight (in pixels) of the canvas.

Definition at line 1097 of file PFourierCanvas.cpp.

References fAveragedView, fAveragedViewPerDataSet, fBar, fBatchMode, fCurrentPlotView, fDataSetTag, fFourier, fFourierPad, fImp, fInfoPad, fMainCanvas, FOURIER_PLOT_IMAG, FOURIER_PLOT_PHASE, FOURIER_PLOT_PHASE_OPT_REAL, FOURIER_PLOT_POWER, FOURIER_PLOT_REAL, FOURIER_PLOT_REAL_AND_IMAG, fPopupFourier, fPopupMain, fTitlePad, fValid, P_MENU_ID_AVERAGE, P_MENU_ID_AVERAGE_PER_DATA_SET, P_MENU_ID_EXPORT_DATA, P_MENU_ID_FOURIER, P_MENU_ID_FOURIER_IMAG, P_MENU_ID_FOURIER_PHASE, P_MENU_ID_FOURIER_PHASE_MINUS, P_MENU_ID_FOURIER_PHASE_OPT_REAL, P_MENU_ID_FOURIER_PHASE_PLUS, P_MENU_ID_FOURIER_PWR, P_MENU_ID_FOURIER_REAL, P_MENU_ID_FOURIER_REAL_AND_IMAG, YINFO, and YTITLE.

◆ InitFourierDataSets()

void PFourierCanvas::InitFourierDataSets ( )
privatevirtual

Generates all Fourier histograms (Re/Im/Pwr/Phase) from PFourier objects.

Initialize the Fourier data sets, i.e. get the TH1F objects, set markers, set colors, ...

Definition at line 956 of file PFourierCanvas.cpp.

References CleanupAverage(), fColorList, fCurrentPlotView, fFourier, fFourierHistos, fInitialXRange, fMarkerList, and FOURIER_PLOT_PHASE_OPT_REAL.

◆ IsValid()

virtual Bool_t PFourierCanvas::IsValid ( )
inlinevirtual

Checks if canvas initialized successfully.

Returns
True if canvas is ready for display, false on initialization errors

Definition at line 269 of file PFourierCanvas.h.

References fValid.

◆ LastCanvasClosed()

void PFourierCanvas::LastCanvasClosed ( )
virtual

Slot called when canvas window is closed by user.

Triggers cleanup and emits Done() signal. Part of ROOT's window management system.

Slot called when the last canvas has been closed. Will emit Done(0) which will terminate the application.

Definition at line 528 of file PFourierCanvas.cpp.

References Done().

◆ PlotAverage()

◆ PlotFourier()

void PFourierCanvas::PlotFourier ( )
privatevirtual

◆ PlotFourierPhaseValue()

void PFourierCanvas::PlotFourierPhaseValue ( )
privatevirtual

Displays current phase value as text overlay on canvas.

Writes the Fourier phase value into the data window.

Definition at line 1714 of file PFourierCanvas.cpp.

References fCurrentFourierPhase, fCurrentFourierPhaseText, and fFourierPad.

Referenced by DecrementFourierPhase(), and IncrementFourierPhase().

◆ SaveGraphicsAndQuit()

void PFourierCanvas::SaveGraphicsAndQuit ( const Char_t * fileName)
virtual

Saves canvas to graphics file and exits.

Exports current canvas view to image file (format determined by extension: .pdf, .png, .eps, .root, etc.) and closes canvas.

Parameters
fileNameOutput file path with extension

Exports canvas to graphics file and terminates.

Saves current canvas view to image file, then emits Done(0) signal to trigger cleanup. Primary use: batch mode automated plotting.

Supported formats (determined by file extension):

  • .pdf: Vector PDF (best for publications)
  • .eps: Encapsulated PostScript (vector)
  • .png: Raster PNG (good for web/presentations)
  • .jpg/.jpeg: Raster JPEG (compressed)
  • .svg: Scalable Vector Graphics
  • .root: ROOT file (preserves interactive features)
  • .C: ROOT macro (for programmatic recreation)

ROOT's TCanvas::SaveAs() handles format detection automatically.

Parameters
fileNameOutput file path with extension indicating format

Batch mode workflow:

PFourierCanvas *canvas = new PFourierCanvas(..., batch=true);
canvas->SaveGraphicsAndQuit("output.pdf");
// Canvas closes automatically after saving
virtual void SaveGraphicsAndQuit(const Char_t *fileName)
See also
Done()

Definition at line 657 of file PFourierCanvas.cpp.

References Done(), and fMainCanvas.

◆ SetTimeout()

void PFourierCanvas::SetTimeout ( Int_t timeout)
virtual

Sets automatic timeout for canvas closure.

Useful for batch processing or automated testing. Canvas emits Done() signal after timeout expires.

Parameters
ivalTimeout in milliseconds (≤0 = no timeout)

Configures automatic canvas closure after specified timeout.

Creates and starts a ROOT TTimer that emits Done() signal after the timeout expires. Useful for:

  • Batch processing with timed display
  • Automated testing and screenshot capture
  • Slideshow-style data review

If timeout ≤ 0, no timer is created (infinite display time).

Timer behavior: Single-shot (kTRUE flag), fires once then stops.

Parameters
timeoutDuration in seconds before auto-close (≤0 = disabled)

Example:

canvas->SetTimeout(30); // Close after 30 seconds
See also
Done()

Definition at line 612 of file PFourierCanvas.cpp.

References fTimeout, fTimeoutTimer, and timeout.

◆ UpdateFourierPad()

void PFourierCanvas::UpdateFourierPad ( )
virtual

Redraws the Fourier spectrum pad with current settings.

Updates the main plotting area with current view mode, phase settings, and averaging options. Called automatically after parameter changes.

Feeds the pad with the Fourier data sets and refreshes it.

Definition at line 541 of file PFourierCanvas.cpp.

References fAveragedView, fAveragedViewPerDataSet, fFourierPad, fMainCanvas, fValid, PlotAverage(), and PlotFourier().

◆ UpdateInfoPad()

void PFourierCanvas::UpdateInfoPad ( )
virtual

Redraws the legend/info pad with current dataset information.

Updates the legend showing which datasets are displayed, with appropriate markers and colors.

Feeds the pad with the legend and refreshes it.

Definition at line 562 of file PFourierCanvas.cpp.

References fFourier, fFourierHistos, fInfoPad, fMainCanvas, and fValid.

Member Data Documentation

◆ fAveragedView

Bool_t PFourierCanvas::fAveragedView
private

tag showing that the averaged view for ALL data or normal view should be presented.

Definition at line 305 of file PFourierCanvas.h.

Referenced by ClassImpQ(), ExportData(), HandleAverage(), HandleCmdKey(), HandleMenuPopup(), InitFourierCanvas(), and UpdateFourierPad().

◆ fAveragedViewPerDataSet

Bool_t PFourierCanvas::fAveragedViewPerDataSet
private

tag showing that the averaged view for individual data sets or normal view should be presented.

Definition at line 306 of file PFourierCanvas.h.

Referenced by ClassImpQ(), HandleAverage(), HandleCmdKey(), HandleMenuPopup(), InitFourierCanvas(), PlotAverage(), and UpdateFourierPad().

◆ fBar

TGMenuBar* PFourierCanvas::fBar
private

menu bar

Definition at line 329 of file PFourierCanvas.h.

Referenced by ClassImpQ(), and InitFourierCanvas().

◆ fBatchMode

Bool_t PFourierCanvas::fBatchMode
private

musrview in ROOT batch mode

Definition at line 303 of file PFourierCanvas.h.

Referenced by ClassImpQ(), HandleCmdKey(), HandleMenuPopup(), and InitFourierCanvas().

◆ fColorList

PIntVector PFourierCanvas::fColorList
private

list of colors

Definition at line 325 of file PFourierCanvas.h.

Referenced by CalcPhaseOptReal(), HandleAverage(), and InitFourierDataSets().

◆ fCurrentFourierPhase

Double_t PFourierCanvas::fCurrentFourierPhase
private

keeps the current Fourier phase (real/imag)

Definition at line 317 of file PFourierCanvas.h.

Referenced by ClassImpQ(), DecrementFourierPhase(), IncrementFourierPhase(), and PlotFourierPhaseValue().

◆ fCurrentFourierPhaseText

std::unique_ptr<TLatex> PFourierCanvas::fCurrentFourierPhaseText
private

used in Re/Im Fourier to show the current phase in the pad

Definition at line 318 of file PFourierCanvas.h.

Referenced by PlotFourierPhaseValue().

◆ fCurrentPlotView

Int_t PFourierCanvas::fCurrentPlotView
private

tag showing what the current plot view is: real, imag, power, phase, ...

Definition at line 308 of file PFourierCanvas.h.

Referenced by ClassImpQ(), DecrementFourierPhase(), ExportData(), HandleMenuPopup(), IncrementFourierPhase(), InitFourierCanvas(), InitFourierDataSets(), PlotAverage(), and PlotFourier().

◆ fDataSetTag

PIntVector PFourierCanvas::fDataSetTag
private

vector holding the data set tags

Definition at line 307 of file PFourierCanvas.h.

Referenced by HandleAverage(), and InitFourierCanvas().

◆ fFourier

std::vector<PFourier*> PFourierCanvas::fFourier
private

keeps all the Fourier data, ownership is with the caller

Definition at line 314 of file PFourierCanvas.h.

Referenced by CalcPhaseOptReal(), CreateXaxisTitle(), InitFourierCanvas(), InitFourierDataSets(), and UpdateInfoPad().

◆ fFourierAverage

PFourierCanvasDataList PFourierCanvas::fFourierAverage
private

keeps the average of the Fourier histos

Definition at line 316 of file PFourierCanvas.h.

Referenced by CleanupAverage(), ExportData(), HandleAverage(), and PlotAverage().

◆ fFourierHistos

PFourierCanvasDataList PFourierCanvas::fFourierHistos
private

◆ fFourierPad

std::unique_ptr<TPad> PFourierCanvas::fFourierPad
private

fourier pad used to display the fourier

Definition at line 336 of file PFourierCanvas.h.

Referenced by HandleCmdKey(), InitFourierCanvas(), PlotAverage(), PlotFourier(), PlotFourierPhaseValue(), and UpdateFourierPad().

◆ fImp

TRootCanvas* PFourierCanvas::fImp
private

ROOT native GUI version of main window with menubar and drawing area.

Definition at line 328 of file PFourierCanvas.h.

Referenced by ClassImpQ(), HandleMenuPopup(), and InitFourierCanvas().

◆ fInfoPad

std::unique_ptr<TLegend> PFourierCanvas::fInfoPad
private

info pad used to display a legend of the data plotted

Definition at line 337 of file PFourierCanvas.h.

Referenced by InitFourierCanvas(), and UpdateInfoPad().

◆ fInitialXRange

Double_t PFourierCanvas::fInitialXRange[2]
private

keeps the initial x-range

Definition at line 309 of file PFourierCanvas.h.

Referenced by CalcPhaseOptReal(), ClassImpQ(), InitFourierDataSets(), PlotAverage(), and PlotFourier().

◆ fInitialYRange

Double_t PFourierCanvas::fInitialYRange[2]
private

keeps the initial y-range

Definition at line 310 of file PFourierCanvas.h.

◆ fLegAvgPerDataSet

std::unique_ptr<TLegend> PFourierCanvas::fLegAvgPerDataSet
private

legend used for averaged per data set view

Definition at line 338 of file PFourierCanvas.h.

Referenced by PlotAverage().

◆ fMainCanvas

std::unique_ptr<TCanvas> PFourierCanvas::fMainCanvas
private

◆ fMarkerList

PIntVector PFourierCanvas::fMarkerList
private

list of markers

Definition at line 324 of file PFourierCanvas.h.

Referenced by CalcPhaseOptReal(), and InitFourierDataSets().

◆ fPopupFourier

std::unique_ptr<TGPopupMenu> PFourierCanvas::fPopupFourier
private

popup menu of the MusrFT/Fourier sub menu

Definition at line 331 of file PFourierCanvas.h.

Referenced by HandleMenuPopup(), and InitFourierCanvas().

◆ fPopupMain

TGPopupMenu* PFourierCanvas::fPopupMain
private

popup menu MusrFT in the main menu bar

Definition at line 330 of file PFourierCanvas.h.

Referenced by ClassImpQ(), HandleCmdKey(), HandleMenuPopup(), and InitFourierCanvas().

◆ fStyle

std::unique_ptr<TStyle> PFourierCanvas::fStyle
private

A collection of all graphics attributes.

Definition at line 320 of file PFourierCanvas.h.

Referenced by CreateStyle().

◆ fTimeout

Int_t PFourierCanvas::fTimeout
private

timeout after which the Done signal should be emited. If timeout <= 0, no timeout is taking place

Definition at line 302 of file PFourierCanvas.h.

Referenced by ClassImpQ(), and SetTimeout().

◆ fTimeoutTimer

std::unique_ptr<TTimer> PFourierCanvas::fTimeoutTimer
private

timeout timer in order to terminate if no action is taking place for too long

Definition at line 322 of file PFourierCanvas.h.

Referenced by SetTimeout().

◆ fTitle

TString PFourierCanvas::fTitle
private

Definition at line 312 of file PFourierCanvas.h.

Referenced by ClassImpQ().

◆ fTitlePad

std::unique_ptr<TPaveText> PFourierCanvas::fTitlePad
private

title pad used to display a title

Definition at line 335 of file PFourierCanvas.h.

Referenced by InitFourierCanvas().

◆ fValid

Bool_t PFourierCanvas::fValid
private

if true, everything looks OK

Definition at line 304 of file PFourierCanvas.h.

Referenced by ClassImpQ(), InitFourierCanvas(), IsValid(), UpdateFourierPad(), and UpdateInfoPad().

◆ fXaxisTitle

TString PFourierCanvas::fXaxisTitle
private

Definition at line 313 of file PFourierCanvas.h.

Referenced by ClassImpQ(), CreateXaxisTitle(), PlotAverage(), and PlotFourier().


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