LTF
|
Small helper class to collect all results, All input parameters are set by class LTF The user can access all input and output quantities. More...
#include <LTF.h>
Public Member Functions | |
double | DoLiTeFit () |
Run linear template fit (LiTeFit,LTF) with previously set input parameters. More... | |
double | DoLiTeFit (int mPolN, int mOrdInfrc, const Eigen::VectorXd &ahat) |
Run non-linear template fit with previously set input parameters. More... | |
double | DoIterativeFitNewton (int nIter=3, int nPol=2, int nInfrc=1) |
Run an non-linear template fit with iterative improvements. More... | |
double | DoIterativeFitTaylor (int nIter=4, double StepSize=0.6, int nPol=2, int nInfrc=1) |
Run an non-linear template fit with iterative improvements. More... | |
void | ApplyLogNormalDistribution () |
Assume underlying log-normal distributed probability density functions. More... | |
void | RescaleInputErrors (std::vector< double > values) |
void | RescaleInputErrors (const Eigen::VectorXd &values) |
Rescale uncertainties. See LTF::RescaleErrors() for more details. | |
void | PrintShort () const |
Print results (short version) | |
void | PrintFull () const |
Print all results. Do not print covariance or correlation matrices though. | |
Eigen::MatrixXd | Mc (int nPow=1, int nInfrc=0) const |
calculated matrix M^+ from matrix M More... | |
Eigen::VectorXd | a0pow (int nPow, int nInfrc, const Eigen::VectorXd &ahat) const |
calculated vector (a0,a0^2,infrc) to be multiplied with Mc More... | |
Eigen::MatrixXd | McApprox (int powmax, int intfrc, const Eigen::VectorXd &ahat) const |
calculated approximate matrix M^+ from non-linear matrix M^+ More... | |
Eigen::MatrixXd | W () const |
calculate inverse covariance matrix from V's More... | |
Eigen::MatrixXd | VFit () const |
calculate covariance matrix of all uncertainties included in fit | |
Eigen::MatrixXd | VExt () const |
calculate covariance matrix of all uncertainties included in fit | |
bool | GetLogNormal () const |
return boolean if fit was performed with relative uncertainties | |
Eigen::VectorXd | CalculatePrediction (double v) const |
Eigen::VectorXd | CalculatePrediction (std::vector< double > v) const |
Eigen::VectorXd | CalculatePrediction (Eigen::VectorXd v) const |
Calculate the prediction as it is used by the fit for a given parameter value. | |
Eigen::VectorXd | ComputeLinearTemplateFit (int mPolN=1, int mOrdInfrc=0, const Eigen::VectorXd &ahat=Eigen::VectorXd()) const |
Solve the (linear) template fit The equations of the linear template fit are applied and the best estimator(s) are determined. More... | |
Eigen::VectorXd | ComputeNewtonEstimator (int mPolN=1, int mOrdInfrc=0, const Eigen::VectorXd &ahat=Eigen::VectorXd()) |
Solve (linear) template fit. More... | |
Public Attributes | |
Eigen::VectorXd | Dt |
data distribution | |
Eigen::MatrixXd | M |
Matrix M (reference values) | |
Eigen::MatrixXd | Y |
Matrix Y (templates) | |
Eigen::MatrixXd | X |
Matrix X (templates) [only required for error propagation]. | |
Eigen::MatrixXd | A |
Response matrix (optional) [only used for (relative) error propagation]. | |
std::vector< std::pair< std::string, Eigen::MatrixXd > > | Vs |
(uncor./Cov) uncertainties | |
std::vector< std::pair< std::string, Eigen::VectorXd > > | Sys |
(correlated) systematic uncertainties | |
std::map< std::string, Eigen::MatrixXd > | VsExt |
external (uncor./Cov) uncertainties | |
std::map< std::string, Eigen::VectorXd > | SysExt |
external (correlated) systematic uncertainties | |
std::map< std::string, LTF::Uncertainty > | SysIsConstr |
uncertainty specification for Sys | |
std::map< std::string, Eigen::MatrixXd > | SysY |
uncertainty of the templates | |
std::map< std::string, Eigen::MatrixXd > | SysA |
uncertainty of the response matrix | |
std::map< std::string, double > | corrSys |
Correlation coefficient of the systematic uncertainties. | |
vector< double > | Gamma |
Use non-linear Gamma-factor. | |
double | a0 = 0 |
Fit result. | |
double | a0_errorFit = 0 |
uncertainty from all uncertainties included in fit (no 'external' uncertainties) | |
double | a0_errorExt = 0 |
uncertainty from 'external' uncertainties | |
double | a0_errorTmpl = 0 |
uncertainty from templates | |
double | a0_errorRespMat = 0 |
uncertainty from response matrix | |
double | chisq = 0 |
chi^2 | |
double | chisq_error = 0 |
uncertainty of chi^2 | |
Eigen::MatrixXd | F |
Projection matrix of LiTeFit. | |
Eigen::VectorXd | chisq_y |
chi^2 for each template | |
std::map< std::string, double > | chisq_part |
'partial' chi^2 for each error source | |
Eigen::VectorXd | ahat |
results (a0, a1, ..., epsilon1, epsilon2,...) | |
Eigen::VectorXd | ahat_errorFit |
Uncertainties included in fit. | |
Eigen::VectorXd | ahat_errorExt |
Uncertainties not included in fit. | |
Eigen::VectorXd | ahat_errorTmpl |
Uncertainties from templates. | |
Eigen::VectorXd | ahat_errorRespMat |
Uncertainties from response matrix. | |
Eigen::VectorXd | TheoFit |
best-fit theory predictions | |
std::map< std::string, Eigen::MatrixXd > | Vsource |
Covariance matrices from uncorr. and cov. uncertainties. | |
std::map< std::string, Eigen::VectorXd > | DeltaSys |
Correlated systematic uncertainties. | |
std::map< std::string, Eigen::MatrixXd > | VsourceExt |
Covariance matrices from 'external' uncorr. and cov. uncertainties. | |
std::map< std::string, Eigen::VectorXd > | DeltaSysExt |
'external' correlated systematic uncertainty | |
std::map< std::string, Eigen::VectorXd > | DeltaSysY |
systematic uncertainty from the templates | |
std::map< std::string, Eigen::VectorXd > | DeltaSysA |
systematic uncertainty from the response matrix | |
Eigen::VectorXd | achk |
result from polynomial fit to chi2's of templates | |
Eigen::VectorXd | achk_errorFit |
result from polynomial fit to chi2's of templates | |
double | achk_chisq |
chisq_min from polynomial fit to chi2's of templates | |
Eigen::VectorXd | ahat21 |
result from linearized second-order model approximation (incl. interference) | |
Eigen::VectorXd | EDM21 |
expected distance to minimum (EDM), calculating the newton step for a non-linear model | |
double | EDM21_chisq |
expected distance to minimum (EDM), calculating the newton step for a non-linear model | |
Eigen::VectorXd | delta_m21 |
uncertainty on M from linearized second-order model (incl. interference) | |
Protected Member Functions | |
void | ApplyGamma (std::map< std::string, Eigen::VectorXd > &Delta) const |
Compute the value of the next Newton step, when using a higher-order model approximation. More... | |
void | ApplyGamma (std::map< std::string, Eigen::MatrixXd > &VMat) const |
apply gamma factor to the uncertainties | |
Protected Attributes | |
bool | LogNormal = false |
Use LogNormal distributed uncertainties, i.e. normal-distibuted relative uncertainties. | |
std::vector< std::pair< std::string, Eigen::MatrixXd > > | SysAX |
uncertainty of the response matrix when using log-normal | |
Eigen::VectorXd | ErrorScale |
Reference values for error rescaling (default: data) | |
Eigen::VectorXd | ybar |
Eigen::MatrixXd | Ytil |
Small helper class to collect all results, All input parameters are set by class LTF The user can access all input and output quantities.
Eigen::VectorXd LTF::LiTeFit::a0pow | ( | int | nPow, |
int | nInfrc, | ||
const Eigen::VectorXd & | ahat | ||
) | const |
calculated vector (a0,a0^2,infrc) to be multiplied with Mc
Compute vector a to be multiplied with Mc.
nPow | maximum power of polynomial model approximation (nPow=1,2) |
nInfrc | maximum power of interference terms (nInfrc=0,1) (only applicable for nPow>=2) |
ahat | input values for parameters alpha |
Return vector may be similar to [and includes the gamma factors] a0pow = ( 1 a0 a1 a0^2 a1^2 a1*a2 )
|
protected |
Compute the value of the next Newton step, when using a higher-order model approximation.
apply gamma factor to the uncertainties
void LTF::LiTeFit::ApplyLogNormalDistribution | ( | ) |
Assume underlying log-normal distributed probability density functions.
Modify input paramters in order to obtain relative uncertainties.
|
inline |
<Calculate the prediction as it is used by the fit for a given parameter value
|
inline |
<Calculate the prediction as it is used by the fit for a given parameter value
Eigen::VectorXd LTF::LiTeFit::ComputeLinearTemplateFit | ( | int | mPolN = 1 , |
int | mOrdInfrc = 0 , |
||
const Eigen::VectorXd & | aexp = Eigen::VectorXd() |
||
) | const |
Solve the (linear) template fit The equations of the linear template fit are applied and the best estimator(s) are determined.
With default arguments, the linear template fit
is applied.
Non-linear approximations of the model are
performed for mPolN > 1, while only mPolN=2 is
implemented (quadratic function)
In addition interference terms can be considered with mOrdInfrc=1
Eigen::VectorXd LTF::LiTeFit::ComputeNewtonEstimator | ( | int | mPolN = 1 , |
int | mOrdInfrc = 0 , |
||
const Eigen::VectorXd & | ahat = Eigen::VectorXd() |
||
) |
Solve (linear) template fit.
Compute the value of the next Newton step, when using higher-order model approximation.
double LTF::LiTeFit::DoIterativeFitNewton | ( | int | nIter = 3 , |
int | nPol = 2 , |
||
int | nInfrc = 1 |
||
) |
Run an non-linear template fit with iterative improvements.
Run the linear template fit iteratively with non-linear model approximation.
using the Newton algorithm
nIter | Number of iterations beyond first linear template fit |
nPol | polynomial of model approximation (default =2, 1: linear template fit) |
nInfrc | polynomial of interference terms for nPol>=2 (default =1) |
double LTF::LiTeFit::DoIterativeFitTaylor | ( | int | nIter = 4 , |
double | StepSize = 0.6 , |
||
int | nPol = 2 , |
||
int | nInfrc = 1 |
||
) |
Run an non-linear template fit with iterative improvements.
Run the linear template fit iteratively with non-linear model approximation.
using a taylor expansion of the non-linear model
nIter | Number of iterations beyond first linear template fit |
StepSize | Learning rate, 0<StepSize<=1 |
nPol | polynomial of model approximation (default =2, 1: linear template fit) |
nInfrc | polynomial of interference terms for nPol>=2 (default =1) |
double LTF::LiTeFit::DoLiTeFit | ( | ) |
Run linear template fit (LiTeFit,LTF) with previously set input parameters.
Run linear template fit (LiTeFit,LTF) with previously set input parameters This function fills all member variables of LiTeFit. All results are collected in the member variables For a printout of the results, call PrintFull() or PrintShort()
double LTF::LiTeFit::DoLiTeFit | ( | int | mPolN, |
int | mOrdInfrc, | ||
const Eigen::VectorXd & | ahat | ||
) |
Run non-linear template fit with previously set input parameters.
Run linear template fit (LiTeFit,LTF) with previously set input parameters This function fills all member variables of LiTeFit. All results are collected in the member variables For a printout of the results, call PrintFull() or PrintShort()
Eigen::MatrixXd LTF::LiTeFit::Mc | ( | int | powmax = 1 , |
int | interference = 0 |
||
) | const |
calculated matrix M^+ from matrix M
calculate matrix called M^+ M^+ = ( M^T W M )^-1 M^T W with W=1, since we use unweighted linear regression
exponential Gamma-factor is applied for each fit-parameter
The function returns the g-inverse for n-th-order regression: powmax = 1: linear regression powmax = 2: second order polynomial etc.... powmax=1 is the default
Eigen::MatrixXd LTF::LiTeFit::McApprox | ( | int | mPolN, |
int | mOrdInfrc, | ||
const Eigen::VectorXd & | aexp0 | ||
) | const |
calculated approximate matrix M^+ from non-linear matrix M^+
< Return matrix Mc that is obtained from first-order approximation of non-linear Mc aexp specifies the expansion point
|
inline |
<Rescale uncertainties. See LTF::RescaleErrors() for more details
Eigen::MatrixXd LTF::LiTeFit::W | ( | ) | const |
calculate inverse covariance matrix from V's
Calculate inverse (covariance) matrix Input are all covariance matrices in V Note: at least one (uncorrelated) uncertainty must be present in the fit.