|
musrfit 1.10.0
|
Manager class for all processed μSR run data during fitting. More...
#include <PRunListCollection.h>

Public Types | |
| enum | EDataSwitch { kIndex , kRunNo } |
| Enumeration for data access mode. More... | |
Public Member Functions | |
| PRunListCollection (PMsrHandler *msrInfo, PRunDataHandler *data, Bool_t theoAsdata=false) | |
| Constructor that initializes the collection. | |
| virtual | ~PRunListCollection () |
| Virtual destructor that cleans up all run objects. | |
| virtual Bool_t | Add (Int_t runNo, EPMusrHandleTag tag) |
| Adds a run to the appropriate list based on fit type. | |
| virtual void | SetFitRange (const PDoublePairVector fitRange) |
| Sets fit range for all runs (time-based or bin-based). | |
| virtual void | SetFitRange (const TString fitRange) |
| Sets fit range from string specification (bin-based). | |
| virtual Double_t | GetSingleHistoChisq (const std::vector< Double_t > &par) const |
| Calculates total χ² for all single histogram runs. | |
| virtual Double_t | GetSingleHistoRRFChisq (const std::vector< Double_t > &par) const |
| Calculates total χ² for all single histogram RRF runs. | |
| virtual Double_t | GetAsymmetryChisq (const std::vector< Double_t > &par) const |
| Calculates total χ² for all asymmetry runs. | |
| virtual Double_t | GetAsymmetryRRFChisq (const std::vector< Double_t > &par) const |
| Calculates total χ² for all asymmetry RRF runs. | |
| virtual Double_t | GetAsymmetryBNMRChisq (const std::vector< Double_t > &par) const |
| Calculates total χ² for all β-NMR asymmetry runs. | |
| virtual Double_t | GetMuMinusChisq (const std::vector< Double_t > &par) const |
| Calculates total χ² for all mu-minus runs. | |
| virtual Double_t | GetNonMusrChisq (const std::vector< Double_t > &par) const |
| Calculates total χ² for all non-μSR runs. | |
| virtual Double_t | GetSingleRunChisqExpected (const std::vector< Double_t > &par, const UInt_t idx) const |
| Calculates expected χ² for a single run by index. | |
| virtual Double_t | GetSingleRunChisq (const std::vector< Double_t > &par, const UInt_t idx) const |
| Calculates χ² for a single run by index. | |
Maximum Likelihood Calculation Methods (Global Fits) | |
| virtual Double_t | GetSingleHistoMaximumLikelihood (const std::vector< Double_t > &par) const |
| Calculates total maximum likelihood for all single histogram runs. | |
| virtual Double_t | GetSingleHistoRRFMaximumLikelihood (const std::vector< Double_t > &par) const |
| Calculates total maximum likelihood for all single histogram RRF runs. | |
| virtual Double_t | GetAsymmetryMaximumLikelihood (const std::vector< Double_t > &par) const |
| Calculates total maximum likelihood for all asymmetry runs. | |
| virtual Double_t | GetAsymmetryRRFMaximumLikelihood (const std::vector< Double_t > &par) const |
| Calculates total maximum likelihood for all asymmetry RRF runs. | |
| virtual Double_t | GetAsymmetryBNMRMaximumLikelihood (const std::vector< Double_t > &par) const |
| Calculates total maximum likelihood for all β-NMR asymmetry runs. | |
| virtual Double_t | GetMuMinusMaximumLikelihood (const std::vector< Double_t > &par) const |
| Calculates total maximum likelihood for all μ⁻ runs. | |
| virtual Double_t | GetNonMusrMaximumLikelihood (const std::vector< Double_t > &par) const |
| Calculates total maximum likelihood for all non-μSR runs. | |
Single Run Maximum Likelihood Methods | |
| virtual Double_t | GetSingleRunMaximumLikelihoodExpected (const std::vector< Double_t > &par, const UInt_t idx) const |
| Calculates expected maximum likelihood for a single run (theoretical expectation). | |
| virtual Double_t | GetSingleRunMaximumLikelihood (const std::vector< Double_t > &par, const UInt_t idx) const |
| Calculates maximum likelihood for a single run. | |
Fit Statistics Methods | |
| virtual UInt_t | GetNoOfBinsFitted (const UInt_t idx) const |
| Returns the number of bins fitted for a specific run. | |
| virtual UInt_t | GetTotalNoOfBinsFitted () const |
| Returns total number of bins fitted across all runs. | |
Run Count Accessors | |
| virtual UInt_t | GetNoOfSingleHisto () const |
| Returns the number of single histogram runs in the collection. | |
| virtual UInt_t | GetNoOfSingleHistoRRF () const |
| Returns the number of single histogram RRF runs in the collection. | |
| virtual UInt_t | GetNoOfAsymmetry () const |
| Returns the number of asymmetry runs in the collection. | |
| virtual UInt_t | GetNoOfAsymmetryRRF () const |
| Returns the number of asymmetry RRF runs in the collection. | |
| virtual UInt_t | GetNoOfAsymmetryBNMR () const |
| Returns the number of β-NMR asymmetry runs in the collection. | |
| virtual UInt_t | GetNoOfMuMinus () const |
| Returns the number of μ⁻ runs in the collection. | |
| virtual UInt_t | GetNoOfNonMusr () const |
| Returns the number of non-μSR runs in the collection. | |
Processed Data Accessors | |
| virtual PRunData * | GetSingleHisto (UInt_t index, EDataSwitch tag=kIndex) |
| Retrieves processed data for a single histogram run. | |
| virtual PRunData * | GetSingleHistoRRF (UInt_t index, EDataSwitch tag=kIndex) |
| Retrieves processed data for a single histogram RRF run. | |
| virtual PRunData * | GetAsymmetry (UInt_t index, EDataSwitch tag=kIndex) |
| Retrieves processed data for an asymmetry run. | |
| virtual PRunData * | GetAsymmetryRRF (UInt_t index, EDataSwitch tag=kIndex) |
| Retrieves processed data for an asymmetry RRF run. | |
| virtual PRunData * | GetAsymmetryBNMR (UInt_t index, EDataSwitch tag=kIndex) |
| Retrieves processed data for a β-NMR asymmetry run. | |
| virtual PRunData * | GetMuMinus (UInt_t index, EDataSwitch tag=kIndex) |
| Retrieves processed data for a μ⁻ run. | |
| virtual PRunData * | GetNonMusr (UInt_t index, EDataSwitch tag=kIndex) |
| Retrieves processed data for a non-μSR run. | |
Experimental Metadata Accessors | |
| Bool_t | fTheoAsData |
| Theory calculation mode flag. | |
| PMsrHandler * | fMsrInfo |
| Pointer to MSR file handler (not owned). | |
| PRunDataHandler * | fData |
| Pointer to raw data handler (not owned). | |
| std::vector< PRunSingleHisto * > | fRunSingleHistoList |
| Collection of single histogram run objects. | |
| std::vector< PRunSingleHistoRRF * > | fRunSingleHistoRRFList |
| Collection of single histogram RRF run objects. | |
| std::vector< PRunAsymmetry * > | fRunAsymmetryList |
| Collection of asymmetry run objects. | |
| std::vector< PRunAsymmetryRRF * > | fRunAsymmetryRRFList |
| Collection of asymmetry RRF run objects. | |
| std::vector< PRunAsymmetryBNMR * > | fRunAsymmetryBNMRList |
| Collection of β-NMR asymmetry run objects. | |
| std::vector< PRunMuMinus * > | fRunMuMinusList |
| Collection of μ⁻ (negative muon) run objects. | |
| std::vector< PRunNonMusr * > | fRunNonMusrList |
| Collection of non-μSR run objects. | |
| virtual const PDoublePairVector * | GetTemp (const TString &runName) const |
| Retrieves temperature information for a specific run. | |
| virtual Double_t | GetField (const TString &runName) const |
| Retrieves magnetic field value for a specific run. | |
| virtual Double_t | GetEnergy (const TString &runName) const |
| Retrieves beam energy for a specific run. | |
| virtual const Char_t * | GetSetup (const TString &runName) const |
| Retrieves experimental setup identifier for a specific run. | |
| virtual const Char_t * | GetXAxisTitle (const TString &runName, const UInt_t idx) const |
| Retrieves x-axis label for plotting. | |
| virtual const Char_t * | GetYAxisTitle (const TString &runName, const UInt_t idx) const |
| Retrieves y-axis label for plotting. | |
Manager class for all processed μSR run data during fitting.
PRunListCollection is the central orchestrator for musrfit, managing all processed run data and serving as the interface between the MINUIT minimizer and the various run types. It acts as a container and dispatcher for different fit types, routing χ² and maximum likelihood calculations to the appropriate run objects.
The collection maintains separate lists for each fit type:
Run management:
MINUIT interface:
Fit range management:
Data access:
The collection routes operations based on fit type:
For global fits (multiple runs sharing parameters):
NOT thread-safe. MINUIT evaluation must be serialized. For parallel fitting of independent datasets, create separate PRunListCollection instances.
Definition at line 140 of file PRunListCollection.h.
Enumeration for data access mode.
Controls how runs are retrieved by Get*() methods:
| Enumerator | |
|---|---|
| kIndex | |
| kRunNo | |
Definition at line 170 of file PRunListCollection.h.
| PRunListCollection::PRunListCollection | ( | PMsrHandler * | msrInfo, |
| PRunDataHandler * | data, | ||
| Bool_t | theoAsData = false ) |
Constructor that initializes the collection.
Constructor initializing the run collection manager.
Creates an empty collection ready to receive runs via Add(). Does not automatically load runs - caller must explicitly add each run.
| msrInfo | Pointer to MSR file handler (must remain valid for object lifetime) |
| data | Pointer to raw data handler (must remain valid for object lifetime) |
| theoAsData | If true, theory calculated only at data points; if false, extra points for visualization |
Creates an empty collection ready to receive processed run objects via Add() calls. The collection maintains separate lists for each fit type (single histogram, asymmetry, RRF variants, etc.) and dispatches operations to the appropriate lists.
Initialization:
The typical workflow is:
| msrInfo | Pointer to MSR file handler (must remain valid for object lifetime) |
| data | Pointer to raw data handler for loading histogram files |
| theoAsData | Theory calculation mode: true = at data points only, false = high-resolution grid |
Definition at line 61 of file PRunListCollection.cpp.
References fData, fMsrInfo, and fTheoAsData.
|
virtual |
Virtual destructor that cleans up all run objects.
Destructor that cleans up all run objects.
Calls CleanUp() and destructor for all run objects in all lists. Clears all run vectors. Does NOT delete fMsrInfo or fData (owned externally).
Systematically destroys all PRunBase-derived objects in the collection:
This process is repeated for all seven run type lists:
The MSR handler (fMsrInfo) and data handler (fData) are NOT deleted as they are owned by the calling code.
Definition at line 89 of file PRunListCollection.cpp.
References fRunAsymmetryBNMRList, fRunAsymmetryList, fRunAsymmetryRRFList, fRunMuMinusList, fRunNonMusrList, fRunSingleHistoList, and fRunSingleHistoRRFList.
|
virtual |
Adds a run to the appropriate list based on fit type.
Adds a processed run to the appropriate list based on fit type.
Creates a PRunBase-derived object matching the fit type specified in the MSR file RUN block, processes the data, and adds it to the corresponding internal list. This is the primary method for populating the collection.
The method:
| runNo | Run number (0-based index into MSR file RUN blocks) |
| tag | Operation mode: kFit (fitting), kView (visualization only) |
Creates a new PRunBase-derived object for the specified MSR file RUN block and adds it to the appropriate type-specific list. The method performs fit type dispatching by:
Supported fit types and corresponding classes:
If data preprocessing fails (e.g., file not found, invalid t0, theory errors), the run object is still added to the list but marked as invalid, and this method returns false.
| runNo | MSR file run number (0-based index into RUN blocks) |
| tag | Operation mode: kFit (for fitting), kView (for display/plotting) |
Definition at line 168 of file PRunListCollection.cpp.
References fData, fMsrInfo, fRunAsymmetryBNMRList, fRunAsymmetryList, fRunAsymmetryRRFList, fRunMuMinusList, fRunNonMusrList, fRunSingleHistoList, fRunSingleHistoRRFList, fTheoAsData, PRUN_ASYMMETRY, PRUN_ASYMMETRY_BNMR, PRUN_ASYMMETRY_RRF, PRUN_MU_MINUS, PRUN_NON_MUSR, PRUN_SINGLE_HISTO, and PRUN_SINGLE_HISTO_RRF.
|
virtual |
Retrieves processed data for an asymmetry run.
Provides access to calculated asymmetry data with proper error propagation, including α-corrected forward/backward combinations.
| index | Run identifier (interpretation depends on tag parameter) |
| tag | Access mode:
|
Get a processed asymmetry data set.
return:
| index | msr-file run index |
| tag | kIndex -> data at index, kRunNo -> data of given run no |
Definition at line 1069 of file PRunListCollection.cpp.
References fRunAsymmetryList, kIndex, and kRunNo.
Referenced by musrfit_dump_ascii(), and musrfit_dump_root().
|
virtual |
Retrieves processed data for a β-NMR asymmetry run.
Provides access to beta-detected NMR asymmetry data with helicity-dependent analysis and appropriate error handling.
| index | Run identifier (interpretation depends on tag parameter) |
| tag | Access mode:
|
Get a processed asymmetry from beta-NMR data set.
return:
| index | msr-file run index |
| tag | kIndex -> data at index, kRunNo -> data of given run no |
Definition at line 1112 of file PRunListCollection.cpp.
References fRunAsymmetryBNMRList, kIndex, and kRunNo.
|
virtual |
Calculates total χ² for all β-NMR asymmetry runs.
| par | Parameter vector from MINUIT |
Calculates chi-square of all asymmetry BNMR runs of a msr-file.
return:
| par | fit parameter vector |
Definition at line 444 of file PRunListCollection.cpp.
References fRunAsymmetryBNMRList.
|
virtual |
Calculates total maximum likelihood for all β-NMR asymmetry runs.
Computes -2×ln(L) summed over all beta-detected NMR asymmetry runs. Handles helicity-dependent measurements with appropriate likelihood formula.
| par | Parameter vector from MINUIT |
Since it is not clear yet how to handle asymmetry fits with max likelihood the chi square will be used!
return:
| par | fit parameter vector |
Definition at line 723 of file PRunListCollection.cpp.
References fRunAsymmetryBNMRList.
|
virtual |
Calculates total χ² for all asymmetry runs.
Calculates total χ² for all asymmetry runs (global fit metric).
| par | Parameter vector from MINUIT |
Sums the chi-squared statistic over all asymmetry runs in the collection. For asymmetry fits, χ² is calculated from the asymmetry values:
![\[ A_i = \frac{F_i - \alpha B_i}{F_i + \alpha B_i} \]](form_80.png)
with proper error propagation. This is the objective function for global asymmetry fits involving multiple runs (e.g., temperature or field scans).
| par | Parameter vector from MINUIT with current parameter values |
Definition at line 402 of file PRunListCollection.cpp.
References fRunAsymmetryList.
|
virtual |
Calculates total maximum likelihood for all asymmetry runs.
Computes -2×ln(L) summed over all asymmetry runs. For asymmetry data, the likelihood is applied to the reconstructed forward/backward histograms rather than directly to the asymmetry values.
| par | Parameter vector from MINUIT |
Since it is not clear yet how to handle asymmetry fits with max likelihood the chi square will be used!
return:
| par | fit parameter vector |
Definition at line 679 of file PRunListCollection.cpp.
References fRunAsymmetryList.
|
virtual |
Retrieves processed data for an asymmetry RRF run.
Provides access to RRF-transformed asymmetry data combining asymmetry calculation with rotating reference frame analysis.
| index | Run identifier (interpretation depends on tag parameter) |
| tag | Access mode:
|
Get a processed asymmetry RRF data set.
return:
| index | msr-file run index |
| tag | kIndex -> data at index, kRunNo -> data of given run no |
Definition at line 1155 of file PRunListCollection.cpp.
References fRunAsymmetryRRFList, kIndex, and kRunNo.
Referenced by musrfit_dump_ascii(), and musrfit_dump_root().
|
virtual |
Calculates total χ² for all asymmetry RRF runs.
| par | Parameter vector from MINUIT |
Calculates chi-square of all asymmetry RRF runs of a msr-file.
return:
| par | fit parameter vector |
Definition at line 423 of file PRunListCollection.cpp.
References fRunAsymmetryRRFList.
|
virtual |
Calculates total maximum likelihood for all asymmetry RRF runs.
Computes -2×ln(L) summed over all asymmetry rotating reference frame runs. Combines RRF transformation with asymmetry analysis in likelihood calculation.
| par | Parameter vector from MINUIT |
Since it is not clear yet how to handle asymmetry fits with max likelihood the chi square will be used!
return:
| par | fit parameter vector |
Definition at line 701 of file PRunListCollection.cpp.
References fRunAsymmetryRRFList.
|
virtual |
Retrieves beam energy for a specific run.
Returns the muon beam implantation energy extracted from the raw data file header. Energy determines the stopping profile (implantation depth) in the sample.
| runName | Run identifier string (e.g., "2425" or "/path/to/run2425.root") |
Get the muon implantation energy from the data set.
return:
| runName | name of the run from which to extract the muon implantation energy |
Definition at line 1310 of file PRunListCollection.cpp.
References fData.
|
virtual |
Retrieves magnetic field value for a specific run.
Returns the applied magnetic field extracted from the raw data file header. This is typically the field measured at the sample position.
| runName | Run identifier string (e.g., "2425" or "/path/to/run2425.root") |
Get the magnetic field from the data set.
return:
| runName | name of the run from which to extract the magnetic field |
Definition at line 1294 of file PRunListCollection.cpp.
References fData.
|
virtual |
Retrieves processed data for a μ⁻ run.
Provides access to negative muon data accounting for different decay properties compared to positive muons.
| index | Run identifier (interpretation depends on tag parameter) |
| tag | Access mode:
|
Get a processed mu minus data set.
return:
| index | msr-file run index |
| tag | kIndex -> data at index, kRunNo -> data of given run no |
Definition at line 1198 of file PRunListCollection.cpp.
References fRunMuMinusList, kIndex, and kRunNo.
Referenced by musrfit_dump_ascii(), and musrfit_dump_root().
|
virtual |
Calculates total χ² for all mu-minus runs.
| par | Parameter vector from MINUIT |
Calculates chi-square of all mu minus runs of a msr-file.
return:
| par | fit parameter vector |
Definition at line 465 of file PRunListCollection.cpp.
References fRunMuMinusList.
|
virtual |
Calculates total maximum likelihood for all μ⁻ runs.
Computes -2×ln(L) summed over all negative muon runs. Negative muons have different decay characteristics than positive muons.
| par | Parameter vector from MINUIT |
Calculates log max-likelihood of all mu minus runs of a msr-file.
return:
| par | fit parameter vector |
Definition at line 744 of file PRunListCollection.cpp.
References fRunMuMinusList.
|
virtual |
Retrieves processed data for a non-μSR run.
Provides access to general time-series data (x-y pairs) processed through the same framework as μSR data but without μSR-specific assumptions.
| index | Run identifier (interpretation depends on tag parameter) |
| tag | Access mode:
|
Get a processed non-muSR data set.
return:
| index | msr-file run index |
| tag | kIndex -> data at index, kRunNo -> data of given run no |
Definition at line 1240 of file PRunListCollection.cpp.
References fRunNonMusrList, kIndex, and kRunNo.
Referenced by musrfit_dump_ascii(), and musrfit_dump_root().
|
virtual |
Calculates total χ² for all non-μSR runs.
| par | Parameter vector from MINUIT |
Calculates chi-square of all non-muSR runs of a msr-file.
return:
| par | fit parameter vector |
Definition at line 486 of file PRunListCollection.cpp.
References fRunNonMusrList.
|
virtual |
Calculates total maximum likelihood for all non-μSR runs.
Computes -2×ln(L) summed over all general time-series (non-μSR) data runs. Uses the same Poisson likelihood framework applied to generic x-y data.
| par | Parameter vector from MINUIT |
Since it is not clear yet how to handle non musr fits with max likelihood the chi square will be used!
return:
| par | fit parameter vector |
Definition at line 766 of file PRunListCollection.cpp.
References fRunNonMusrList.
|
inlinevirtual |
Returns the number of asymmetry runs in the collection.
Definition at line 466 of file PRunListCollection.h.
References fRunAsymmetryList.
Referenced by musrfit_dump_ascii(), and musrfit_dump_root().
|
inlinevirtual |
Returns the number of β-NMR asymmetry runs in the collection.
Definition at line 478 of file PRunListCollection.h.
References fRunAsymmetryBNMRList.
|
inlinevirtual |
Returns the number of asymmetry RRF runs in the collection.
Definition at line 472 of file PRunListCollection.h.
References fRunAsymmetryRRFList.
Referenced by musrfit_dump_ascii(), and musrfit_dump_root().
|
virtual |
Returns the number of bins fitted for a specific run.
Queries a single run to determine how many data bins fall within its fit range. This depends on:
Used for calculating degrees of freedom: ν = N_bins_total - N_params
| idx | Run index (absolute index across all run lists) |
Number of bins in run block idx to be fitted. Only used for single histogram fitting together with the expected chisq.
return:
| idx | run block index |
Definition at line 880 of file PRunListCollection.cpp.
References fMsrInfo, fRunAsymmetryBNMRList, fRunAsymmetryList, fRunAsymmetryRRFList, fRunMuMinusList, fRunNonMusrList, fRunSingleHistoList, fRunSingleHistoRRFList, PRUN_ASYMMETRY, PRUN_ASYMMETRY_BNMR, PRUN_ASYMMETRY_RRF, PRUN_MU_MINUS, PRUN_NON_MUSR, PRUN_SINGLE_HISTO, and PRUN_SINGLE_HISTO_RRF.
|
inlinevirtual |
Returns the number of μ⁻ runs in the collection.
Definition at line 484 of file PRunListCollection.h.
References fRunMuMinusList.
Referenced by musrfit_dump_ascii(), and musrfit_dump_root().
|
inlinevirtual |
Returns the number of non-μSR runs in the collection.
Definition at line 490 of file PRunListCollection.h.
References fRunNonMusrList.
Referenced by musrfit_dump_ascii(), and musrfit_dump_root().
|
inlinevirtual |
Returns the number of single histogram runs in the collection.
Definition at line 454 of file PRunListCollection.h.
References fRunSingleHistoList.
Referenced by musrfit_dump_ascii(), and musrfit_dump_root().
|
inlinevirtual |
Returns the number of single histogram RRF runs in the collection.
Definition at line 460 of file PRunListCollection.h.
References fRunSingleHistoRRFList.
Referenced by musrfit_dump_ascii(), and musrfit_dump_root().
|
virtual |
Retrieves experimental setup identifier for a specific run.
Returns the beamline or spectrometer name extracted from the raw data file header. This identifies the experimental station where data was collected.
| runName | Run identifier string (e.g., "2425" or "/path/to/run2425.root") |
Get the setup information from the data set.
return:
| runName | name of the run from which to extract the setup information |
Definition at line 1326 of file PRunListCollection.cpp.
References fData.
|
virtual |
Retrieves processed data for a single histogram run.
Provides access to the PRunData object containing background-corrected, packed histogram data with theory values and error bars.
| index | Run identifier (interpretation depends on tag parameter) |
| tag | Access mode:
|
Get a processed single histogram data set.
return:
| index | msr-file run index |
| tag | kIndex -> data at index, kRunNo -> data of given run no |
Definition at line 983 of file PRunListCollection.cpp.
References fRunSingleHistoList, kIndex, and kRunNo.
Referenced by musrfit_dump_ascii(), and musrfit_dump_root().
|
virtual |
Calculates total χ² for all single histogram runs.
Calculates total χ² for all single histogram runs (global fit metric).
Sums χ² over all runs in fRunSingleHistoList. Each run compares its measured data with theory at the given parameters.
| par | Parameter vector from MINUIT |
Sums the chi-squared statistic over all single histogram runs in the collection:
![\[ \chi^2_{\rm total} = \sum_{i=1}^{N_{\rm runs}} \chi^2_i \]](form_78.png)
where each run's χ² is:
![\[ \chi^2_i = \sum_{j=1}^{N_{\rm bins,i}} \frac{(y_j^{\rm data} - y_j^{\rm theory})^2}{\sigma_j^2} \]](form_79.png)
This is the objective function minimized by MINUIT during global fitting of multiple single histogram runs. Called repeatedly during each fit iteration.
| par | Parameter vector from MINUIT with current parameter values |
Definition at line 353 of file PRunListCollection.cpp.
References fRunSingleHistoList.
|
virtual |
Calculates total maximum likelihood for all single histogram runs.
Computes the negative 2×log-likelihood summed over all single histogram runs:
![\[ -2\ln L_{\rm total} = \sum_{i=1}^{N_{\rm runs}} (-2\ln L_i) \]](form_24.png)
For each run, the maximum likelihood is calculated using Poisson statistics:
![\[ -2\ln L = 2\sum_{j=1}^{N_{\rm bins}} \left[y_j^{\rm theory} - y_j^{\rm data} \ln(y_j^{\rm theory})\right] \]](form_25.png)
Maximum likelihood fitting is preferred over χ² for low-count data (< 10-20 counts/bin) where Gaussian approximations break down. It naturally handles Poisson statistics without requiring error estimates.
| par | Parameter vector from MINUIT |
Calculates log max-likelihood of all single histogram runs of a msr-file.
return:
| par | fit parameter vector |
Definition at line 636 of file PRunListCollection.cpp.
References fRunSingleHistoList.
|
virtual |
Retrieves processed data for a single histogram RRF run.
Provides access to RRF-transformed single histogram data including filtered theory curves and RRF-specific metadata.
| index | Run identifier (interpretation depends on tag parameter) |
| tag | Access mode:
|
Get a processed single histogram RRF data set.
return:
| index | msr-file run index |
| tag | kIndex -> data at index, kRunNo -> data of given run no |
Definition at line 1026 of file PRunListCollection.cpp.
References fRunSingleHistoRRFList, kIndex, and kRunNo.
Referenced by musrfit_dump_ascii(), and musrfit_dump_root().
|
virtual |
Calculates total χ² for all single histogram RRF runs.
| par | Parameter vector from MINUIT |
Calculates chi-square of all single histogram RRF runs of a msr-file.
return:
| par | fit parameter vector |
Definition at line 374 of file PRunListCollection.cpp.
References fRunSingleHistoRRFList.
|
virtual |
Calculates total maximum likelihood for all single histogram RRF runs.
Computes -2×ln(L) summed over all single histogram rotating reference frame runs. Uses the same Poisson likelihood formula as GetSingleHistoMaximumLikelihood(), but applied to RRF-transformed data.
| par | Parameter vector from MINUIT |
Calculates log max-likelihood of all single histogram RRF runs of a msr-file.
return:
| par | fit parameter vector |
Definition at line 657 of file PRunListCollection.cpp.
References fRunSingleHistoRRFList.
|
virtual |
Calculates χ² for a single run by index.
Evaluates χ² for one specific run, searching across all fit type lists. Used for individual run analysis or diagnostics.
| par | Parameter vector from MINUIT |
| idx | Run index (absolute index across all run lists) |
Calculates chi-square of a single run-block entry of the msr-file.
return:
| par | fit parameter vector |
| idx | run block index |
Definition at line 573 of file PRunListCollection.cpp.
References fMsrInfo, fRunAsymmetryBNMRList, fRunAsymmetryList, fRunAsymmetryRRFList, fRunMuMinusList, fRunNonMusrList, fRunSingleHistoList, fRunSingleHistoRRFList, PRUN_ASYMMETRY, PRUN_ASYMMETRY_BNMR, PRUN_ASYMMETRY_RRF, PRUN_MU_MINUS, PRUN_NON_MUSR, PRUN_SINGLE_HISTO, and PRUN_SINGLE_HISTO_RRF.
|
virtual |
Calculates expected χ² for a single run by index.
Returns expected χ² based on theory and error estimates for one run. Useful for evaluating fit quality and error bar estimation.
| par | Parameter vector from MINUIT |
| idx | Run index (searches all lists sequentially) |
Calculates expected chi-square of the run block index idx of a msr-file.
return:
| par | fit parameter vector |
| idx | run block index |
Definition at line 508 of file PRunListCollection.cpp.
References fMsrInfo, fRunAsymmetryBNMRList, fRunAsymmetryList, fRunAsymmetryRRFList, fRunMuMinusList, fRunNonMusrList, fRunSingleHistoList, fRunSingleHistoRRFList, PRUN_ASYMMETRY, PRUN_ASYMMETRY_BNMR, PRUN_ASYMMETRY_RRF, PRUN_MU_MINUS, PRUN_NON_MUSR, PRUN_SINGLE_HISTO, and PRUN_SINGLE_HISTO_RRF.
|
virtual |
Calculates maximum likelihood for a single run.
Computes -2×ln(L) for a specific run identified by absolute index. This is useful for identifying problematic runs in a global fit or for analyzing individual run contributions to the total likelihood.
| par | Parameter vector from MINUIT |
| idx | Run index (absolute index across all run lists) |
Calculates mlh of a single run-block entry of the msr-file.
return:
| par | fit parameter vector |
| idx | run block index |
Definition at line 834 of file PRunListCollection.cpp.
References fMsrInfo, fRunSingleHistoList, and PRUN_SINGLE_HISTO.
|
virtual |
Calculates expected maximum likelihood for a single run (theoretical expectation).
Computes the expected -2×ln(L) value based on the theory predictions and error estimates for a specific run. Useful for statistical diagnostics and validating error bars. For properly estimated errors and valid model, expected likelihood should be comparable to actual likelihood.
| par | Parameter vector from MINUIT |
| idx | Run index (absolute index across all run lists) |
Calculates expected mlh of the run block index idx of a msr-file.
return:
| par | fit parameter vector |
| idx | run block index |
Definition at line 788 of file PRunListCollection.cpp.
References fMsrInfo, fRunSingleHistoList, and PRUN_SINGLE_HISTO.
|
virtual |
Retrieves temperature information for a specific run.
Returns temperature data extracted from the raw data file header. Temperature may be recorded as a time-series (multiple values) or a single value depending on the data acquisition system.
| runName | Run identifier string (e.g., "2425" or "/path/to/run2425.root") |
Get the temperature from the data set.
return:
| runName | name of the run from which to extract the temperature |
Definition at line 1278 of file PRunListCollection.cpp.
References fData.
|
virtual |
Returns total number of bins fitted across all runs.
Sums the number of fitted bins over all runs in the collection:
![\[ N_{\rm bins,total} = \sum_{i=1}^{N_{\rm runs}} N_{\rm bins,i} \]](form_26.png)
This is the numerator for calculating reduced chi-squared:
![\[ \chi^2_{\rm red} = \frac{\chi^2}{N_{\rm bins,total} - N_{\rm params}} \]](form_27.png)
For a good fit: χ²_red ≈ 1.0
Counts the total number of bins to be fitted.
return:
Definition at line 942 of file PRunListCollection.cpp.
References fRunAsymmetryBNMRList, fRunAsymmetryList, fRunAsymmetryRRFList, fRunMuMinusList, fRunNonMusrList, fRunSingleHistoList, and fRunSingleHistoRRFList.
|
virtual |
Retrieves x-axis label for plotting.
Returns the appropriate x-axis title based on fit type and run settings. Typically "Time (μs)" for time-domain fits, "Frequency (MHz)" for Fourier transforms, or custom labels for non-μSR data.
| runName | Run identifier string (e.g., "2425" or "/path/to/run2425.root") |
| idx | Run index within the specified fit type |
Get the x-axis title (used with non-muSR fit).
return:
| runName | name of the run file |
| idx | msr-file run index |
Definition at line 1343 of file PRunListCollection.cpp.
References fData, PRawRunData::fDataNonMusr, PNonMusrRawRunData::FromAscii(), fRunNonMusrList, and PNonMusrRawRunData::GetLabels().
|
virtual |
Retrieves y-axis label for plotting.
Returns the appropriate y-axis title based on fit type:
| runName | Run identifier string (e.g., "2425" or "/path/to/run2425.root") |
| idx | Run index within the specified fit type |
Get the y-axis title (used with non-muSR fit).
return:
| runName | name of the run file |
| idx | msr-file run index |
Definition at line 1376 of file PRunListCollection.cpp.
References fData, PRawRunData::fDataNonMusr, PNonMusrRawRunData::FromAscii(), fRunNonMusrList, and PNonMusrRawRunData::GetLabels().
|
virtual |
Sets fit range for all runs (time-based or bin-based).
Sets fit range in time units (microseconds from t0).
Updates the fitting window for all runs in the collection. Supports:
| fitRange | Vector of (start, end) pairs in microseconds |
If one pair: applies to all runs. If multiple: fitRange[i] applies to run i.
Applies time-based fit ranges to all runs in the collection. This is the standard method for specifying fit ranges in the MSR file FIT block or during interactive range adjustments.
Range specification modes:
Processing steps for each run:
The bin recalculation is necessary because the fit range is initially specified in time but χ² calculation operates on bin indices.
| fitRange | Vector of (start_time, end_time) pairs in microseconds (μs) from t0 |
Definition at line 303 of file PRunListCollection.cpp.
References fRunAsymmetryBNMRList, fRunAsymmetryList, fRunAsymmetryRRFList, fRunMuMinusList, fRunNonMusrList, fRunSingleHistoList, fRunSingleHistoRRFList, and SetFitRange().
Referenced by SetFitRange().
|
virtual |
Sets fit range from string specification (bin-based).
Sets fit range in bin units using string specification (COMMANDS block syntax).
Parses and applies bin-based fit ranges from FIT_RANGE command. Format: "fgb[+offset] lgb[-offset]" for each run.
| fitRange | String with fit range specification |
Example: "10+5 200-10" → bins [15, 190]
Parses and applies fit range specified in bin offsets from t0 markers. This method supports the COMMANDS block FIT_RANGE syntax used for dynamic range adjustments during optimization.
String format:
Where:
Example:
This method broadcasts the range specification to all run objects in all lists. Each run's SetFitRangeBin() method interprets the string based on its position in the MSR file.
| fitRange | String holding fit range specification in bin offsets |
Definition at line 253 of file PRunListCollection.cpp.
References fRunAsymmetryBNMRList, fRunAsymmetryList, fRunAsymmetryRRFList, fRunMuMinusList, fRunNonMusrList, fRunSingleHistoList, and fRunSingleHistoRRFList.
|
private |
Pointer to raw data handler (not owned).
Provides access to raw histogram data files via unified interface supporting multiple formats (ROOT, NeXus, MUD, PSI-BIN, etc.). Used during Add() calls to load data for each run.
Definition at line 716 of file PRunListCollection.h.
Referenced by Add(), GetEnergy(), GetField(), GetSetup(), GetTemp(), GetXAxisTitle(), GetYAxisTitle(), and PRunListCollection().
|
private |
Pointer to MSR file handler (not owned).
Provides access to all MSR file content including PARAMETER, THEORY, FUNCTIONS, RUN, COMMANDS, FOURIER, and PLOT blocks. Must remain valid for the lifetime of this PRunListCollection object.
Definition at line 705 of file PRunListCollection.h.
Referenced by Add(), GetNoOfBinsFitted(), GetSingleRunChisq(), GetSingleRunChisqExpected(), GetSingleRunMaximumLikelihood(), GetSingleRunMaximumLikelihoodExpected(), and PRunListCollection().
|
private |
Collection of β-NMR asymmetry run objects.
Each element is a PRunAsymmetryBNMR object for beta-detected NMR measurements with helicity-dependent analysis. Objects are owned by this vector.
Definition at line 767 of file PRunListCollection.h.
Referenced by Add(), GetAsymmetryBNMR(), GetAsymmetryBNMRChisq(), GetAsymmetryBNMRMaximumLikelihood(), GetNoOfAsymmetryBNMR(), GetNoOfBinsFitted(), GetSingleRunChisq(), GetSingleRunChisqExpected(), GetTotalNoOfBinsFitted(), SetFitRange(), SetFitRange(), and ~PRunListCollection().
|
private |
Collection of asymmetry run objects.
Each element is a PRunAsymmetry object containing calculated asymmetry data from forward/backward detector pairs. Objects are owned by this vector.
Definition at line 747 of file PRunListCollection.h.
Referenced by Add(), GetAsymmetry(), GetAsymmetryChisq(), GetAsymmetryMaximumLikelihood(), GetNoOfAsymmetry(), GetNoOfBinsFitted(), GetSingleRunChisq(), GetSingleRunChisqExpected(), GetTotalNoOfBinsFitted(), SetFitRange(), SetFitRange(), and ~PRunListCollection().
|
private |
Collection of asymmetry RRF run objects.
Each element is a PRunAsymmetryRRF object combining asymmetry calculation with RRF transformation for high-frequency analysis. Objects are owned by this vector.
Definition at line 757 of file PRunListCollection.h.
Referenced by Add(), GetAsymmetryRRF(), GetAsymmetryRRFChisq(), GetAsymmetryRRFMaximumLikelihood(), GetNoOfAsymmetryRRF(), GetNoOfBinsFitted(), GetSingleRunChisq(), GetSingleRunChisqExpected(), GetTotalNoOfBinsFitted(), SetFitRange(), SetFitRange(), and ~PRunListCollection().
|
private |
Collection of μ⁻ (negative muon) run objects.
Each element is a PRunMuMinus object for negative muon measurements with different decay characteristics than μ⁺. Objects are owned by this vector.
Definition at line 777 of file PRunListCollection.h.
Referenced by Add(), GetMuMinus(), GetMuMinusChisq(), GetMuMinusMaximumLikelihood(), GetNoOfBinsFitted(), GetNoOfMuMinus(), GetSingleRunChisq(), GetSingleRunChisqExpected(), GetTotalNoOfBinsFitted(), SetFitRange(), SetFitRange(), and ~PRunListCollection().
|
private |
Collection of non-μSR run objects.
Each element is a PRunNonMusr object for general time-series (x-y) data fits using the musrfit framework without μSR-specific assumptions. Objects are owned.
Definition at line 787 of file PRunListCollection.h.
Referenced by Add(), GetNonMusr(), GetNonMusrChisq(), GetNonMusrMaximumLikelihood(), GetNoOfBinsFitted(), GetNoOfNonMusr(), GetSingleRunChisq(), GetSingleRunChisqExpected(), GetTotalNoOfBinsFitted(), GetXAxisTitle(), GetYAxisTitle(), SetFitRange(), SetFitRange(), and ~PRunListCollection().
|
private |
Collection of single histogram run objects.
Each element is a PRunSingleHisto object containing processed data for one single-detector histogram fit. Objects are heap-allocated and owned by this vector; deleted in destructor.
Definition at line 727 of file PRunListCollection.h.
Referenced by Add(), GetNoOfBinsFitted(), GetNoOfSingleHisto(), GetSingleHisto(), GetSingleHistoChisq(), GetSingleHistoMaximumLikelihood(), GetSingleRunChisq(), GetSingleRunChisqExpected(), GetSingleRunMaximumLikelihood(), GetSingleRunMaximumLikelihoodExpected(), GetTotalNoOfBinsFitted(), SetFitRange(), SetFitRange(), and ~PRunListCollection().
|
private |
Collection of single histogram RRF run objects.
Each element is a PRunSingleHistoRRF object containing RRF-transformed single histogram data with Kaiser filtering. Objects are owned by this vector.
Definition at line 737 of file PRunListCollection.h.
Referenced by Add(), GetNoOfBinsFitted(), GetNoOfSingleHistoRRF(), GetSingleHistoRRF(), GetSingleHistoRRFChisq(), GetSingleHistoRRFMaximumLikelihood(), GetSingleRunChisq(), GetSingleRunChisqExpected(), GetTotalNoOfBinsFitted(), SetFitRange(), SetFitRange(), and ~PRunListCollection().
|
private |
Theory calculation mode flag.
Controls whether theory is calculated at:
Set from MSR PLOT block. For fitting, always uses fTheoAsData=true internally regardless of this setting. This flag primarily affects plotting and export.
Definition at line 694 of file PRunListCollection.h.
Referenced by Add(), and PRunListCollection().