musrfit 1.10.0
nxH4::PNeXusDeadTime Class Reference

Dead time correction calculator for muon detector data. More...

#include <PNeXus.h>

Inheritance diagram for nxH4::PNeXusDeadTime:
Collaboration diagram for nxH4::PNeXusDeadTime:

Public Member Functions

 PNeXusDeadTime (const PNeXus *nxs, bool debug=false)
 Constructor - initializes dead time calculator from NeXus data.
 
bool IsValid ()
 Check if the dead time calculator was initialized successfully.
 
double Up () const
 Get the error definition for the minimizer (FCNBase requirement)
 
double operator() (const std::vector< double > &par) const
 Function call operator - calculates chi-square for given parameters.
 
void Minimize (const int i)
 Minimize dead time for a specific detector spectrum.
 
const std::vector< uint32_t > & GetDimensions () const
 Get the dimensions of the count dataset.
 

Private Attributes

bool fDebug {false}
 Debug flag - if true, print additional diagnostic information.
 
bool fValid
 Validity flag - true if required data was loaded successfully.
 
int fGoodFrames {-1}
 Number of good time frames for analysis.
 
float fTimeResolution {0.0}
 Time resolution in picoseconds.
 
std::vector< uint32_t > fDims = {0, 0, 0}
 Dimensions of count data [periods, spectra, bins].
 
int fT0Bin {-1}
 T0 bin number (time zero reference)
 
int fFgbBin {-1}
 First good bin for analysis.
 
int fLgbBin {-1}
 Last good bin for analysis.
 
std::vector< float > fDeadTime
 Dead time values per detector (microseconds)
 
std::vector< int > fCounts
 Count data for minimization.
 
double fUp {0.5}
 UP parameter for Minuit2 (0.5 for chi-square)
 
unsigned int fIdx {0}
 Current spectrum index being minimized.
 

Detailed Description

Dead time correction calculator for muon detector data.

The PNeXusDeadTime class calculates dead time corrections for muon detector count data using ROOT Minuit2 minimization. It inherits from ROOT::Minuit2::FCNBase to implement a chi-square minimization function.

Dead time is the period after detecting an event during which the detector cannot register another event. This class estimates the dead time parameter for each detector spectrum by minimizing the deviation from expected count rates.

Typical Usage:

nxH4::PNeXus nexus("file.nxs");
nxH4::PNeXusDeadTime ndt(&nexus, false); // false = no debug output
if (ndt.IsValid()) {
auto dims = ndt.GetDimensions();
// Minimize for each spectrum
for (unsigned int i = 0; i < dims[1]; i++) {
ndt.minimize(i);
}
}
Dead time correction calculator for muon detector data.
Definition PNeXus.h:254
NeXus HDF4 file reader with case-insensitive path lookup.
Definition PNeXus.h:517
Note
Requires a valid PNeXus object with count data
Uses ROOT Minuit2 for minimization
See also
ROOT::Minuit2::FCNBase
nxH4::PNeXus

Definition at line 253 of file PNeXus.h.

Constructor & Destructor Documentation

◆ PNeXusDeadTime()

nxH4::PNeXusDeadTime::PNeXusDeadTime ( const PNeXus * nxs,
bool debug = false )

Constructor - initializes dead time calculator from NeXus data.

  • Reads count data, time resolution, and bin information from the NeXus file to set up the dead time calculation.
  • Parameters
    nxsPointer to PNeXus object containing the detector data
    debugIf true, print additional debug information during calculations
  • Note
    After construction, check IsValid() to ensure data was loaded successfully
Examples
/workspace/LMU/musrfit/src/external/nexus/PNeXus.cpp, and /workspace/LMU/musrfit/src/external/nexus/PNeXus.h.

Definition at line 163 of file PNeXus.cpp.

References fCounts, fDebug, fDims, fFgbBin, fGoodFrames, fLgbBin, fT0Bin, fTimeResolution, and fValid.

Member Function Documentation

◆ GetDimensions()

const std::vector< uint32_t > & nxH4::PNeXusDeadTime::GetDimensions ( ) const
inline

Get the dimensions of the count dataset.

  • Returns the dimensions [periods, spectra, bins] of the count data being used for dead time calculation.
  • Returns
    Vector of dimension sizes (typically 3D: [periods, spectra, bins])
Examples
/workspace/LMU/musrfit/src/external/nexus/PNeXus.h.

Definition at line 306 of file PNeXus.h.

References fDims.

◆ IsValid()

bool nxH4::PNeXusDeadTime::IsValid ( )
inline

Check if the dead time calculator was initialized successfully.

  • Returns
    true if required datasets were found and loaded, false otherwise
Examples
/workspace/LMU/musrfit/src/external/nexus/PNeXus.h.

Definition at line 270 of file PNeXus.h.

References fValid.

◆ Minimize()

void nxH4::PNeXusDeadTime::Minimize ( const int i)

Minimize dead time for a specific detector spectrum.

  • Performs Minuit2 minimization to find the optimal dead time parameter for the specified spectrum index. Results are printed to stdout.
  • Parameters
    iSpectrum index to minimize (0-based index into second dimension)
  • Note
    Prints minimization results including dead time estimate and errors
    The index i must be less than dims[1] (number of spectra)
Examples
/workspace/LMU/musrfit/src/external/nexus/PNeXus.cpp, and /workspace/LMU/musrfit/src/external/nexus/PNeXus.h.

Definition at line 300 of file PNeXus.cpp.

References fDims, and fIdx.

◆ operator()()

double nxH4::PNeXusDeadTime::operator() ( const std::vector< double > & par) const

Function call operator - calculates chi-square for given parameters.

  • This is the objective function that ROOT::Minuit2 minimizes. It calculates the chi-square deviation between observed counts and expected counts corrected for dead time.
  • Parameters
    parVector of parameters (dead time values in microseconds)
    Returns
    Chi-square value for the given parameters
Examples
/workspace/LMU/musrfit/src/external/nexus/PNeXus.cpp, and /workspace/LMU/musrfit/src/external/nexus/PNeXus.h.

Definition at line 268 of file PNeXus.cpp.

References fCounts, fDims, fFgbBin, fGoodFrames, fIdx, fLgbBin, and fTimeResolution.

◆ Up()

double nxH4::PNeXusDeadTime::Up ( ) const
inline

Get the error definition for the minimizer (FCNBase requirement)

  • Returns the UP parameter which defines how the minimizer estimates errors. For chi-square minimization, UP = 0.5 corresponds to 1-sigma errors.
  • Returns
    Error definition parameter (0.5 for chi-square)
Examples
/workspace/LMU/musrfit/src/external/nexus/PNeXus.h.

Definition at line 278 of file PNeXus.h.

References fUp.

Member Data Documentation

◆ fCounts

std::vector<int> nxH4::PNeXusDeadTime::fCounts
private

Count data for minimization.

Definition at line 318 of file PNeXus.h.

Referenced by operator()(), and PNeXusDeadTime().

◆ fDeadTime

std::vector<float> nxH4::PNeXusDeadTime::fDeadTime
private

Dead time values per detector (microseconds)

Definition at line 317 of file PNeXus.h.

◆ fDebug

bool nxH4::PNeXusDeadTime::fDebug {false}
private

Debug flag - if true, print additional diagnostic information.

Definition at line 309 of file PNeXus.h.

Referenced by PNeXusDeadTime().

◆ fDims

std::vector<uint32_t> nxH4::PNeXusDeadTime::fDims = {0, 0, 0}
private

Dimensions of count data [periods, spectra, bins].

Definition at line 313 of file PNeXus.h.

Referenced by GetDimensions(), Minimize(), operator()(), and PNeXusDeadTime().

◆ fFgbBin

int nxH4::PNeXusDeadTime::fFgbBin {-1}
private

First good bin for analysis.

Definition at line 315 of file PNeXus.h.

Referenced by operator()(), and PNeXusDeadTime().

◆ fGoodFrames

int nxH4::PNeXusDeadTime::fGoodFrames {-1}
private

Number of good time frames for analysis.

Definition at line 311 of file PNeXus.h.

Referenced by operator()(), and PNeXusDeadTime().

◆ fIdx

unsigned int nxH4::PNeXusDeadTime::fIdx {0}
private

Current spectrum index being minimized.

Definition at line 320 of file PNeXus.h.

Referenced by Minimize(), and operator()().

◆ fLgbBin

int nxH4::PNeXusDeadTime::fLgbBin {-1}
private

Last good bin for analysis.

Definition at line 316 of file PNeXus.h.

Referenced by operator()(), and PNeXusDeadTime().

◆ fT0Bin

int nxH4::PNeXusDeadTime::fT0Bin {-1}
private

T0 bin number (time zero reference)

Definition at line 314 of file PNeXus.h.

Referenced by PNeXusDeadTime().

◆ fTimeResolution

float nxH4::PNeXusDeadTime::fTimeResolution {0.0}
private

Time resolution in picoseconds.

Definition at line 312 of file PNeXus.h.

Referenced by operator()(), and PNeXusDeadTime().

◆ fUp

double nxH4::PNeXusDeadTime::fUp {0.5}
private

UP parameter for Minuit2 (0.5 for chi-square)

Definition at line 319 of file PNeXus.h.

Referenced by Up().

◆ fValid

bool nxH4::PNeXusDeadTime::fValid
private

Validity flag - true if required data was loaded successfully.

Examples
/workspace/LMU/musrfit/src/external/nexus/PNeXus.h.

Definition at line 310 of file PNeXus.h.

Referenced by IsValid(), and PNeXusDeadTime().


The documentation for this class was generated from the following files: