void plot_xsec_comp(){ double Eg[15],dEg[15]; for (int i=0;i<15;i++){ Eg[i]=2.9+0.2*i; dEg[i]=0.1; } double dsdt[15]; double ddsdt[15]; double tslope[15]; double dtslope[15]; ifstream in_file("phi_parms.dat"); for (int i=0;i<15;i++){ double dummy; in_file >> dummy; in_file >> dsdt[i]; in_file >> ddsdt[i]; in_file >> tslope[i]; in_file >> dtslope[i]; } double xsec[15]; double dxsec[15]; double dsdt1[15]; double ddsdt1[15]; double tslope1[15]; double dtslope1[15]; ifstream in_file2("phi_parms_method1.dat"); for (int i=0;i<15;i++){ double dummy; in_file2 >> dummy; in_file2 >> dsdt1[i]; in_file2 >> ddsdt1[i]; in_file2 >> tslope1[i]; in_file2 >> dtslope1[i]; } double xsec1[15]; double dxsec1[15]; double m_p_sq=0.9837*0.93827; double m_phi_sq=1.0195*1.0195; for (int i=0;i<15;i++){ double s=m_p_sq+2.*0.93827*Eg[i]; double t0=(m_phi_sq*m_phi_sq-pow(s-m_p_sq-sqrt(pow(s-m_p_sq,2)-2*m_phi_sq*(s+m_p_sq)+m_phi_sq*m_phi_sq),2))/(4.*s); double t1=(m_phi_sq*m_phi_sq-pow(s-m_p_sq+sqrt(pow(s-m_p_sq,2)-2*m_phi_sq*(s+m_p_sq)+m_phi_sq*m_phi_sq),2))/(4.*s); double mytslope=fabs(tslope[i]); xsec[i]=dsdt[i]/mytslope*(exp(mytslope*t0)-exp(mytslope*t1)); double sigB=ddsdt[i]/dsdt[i]*xsec[i]; double sigA=dsdt[i]/mytslope*((t0-1./mytslope)*exp(mytslope*t0) -(t1-1./mytslope)*exp(mytslope*t1))*dtslope[i]; dxsec[i]=fabs(sigB)+fabs(sigA); double mytslope1=fabs(tslope1[i]); xsec1[i]=dsdt1[i]/mytslope1*(exp(mytslope*t0)-exp(mytslope1*t1)); double sigB1=ddsdt1[i]/dsdt1[i]*xsec1[i]; double sigA1=dsdt1[i]/mytslope1*((t0-1./mytslope1)*exp(mytslope1*t0) -(t1-1./mytslope1)*exp(mytslope1*t1))*dtslope1[i]; dxsec1[i]=fabs(sigB1)+fabs(sigA1); } TH2F *h=new TH2F("h","cross section",15,2.6,5.8,10,0,0.6); h->SetXTitle("E_{#gamma} [GeV]"); h->SetYTitle("#sigma [#mub]"); h->Draw(); TGraphErrors *g1=new TGraphErrors(15,Eg,xsec,0,dxsec); g1->SetMarkerColor(4); g1->SetMarkerStyle(21); g1->SetLineColor(4); g1->Draw("p"); TGraphErrors *g3=new TGraphErrors(15,Eg,xsec1,0,dxsec1); g3->SetMarkerColor(2); g3->SetMarkerStyle(20); g3->SetLineColor(2); g3->Draw("p"); double ballamE[2]={2.8,4.7}; double ballamdE[2]={0.5,0.6}; double ballamx[2]={0.40,0.41}; double ballamdx[2]={0.1,0.09}; TGraphErrors *g2=new TGraphErrors(2,ballamE,ballamx,ballamdE,ballamdx); g2->SetLineColor(8); g2->SetMarkerColor(8); g2->SetMarkerStyle(22); g2->Draw("p"); TLegend *legend =new TLegend(0.15,0.65,0.45,0.85); legend->AddEntry(g1,"Method 2","p"); legend->AddEntry(g3,"Method 1","p"); legend->AddEntry(g2,"Ballam 1973","p"); legend->Draw(); }