CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ErrorMatrixPropagator.cc
Go to the documentation of this file.
1 /* From SimpleFits Package
2  * Designed an written by
3  * author: Ian M. Nugent
4  * Humboldt Foundations
5  */
7 #include "math.h"
8 #include <iostream>
9 
10 using namespace tauImpactParameter;
11 
12 TMatrixTSym<double> ErrorMatrixPropagator::propagateError( std::function<TVectorT<double>(const TVectorT<double>&)> f,
13  const TVectorT<double>& inPar, TMatrixTSym<double>& inCov, double epsilon, double errorEpsilonRatio){
14  TVectorT<double> v=f(inPar);
15  TMatrixT<double> Jacobian(inPar.GetNrows(),v.GetNrows());
16  for(int i=0;i<inPar.GetNrows();i++){
17  TVectorT<double> ParPlusEpsilon=inPar;
18  double error=sqrt(fabs(inCov(i,i)));
19  double delta=epsilon;
20  if(delta*errorEpsilonRatio<error) delta=error/errorEpsilonRatio;
21  ParPlusEpsilon(i)+=delta;
22  TVectorT<double> vp=f(ParPlusEpsilon);
23  for(int j=0;j<v.GetNrows();j++){
24  Jacobian(i,j)=(vp(j)-v(j))/delta;
25  }// Newtons approx.
26  }
27  TMatrixTSym<double> newCov=inCov.SimilarityT(Jacobian);
28  return newCov;
29 }
dbl * delta
Definition: mlp_gen.cc:36
int i
Definition: DBlmapReader.cc:9
T sqrt(T t)
Definition: SSEVec.h:48
helper::RootFunctionHelper< F, args >::root_function function(F &f)
Definition: rootFunction.h:14
int j
Definition: DBlmapReader.cc:9
double f[11][100]
static TMatrixTSym< double > propagateError(std::function< TVectorT< double >(const TVectorT< double > &)> f, const TVectorT< double > &inPar, TMatrixTSym< double > &inCov, double epsilon=0.001, double errorEpsilonRatio=1000)