Using efficiency curve in third party applications
When an efficiency curve is constructed in HyperLab's detector efficiency analysis module, the fitted orthogonal polynomial is available from the File / Generic info menu item or in efficiency reports. A reported polynomial may be the following:
      
Eff  = exp(
 -8.29004319788 -1.89376623371*T[1] -0.782232919684*T[2] -0.0814766195533*T[3]
 -0.684186229251*T[4] +0.0122364315926*T[5] +0.278512435801*T[6] )
X = -2.56318287167535 +0.393416534891053*loge(E_keV)
T[0] = 1.0
T[1] =  X -0.265941444781564
T[2] = (X -0.114813912833466)*T[1] -0.217642251256021*T[0]
T[3] = (X +0.123855849579396)*T[2] -0.233867482021834*T[1]
T[4] = (X +0.070373668815714)*T[3] -0.413775078142546*T[2]
T[5] = (X -0.132282651671386)*T[4] -0.124487482871051*T[3]
T[6] = (X +0.176131058246229)*T[5] -0.330089517919545*T[4]
The corresponding high-precision calculation function in C language:
      
double Eff( double E_keV ) {
double T[7], X = -2.56318287167535 +0.393416534891053 * log( E_keV );
 T[0] = 1.0;
 T[1] =  X -0.265941444781564;
 T[2] = (X -0.114813912833466)*T[1] -0.217642251256021*T[0];
 T[3] = (X +0.123855849579396)*T[2] -0.233867482021834*T[1];
 T[4] = (X +0.070373668815714)*T[3] -0.413775078142546*T[2];
 T[5] = (X -0.132282651671386)*T[4] -0.124487482871051*T[3];
 T[6] = (X +0.176131058246229)*T[5] -0.330089517919545*T[4];
double Eff = exp(
 -8.29004319788 -1.89376623371*T[1] -0.782232919684*T[2]-0.0814766195533*T[3]
 -0.684186229251*T[4] +0.0122364315926*T[5] +0.278512435801*T[6] );
return Eff;
}
The formula above is also reported to the user as a regular polynomial, which is the more usual description of the log Eff vs. log Energy dependency. See the formulaat the File / General info menu.
A possible transcription in C:
      
double Eff_regular( double E_keV )
{
double LogE = log(E_keV), LogE2=LogE*LogE, LogE4=LogE2*LogE2;
double LogEff =
 30.6835240174 -46.5504384031*LogE +21.9649579373*LogE2
 -5.14575805865*LogE2*LogE +0.640226601624*LogE4
 -0.0406273018462*LogE4*LogE +0.00103266687194*LogE4*LogE2;
return exp( LogEff );
}
Please note that due to the inherent numerical instability of regular polynomials, you must preserve as many significant figures in the coefficients as you can, otherwise imprecise values will be computed. At least 10-12 digits are strongly recommended.
An equivalent, and a bit numerically more stable calculation method is the following:
      
double Eff_regular_stable( double E_keV )
{
double LogE = log(E_keV);
double LogEff =
 30.6835240174
 +LogE*(-46.5504384031
 +LogE*(+21.9649579373
 +LogE*(-5.14575805865
 +LogE*(+0.640226601624
 +LogE*(-0.0406273018462
 +LogE*(+0.00103266687194))))));
return exp( LogEff );
}
 
 
Copyright © 1998-2014 by HyperLabs Software