TFile *f2 = new TFile("rffc_Good_dataQA.root"); TH1F *h1 = (TH1F*)f2->Get("hgdca_protonN0"); TH1F *h2 = (TH1F*)f2->Get("hgdca_protonP0"); void fit_sample() { Double_t ftotal(Double_t *x, Double_t *par); gStyle->SetOptFit(1); TCanvas *c1 = new TCanvas("c1","",600,600); h2->Draw(); c1->SetLogy(); TF1 *func = new TF1("func",ftotal,0,15, 4); func->SetLineColor(2); func->SetParameters(0.95, 0.70, 1.076, 5.66); func->SetParNames("r", "A", "B", "C"); // h2->Fit("func", "V+"); h2->Fit("func", "R"); // ----- Getting Integral for the ftotal fn ----- // cout<<"Integral of a ftotal fn. ===== " <Integral(0,15)<Integral(0,3)<GetXaxis()->FindBin(x[0]); Int_t bin = h1->GetXaxis()->FindBin(xx); // cout <<"xx = "<