void calc_phi_t_yields(double Eg){ TF1 *f1=new TF1("f1","[0]*TMath::Voigt(x-[1],[2],0.00425)+pol1(3)",0.99,1.1); f1->SetParameters(10.,1.02,0.005,10,0); double t[50]; double dt[50]; double sig[50]; double dsig[50]; char histname[80]; sprintf(histname,"KpKm_vs_t_%3.1fGeV",Eg); printf("%s\n",histname); TH2F *h2=(TH2F*)_file0->FindObjectAny(histname); for (int i=1;i<51;i++){ TH1D *h=h2->ProjectionY("h",i,i); h->GetXaxis()->SetRangeUser(0.99,1.1); h->Fit("f1","r"); f1->SetParameter(0,0); f1->Draw("same"); int index=i-1; t[index]=0.02+0.04*index; dt[index]=0.02; sig[index]=h->Integral(22,27)-f1->Integral(1.005,1.035)/0.005; dsig[index]=sqrt(h->Integral(22,27)+f1->Integral(1.005,1.035)/0.005); // cout << t[index] << " " << sig[index] << " " << dsig[index] << endl; } TCanvas *c2=new TCanvas("c2","c2"); TGraphErrors *g1=new TGraphErrors(50,t,sig,dt,dsig); g1->Draw(); ofstream out("phi_t_yields.dat"); for (int i=0;i<50;i++) out << sig[i] << " " <