|
musrfit 1.10.0
|
Interactive GUI for determining t0 and data/background ranges in μSR experiments. More...
#include <PMusrT0.h>


Public Member Functions | |
| PMusrT0 () | |
| Default constructor (creates invalid instance) | |
| PMusrT0 (PMusrT0Data &data) | |
| Main constructor that initializes the interactive GUI. | |
| virtual Bool_t | IsValid () |
| Returns validity status of the PMusrT0 instance. | |
| virtual void | Done (Int_t status=0) |
| Emits signal indicating completion of t0/range determination. | |
| virtual void | HandleCmdKey (Int_t event, Int_t x, Int_t y, TObject *selected) |
| Handles keyboard input for interactive t0 and range selection. | |
| virtual void | Quit () |
| Quit slot that emits Done signal to close the current canvas. | |
| virtual void | SetTimeout (Int_t timeout) |
| Sets automatic timeout for the interactive session. | |
| virtual void | SetMsrHandler (PMsrHandler *msrHandler) |
| Sets the MSR file handler for accessing run configuration. | |
| virtual void | InitT0 () |
| Initializes GUI for interactive t0 determination. | |
| virtual void | InitDataAndBkg () |
| Initializes GUI for interactive data and background range determination. | |
| virtual Int_t | GetStatus () |
| Returns current exit status. | |
Private Member Functions | |
| void | ShowDataFileT0Channel () |
| Displays vertical line showing t0 from data file. | |
| void | HideDataFileT0Channel () |
| Hides vertical line showing t0 from data file. | |
| void | SetT0Channel () |
| Sets t0 to cursor position and updates display. | |
| void | SetEstimatedT0Channel () |
| Sets t0 to estimated value and updates display. | |
| void | SetDataFirstChannel () |
| Sets first good data bin to cursor position. | |
| void | SetDataLastChannel () |
| Sets last good data bin to cursor position. | |
| void | SetBkgFirstChannel () |
| Sets background start bin to cursor position. | |
| void | SetBkgLastChannel () |
| Sets background end bin to cursor position. | |
| void | UnZoom () |
| Resets zoom to show full histogram range. | |
| void | ZoomT0 () |
| Zooms to region around t0 for precise adjustment. | |
Private Attributes | |
| PMsrHandler * | fMsrHandler |
| MSR file handler for accessing run configuration. | |
| Int_t | fTimeout |
| Timeout in ms after which Done signal is emitted (≤0 disables timeout) | |
| Bool_t | fValid |
| True if raw data sets are available and GUI is functional. | |
| Int_t | fStatus |
| Exit status: 0=local quit (single canvas), 1=quit application. | |
| PMusrT0Data | fMusrT0Data |
| Container for raw μSR run data and histogram information. | |
| Bool_t | fDataAndBkgEnabled |
| Enable/disable data and background range handling (required for grouping/addrun) | |
| Bool_t | fT0Enabled |
| Enable/disable t0 handling (required for grouping/addrun) | |
| Int_t | fT0Estimated |
| Estimated t0 value in bins (used as initial guess) | |
| Bool_t | fShowT0DataChannel |
| Flag to show/hide t0 value from data file. | |
| std::unique_ptr< TTimer > | fTimeoutTimer |
| Timer to emit Done signal if no user interaction occurs. | |
| std::unique_ptr< TCanvas > | fMainCanvas |
| Main ROOT canvas for the interactive GUI. | |
| std::unique_ptr< TH1F > | fHisto |
| Full raw data histogram (all bins) | |
| std::unique_ptr< TH1F > | fData |
| Data region histogram (first good bin to last good bin) | |
| std::unique_ptr< TH1F > | fBkg |
| Background region histogram (background start to end) | |
| std::unique_ptr< TLatex > | fToDoInfo |
| Text display showing current instructions to user. | |
| std::unique_ptr< TLine > | fT0Line |
| Vertical line marking current t0 position. | |
| std::unique_ptr< TLine > | fT0DataLine |
| Vertical line marking t0 found in data file. | |
| std::unique_ptr< TLine > | fFirstBkgLine |
| Vertical line marking background start bin. | |
| std::unique_ptr< TLine > | fLastBkgLine |
| Vertical line marking background end bin. | |
| std::unique_ptr< TLine > | fFirstDataLine |
| Vertical line marking first good data bin. | |
| std::unique_ptr< TLine > | fLastDataLine |
| Vertical line marking last good data bin. | |
| Int_t | fPx |
| Current cursor x-position in pixel coordinates. | |
| Int_t | fPy |
| Current cursor y-position in pixel coordinates. | |
| Int_t | fDataRange [2] |
| Data range in bins: [0]=first good bin, [1]=last good bin. | |
| Int_t | fBkgRange [2] |
| Background range in bins: [0]=first bkg bin, [1]=last bkg bin. | |
Interactive GUI for determining t0 and data/background ranges in μSR experiments.
PMusrT0 provides a ROOT-based graphical interface for interactively determining:
The tool displays raw histogram data and allows users to set these parameters through keyboard interactions. It supports:
| PMusrT0::PMusrT0 | ( | ) |
Default constructor (creates invalid instance)
| PMusrT0::PMusrT0 | ( | PMusrT0Data & | data | ) |
Main constructor that initializes the interactive GUI.
Main constructor that initializes the GUI with raw run data.
| data | Reference to PMusrT0Data containing raw run data and configuration |
Creates and initializes the interactive t0/range determination GUI. The constructor:
| data | PMusrT0Data object containing raw run data and configuration |
Definition at line 277 of file PMusrT0.cpp.
References fBkgRange, fDataAndBkgEnabled, fDataRange, fHisto, fMusrT0Data, fShowT0DataChannel, fStatus, fT0Enabled, fT0Estimated, fTimeout, fValid, if(), PMUSRT0_GET_T0, and PMUSRT0_GET_T0_DATA_AND_BKG_RANGE.
|
virtual |
Emits signal indicating completion of t0/range determination.
Emits Done signal to terminate the interactive session.
| status | Exit status: 0=local quit (single canvas), 1=quit entire application |
This ROOT signal is emitted when the user finishes t0/range determination or closes the canvas. The status value determines the scope of termination.
| status | Exit status: 0=local quit, 1=quit application, 2=global quit |
Definition at line 551 of file PMusrT0.cpp.
References status.
Referenced by HandleCmdKey(), and Quit().
|
inlinevirtual |
|
virtual |
Handles keyboard input for interactive t0 and range selection.
Handles keyboard and mouse events for interactive t0/range selection.
| event | Keyboard event code |
| x | Mouse x-coordinate in pixels |
| y | Mouse y-coordinate in pixels |
| selected | Pointer to selected ROOT object (unused) |
Processes keyboard commands for setting t0, data ranges, background ranges, and zoom controls. See class documentation for complete key bindings.
Processes keyboard commands for t0 determination and range selection. Mouse position is tracked for bin selection. This is the main event handler for the interactive GUI.
| event | Event type (kKeyPress for keyboard events) |
| x | For keyboard: character key code; for mouse: x-position in pixels |
| y | For mouse: y-position in pixels |
| selected | Pointer to selected ROOT object (unused) |
Definition at line 584 of file PMusrT0.cpp.
References Done(), fPx, fPy, fShowT0DataChannel, fStatus, HideDataFileT0Channel(), SetBkgFirstChannel(), SetBkgLastChannel(), SetDataFirstChannel(), SetDataLastChannel(), SetEstimatedT0Channel(), SetT0Channel(), ShowDataFileT0Channel(), UnZoom(), and ZoomT0().
|
private |
Hides vertical line showing t0 from data file.
Hides the t0 value line from the data file.
Removes the orange vertical line showing the data file t0 value. The canvas is updated to reflect the change.
Definition at line 864 of file PMusrT0.cpp.
References fMainCanvas, and fT0DataLine.
Referenced by HandleCmdKey().
|
virtual |
Initializes GUI for interactive data and background range determination.
Initializes the interactive data and background range GUI.
Creates and displays data and background region histograms overlaid on the main histogram. Retrieves initial range values from the MSR file based on detector tag (forward/backward):
Definition at line 739 of file PMusrT0.cpp.
References fBkg, fBkgRange, fData, fDataRange, fFirstBkgLine, fFirstDataLine, fHisto, fLastBkgLine, fLastDataLine, fMainCanvas, fMsrHandler, fMusrT0Data, PMUSRT0_BACKWARD, and PMUSRT0_FORWARD.
|
virtual |
Initializes GUI for interactive t0 determination.
Initializes the interactive t0 determination GUI.
Creates and displays the t0 marker line on the histogram canvas. The initial t0 value is retrieved from the MSR file based on the current detector tag (forward/backward) and histogram index. The t0 line is drawn as a green vertical line from 0 to histogram maximum.
Definition at line 691 of file PMusrT0.cpp.
References fHisto, fMsrHandler, fMusrT0Data, fT0Line, PMUSRT0_BACKWARD, and PMUSRT0_FORWARD.
|
inlinevirtual |
|
virtual |
Quit slot that emits Done signal to close the current canvas.
Slot called when canvas is closed via the close button.
This method is invoked when the user clicks the close icon (X) in the canvas window. It sets a global quit status and emits the Done signal.
Definition at line 633 of file PMusrT0.cpp.
|
private |
Sets background start bin to cursor position.
Sets the background start bin to the cursor position.
Converts cursor position to bin number, updates the MSR handler with the new background start value, and redraws the red background region histogram. The red vertical line marking the background start is moved to the new position.
Definition at line 1074 of file PMusrT0.cpp.
References fBkg, fBkgRange, fDataAndBkgEnabled, fFirstBkgLine, fHisto, fMainCanvas, fMsrHandler, fMusrT0Data, fPx, fPy, and PMUSRT0_BACKWARD.
Referenced by HandleCmdKey().
|
private |
Sets background end bin to cursor position.
Sets the background end bin to the cursor position.
Converts cursor position to bin number, updates the MSR handler with the new background end value, and redraws the red background region histogram. The red vertical line marking the background end is moved to the new position.
Definition at line 1124 of file PMusrT0.cpp.
References fBkg, fBkgRange, fDataAndBkgEnabled, fHisto, fLastBkgLine, fMainCanvas, fMsrHandler, fMusrT0Data, fPx, fPy, and PMUSRT0_BACKWARD.
Referenced by HandleCmdKey().
|
private |
Sets first good data bin to cursor position.
Sets the first good data bin to the cursor position.
Converts cursor position to bin number, updates the MSR handler with the new first good bin value, and redraws the blue data region histogram. The blue vertical line marking the data start is moved to the new position.
Definition at line 974 of file PMusrT0.cpp.
References fData, fDataAndBkgEnabled, fDataRange, fFirstDataLine, fHisto, fMainCanvas, fMsrHandler, fMusrT0Data, fPx, fPy, and PMUSRT0_BACKWARD.
Referenced by HandleCmdKey().
|
private |
Sets last good data bin to cursor position.
Sets the last good data bin to the cursor position.
Converts cursor position to bin number, updates the MSR handler with the new last good bin value, and redraws the blue data region histogram. The blue vertical line marking the data end is moved to the new position.
Definition at line 1024 of file PMusrT0.cpp.
References fData, fDataAndBkgEnabled, fDataRange, fHisto, fLastDataLine, fMainCanvas, fMsrHandler, fMusrT0Data, fPx, fPy, and PMUSRT0_BACKWARD.
Referenced by HandleCmdKey().
|
private |
Sets t0 to estimated value and updates display.
Sets t0 to the estimated value (maximum bin).
Uses the automatically estimated t0 value (bin with maximum counts) as the new t0. Updates the MSR handler and moves the green t0 line to the estimated position. The t0 index is calculated based on detector tag and fit type.
Definition at line 930 of file PMusrT0.cpp.
References fHisto, fMainCanvas, fMsrHandler, fMusrT0Data, fT0Enabled, fT0Estimated, fT0Line, and PMUSRT0_BACKWARD.
Referenced by HandleCmdKey().
|
virtual |
Sets the MSR file handler for accessing run configuration.
| msrHandler | Pointer to initialized PMsrHandler instance |
The MSR handler provides access to run parameters, t0 values, and other configuration data needed for interactive t0/range determination.
| msrHandler | Pointer to initialized PMsrHandler instance |
Definition at line 675 of file PMusrT0.cpp.
References fMsrHandler.
|
private |
Sets t0 to cursor position and updates display.
Sets t0 to the current cursor position.
Converts cursor pixel position to bin number, updates the MSR handler with the new t0 value, and moves the green t0 line to the cursor position. The t0 index is calculated based on detector tag and fit type (single/asymmetry).
Definition at line 882 of file PMusrT0.cpp.
References fHisto, fMainCanvas, fMsrHandler, fMusrT0Data, fPx, fPy, fT0Enabled, fT0Line, and PMUSRT0_BACKWARD.
Referenced by HandleCmdKey().
|
virtual |
Sets automatic timeout for the interactive session.
| timeout | Timeout in milliseconds (≤0 disables timeout) |
If timeout expires without user interaction, the Done signal is automatically emitted.
Creates and starts a timer that will automatically call Quit() if no user interaction occurs within the specified timeout period.
| timeout | Timeout duration in seconds (≤0 disables timeout) |
Definition at line 650 of file PMusrT0.cpp.
References fTimeout, fTimeoutTimer, and timeout.
|
private |
Displays vertical line showing t0 from data file.
Displays the t0 value found in the data file.
Creates and draws an orange vertical line showing the t0 value that was read from the raw data file. This allows comparison with the user-selected t0.
Definition at line 838 of file PMusrT0.cpp.
References fHisto, fMainCanvas, fMusrT0Data, and fT0DataLine.
Referenced by HandleCmdKey().
|
private |
Resets zoom to show full histogram range.
Resets zoom to show the full histogram range.
Unzooms both x and y axes of the histogram to display the complete data range. The canvas is updated to reflect the change.
Definition at line 1173 of file PMusrT0.cpp.
References fHisto, and fMainCanvas.
Referenced by HandleCmdKey().
|
private |
Zooms to region around t0 for precise adjustment.
Zooms to the region around t0 for precise adjustment.
Zooms the x-axis to a ±75 bin range centered on the current t0 position. This allows for precise t0 selection. If t0 is near the histogram edges, the zoom range is automatically adjusted to stay within valid bin numbers.
Definition at line 1192 of file PMusrT0.cpp.
References fHisto, fMainCanvas, fT0Enabled, fT0Estimated, and fT0Line.
Referenced by HandleCmdKey().
|
private |
Background region histogram (background start to end)
Definition at line 287 of file PMusrT0.h.
Referenced by InitDataAndBkg(), SetBkgFirstChannel(), and SetBkgLastChannel().
|
private |
Background range in bins: [0]=first bkg bin, [1]=last bkg bin.
Definition at line 302 of file PMusrT0.h.
Referenced by ClassImpQ(), InitDataAndBkg(), PMusrT0(), SetBkgFirstChannel(), and SetBkgLastChannel().
|
private |
Data region histogram (first good bin to last good bin)
Definition at line 286 of file PMusrT0.h.
Referenced by InitDataAndBkg(), SetDataFirstChannel(), and SetDataLastChannel().
|
private |
Enable/disable data and background range handling (required for grouping/addrun)
Definition at line 275 of file PMusrT0.h.
Referenced by ClassImpQ(), PMusrT0(), SetBkgFirstChannel(), SetBkgLastChannel(), SetDataFirstChannel(), and SetDataLastChannel().
|
private |
Data range in bins: [0]=first good bin, [1]=last good bin.
Definition at line 301 of file PMusrT0.h.
Referenced by ClassImpQ(), InitDataAndBkg(), PMusrT0(), SetDataFirstChannel(), and SetDataLastChannel().
|
private |
Vertical line marking background start bin.
Definition at line 293 of file PMusrT0.h.
Referenced by InitDataAndBkg(), and SetBkgFirstChannel().
|
private |
Vertical line marking first good data bin.
Definition at line 295 of file PMusrT0.h.
Referenced by InitDataAndBkg(), and SetDataFirstChannel().
|
private |
Full raw data histogram (all bins)
Definition at line 285 of file PMusrT0.h.
Referenced by InitDataAndBkg(), InitT0(), PMusrT0(), SetBkgFirstChannel(), SetBkgLastChannel(), SetDataFirstChannel(), SetDataLastChannel(), SetEstimatedT0Channel(), SetT0Channel(), ShowDataFileT0Channel(), UnZoom(), and ZoomT0().
|
private |
Vertical line marking background end bin.
Definition at line 294 of file PMusrT0.h.
Referenced by InitDataAndBkg(), and SetBkgLastChannel().
|
private |
Vertical line marking last good data bin.
Definition at line 296 of file PMusrT0.h.
Referenced by InitDataAndBkg(), and SetDataLastChannel().
|
private |
Main ROOT canvas for the interactive GUI.
Definition at line 283 of file PMusrT0.h.
Referenced by HideDataFileT0Channel(), InitDataAndBkg(), SetBkgFirstChannel(), SetBkgLastChannel(), SetDataFirstChannel(), SetDataLastChannel(), SetEstimatedT0Channel(), SetT0Channel(), ShowDataFileT0Channel(), UnZoom(), and ZoomT0().
|
private |
MSR file handler for accessing run configuration.
Definition at line 265 of file PMusrT0.h.
Referenced by InitDataAndBkg(), InitT0(), SetBkgFirstChannel(), SetBkgLastChannel(), SetDataFirstChannel(), SetDataLastChannel(), SetEstimatedT0Channel(), SetMsrHandler(), and SetT0Channel().
|
private |
Container for raw μSR run data and histogram information.
Definition at line 273 of file PMusrT0.h.
Referenced by InitDataAndBkg(), InitT0(), PMusrT0(), SetBkgFirstChannel(), SetBkgLastChannel(), SetDataFirstChannel(), SetDataLastChannel(), SetEstimatedT0Channel(), SetT0Channel(), and ShowDataFileT0Channel().
|
private |
Current cursor x-position in pixel coordinates.
Definition at line 298 of file PMusrT0.h.
Referenced by HandleCmdKey(), SetBkgFirstChannel(), SetBkgLastChannel(), SetDataFirstChannel(), SetDataLastChannel(), and SetT0Channel().
|
private |
Current cursor y-position in pixel coordinates.
Definition at line 299 of file PMusrT0.h.
Referenced by HandleCmdKey(), SetBkgFirstChannel(), SetBkgLastChannel(), SetDataFirstChannel(), SetDataLastChannel(), and SetT0Channel().
|
private |
Flag to show/hide t0 value from data file.
Definition at line 278 of file PMusrT0.h.
Referenced by ClassImpQ(), HandleCmdKey(), and PMusrT0().
|
private |
Exit status: 0=local quit (single canvas), 1=quit application.
Definition at line 271 of file PMusrT0.h.
Referenced by ClassImpQ(), GetStatus(), HandleCmdKey(), PMusrT0(), and Quit().
|
private |
Vertical line marking t0 found in data file.
Definition at line 292 of file PMusrT0.h.
Referenced by HideDataFileT0Channel(), and ShowDataFileT0Channel().
|
private |
Enable/disable t0 handling (required for grouping/addrun)
Definition at line 276 of file PMusrT0.h.
Referenced by ClassImpQ(), PMusrT0(), SetEstimatedT0Channel(), SetT0Channel(), and ZoomT0().
|
private |
Estimated t0 value in bins (used as initial guess)
Definition at line 277 of file PMusrT0.h.
Referenced by PMusrT0(), SetEstimatedT0Channel(), and ZoomT0().
|
private |
Vertical line marking current t0 position.
Definition at line 291 of file PMusrT0.h.
Referenced by InitT0(), SetEstimatedT0Channel(), SetT0Channel(), and ZoomT0().
|
private |
Timeout in ms after which Done signal is emitted (≤0 disables timeout)
Definition at line 267 of file PMusrT0.h.
Referenced by ClassImpQ(), PMusrT0(), and SetTimeout().
|
private |
Timer to emit Done signal if no user interaction occurs.
Definition at line 280 of file PMusrT0.h.
Referenced by SetTimeout().
|
private |
|
private |
True if raw data sets are available and GUI is functional.
Definition at line 269 of file PMusrT0.h.
Referenced by ClassImpQ(), IsValid(), and PMusrT0().