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

Detailed Description

Definition at line 90 of file PFourierCanvas.h.

Constructor & Destructor Documentation

◆ PFourierCanvas() [1/3]

PFourierCanvas::PFourierCanvas ( )

◆ 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 
)

◆ 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 
)

Member Function Documentation

◆ CalcPhaseOptReal()

void PFourierCanvas::CalcPhaseOptReal ( )
privatevirtual

calculate the phase opt. real FT

Definition at line 1327 of file PFourierCanvas.cpp.

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

Referenced by PlotAverage(), and PlotFourier().

◆ CleanupAverage()

void PFourierCanvas::CleanupAverage ( )
privatevirtual

Cleanup average Fourier data sets.

Definition at line 1016 of file PFourierCanvas.cpp.

References fFourierAverage.

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

◆ CreateStyle()

void PFourierCanvas::CreateStyle ( )
privatevirtual

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

Definition at line 748 of file PFourierCanvas.cpp.

References fStyle.

◆ CreateXaxisTitle()

void PFourierCanvas::CreateXaxisTitle ( )
privatevirtual

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

Definition at line 721 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

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

Definition at line 1767 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 that the user wants to terminate the application.

Parameters
statusStatus info

Definition at line 192 of file PFourierCanvas.cpp.

References status.

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

◆ ExportData()

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

Exports the currently displayed Fourier data set in ascii column format.

Definition at line 517 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

filters out the data set name from the title

return:

  • data set name
Parameters
titletitle of the Fourier histogram

Definition at line 1929 of file PFourierCanvas.cpp.

Referenced by PlotAverage().

◆ GetInterpolatedValue()

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

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 1893 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

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 1808 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

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 1851 of file PFourierCanvas.cpp.

Referenced by PlotAverage(), and PlotFourier().

◆ HandleAverage()

void PFourierCanvas::HandleAverage ( )
privatevirtual

◆ HandleCmdKey()

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

Filters keyboard events, and if they are a command key (see below) carries out the necessary actions.

Currently implemented command keys:

  • 'q' quit musrview
  • 'u' unzoom to the original plot range given in the msr-file.
  • 'a' toggle between average view and single Fourier histo view.
  • '+' increment the phase (real/imaginary Fourier). The phase step is defined in the musrfit_startup.xml
  • '-' decrement the phase (real/imaginary Fourier). The phase step is defined in the musrfit_startup.xml
Parameters
eventevent type
xcharacter key
ynot used
selectednot used

Definition at line 215 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()

◆ IncrementFourierPhase()

void PFourierCanvas::IncrementFourierPhase ( )
privatevirtual

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

Definition at line 1734 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

◆ InitFourierDataSets()

void PFourierCanvas::InitFourierDataSets ( )
privatevirtual

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

Definition at line 764 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

Definition at line 112 of file PFourierCanvas.h.

References fValid.

◆ LastCanvasClosed()

void PFourierCanvas::LastCanvasClosed ( )
virtual

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

Definition at line 413 of file PFourierCanvas.cpp.

References Done().

◆ PlotAverage()

◆ PlotFourier()

◆ PlotFourierPhaseValue()

void PFourierCanvas::PlotFourierPhaseValue ( )
privatevirtual

Writes the Fourier phase value into the data window.

Definition at line 1522 of file PFourierCanvas.cpp.

References fCurrentFourierPhase, fCurrentFourierPhaseText, and fFourierPad.

Referenced by DecrementFourierPhase(), and IncrementFourierPhase().

◆ SaveGraphicsAndQuit()

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

Will save the canvas as graphics output. Needed in the batch mode of musrview.

Parameters
fileNamefile name under which the canvas shall be saved.

Definition at line 502 of file PFourierCanvas.cpp.

References Done(), and fMainCanvas.

◆ SetTimeout()

void PFourierCanvas::SetTimeout ( Int_t  timeout)
virtual

sets the timeout after which the program shall terminate.

Parameters
timeoutafter which the done signal shall be emitted. Given in seconds

Definition at line 480 of file PFourierCanvas.cpp.

References fTimeout, fTimeoutTimer, and timeout.

◆ UpdateFourierPad()

void PFourierCanvas::UpdateFourierPad ( )
virtual

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

Definition at line 426 of file PFourierCanvas.cpp.

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

◆ UpdateInfoPad()

void PFourierCanvas::UpdateInfoPad ( )
virtual

Feeds the pad with the legend and refreshes it.

Definition at line 447 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 123 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 124 of file PFourierCanvas.h.

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

◆ fBar

TGMenuBar* PFourierCanvas::fBar
private

menu bar

Definition at line 147 of file PFourierCanvas.h.

Referenced by ClassImpQ(), and InitFourierCanvas().

◆ fBatchMode

Bool_t PFourierCanvas::fBatchMode
private

musrview in ROOT batch mode

Definition at line 121 of file PFourierCanvas.h.

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

◆ fColorList

PIntVector PFourierCanvas::fColorList
private

list of colors

Definition at line 143 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 135 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 136 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 126 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 125 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 132 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 134 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 154 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 146 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 155 of file PFourierCanvas.h.

Referenced by InitFourierCanvas(), and UpdateInfoPad().

◆ fInitialXRange

Double_t PFourierCanvas::fInitialXRange[2]
private

keeps the initial x-range

Definition at line 127 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 128 of file PFourierCanvas.h.

◆ fLegAvgPerDataSet

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

legend used for averaged per data set view

Definition at line 156 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 142 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 149 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 148 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 138 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 120 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 140 of file PFourierCanvas.h.

Referenced by SetTimeout().

◆ fTitle

TString PFourierCanvas::fTitle
private

Definition at line 130 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 153 of file PFourierCanvas.h.

Referenced by InitFourierCanvas().

◆ fValid

Bool_t PFourierCanvas::fValid
private

if true, everything looks OK

Definition at line 122 of file PFourierCanvas.h.

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

◆ fXaxisTitle

TString PFourierCanvas::fXaxisTitle
private

Definition at line 131 of file PFourierCanvas.h.

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


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