38#include <TRootCanvas.h>
54#define PMUSRT0_FORWARD 0
55#define PMUSRT0_BACKWARD 1
60#define PMUSRT0_GET_T0 0
61#define PMUSRT0_GET_DATA_AND_BKG_RANGE 1
62#define PMUSRT0_GET_T0_DATA_AND_BKG_RANGE 2
121 virtual Int_t
GetAddT0Bin(UInt_t addRunIdx, UInt_t idx);
142 virtual void SetT0Bin(UInt_t val, UInt_t idx);
144 virtual void SetAddT0Bin(UInt_t val, UInt_t addRunIdx, UInt_t idx);
197class PMusrT0 :
public TObject,
public TQObject
230 virtual void HandleCmdKey(Int_t event, Int_t x, Int_t y, TObject *selected);
std::vector< Int_t > PIntVector
MSR file parser and manager for the musrfit framework.
Data container for musrt0 raw run data and histogram information.
virtual Int_t GetHistoNo(UInt_t idx)
Returns histogram number at given index.
PIntVector fT0
t0 bin values for main run histograms
virtual Int_t GetAddT0Bin(UInt_t addRunIdx, UInt_t idx)
Returns t0 bin for specific addrun and histogram.
virtual Int_t GetHistoNoIdx()
Returns current histogram number index.
Int_t fHistoNoIdx
Current histogram number index.
virtual void SetT0BinData(UInt_t val)
Sets t0 bin value found from data file.
PMusrT0Data()
Default constructor.
virtual void InitData()
Initializes data structures (currently empty implementation)
std::vector< PRawRunData * > fRawRunData
Raw data: index 0 = main run, index >0 = addruns.
virtual Int_t GetRunNo()
Returns MSR file run number.
virtual void SetSingleHisto(const Bool_t flag)
Sets single histogram fit mode flag.
virtual UInt_t GetHistoNoSize()
Returns number of histogram numbers.
virtual void SetHistoNo(const PIntVector histoNo)
Sets vector of histogram numbers.
virtual void SetRawRunData(const std::vector< PRawRunData * > rawRunData)
Sets vector of raw run data pointers.
virtual Int_t GetT0Bin(UInt_t idx)
Returns t0 bin value at given index.
virtual UInt_t GetRawRunDataSize()
Returns number of raw run data entries (1 + number of addruns)
virtual void SetAddT0Bin(UInt_t val, UInt_t addRunIdx, UInt_t idx)
Sets t0 bin value for specific addrun and index.
virtual Int_t GetT0BinData()
Returns t0 bin found from data file.
virtual void SetHistoNoIdx(const UInt_t histoNoIdx)
Sets current histogram number index.
virtual ~PMusrT0Data()
Destructor.
std::vector< PIntVector > fAddT0
t0 bin values for addrun histograms
PIntVector fHistoNo
Histogram numbers (with Red/Green offset applied)
virtual void SetCmdTag(const UInt_t cmdTag)
Sets command/mode tag.
virtual UInt_t GetAddT0Entries()
Returns number of addrun entries with t0 values.
virtual UInt_t GetAddT0BinSize(UInt_t idx)
Returns number of t0 bins for given addrun.
virtual PRawRunData * GetRawRunData(Int_t idx)
Returns raw run data for given index (0=main run, >0=addruns)
Int_t fT0Data
t0 bin found in current data file
Int_t fRunNo
MSR file run block number.
Int_t fCmdTag
Mode: 0=t0 only, 1=ranges only, 2=both t0 and ranges.
virtual Int_t GetCmdTag()
Returns command tag (mode for t0/range determination)
virtual UInt_t GetT0BinSize()
Returns number of t0 bins for main run.
virtual void SetDetectorTag(const UInt_t detectorTag)
Sets detector tag (forward/backward)
virtual Int_t GetAddRunIdx()
Returns current addrun index.
virtual void SetRunNo(const UInt_t runNo)
Sets MSR file run number.
Int_t fAddRunIdx
Current addrun index being processed.
virtual void SetT0Bin(UInt_t val, UInt_t idx)
Sets t0 bin value at given index.
virtual Bool_t IsSingleHisto()
Returns true if single histogram fit mode.
virtual void SetAddRunIdx(const UInt_t addRunIdx)
Sets current addrun index.
Bool_t fSingleHisto
True for single histogram fit, false for asymmetry fit.
Int_t fDetectorTag
Detector: PMUSRT0_FORWARD (0) or PMUSRT0_BACKWARD (1)
virtual Int_t GetDetectorTag()
Returns detector tag (PMUSRT0_FORWARD or PMUSRT0_BACKWARD)
Int_t fTimeout
Timeout in ms after which Done signal is emitted (≤0 disables timeout)
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< TTimer > fTimeoutTimer
Timer to emit Done signal if no user interaction occurs.
void SetDataLastChannel()
Sets last good data bin to cursor position.
PMusrT0Data fMusrT0Data
Container for raw μSR run data and histogram information.
std::unique_ptr< TLine > fT0Line
Vertical line marking current t0 position.
std::unique_ptr< TLatex > fToDoInfo
Text display showing current instructions to user.
Bool_t fValid
True if raw data sets are available and GUI is functional.
void UnZoom()
Resets zoom to show full histogram range.
PMusrT0()
Default constructor (creates invalid instance)
void HideDataFileT0Channel()
Hides vertical line showing t0 from data file.
virtual Bool_t IsValid()
Returns validity status of the PMusrT0 instance.
void SetBkgLastChannel()
Sets background end bin to cursor position.
void SetEstimatedT0Channel()
Sets t0 to estimated value and updates display.
Bool_t fShowT0DataChannel
Flag to show/hide t0 value from data file.
virtual void SetMsrHandler(PMsrHandler *msrHandler)
Sets the MSR file handler for accessing run configuration.
std::unique_ptr< TLine > fLastDataLine
Vertical line marking last good data bin.
virtual void InitT0()
Initializes GUI for interactive t0 determination.
virtual void InitDataAndBkg()
Initializes GUI for interactive data and background range determination.
void SetT0Channel()
Sets t0 to cursor position and updates display.
virtual void Done(Int_t status=0)
Emits signal indicating completion of t0/range determination.
Bool_t fDataAndBkgEnabled
Enable/disable data and background range handling (required for grouping/addrun)
Int_t fDataRange[2]
Data range in bins: [0]=first good bin, [1]=last good bin.
Int_t fPx
Current cursor x-position in pixel coordinates.
void ShowDataFileT0Channel()
Displays vertical line showing t0 from data file.
Int_t fPy
Current cursor y-position in pixel coordinates.
std::unique_ptr< TH1F > fHisto
Full raw data histogram (all bins)
PMsrHandler * fMsrHandler
MSR file handler for accessing run configuration.
Int_t fBkgRange[2]
Background range in bins: [0]=first bkg bin, [1]=last bkg bin.
std::unique_ptr< TLine > fFirstBkgLine
Vertical line marking background start bin.
void SetBkgFirstChannel()
Sets background start bin to cursor position.
Int_t fStatus
Exit status: 0=local quit (single canvas), 1=quit application.
std::unique_ptr< TLine > fT0DataLine
Vertical line marking t0 found in data file.
std::unique_ptr< TH1F > fBkg
Background region histogram (background start to end)
Bool_t fT0Enabled
Enable/disable t0 handling (required for grouping/addrun)
Int_t fT0Estimated
Estimated t0 value in bins (used as initial guess)
virtual Int_t GetStatus()
Returns current exit status.
std::unique_ptr< TH1F > fData
Data region histogram (first good bin to last good bin)
virtual void HandleCmdKey(Int_t event, Int_t x, Int_t y, TObject *selected)
Handles keyboard input for interactive t0 and range selection.
void SetDataFirstChannel()
Sets first good data bin to cursor position.
void ZoomT0()
Zooms to region around t0 for precise adjustment.
virtual void SetTimeout(Int_t timeout)
Sets automatic timeout for the interactive session.
virtual void Quit()
Quit slot that emits Done signal to close the current canvas.
std::unique_ptr< TCanvas > fMainCanvas
Main ROOT canvas for the interactive GUI.