34double f(
double *
x,
double * p) {
41 fitFunc =
new TF1(
"f",
f,0,1,NPAR);
44 double par[NPAR] = { 3.14, 1.};
49 auto fitResult =
h1->
Fit(fitFunc,
"S");
54 double integral = fitFunc->
Integral(0,1);
56 auto covMatrix = fitResult->GetCovarianceMatrix();
57 std::cout <<
"Covariance matrix from the fit ";
62 double sigma_integral = fitFunc->
IntegralError(0,1, fitResult->GetParams() , covMatrix.GetMatrixArray());
64 std::cout <<
"Integral = " << integral <<
" +/- " << sigma_integral
70 double ic = p[1]* (1-
std::cos(p[0]) )/p[0];
72 double c1c = (1-
std::cos(p[0]) )/p[0];
75 double sic =
std::sqrt( c0c*c0c * covMatrix(0,0) + c1c*c1c * covMatrix(1,1)
76 + 2.* c0c*c1c * covMatrix(0,1));
78 if (
std::fabs(sigma_integral-sic) > 1.E-6*sic )
79 std::cout <<
" ERROR: test failed : different analytical integral : "
80 << ic <<
" +/- " << sic << std::endl;
virtual Double_t Integral(Double_t a, Double_t b, Double_t epsrel=1.e-12)
IntegralOneDim or analytical integral.
virtual Double_t * GetParameters() const
virtual void SetParameters(const Double_t *params)
virtual void SetParameter(Int_t param, Double_t value)
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 parametric function between a and b due to the parameter uncertainties ...
1-D histogram with a double per channel (see TH1 documentation)}
virtual void FillRandom(const char *fname, Int_t ntimes=5000, TRandom *rng=nullptr)
Fill histogram following distribution in function fname.
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.
virtual void Draw(Option_t *option="")
Draw this histogram with options.
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)