25 double f(
double * x,
double * p) {
32 #ifdef HAVE_OLD_ROOT_VERSION
34 double df_dPar(
double * x,
double * p) {
40 int ipar = int(p[0] );
41 assert (ipar >=0 && ipar < NPAR );
51 double * covMatrix = 0) {
56 for (
int i = 0; i < npar; ++i) {
58 err2 += c[i] * c[i] * errPar[i] * errPar[i];
61 for (
int j = 0; j < npar; ++j) {
62 s += covMatrix[i*npar + j] * c[j];
74 fitFunc =
new TF1(
"f",
f,0,1,NPAR);
87 double integral = fitFunc->
Integral(0,1);
93 #ifdef HAVE_OLD_ROOT_VERSION
97 TF1 * deriv_par0 =
new TF1(
"dfdp0",df_dPar,0,1,1);
100 TF1 * deriv_par1 =
new TF1(
"dfdp1",df_dPar,0,1,1);
125 std::cout <<
"Integral = " << integral <<
" +/- " << sigma_integral
131 double ic = p[1]* (1-
std::cos(p[0]) )/p[0];
133 double c1c = (1-
std::cos(p[0]) )/p[0];
136 double sic =
std::sqrt( c0c*c0c * covMatrix[0] + c1c*c1c * covMatrix[3]
137 + 2.* c0c*c1c * covMatrix[1]);
139 if (
std::fabs(sigma_integral-sic) > 1.
E-6*sic )
140 std::cout <<
" ERROR: test failed : different analytical integral : "
141 << ic <<
" +/- " << sic << std::endl;
virtual void SetParameters(const Double_t *params)
double f(double *x, double *p)
virtual Double_t * GetCovarianceMatrix() const =0
virtual Double_t Integral(Double_t a, Double_t b, Double_t epsrel=1.e-12)
IntegralOneDim or analytical integral.
virtual const Double_t * GetParErrors() const
virtual Double_t GradientPar(Int_t ipar, const Double_t *x, Double_t eps=0.01)
Compute the gradient (derivative) wrt a parameter ipar.
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)
virtual void FillRandom(const char *fname, Int_t ntimes=5000)
Fill histogram following distribution in function fname.
virtual void Draw(Option_t *option="")
Draw this histogram with options.
double IntegralError(TF1 *func, Int_t ndim, const double *a, const double *b, const double *params, const double *covmat, double epsilon)
static TVirtualFitter * GetFitter()
static: return the current Fitter
1-D histogram with a double per channel (see TH1 documentation)}
Abstract Base Class for Fitting.
virtual Double_t * GetParameters() const
virtual Double_t IntegralError(Double_t a, Double_t b, const Double_t *params=0, const Double_t *covmat=0, Double_t epsilon=1.E-2)
Return Error on Integral of a parameteric function between a and b due to the parameter uncertainties...
virtual void SetParameter(Int_t param, Double_t value)
Double_t Sqrt(Double_t x)
virtual TFitResultPtr Fit(const char *formula, Option_t *option="", Option_t *goption="", Double_t xmin=0, Double_t xmax=0)
Fit histogram with function fname.