#include "TF1.h" #include "TGraph.h" #include "TMinuit.h" void otherChi2(int &n,double *x, double &f, double *p, int k){ double chi2=0; for (int i=0;iSetFCN(otherChi2); TGraphErrors *myData = new TGraphErrors("dataset1.dat","%lg %lg %lg"); TF1 *myFunc = new TF1("myF","[0]*x+[1]",0,10); myFunc->SetParName(0,"alpha"); myFunc->SetParName(1,"omega"); myData->SetTitle("Cross Section #sigma_{CC} (E_{#nu})"); myData->SetMarkerStyle(kFullSquare); myData->SetMarkerColor(kRed); myData->GetXaxis()->SetTitle("E_{#nu} (GeV)"); myData->GetXaxis()->SetTitleSize(0.050); myData->GetYaxis()->SetTitle("#sigma #times 10^{-42} m^{2}"); myData->GetYaxis()->SetTitleSize(0.050); myData->GetXaxis()->SetLabelSize(0.045); myData->GetYaxis()->SetLabelSize(0.045); myData->Draw("APE"); myData->Fit(myFunc); }