improve doxygen documentation of PMusrT0.*

This commit is contained in:
2025-11-14 09:48:35 +01:00
parent 368957b46f
commit e900bd547a
2 changed files with 330 additions and 137 deletions

View File

@@ -44,7 +44,9 @@
// Constructor
//--------------------------------------------------------------------------
/**
* <p>Constructor.
* \brief Default constructor that initializes all member variables.
*
* Calls InitData() to set default values for all member variables.
*/
PMusrT0Data::PMusrT0Data()
{
@@ -55,7 +57,10 @@ PMusrT0Data::PMusrT0Data()
// Destructor
//--------------------------------------------------------------------------
/**
* <p>Destructor.
* \brief Destructor that cleans up all vector containers.
*
* Clears all vectors including raw run data references, histogram numbers,
* t0 values, and addrun t0 values.
*/
PMusrT0Data::~PMusrT0Data()
{
@@ -71,7 +76,10 @@ PMusrT0Data::~PMusrT0Data()
// InitData
//--------------------------------------------------------------------------
/**
* <p>Initialize the necessary variables.
* \brief Initializes all member variables to default values.
*
* Sets all indices to -1, flags to default states, and clears all vectors.
* This method is called by the constructor and can be used to reset the object.
*/
void PMusrT0Data::InitData()
{
@@ -94,13 +102,10 @@ void PMusrT0Data::InitData()
// GetRawRunData
//--------------------------------------------------------------------------
/**
* <p>Returns the raw run data set with index idx.
* \brief Returns pointer to raw run data at the specified index.
*
* <b>return:</b>
* - raw run data set
* - 0 pointer, if idx is out of range
*
* \param idx index of the raw run data
* \param idx Index of raw run data (0=main run, >0=addruns)
* \return Pointer to PRawRunData object, or nullptr if idx is out of range
*/
PRawRunData* PMusrT0Data::GetRawRunData(Int_t idx)
{
@@ -114,13 +119,10 @@ PRawRunData* PMusrT0Data::GetRawRunData(Int_t idx)
// GetHistoNo
//--------------------------------------------------------------------------
/**
* <p>Get histogram number of a run.
* \brief Returns histogram number at the specified index.
*
* <b>return:</b>
* - histogram number
* - -1 if index is out of range
*
* \param idx index of the run (msr-file).
* \param idx Index into histogram number vector
* \return Histogram number (with Red/Green offset applied), or -1 if out of range
*/
Int_t PMusrT0Data::GetHistoNo(UInt_t idx)
{
@@ -134,13 +136,10 @@ Int_t PMusrT0Data::GetHistoNo(UInt_t idx)
// GetT0Bin
//--------------------------------------------------------------------------
/**
* <p>Get t0 (in bin) of a run.
* \brief Returns t0 bin value for the main run at the specified index.
*
* <b>return:</b>
* - t0 bin
* - -1 if index is out of range
*
* \param idx index of the run (msr-file).
* \param idx Index into main run t0 vector
* \return t0 bin value, or -1 if out of range
*/
Int_t PMusrT0Data::GetT0Bin(UInt_t idx)
{
@@ -154,13 +153,10 @@ Int_t PMusrT0Data::GetT0Bin(UInt_t idx)
// GetAddT0BinSize
//--------------------------------------------------------------------------
/**
* <p>Get addt0 size of a run, i.e. the number of addt0's for a given msr-file run.
* \brief Returns number of t0 bins for the specified addrun.
*
* <b>return:</b>
* - number of addt0's
* - -1 if index is out of range
*
* \param idx index of the run (msr-file).
* \param idx Addrun index
* \return Number of t0 bin values for this addrun, or 0 if out of range
*/
UInt_t PMusrT0Data::GetAddT0BinSize(UInt_t idx)
{
@@ -174,14 +170,11 @@ UInt_t PMusrT0Data::GetAddT0BinSize(UInt_t idx)
// GetAddT0Bin
//--------------------------------------------------------------------------
/**
* <p>Get addt0 (in bin) of a run.
* \brief Returns t0 bin value for a specific addrun and histogram index.
*
* <b>return:</b>
* - addt0 bin
* - -1 if index is out of range
*
* \param addRunIdx index of the addrun
* \param idx index of the run (msr-file).
* \param addRunIdx Addrun index
* \param idx Histogram index within the addrun
* \return t0 bin value, or -1 if either index is out of range
*/
Int_t PMusrT0Data::GetAddT0Bin(UInt_t addRunIdx, UInt_t idx)
{
@@ -198,10 +191,12 @@ Int_t PMusrT0Data::GetAddT0Bin(UInt_t addRunIdx, UInt_t idx)
// SetT0Bin
//--------------------------------------------------------------------------
/**
* <p>Set t0 value.
* \brief Sets t0 bin value for the main run at the specified index.
*
* \param val t0 value to be set
* \param idx index at which t0 shall be set.
* Automatically resizes the t0 vector if idx is beyond current size.
*
* \param val t0 bin value to set
* \param idx Index at which to set the t0 value
*/
void PMusrT0Data::SetT0Bin(UInt_t val, UInt_t idx)
{
@@ -215,11 +210,13 @@ void PMusrT0Data::SetT0Bin(UInt_t val, UInt_t idx)
// SetAddT0Bin
//--------------------------------------------------------------------------
/**
* <p>Set addt0 value.
* \brief Sets t0 bin value for a specific addrun and histogram index.
*
* \param val t0 value to be set
* \param addRunIdx addt0 index (for each addrun, there has to be an addt0)
* \param idx index at which t0 shall be set.
* Automatically resizes vectors if indices are beyond current size.
*
* \param val t0 bin value to set
* \param addRunIdx Addrun index (each addrun needs its own t0 values)
* \param idx Histogram index within the addrun
*/
void PMusrT0Data::SetAddT0Bin(UInt_t val, UInt_t addRunIdx, UInt_t idx)
{
@@ -240,7 +237,10 @@ ClassImpQ(PMusrT0)
// Constructor
//--------------------------------------------------------------------------
/**
* <p>Constructor.
* \brief Default constructor that creates an invalid PMusrT0 instance.
*
* Initializes all member variables to default values. The instance is marked
* as invalid (fValid=false) since no raw data has been provided.
*/
PMusrT0::PMusrT0()
{
@@ -264,9 +264,15 @@ PMusrT0::PMusrT0()
// Constructor
//--------------------------------------------------------------------------
/**
* <p>Constructor
* \brief Main constructor that initializes the GUI with raw run data.
*
* \param data raw run data set
* Creates and initializes the interactive t0/range determination GUI. The constructor:
* - Validates raw data availability and histogram presence
* - Creates histogram from raw data (single or grouped/added)
* - Estimates initial t0 by finding the maximum bin value
* - Sets up canvas title with run name, histogram number, and detector tag
*
* \param data PMusrT0Data object containing raw run data and configuration
*/
PMusrT0::PMusrT0(PMusrT0Data &data) : fMusrT0Data(data)
{
@@ -535,7 +541,12 @@ PMusrT0::PMusrT0(PMusrT0Data &data) : fMusrT0Data(data)
// Done (SIGNAL)
//--------------------------------------------------------------------------
/**
* <p>Signal emitted if the user wants to terminate the application.
* \brief Emits Done signal to terminate the interactive session.
*
* This ROOT signal is emitted when the user finishes t0/range determination
* or closes the canvas. The status value determines the scope of termination.
*
* \param status Exit status: 0=local quit, 1=quit application, 2=global quit
*/
void PMusrT0::Done(Int_t status)
{
@@ -546,25 +557,29 @@ void PMusrT0::Done(Int_t status)
// HandleCmdKey (SLOT)
//--------------------------------------------------------------------------
/**
* <p>Filters keyboard and mouse events, and if they are a command key (see below) carries out the
* necessary actions.
* <p>Currently implemented command keys:
* - 'q' close the currently shown canvas
* - 'Q' quite the application
* - 'u' unzoom to the original range
* - 'z' zoom to the region aroung t0
* - 's' show/hide (toggle) the t0 of the data file (if present)
* - 'T' set t0 channel to the estimated t0
* - 't' set t0 channel to the current cursor position
* - 'b' set first background channel
* - 'B' set last background channel
* - 'd' set first good bin channel
* - 'D' set last good bin channel
* \brief Handles keyboard and mouse events for interactive t0/range selection.
*
* \param event event type
* \param x keyboard event: character key; mouse event: x-position
* \param y mouse event: y-position
* \param selected not used
* 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.
*
* \par Keyboard Commands:
* - 'q': Close current canvas (local quit)
* - 'Q': Quit entire application (global quit)
* - 'u': Unzoom to original histogram range
* - 'z': Zoom to region around t0
* - 's': Toggle visibility of t0 from data file
* - 'T': Set t0 to estimated value (maximum bin)
* - 't': Set t0 to cursor position
* - 'b': Set background start bin to cursor position
* - 'B': Set background end bin to cursor position
* - 'd': Set first good data bin to cursor position
* - 'D': Set last good data bin to cursor position
*
* \param event Event type (kKeyPress for keyboard events)
* \param x For keyboard: character key code; for mouse: x-position in pixels
* \param y For mouse: y-position in pixels
* \param selected Pointer to selected ROOT object (unused)
*/
void PMusrT0::HandleCmdKey(Int_t event, Int_t x, Int_t y, TObject *selected)
{
@@ -610,8 +625,10 @@ void PMusrT0::HandleCmdKey(Int_t event, Int_t x, Int_t y, TObject *selected)
// Quit (public)
//--------------------------------------------------------------------------
/**
* <p>Slot called when the canvas is closed via the close icon (cross top right corner).
* It is emitting a global quit singal.
* \brief 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.
*/
void PMusrT0::Quit()
{
@@ -623,9 +640,12 @@ void PMusrT0::Quit()
// SetTimeout (public)
//--------------------------------------------------------------------------
/**
* <p>
* \brief Sets automatic timeout for the interactive session.
*
* \param timeout after which the done signal shall be emitted. Given in seconds
* Creates and starts a timer that will automatically call Quit() if no
* user interaction occurs within the specified timeout period.
*
* \param timeout Timeout duration in seconds (≤0 disables timeout)
*/
void PMusrT0::SetTimeout(Int_t timeout)
{
@@ -645,9 +665,12 @@ void PMusrT0::SetTimeout(Int_t timeout)
// SetMsrHandler
//--------------------------------------------------------------------------
/**
* <p>Set the msr-file handler
* \brief Sets the MSR file handler for accessing run configuration.
*
* \param msrHandler msr-file handler pointer
* The MSR handler provides access to run parameters, t0 values, and other
* configuration data needed for interactive t0/range determination.
*
* \param msrHandler Pointer to initialized PMsrHandler instance
*/
void PMusrT0::SetMsrHandler(PMsrHandler *msrHandler)
{
@@ -658,7 +681,12 @@ void PMusrT0::SetMsrHandler(PMsrHandler *msrHandler)
// InitT0
//--------------------------------------------------------------------------
/**
* <p>Initialize t0 data.
* \brief 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.
*/
void PMusrT0::InitT0()
{
@@ -699,7 +727,14 @@ void PMusrT0::InitT0()
// InitDataAndBkg
//--------------------------------------------------------------------------
/**
* <p>Initialize data and background ranges.
* \brief 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):
* - Data region shown in blue (first good bin to last good bin)
* - Background region shown in red (background start to end)
* - Vertical lines mark the boundaries of both regions
*/
void PMusrT0::InitDataAndBkg()
{
@@ -795,7 +830,10 @@ void PMusrT0::InitDataAndBkg()
// ShowDataFileT0Channel
//--------------------------------------------------------------------------
/**
* <p>Show the t0 channel from the data file (if present).
* \brief 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.
*/
void PMusrT0::ShowDataFileT0Channel()
{
@@ -818,7 +856,10 @@ void PMusrT0::ShowDataFileT0Channel()
// HideDataFileT0Channel
//--------------------------------------------------------------------------
/**
* <p>Hide the t0 channel from the data file (if currently displayed).
* \brief 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.
*/
void PMusrT0::HideDataFileT0Channel()
{
@@ -832,7 +873,11 @@ void PMusrT0::HideDataFileT0Channel()
// SetT0Channel
//--------------------------------------------------------------------------
/**
* <p>Set the t0 channel to the current cursor position and keep the x-position as new t0 bin.
* \brief 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).
*/
void PMusrT0::SetT0Channel()
{
@@ -876,7 +921,11 @@ void PMusrT0::SetT0Channel()
// SetEstimatedT0Channel
//--------------------------------------------------------------------------
/**
* <p>Set the estimated t0 channel to the current cursor position and keep the x-position as new t0 bin.
* \brief 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.
*/
void PMusrT0::SetEstimatedT0Channel()
{
@@ -916,7 +965,11 @@ void PMusrT0::SetEstimatedT0Channel()
// SetDataFirstChannel
//--------------------------------------------------------------------------
/**
* <p>Set the first good data channel to the current cursor position and keep the x-position as new first good data bin.
* \brief 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.
*/
void PMusrT0::SetDataFirstChannel()
{
@@ -962,7 +1015,11 @@ void PMusrT0::SetDataFirstChannel()
// SetDataLastChannel
//--------------------------------------------------------------------------
/**
* <p>Set the last good data channel to the current cursor position and keep the x-position as new last good data bin.
* \brief 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.
*/
void PMusrT0::SetDataLastChannel()
{
@@ -1008,7 +1065,11 @@ void PMusrT0::SetDataLastChannel()
// SetBkgFirstChannel
//--------------------------------------------------------------------------
/**
* <p>Set the first background channel to the current cursor position and keep the x-position as new first background bin.
* \brief 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.
*/
void PMusrT0::SetBkgFirstChannel()
{
@@ -1054,7 +1115,11 @@ void PMusrT0::SetBkgFirstChannel()
// SetBkgLastChannel
//--------------------------------------------------------------------------
/**
* <p>Set the last background channel to the current cursor position and keep the x-position as new last background bin.
* \brief 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.
*/
void PMusrT0::SetBkgLastChannel()
{
@@ -1100,7 +1165,10 @@ void PMusrT0::SetBkgLastChannel()
// UnZoom
//--------------------------------------------------------------------------
/**
* <p>Unzoom the current histogram
* \brief 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.
*/
void PMusrT0::UnZoom()
{
@@ -1115,7 +1183,11 @@ void PMusrT0::UnZoom()
// ZoomT0
//--------------------------------------------------------------------------
/**
* <p>Zoom into the histogram region of the t0, and/or estimated t0 range.
* \brief 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.
*/
void PMusrT0::ZoomT0()
{