improve doxygen documentation of PMusrT0.*
This commit is contained in:
@@ -48,148 +48,269 @@
|
||||
#include "PMsrHandler.h"
|
||||
#endif // __MAKECLING__
|
||||
|
||||
#define PMUSRT0_FORWARD 0
|
||||
#define PMUSRT0_BACKWARD 1
|
||||
//--------------------------------------------------------------------------
|
||||
// Detector tags
|
||||
//--------------------------------------------------------------------------
|
||||
#define PMUSRT0_FORWARD 0 ///< Forward detector tag
|
||||
#define PMUSRT0_BACKWARD 1 ///< Backward detector tag
|
||||
|
||||
#define PMUSRT0_GET_T0 0
|
||||
#define PMUSRT0_GET_DATA_AND_BKG_RANGE 1
|
||||
#define PMUSRT0_GET_T0_DATA_AND_BKG_RANGE 2
|
||||
//--------------------------------------------------------------------------
|
||||
// Command/mode tags
|
||||
//--------------------------------------------------------------------------
|
||||
#define PMUSRT0_GET_T0 0 ///< Mode: Determine t0 only
|
||||
#define PMUSRT0_GET_DATA_AND_BKG_RANGE 1 ///< Mode: Determine data and background ranges only
|
||||
#define PMUSRT0_GET_T0_DATA_AND_BKG_RANGE 2 ///< Mode: Determine t0, data range, and background range
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Handles the raw muSR run data sets.
|
||||
* \brief Data container for musrt0 raw run data and histogram information.
|
||||
*
|
||||
* PMusrT0Data manages the raw histogram data needed for interactive t0 and
|
||||
* range determination in the musrt0 tool. It stores:
|
||||
* - Raw run data (main run and optional addruns)
|
||||
* - Histogram numbers and detector grouping
|
||||
* - Current and saved t0 bin values
|
||||
* - Data and background range information
|
||||
*
|
||||
* The class supports both single histogram and asymmetry fit modes, and
|
||||
* handles complex run configurations including addrun combinations.
|
||||
*
|
||||
* \see PMusrT0 for the GUI interface using this data
|
||||
* \see PRawRunData for the underlying raw data structure
|
||||
*/
|
||||
class PMusrT0Data {
|
||||
public:
|
||||
/// Default constructor
|
||||
PMusrT0Data();
|
||||
/// Destructor
|
||||
virtual ~PMusrT0Data();
|
||||
|
||||
|
||||
/// Initializes data structures (currently empty implementation)
|
||||
virtual void InitData();
|
||||
|
||||
/// Returns true if single histogram fit mode
|
||||
virtual Bool_t IsSingleHisto() { return fSingleHisto; }
|
||||
/// Returns number of raw run data entries (1 + number of addruns)
|
||||
virtual UInt_t GetRawRunDataSize() { return fRawRunData.size(); }
|
||||
/// Returns raw run data for given index (0=main run, >0=addruns)
|
||||
virtual PRawRunData* GetRawRunData(Int_t idx);
|
||||
/// Returns MSR file run number
|
||||
virtual Int_t GetRunNo() { return fRunNo; }
|
||||
/// Returns current addrun index
|
||||
virtual Int_t GetAddRunIdx() { return fAddRunIdx; }
|
||||
/// Returns current histogram number index
|
||||
virtual Int_t GetHistoNoIdx() { return fHistoNoIdx; }
|
||||
/// Returns number of histogram numbers
|
||||
virtual UInt_t GetHistoNoSize() { return fHistoNo.size(); }
|
||||
/// Returns histogram number at given index
|
||||
virtual Int_t GetHistoNo(UInt_t idx);
|
||||
/// Returns detector tag (PMUSRT0_FORWARD or PMUSRT0_BACKWARD)
|
||||
virtual Int_t GetDetectorTag() { return fDetectorTag; }
|
||||
/// Returns command tag (mode for t0/range determination)
|
||||
virtual Int_t GetCmdTag() { return fCmdTag; }
|
||||
/// Returns number of t0 bins for main run
|
||||
virtual UInt_t GetT0BinSize() { return fT0.size(); }
|
||||
/// Returns t0 bin value at given index
|
||||
virtual Int_t GetT0Bin(UInt_t idx);
|
||||
/// Returns number of addrun entries with t0 values
|
||||
virtual UInt_t GetAddT0Entries() { return fAddT0.size(); }
|
||||
/// Returns number of t0 bins for given addrun
|
||||
virtual UInt_t GetAddT0BinSize(UInt_t idx);
|
||||
/// Returns t0 bin for specific addrun and histogram
|
||||
virtual Int_t GetAddT0Bin(UInt_t addRunIdx, UInt_t idx);
|
||||
/// Returns t0 bin found from data file
|
||||
virtual Int_t GetT0BinData() { return fT0Data; }
|
||||
|
||||
/// Sets single histogram fit mode flag
|
||||
virtual void SetSingleHisto(const Bool_t flag) { fSingleHisto = flag; }
|
||||
/// Sets vector of raw run data pointers
|
||||
virtual void SetRawRunData(const std::vector<PRawRunData*> rawRunData) { fRawRunData = rawRunData; }
|
||||
/// Sets MSR file run number
|
||||
virtual void SetRunNo(const UInt_t runNo) { fRunNo = runNo; }
|
||||
/// Sets current addrun index
|
||||
virtual void SetAddRunIdx(const UInt_t addRunIdx) { fAddRunIdx = addRunIdx; }
|
||||
/// Sets current histogram number index
|
||||
virtual void SetHistoNoIdx(const UInt_t histoNoIdx) { fHistoNoIdx = histoNoIdx; }
|
||||
/// Sets vector of histogram numbers
|
||||
virtual void SetHistoNo(const PIntVector histoNo) { fHistoNo = histoNo; }
|
||||
/// Sets detector tag (forward/backward)
|
||||
virtual void SetDetectorTag(const UInt_t detectorTag) { fDetectorTag = detectorTag; }
|
||||
/// Sets command/mode tag
|
||||
virtual void SetCmdTag(const UInt_t cmdTag) { fCmdTag = cmdTag; }
|
||||
/// Sets t0 bin value at given index
|
||||
virtual void SetT0Bin(UInt_t val, UInt_t idx);
|
||||
/// Sets t0 bin value for specific addrun and index
|
||||
virtual void SetAddT0Bin(UInt_t val, UInt_t addRunIdx, UInt_t idx);
|
||||
/// Sets t0 bin value found from data file
|
||||
virtual void SetT0BinData(UInt_t val) { fT0Data = val; }
|
||||
|
||||
private:
|
||||
Bool_t fSingleHisto; ///< true if single histo fit, false for asymmetry fit
|
||||
std::vector<PRawRunData*> fRawRunData; ///< holds the raw data of the needed runs, idx=0 the run, idx>0 the addruns
|
||||
Int_t fRunNo; ///< msr-file run number
|
||||
Int_t fAddRunIdx; ///< msr-file addrun index
|
||||
Int_t fHistoNoIdx; ///< msr-file histo number index
|
||||
PIntVector fHistoNo; ///< msr-file histo numbers, i.e. idx + Red/Green offset
|
||||
Int_t fDetectorTag; ///< detector tag. forward=0,backward=1
|
||||
Int_t fCmdTag; ///< command tag. 0=get t0, 1=get data-/bkg-range, 2=get t0, and data-/bkg-range
|
||||
PIntVector fT0; ///< holding the t0's of the run
|
||||
std::vector<PIntVector> fAddT0; ///< holding the t0's of the addruns
|
||||
Int_t fT0Data; ///< holding the t0 found in the current data set
|
||||
Bool_t fSingleHisto; ///< True for single histogram fit, false for asymmetry fit
|
||||
std::vector<PRawRunData*> fRawRunData; ///< Raw data: index 0 = main run, index >0 = addruns
|
||||
Int_t fRunNo; ///< MSR file run block number
|
||||
Int_t fAddRunIdx; ///< Current addrun index being processed
|
||||
Int_t fHistoNoIdx; ///< Current histogram number index
|
||||
PIntVector fHistoNo; ///< Histogram numbers (with Red/Green offset applied)
|
||||
Int_t fDetectorTag; ///< Detector: PMUSRT0_FORWARD (0) or PMUSRT0_BACKWARD (1)
|
||||
Int_t fCmdTag; ///< Mode: 0=t0 only, 1=ranges only, 2=both t0 and ranges
|
||||
PIntVector fT0; ///< t0 bin values for main run histograms
|
||||
std::vector<PIntVector> fAddT0; ///< t0 bin values for addrun histograms
|
||||
Int_t fT0Data; ///< t0 bin found in current data file
|
||||
};
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Handles the musrt0 graphical user interface.
|
||||
* <p>The preprocessor tag __MAKECLING__ is used to hide away from rootcling
|
||||
* \brief Interactive GUI for determining t0 and data/background ranges in μSR experiments.
|
||||
*
|
||||
* PMusrT0 provides a ROOT-based graphical interface for interactively determining:
|
||||
* - t0 values (time zero calibration for detector histograms)
|
||||
* - Data ranges (first good bin, last good bin)
|
||||
* - Background ranges (background start/end bins)
|
||||
*
|
||||
* The tool displays raw histogram data and allows users to set these parameters
|
||||
* through keyboard interactions. It supports:
|
||||
* - Single histogram and asymmetry fit modes
|
||||
* - Multiple histograms and addrun configurations
|
||||
* - Visual markers for t0, data ranges, and background ranges
|
||||
* - Zoom capabilities for precise bin selection
|
||||
*
|
||||
* \par Keyboard Controls:
|
||||
* - 't': Set t0 at cursor position
|
||||
* - 'e': Set estimated t0
|
||||
* - 'f': Set first good data bin
|
||||
* - 'l': Set last good data bin
|
||||
* - 'b': Set background start bin
|
||||
* - 'n': Set background end bin
|
||||
* - 'u': Unzoom to full histogram
|
||||
* - 'z': Zoom to t0 region
|
||||
* - 'd': Toggle data file t0 display
|
||||
* - 'q': Quit/advance to next histogram
|
||||
*
|
||||
* \note The preprocessor tag __MAKECLING__ is used to hide away from rootcling
|
||||
* the overly complex spirit header files.
|
||||
*
|
||||
* \see PMusrT0Data for the underlying data container
|
||||
* \see PMsrHandler for MSR file management
|
||||
*/
|
||||
class PMusrT0 : public TObject, public TQObject
|
||||
{
|
||||
public:
|
||||
/// Default constructor (creates invalid instance)
|
||||
PMusrT0();
|
||||
/**
|
||||
* \brief Main constructor that initializes the interactive GUI.
|
||||
* \param data Reference to PMusrT0Data containing raw run data and configuration
|
||||
*/
|
||||
PMusrT0(PMusrT0Data &data);
|
||||
|
||||
/**
|
||||
* \brief Returns validity status of the PMusrT0 instance.
|
||||
* \return True if raw data sets are available and GUI is functional, false otherwise
|
||||
*/
|
||||
virtual Bool_t IsValid() { return fValid; }
|
||||
|
||||
/**
|
||||
* \brief Emits signal indicating completion of t0/range determination.
|
||||
* \param status Exit status: 0=local quit (single canvas), 1=quit entire application
|
||||
*/
|
||||
virtual void Done(Int_t status=0); // *SIGNAL*
|
||||
|
||||
/**
|
||||
* \brief Handles keyboard input for interactive t0 and range selection.
|
||||
* \param event Keyboard event code
|
||||
* \param x Mouse x-coordinate in pixels
|
||||
* \param y Mouse y-coordinate in pixels
|
||||
* \param 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.
|
||||
*/
|
||||
virtual void HandleCmdKey(Int_t event, Int_t x, Int_t y, TObject *selected); // SLOT
|
||||
|
||||
/// Quit slot that emits Done signal to close the current canvas
|
||||
virtual void Quit(); // SLOT
|
||||
|
||||
/**
|
||||
* \brief Sets automatic timeout for the interactive session.
|
||||
* \param timeout Timeout in milliseconds (≤0 disables timeout)
|
||||
*
|
||||
* If timeout expires without user interaction, the Done signal is automatically emitted.
|
||||
*/
|
||||
virtual void SetTimeout(Int_t timeout);
|
||||
|
||||
#ifndef __MAKECLING__
|
||||
/**
|
||||
* \brief Sets the MSR file handler for accessing run configuration.
|
||||
* \param msrHandler Pointer to initialized PMsrHandler instance
|
||||
*/
|
||||
virtual void SetMsrHandler(PMsrHandler *msrHandler);
|
||||
#endif // __MAKECLING__
|
||||
|
||||
/// Initializes GUI for interactive t0 determination
|
||||
virtual void InitT0();
|
||||
|
||||
/// Initializes GUI for interactive data and background range determination
|
||||
virtual void InitDataAndBkg();
|
||||
|
||||
/**
|
||||
* \brief Returns current exit status.
|
||||
* \return 0=local quit (single canvas terminates), 1=quit entire application
|
||||
*/
|
||||
virtual Int_t GetStatus() { return fStatus; }
|
||||
|
||||
private:
|
||||
#ifndef __MAKECLING__
|
||||
PMsrHandler *fMsrHandler; ///< msr-file handler
|
||||
PMsrHandler *fMsrHandler; ///< MSR file handler for accessing run configuration
|
||||
#endif // __MAKECLING__
|
||||
Int_t fTimeout; ///< timeout after which the Done signal should be emited. If timeout <= 0, no timeout is taking place
|
||||
Int_t fTimeout; ///< Timeout in ms after which Done signal is emitted (≤0 disables timeout)
|
||||
|
||||
Bool_t fValid; ///< true if raw data set are available, otherwise false
|
||||
Bool_t fValid; ///< True if raw data sets are available and GUI is functional
|
||||
|
||||
Int_t fStatus; ///< 0=quit locally, i.e. only a single musrt0 raw data canvas will terminate but not the application, 1=quit the application
|
||||
Int_t fStatus; ///< Exit status: 0=local quit (single canvas), 1=quit application
|
||||
|
||||
PMusrT0Data fMusrT0Data; ///< raw muSR run data sets.
|
||||
PMusrT0Data fMusrT0Data; ///< Container for raw μSR run data and histogram information
|
||||
|
||||
Bool_t fDataAndBkgEnabled; ///< enable/disable data and background range handling (necessary in connection with grouping and addrun)
|
||||
Bool_t fT0Enabled; ///< enable/disable t0 handling (necessary in connection with grouping and addrun)
|
||||
Int_t fT0Estimated; ///< estimated t0 value (in bins)
|
||||
Bool_t fShowT0DataChannel;
|
||||
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; ///< timeout timer in order to terminate if no action is taking place for too long
|
||||
std::unique_ptr<TTimer> fTimeoutTimer; ///< Timer to emit Done signal if no user interaction occurs
|
||||
|
||||
// canvas related variables
|
||||
std::unique_ptr<TCanvas> fMainCanvas; ///< main canvas for the graphical user interface
|
||||
// Canvas related variables
|
||||
std::unique_ptr<TCanvas> fMainCanvas; ///< Main ROOT canvas for the interactive GUI
|
||||
|
||||
std::unique_ptr<TH1F> fHisto; ///< full raw data histogram
|
||||
std::unique_ptr<TH1F> fData; ///< ranged raw data histogram (first good bin, last good bin)
|
||||
std::unique_ptr<TH1F> fBkg; ///< histogram starting from 'bkg start' up to 'bkg end'
|
||||
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; ///< clear text user instruction string
|
||||
std::unique_ptr<TLatex> fToDoInfo; ///< Text display showing current instructions to user
|
||||
|
||||
std::unique_ptr<TLine> fT0Line; ///< line showing the position of t0
|
||||
std::unique_ptr<TLine> fT0DataLine; ///< line showing the position of t0 found in the data file
|
||||
std::unique_ptr<TLine> fFirstBkgLine; ///< line showing the start of the background
|
||||
std::unique_ptr<TLine> fLastBkgLine; ///< line showing the end of the background
|
||||
std::unique_ptr<TLine> fFirstDataLine; ///< line showing the start of the data (first good data bin)
|
||||
std::unique_ptr<TLine> fLastDataLine; ///< line showing the end of the data (last good data bin)
|
||||
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; ///< x-position of the cursor
|
||||
Int_t fPy; ///< y-position of the cursor
|
||||
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 (first good bin, last good bin)
|
||||
Int_t fBkgRange[2]; ///< background range (first bkg bin, last bkg bin)
|
||||
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
|
||||
|
||||
void ShowDataFileT0Channel();
|
||||
void HideDataFileT0Channel();
|
||||
void SetT0Channel();
|
||||
void SetEstimatedT0Channel();
|
||||
void SetDataFirstChannel();
|
||||
void SetDataLastChannel();
|
||||
void SetBkgFirstChannel();
|
||||
void SetBkgLastChannel();
|
||||
void UnZoom();
|
||||
void ZoomT0();
|
||||
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
|
||||
|
||||
ClassDef(PMusrT0, 1)
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user