void calc_rho_yields(){ double nrho[45],dnrho[45]; for (unsigned int i=1;i<46;i++){ unsigned int k=i-1; double yield; double unc; calc_rho_yield(i,yield,unc); nrho[k]=yield; dnrho[k]=unc; } ofstream fout2("rho_yields.dat"); for (int j=0;j<45;j++){ fout2 << 2.9+0.2*float(j) << " " << nrho[j] << " " << dnrho[j] << endl; } fout2.close(); double egamma[45]; for (int j=0;j<45;j++) egamma[j]=2.9+0.2*j; TGraphErrors *g1=new TGraphErrors(45,egamma,nrho,0,dnrho); g1->Draw(); }