void calc_phi_t_xsecs(double Eg){ gStyle->SetOptStat(0); double eff[50],deff[50]; double y[50],dy[50]; double t[50],dt[50]; double Nps[42]; int bin=int((Eg-2.8)/0.2); ifstream inps("flux.dat"); for (int i=0;i<42;i++){ inps >> Nps[i]; //Nps[i]=2e11; } inps.close(); double Nps_sum=Nps[bin]; ifstream in1("phi_t_yields.dat"); for (int i=0;i> dummy; cout << dummy << endl; for (int i=0;i<50;i++){ in1 >> y[i]; in1 >> dy[i]; } in1.close(); ifstream in2("phi_kk_t_acc.dat"); for (int i=0;i> dummy; for (int i=0;i<50;i++){ in2 >> eff[i]; in2 >> deff[i]; } in2.close(); double y_acc[50],dy_acc[50]; for (int i=0;i<50;i++){ //cout << eff[i] << endl; if (eff[i]>0.){ double scale=1e6/1.293/Nps_sum/0.492/0.04; y_acc[i]=scale*y[i]/eff[i]; // cout << y[i] << endl; dy_acc[i]=y_acc[i]*sqrt(deff[i]*deff[i]/(eff[i]*eff[i])+dy[i]*dy[i]/(y[i]*y[i])); } t[i]=0.02+0.04*i; dt[i]=0.02; } TCanvas *c2=new TCanvas("c2","c2"); c2->Draw(); TH2F *h=new TH2F("h","Differential cross section for #phi",10,0,1.5,10,0,2); h->SetXTitle("-t [GeV^{2}]"); h->SetYTitle("d#sigma/dt [#mub/GeV^{2}]"); h->Draw(); TGraphErrors *g1=new TGraphErrors(25,&t[2],&y_acc[2],&dt[2],&dy_acc[2]); g1->SetLineColor(2); g1->SetMarkerColor(2); g1->SetMarkerStyle(20); g1->Fit("expo"); g1->Draw("p"); double ballamx[5]={1.5,0.68,0.23,0.15,0.04}; double ballamdx[5]={0.3,0.15,0.11,0.10,0.03}; double ballamt[5]={0.11,0.3,0.5,0.7,1.2}; double ballamdt[5]={0.09,0.1,0.1,0.1,0.4}; double ballamx_lo[5]={1.22,0.44,0.17,0.24,0.03}; double ballamdx_lo[5]={0.22,0.12,0.10,0.10,0.02}; double ballamt_lo[5]={0.1225,0.3,0.5,0.7,1.2}; double ballamdt_lo[5]={0.0775,0.1,0.1,0.1,0.4}; TGraphErrors *g2=NULL; if (Eg>5){ g2=new TGraphErrors(5,ballamt,ballamx,ballamdt,ballamdx); } else{ g2=new TGraphErrors(5,ballamt_lo,ballamx_lo,ballamdt_lo,ballamdx_lo); } g2->SetLineColor(8); g2->SetMarkerColor(8); g2->SetMarkerStyle(22); g2->Draw("p"); TLegend *legend =new TLegend(0.4,0.5,0.8,0.7); char mytitle[80]; sprintf(mytitle,"our measurement at E#gamma=%3.1f GeV",Eg); legend->AddEntry(g1,mytitle,"p"); legend->AddEntry(g2,"Ballam 1973","p"); legend->Draw(); }