#include "TGraphErrors.h" #include "TGraph.h" #include "TF1.h" void example04(){ TVirtualFitter::SetDefaultFitter("Minuit"); TGraphErrors *data = new TGraphErrors("dataset1.dat","%lg %lg %lg"); double xmin = myData->GetX()[0]; double xmax = myData->GetX()[ myData->GetN()-1 ]; TF1 *myModel = new TF1("oscillation","[0]*x+[1]",xmin,xmax); myData->Fit(myModel); gMinuit->SetErrorDef(1); TGraph *cont_1s = (TGraph*) gMinuit->Contour(100,0,1); gMinuit->SetErrorDef(4); TGraph *cont_2s = (TGraph*) gMinuit->Contour(100,0,1); double cl = 0.95; int N=100; TGraphErrors *band = new TGraphErrors(N); for (int i=0;iSetPoint(i, i*(xmax-xmin)/(N-1.), 0); (TVirtualFitter::GetFitter())->GetConfidenceIntervals(band,cl); band->SetFillColor(kOrange-2); band->Draw("A3"); myData->SetMarkerStyle(kFullCircle); myData->SetMarkerColor(kBlue+2); myData->Draw("PZ same"); }