|
musrfit 1.10.0
|
Prepares time-domain μSR data for Fourier transformation. More...
#include <PPrepFourier.h>
Public Member Functions | |
| PPrepFourier () | |
| Default constructor (requires separate configuration) | |
| PPrepFourier (const Int_t packing, const Int_t *bkgRange, PDoubleVector bkg) | |
| Full constructor with all configuration parameters. | |
| virtual | ~PPrepFourier () |
| Destructor. | |
| virtual void | SetBkgRange (const Int_t *bkgRange) |
| Sets background range for automatic background calculation. | |
| virtual void | SetBkg (PDoubleVector bkg) |
| Sets explicit background values for each data set. | |
| virtual void | SetPacking (const Int_t packing) |
| Sets rebinning/packing factor for data reduction. | |
| virtual void | AddData (musrFT_data &data) |
| Adds a time-domain data set for processing. | |
| virtual void | DoBkgCorrection () |
| Applies background correction to all data sets. | |
| virtual void | DoPacking () |
| Applies rebinning/packing to reduce data points. | |
| virtual void | DoLifeTimeCorrection (Double_t fudge) |
| Applies muon lifetime correction for theory-free analysis. | |
| TString | GetInfo (const UInt_t idx) |
| Returns metadata string for a specific data set. | |
| Int_t | GetDataSetTag (const UInt_t idx) |
| Returns data set tag identifier. | |
| UInt_t | GetNoOfData () |
| Returns number of stored data sets. | |
| std::vector< TH1F * > | GetData () |
| Creates ROOT histograms for all processed data sets. | |
| TH1F * | GetData (const UInt_t idx) |
| Creates ROOT histogram for a specific processed data set. | |
Private Member Functions | |
| virtual void | InitData () |
| Initializes processed data from raw data. | |
Private Attributes | |
| std::vector< musrFT_data > | fRawData |
| Raw input data sets with metadata. | |
| std::vector< PDoubleVector > | fData |
| Processed data (after t0, corrections, packing) | |
| Int_t | fBkgRange [2] |
| Background range: [0]=start bin, [1]=end bin (-1=unused) | |
| PDoubleVector | fBkg |
| Explicit background values (one per data set) | |
| Int_t | fPacking |
| Rebinning factor (1=no rebinning, N=combine N bins) | |
Prepares time-domain μSR data for Fourier transformation.
PPrepFourier is a utility class that processes raw time-domain μSR data before Fourier transformation. It performs essential preprocessing steps:
The class handles multiple data sets simultaneously and prepares them for subsequent Fourier analysis without requiring theoretical fit functions.
Definition at line 87 of file PPrepFourier.h.
| PPrepFourier::PPrepFourier | ( | ) |
Default constructor (requires separate configuration)
Default constructor that initializes to default values.
Sets background range to unused (-1, -1) and packing to 1 (no rebinning). Background values and data must be set separately using setter methods.
Definition at line 43 of file PPrepFourier.cpp.
| PPrepFourier::PPrepFourier | ( | const Int_t | packing, |
| const Int_t * | bkgRange, | ||
| PDoubleVector | bkg ) |
Full constructor with all configuration parameters.
Full constructor that initializes all configuration parameters.
| packing | Rebinning factor (1=no rebinning, 2=combine 2 bins, etc.) |
| bkgRange | Background range [start, end] in bins (-1 if not used) |
| bkg | Vector of explicit background values (one per data set) |
Creates a PPrepFourier instance with complete configuration. Background can be specified either via range (for automatic calculation) or via explicit values (one per data set to be added later).
| packing | Rebinning factor (1=no rebinning, N=combine N bins) |
| bkgRange | Background range [start, end] in bins (-1 if not used) |
| bkg | Vector of explicit background values (one per data set) |
Definition at line 64 of file PPrepFourier.cpp.
References fPacking, SetBkg(), and SetBkgRange().
|
virtual |
Destructor.
Destructor that cleans up internal data structures.
Clears both raw data and processed data vectors. Note that TH1F objects returned by GetData() are owned by the caller and not cleaned up here.
Definition at line 80 of file PPrepFourier.cpp.
|
virtual |
Adds a time-domain data set for processing.
Adds a time-domain data set to the internal collection.
| data | musrFT_data structure containing raw data and metadata |
Stores the raw data and metadata for later processing. Multiple data sets can be added and will be processed together by DoBkgCorrection(), DoPacking(), and DoLifeTimeCorrection().
| data | musrFT_data structure containing raw histogram data and metadata |
Definition at line 188 of file PPrepFourier.cpp.
References fRawData.
Referenced by main().
|
virtual |
Applies background correction to all data sets.
Uses either the background range (averaged over range) or explicit background values. Background is subtracted from all data points.
Subtracts background from each data point. The background can be specified in two ways:
If fData is not yet initialized, calls InitData() first. If neither background range nor explicit values are provided, no correction is applied. Validates that background range is within data bounds and that the number of explicit background values matches the number of data sets.
Definition at line 209 of file PPrepFourier.cpp.
References fBkg, fBkgRange, fData, fRawData, and InitData().
Referenced by main().
|
virtual |
Applies muon lifetime correction for theory-free analysis.
Applies muon lifetime correction for theory-free Fourier analysis.
| fudge | Rescaling factor for estimated N0 (typically ~1.0) |
Multiplies data by exp(t/τ) to remove muon decay, estimates N0 from the average, and normalizes to create asymmetry-like data. Works best for high fields (>few kGauss) where depolarization is minimal.
Performs a theory-free lifetime correction by:
This approach works well for high fields (>few kGauss) where depolarization is minimal, but may be less accurate for low fields where significant relaxation occurs during the muon lifetime.
If fData is not yet initialized, calls InitData() first. Background correction should typically be applied before lifetime correction.
| fudge | Rescaling factor for estimated N0 (typically ~1.0, allows fine-tuning) |
Definition at line 322 of file PPrepFourier.cpp.
References fData, fRawData, InitData(), and PMUON_LIFETIME.
Referenced by main().
|
virtual |
Applies rebinning/packing to reduce data points.
Applies rebinning/packing to reduce the number of data points.
Combines adjacent bins according to the packing factor to improve statistics and reduce the number of data points.
Combines adjacent bins according to the packing factor to improve statistics and reduce data size. Bins are summed in groups of fPacking size. If fPacking=1, no rebinning is performed.
If fData is not yet initialized, calls InitData() first. The time resolution should be adjusted accordingly (multiplied by fPacking) when creating histograms.
Definition at line 273 of file PPrepFourier.cpp.
References fData, fPacking, fRawData, and InitData().
Referenced by main().
| std::vector< TH1F * > PPrepFourier::GetData | ( | ) |
Creates ROOT histograms for all processed data sets.
Creates histograms with proper time binning, respecting time ranges and packing. The caller is responsible for deleting the histograms.
Converts the processed data into TH1F histograms with proper time binning. The time range, bin width, and histogram titles are taken from the musrFT_data metadata. The packing factor is applied to the time resolution.
Definition at line 411 of file PPrepFourier.cpp.
References fData, fPacking, and fRawData.
Referenced by main().
| TH1F * PPrepFourier::GetData | ( | const UInt_t | idx | ) |
Creates ROOT histogram for a specific processed data set.
Creates a ROOT histogram for a specific processed data set.
| idx | Data set index |
Creates a histogram with proper time binning for the specified data set. The caller is responsible for deleting the histogram.
Converts a single processed data set into a TH1F histogram with proper time binning. The time range, bin width, and histogram title are taken from the musrFT_data metadata. The packing factor is applied to the time resolution.
| idx | Data set index |
Definition at line 488 of file PPrepFourier.cpp.
| Int_t PPrepFourier::GetDataSetTag | ( | const UInt_t | idx | ) |
Returns data set tag identifier.
Returns the data set tag identifier.
| idx | Data set index |
The data set tag is used to label and group related data sets, particularly for average-per-data-set operations in Fourier analysis.
| idx | Data set index |
Definition at line 386 of file PPrepFourier.cpp.
References fRawData.
Referenced by main().
| TString PPrepFourier::GetInfo | ( | const UInt_t | idx | ) |
Returns metadata string for a specific data set.
Returns the metadata string for a specific data set.
| idx | Data set index |
| idx | Data set index |
Definition at line 364 of file PPrepFourier.cpp.
References fRawData.
|
inline |
Returns number of stored data sets.
Definition at line 171 of file PPrepFourier.h.
References fRawData.
Referenced by main().
|
privatevirtual |
Initializes processed data from raw data.
Initializes processed data by copying from raw data starting at t0.
Copies raw data to fData starting from t0 bin. This is called automatically by processing methods if needed.
Creates the fData vectors from fRawData, starting from the t0 bin for each data set. This effectively removes pre-t0 bins and creates a working copy for subsequent processing (background correction, packing, lifetime correction).
If t0 is negative or not set, data is copied from bin 0. This method is called automatically by processing methods if fData is not yet initialized.
Definition at line 548 of file PPrepFourier.cpp.
References fData, and fRawData.
Referenced by DoBkgCorrection(), DoLifeTimeCorrection(), and DoPacking().
|
virtual |
Sets explicit background values for each data set.
Sets explicit background values for all data sets.
| bkg | Vector of background values (one per histogram) |
Provides pre-calculated background values (one per data set) instead of calculating them from a background range. This allows different background values for each histogram.
| bkg | Vector of background values (should match number of data sets) |
Definition at line 149 of file PPrepFourier.cpp.
References fBkg.
Referenced by PPrepFourier().
|
virtual |
Sets background range for automatic background calculation.
Sets the background range for automatic background calculation.
| bkgRange | Array [start, end] specifying background bins (both ≥-1) |
Specifies the bin range [start, end] for calculating background by averaging. Values of -1 indicate that background range is not used (explicit background values should be provided instead). Validates that both values are ≥-1 and prints warnings if invalid values are encountered.
| bkgRange | Array [start, end] with background bin range (both must be ≥-1) |
Definition at line 99 of file PPrepFourier.cpp.
References fBkgRange.
Referenced by main(), and PPrepFourier().
|
virtual |
Sets rebinning/packing factor for data reduction.
Sets the rebinning/packing factor for data reduction.
| packing | Number of bins to combine (must be > 0) |
Specifies how many adjacent bins to combine during DoPacking(). A value of 1 means no rebinning, 2 combines pairs of bins, etc. Invalid values (≤0) are rejected with a warning.
| packing | Number of bins to combine (must be > 0) |
Definition at line 167 of file PPrepFourier.cpp.
References fPacking.
Referenced by main().
|
private |
Explicit background values (one per data set)
Definition at line 196 of file PPrepFourier.h.
Referenced by DoBkgCorrection(), and SetBkg().
|
private |
Background range: [0]=start bin, [1]=end bin (-1=unused)
Definition at line 195 of file PPrepFourier.h.
Referenced by DoBkgCorrection(), PPrepFourier(), and SetBkgRange().
|
private |
Processed data (after t0, corrections, packing)
Definition at line 194 of file PPrepFourier.h.
Referenced by DoBkgCorrection(), DoLifeTimeCorrection(), DoPacking(), GetData(), GetData(), InitData(), and ~PPrepFourier().
|
private |
Rebinning factor (1=no rebinning, N=combine N bins)
Definition at line 197 of file PPrepFourier.h.
Referenced by DoPacking(), GetData(), GetData(), PPrepFourier(), PPrepFourier(), and SetPacking().
|
private |
Raw input data sets with metadata.
Definition at line 193 of file PPrepFourier.h.
Referenced by AddData(), DoBkgCorrection(), DoLifeTimeCorrection(), DoPacking(), GetData(), GetData(), GetDataSetTag(), GetInfo(), GetNoOfData(), InitData(), and ~PPrepFourier().