void plotLimit(int signal = 0){ //signal: 0 = ZPN, 1 = ZPW, 2 = ZPXW, 3 = RSG setTDRStyle(); //gROOT->SetStyle("Plain"); gStyle->SetOptStat(0000000000); //this clears all the boxes and crap gStyle->SetLegendBorderSize(1); TGraph * limit_obs = new TGraph(3); TGraph * limit_exp = new TGraph(3); TGraphAsymmErrors * band_exp1 = new TGraphAsymmErrors(); TGraphAsymmErrors * band_exp2 = new TGraphAsymmErrors(); TGraph * limit_obs_2 = new TGraph(3); TGraph * limit_exp_2 = new TGraph(3); TGraphAsymmErrors * band_exp1_2 = new TGraphAsymmErrors(); TGraphAsymmErrors * band_exp2_2 = new TGraphAsymmErrors(); TGraph * limit_obs_3 = new TGraph(3); TGraph * limit_exp_3 = new TGraph(3); TGraphAsymmErrors * band_exp1_3 = new TGraphAsymmErrors(); TGraphAsymmErrors * band_exp2_3 = new TGraphAsymmErrors(); TGraph * limit_obs_4 = new TGraph(3); TGraph * limit_exp_4 = new TGraph(3); TGraphAsymmErrors * band_exp1_4 = new TGraphAsymmErrors(); TGraphAsymmErrors * band_exp2_4 = new TGraphAsymmErrors(); TGraph *theory = new TGraph(3); TGraph *theory2 = new TGraph(3); TGraph *theory3 = new TGraph(3); TGraph *theory4 = new TGraph(3); theory->SetPoint(0, 0.01, 4.24671); theory->SetPoint(1, 0.1, 42.24246); theory->SetPoint(2, 0.3, 122.17487); theory2->SetPoint(0, 0.01, 0.17980); theory2->SetPoint(1, 0.1, 2.00723); theory2->SetPoint(2, 0.3, 6.99950); theory3->SetPoint(0, 0.01, 0.01659*0.1); theory3->SetPoint(1, 0.1, 0.23030*0.1); theory3->SetPoint(2, 0.3, 1.03387*0.1); theory4->SetPoint(0, 0.01, 0.00203*0.01); theory4->SetPoint(1, 0.1, 0.04254*0.01); theory4->SetPoint(2, 0.3, 0.25352*0.01); string filename = "Limits/comb_width_1TeV.txt"; if (signal == 1) filename= "Limits/comb_width_2TeV.txt"; if (signal == 2) filename= "Limits/comb_width_3TeV.txt"; if (signal == 3) filename= "Limits/comb_width_4TeV.txt"; ifstream infile(filename); double mass, exp, obs, up1, up2, dn1, dn2; int point = 0; while (!infile.eof()){ //infile >> mass >> exp >> dn2 >> up2 >> dn1 >> up1; //obs = exp; infile >> mass >> obs >> exp >> dn2 >> up2 >> dn1 >> up1; double sf = 1.0; cout.precision(3); //cout << mass << " & " << obs << " & " << exp << " & " << "["<<dn1<<", "<<up1<<"] & ["<<dn2<<", "<<up2<<"] \\" << endl; cout << mass << " & \\textbf{" << obs*sf << "} & " << dn2*sf << " & " << dn1*sf << " & \\textbf{" << exp*sf << "} & " << up1*sf << " & " << up2*sf << " \\\\" << endl; //if (mass == 2500) sf = 0.01; //if (mass == 3000) sf = 0.001; //if (mass == 3500) sf = 0.0001; //if (mass == 4000) sf = 0.0001; limit_obs->SetPoint(point, mass, obs*sf); limit_exp->SetPoint(point, mass, exp*sf); band_exp1->SetPoint(point, mass, exp*sf); band_exp2->SetPoint(point, mass, exp*sf); band_exp1->SetPointEYhigh(point, up1*sf - exp*sf); band_exp1->SetPointEYlow(point, exp*sf - dn1*sf); band_exp2->SetPointEYhigh(point, up2*sf - exp*sf); band_exp2->SetPointEYlow(point, exp*sf - dn2*sf); point++; } ifstream infile2 ("Limits/comb_width_2TeV.txt"); point = 0; while (!infile2.eof()){ //infile >> mass >> exp >> dn2 >> up2 >> dn1 >> up1; //obs = exp; infile2 >> mass >> obs >> exp >> dn2 >> up2 >> dn1 >> up1; double sf = 1.0; cout.precision(3); //cout << mass << " & " << obs << " & " << exp << " & " << "["<<dn1<<", "<<up1<<"] & ["<<dn2<<", "<<up2<<"] \\" << endl; cout << mass << " & \\textbf{" << obs*sf << "} & " << dn2*sf << " & " << dn1*sf << " & \\textbf{" << exp*sf << "} & " << up1*sf << " & " << up2*sf << " \\\\" << endl; //if (mass == 2500) sf = 0.01; //if (mass == 3000) sf = 0.001; //if (mass == 3500) sf = 0.0001; //if (mass == 4000) sf = 0.0001; limit_obs_2->SetPoint(point, mass, obs*sf); limit_exp_2->SetPoint(point, mass, exp*sf); band_exp1_2->SetPoint(point, mass, exp*sf); band_exp2_2->SetPoint(point, mass, exp*sf); band_exp1_2->SetPointEYhigh(point, up1*sf - exp*sf); band_exp1_2->SetPointEYlow(point, exp*sf - dn1*sf); band_exp2_2->SetPointEYhigh(point, up2*sf - exp*sf); band_exp2_2->SetPointEYlow(point, exp*sf - dn2*sf); point++; } ifstream infile3 ("Limits/comb_width_3TeV.txt"); point = 0; while (!infile3.eof()){ //infile >> mass >> exp >> dn2 >> up2 >> dn1 >> up1; //obs = exp; infile3 >> mass >> obs >> exp >> dn2 >> up2 >> dn1 >> up1; double sf = 0.1; cout.precision(3); //cout << mass << " & " << obs << " & " << exp << " & " << "["<<dn1<<", "<<up1<<"] & ["<<dn2<<", "<<up2<<"] \\" << endl; cout << mass << " & \\textbf{" << obs*sf << "} & " << dn2*sf << " & " << dn1*sf << " & \\textbf{" << exp*sf << "} & " << up1*sf << " & " << up2*sf << " \\\\" << endl; //if (mass == 2500) sf = 0.01; //if (mass == 3000) sf = 0.001; //if (mass == 3500) sf = 0.0001; //if (mass == 4000) sf = 0.0001; limit_obs_3->SetPoint(point, mass, obs*sf); limit_exp_3->SetPoint(point, mass, exp*sf); band_exp1_3->SetPoint(point, mass, exp*sf); band_exp2_3->SetPoint(point, mass, exp*sf); band_exp1_3->SetPointEYhigh(point, up1*sf - exp*sf); band_exp1_3->SetPointEYlow(point, exp*sf - dn1*sf); band_exp2_3->SetPointEYhigh(point, up2*sf - exp*sf); band_exp2_3->SetPointEYlow(point, exp*sf - dn2*sf); point++; } ifstream infile4 ("Limits/comb_width_4TeV.txt"); point = 0; while (!infile4.eof()){ //infile >> mass >> exp >> dn2 >> up2 >> dn1 >> up1; //obs = exp; infile4 >> mass >> obs >> exp >> dn2 >> up2 >> dn1 >> up1; double sf = 0.01; cout.precision(3); //cout << mass << " & " << obs << " & " << exp << " & " << "["<<dn1<<", "<<up1<<"] & ["<<dn2<<", "<<up2<<"] \\" << endl; cout << mass << " & \\textbf{" << obs*sf << "} & " << dn2*sf << " & " << dn1*sf << " & \\textbf{" << exp*sf << "} & " << up1*sf << " & " << up2*sf << " \\\\" << endl; //if (mass == 2500) sf = 0.01; //if (mass == 3000) sf = 0.001; //if (mass == 3500) sf = 0.0001; //if (mass == 4000) sf = 0.0001; limit_obs_4->SetPoint(point, mass, obs*sf); limit_exp_4->SetPoint(point, mass, exp*sf); band_exp1_4->SetPoint(point, mass, exp*sf); band_exp2_4->SetPoint(point, mass, exp*sf); band_exp1_4->SetPointEYhigh(point, up1*sf - exp*sf); band_exp1_4->SetPointEYlow(point, exp*sf - dn1*sf); band_exp2_4->SetPointEYhigh(point, up2*sf - exp*sf); band_exp2_4->SetPointEYlow(point, exp*sf - dn2*sf); point++; } double max = 200000.0; //band_exp2->GetHistogram()->GetMaximum()*50; TCanvas *canvas = new TCanvas("limit set ZPN","limit set ZPN", 500,500); limit_exp->SetMinimum(0.00001); limit_exp->GetXaxis()->SetLabelSize(0.05); limit_exp->GetYaxis()->SetLabelSize(0.05); limit_exp->Draw("AL"); if (signal == 0){ limit_exp->GetXaxis()->SetTitle("#Gamma_{Z'} / M_{Z'}"); limit_exp->GetYaxis()->SetTitle("95% CL Limit on #sigma_{Z'} #times B(Z'#rightarrowt#bar{t}) [pb]"); } else if (signal == 1){ limit_exp->GetXaxis()->SetTitle("M_{Z'} [GeV]"); limit_exp->GetYaxis()->SetTitle("95% CL Limit on #sigma_{Z'} #times B(Z'#rightarrowt#bar{t}) [pb]"); } else if (signal == 2){ limit_exp->GetXaxis()->SetTitle("M_{Z'} [GeV]"); limit_exp->GetYaxis()->SetTitle("95% CL Limit on #sigma_{Z'} #times B(Z'#rightarrowt#bar{t}) [pb]"); } else if (signal == 3){ limit_exp->GetXaxis()->SetTitle("M_{g_{KK}} [GeV]"); limit_exp->GetYaxis()->SetTitle("95% CL Limit on #sigma_{g_{KK}} #times B(g_{KK}#rightarrowt#bar{t}) [pb]"); } //limit_exp->GetYaxis()->SetTitleOffset(1.2); limit_exp->GetYaxis()->SetRangeUser(0.00001,2000); band_exp2->SetFillColor(5); band_exp2->SetLineColor(0); //band_exp2->SetFillStyle(4000); band_exp2->Draw("3same"); band_exp1->SetFillColor(3); band_exp1->SetLineColor(0); //band_exp1->SetFillStyle(4000); band_exp1->Draw("3same"); limit_obs->Draw("Lsame"); limit_obs->SetLineWidth(2); limit_obs->SetMarkerSize(1.0); limit_obs->SetMarkerStyle(20); limit_exp->Draw("Lsame"); limit_exp->SetLineStyle(2); limit_exp->SetLineWidth(2); limit_exp->SetMarkerSize(1.0); limit_exp->SetMaximum(max); limit_exp->SetMinimum(0.000001); limit_exp->SetMarkerStyle(20); band_exp2_2->SetFillColor(5); band_exp2_2->SetLineColor(0); band_exp1_2->SetFillColor(3); band_exp1_2->SetLineColor(0); band_exp2_3->SetFillColor(5); band_exp2_3->SetLineColor(0); band_exp1_3->SetFillColor(3); band_exp1_3->SetLineColor(0); band_exp2_4->SetFillColor(5); band_exp2_4->SetLineColor(0); band_exp1_4->SetFillColor(3); band_exp1_4->SetLineColor(0); band_exp2_2->Draw("3same"); band_exp1_2->Draw("3same"); limit_obs_2->Draw("Lsame"); limit_obs_2->SetLineWidth(2); limit_obs_2->SetMarkerSize(1.0); limit_obs_2->SetMarkerStyle(20); band_exp2_3->Draw("3same"); band_exp1_3->Draw("3same"); limit_obs_3->Draw("Lsame"); limit_obs_3->SetLineWidth(2); limit_obs_3->SetMarkerSize(1.0); limit_obs_3->SetMarkerStyle(20); band_exp2_4->Draw("3same"); band_exp1_4->Draw("3same"); limit_obs_4->Draw("Lsame"); limit_obs_4->SetLineWidth(2); limit_obs_4->SetMarkerSize(1.0); limit_obs_4->SetMarkerStyle(20); limit_exp_2->Draw("L same"); limit_exp_2->SetLineStyle(2); limit_exp_2->SetLineWidth(2); limit_exp_2->SetMarkerSize(1.0); limit_exp_3->Draw("L same"); limit_exp_3->SetLineStyle(2); limit_exp_3->SetLineWidth(2); limit_exp_3->SetMarkerSize(1.0); limit_exp_4->Draw("L same"); limit_exp_4->SetLineStyle(2); limit_exp_4->SetLineWidth(2); limit_exp_4->SetMarkerSize(1.0); canvas->RedrawAxis(); double x1 = 595; double y1 = 1.0; double x2 = 905; double y2 = 1.0; TLine * line = new TLine(x1, y1, x2, y2); theory->SetLineColor(2); theory->SetLineWidth(2); theory->Draw("same"); theory2->SetLineColor(kBlue); theory2->SetLineWidth(2); theory2->Draw("same"); theory3->SetLineColor(kMagenta); theory3->SetLineWidth(2); theory3->Draw("same"); theory4->SetLineColor(kCyan); theory4->SetLineWidth(2); theory4->Draw("same"); CMS_lumi(canvas, 4, 10); float t = canvas->GetTopMargin(); float r = canvas->GetRightMargin(); //Legend TLegend *l = new TLegend(0.51,0.63,0.99-r,0.99-t); l->AddEntry(limit_obs,"Observed", "L"); l->AddEntry(limit_exp,"Expected", "L"); l->AddEntry(band_exp1,"#pm1 #sigma Exp.", "F"); l->AddEntry(band_exp2,"#pm2 #sigma Exp.", "F"); l->AddEntry(theory, "Z' 1 TeV (NLO)", "L"); l->AddEntry(theory2, "Z' 2 TeV (NLO)", "L"); l->AddEntry(theory3, "Z' 3 TeV (NLO x 0.1)", "L"); l->AddEntry(theory4, "Z' 4 TeV (NLO x 0.01)", "L"); l->SetFillColor(0); l->SetLineColor(0); l->SetTextSize(0.04); l->SetTextFont(42); l->Draw(); //TLatex * label = new TLatex(); //label->SetNDC(); //label->DrawLatex(0.2,0.86,"CMS Preliminary, 19.7 fb^{-1}"); //label->DrawLatex(0.2,0.80,"#sqrt{s} = 8 TeV"); //label->DrawLatex(0.6,0.80, Form("BR(b'#rightarrow %s) = 1", channel.Data())); //label->DrawLatex(0.55,0.80, "BR(b'#rightarrow tW) = 0.5"); //label->DrawLatex(0.55,0.74, "BR(b'#rightarrow bH) = 0.25"); //label->DrawLatex(0.55,0.68, "BR(b'#rightarrow bZ) = 0.25"); //label->DrawLatex(0.2,0.74, lepton.Data()); canvas->SetLogy(1); canvas->SetLogx(1); canvas->SetTickx(1); canvas->SetTicky(1); if (signal == 0){ canvas->Print("Limits/comb_ZPN_limit.pdf"); canvas->Print("Limits/comb_ZPN_limit.root"); } else if (signal == 1){ canvas->Print("Limits/comb_ZPW_limit.pdf"); canvas->Print("Limits/comb_ZPW_limit.root"); } else if (signal == 2){ canvas->Print("Limits/comb_ZPXW_limit.pdf"); canvas->Print("Limits/comb_ZPXW_limit.root"); } else if (signal == 3){ canvas->Print("Limits/comb_RSG_limit.pdf"); canvas->Print("Limits/comb_RSG_limit.root"); } }
void final_pdf_error(){ const int nPoints0 = 53; double pdf00[nPoints0],pdf01[nPoints0]; const int nPoints1 = 101; double pdf10[nPoints1],pdf11[nPoints1]; const int nPoints2 = 41; double pdf20[nPoints2],pdf21[nPoints2]; const int nPoints3 = 2; double pdf30[nPoints3],pdf31[nPoints3]; const int nPoints4 = 2; double pdf40[nPoints4],pdf41[nPoints4]; const int nPoints5 = 2; double pdf50[nPoints5],pdf51[nPoints5]; int i = 0; ifstream infile0("pdf_cteq66.txt"); while (infile0>>pdf00[i] >>pdf01[i]){ i++;} i = 0; ifstream infile1("pdf_nnpdf.txt"); while (infile1>>pdf10[i] >>pdf11[i]){ i++;} i = 0; ifstream infile2("pdf_mstw.txt"); while (infile2>>pdf20[i] >>pdf21[i]){ i++;} i = 0; ifstream infile3("pdf_cteq66_alphas.txt"); while (infile3>>pdf30[i] >>pdf31[i]){ i++;} i = 0; ifstream infile4("pdf_nnpdf_alphas.txt"); while (infile4>>pdf40[i] >>pdf41[i]){ i++;} i = 0; ifstream infile5("pdf_mstw_alphas.txt"); while (infile5>>pdf50[i] >>pdf51[i]){ i++;} double results00[2],results10[2],results20[2]; mstw_cteq(pdf00, nPoints0, results00); nnpdf (pdf10, nPoints1, results10); mstw_cteq(pdf20, nPoints2, results20); double results01[2],results11[2],results21[2]; mstw_cteq(pdf01, nPoints0, results01); nnpdf (pdf11, nPoints1, results11); mstw_cteq(pdf21, nPoints2, results21); double resultsN00[2],resultsN10[2],resultsN20[2]; combined_syst(pdf00, nPoints0, false, resultsN00); combined_syst(pdf10, nPoints1, true , resultsN10); combined_syst(pdf20, nPoints2, false, resultsN20); double resultsN01[2],resultsN11[2],resultsN21[2]; combined_syst(pdf01, nPoints0, false, resultsN01); combined_syst(pdf11, nPoints1, true , resultsN11); combined_syst(pdf21, nPoints2, false, resultsN21); printf("CTEQ Acc syst. => + %5.3f - %5.3f\n",results00[0],results00[1]); printf("NNPDF Acc syst. => + %5.3f - %5.3f\n",results10[0],results10[1]); printf("MSTW Acc syst. => + %5.3f - %5.3f\n",results20[0],results20[1]); printf("CTEQ Rec syst. => + %5.3f - %5.3f\n",results01[0],results01[1]); printf("NNPDF Rec syst. => + %5.3f - %5.3f\n",results11[0],results11[1]); printf("MSTW Rec syst. => + %5.3f - %5.3f\n",results21[0],results21[1]); printf("CTEQ Acc syst. => + %5.3f - %5.3f\n",resultsN00[0],resultsN00[1]); printf("NNPDF Acc syst. => + %5.3f - %5.3f\n",resultsN10[0],resultsN10[1]); printf("MSTW Acc syst. => + %5.3f - %5.3f\n",resultsN20[0],resultsN20[1]); printf("CTEQ Rec syst. => + %5.3f - %5.3f\n",resultsN01[0],resultsN01[1]); printf("NNPDF Rec syst. => + %5.3f - %5.3f\n",resultsN11[0],resultsN11[1]); printf("MSTW Rec syst. => + %5.3f - %5.3f\n",resultsN21[0],resultsN21[1]); double alpha_s_acc[3] = {100*(pdf30[0]-pdf30[1])/2.0/pdf00[0],100*(pdf40[0]-pdf40[1])/2.0/pdf10[0],100*(pdf50[0]-pdf50[1])/2.0/pdf20[0]}; double alpha_s_rec[3] = {100*(pdf31[0]-pdf31[1])/2.0/pdf01[0],100*(pdf41[0]-pdf41[1])/2.0/pdf11[0],100*(pdf51[0]-pdf51[1])/2.0/pdf21[0]}; printf("CTEQ/NNPDF/MSTW Acc-alphas syst. => %5.3f %5.3f %5.3f\n",alpha_s_acc[0],alpha_s_acc[1],alpha_s_acc[2]); printf("CTEQ/NNPDF/MSTW Rec-alphas syst. => %5.3f %5.3f %5.3f\n",alpha_s_rec[0],alpha_s_rec[1],alpha_s_rec[2]); double Vmax_acc = (1.0+resultsN00[0]/100.)*pdf00[0]; if((1.0+resultsN10[0]/100.)*pdf10[0] > Vmax_acc) Vmax_acc = (resultsN10[0]/100.+1)*pdf10[0]; if((1.0+resultsN20[0]/100.)*pdf20[0] > Vmax_acc) Vmax_acc = (resultsN20[0]/100.+1)*pdf20[0]; double Vmin_acc = (1.0-resultsN00[1]/100.)*pdf00[0]; if((1.0-resultsN10[0]/100.)*pdf10[0] < Vmin_acc) Vmin_acc = (1.0-resultsN10[0]/100.)*pdf10[0]; if((1.0-resultsN20[0]/100.)*pdf20[0] < Vmin_acc) Vmin_acc = (1.0-resultsN20[0]/100.)*pdf20[0]; double sigma_acc = (Vmax_acc-Vmin_acc)/2.; double x_central_acc = (Vmax_acc+Vmin_acc)/2.; printf("Acc-additional syst. x,sigma: %7.5f +/- %7.5f ==> %7.5f\n",x_central_acc,sigma_acc,100*sigma_acc/x_central_acc); double Vmax_rec = (1.0+resultsN01[0]/100.)*pdf01[0]; if((1.0+resultsN11[0]/100.)*pdf11[0] > Vmax_rec) Vmax_rec = (resultsN11[0]/100.+1)*pdf11[0]; if((1.0+resultsN21[0]/100.)*pdf21[0] > Vmax_rec) Vmax_rec = (resultsN21[0]/100.+1)*pdf21[0]; double Vmin_rec = (1.0-resultsN01[1]/100.)*pdf01[0]; if((1.0-resultsN11[0]/100.)*pdf11[0] < Vmin_rec) Vmin_rec = (1.0-resultsN11[0]/100.)*pdf11[0]; if((1.0-resultsN21[0]/100.)*pdf21[0] < Vmin_rec) Vmin_rec = (1.0-resultsN21[0]/100.)*pdf21[0]; double sigma_rec = (Vmax_rec-Vmin_rec)/2.; double x_central_rec = (Vmax_rec+Vmin_rec)/2.; printf("Rec-additional syst. x,sigma: %7.5f +/- %7.5f ==> %7.5f\n",x_central_rec,sigma_rec,100*sigma_rec/x_central_rec); double total0[2] = {sqrt((resultsN00[0]+resultsN00[1])*(resultsN00[0]+resultsN00[1])/4.+alpha_s_acc[0]*alpha_s_acc[0]+(100*sigma_acc/x_central_acc)*(100*sigma_acc/x_central_acc)), sqrt((resultsN01[0]+resultsN01[1])*(resultsN01[0]+resultsN01[1])/4.+alpha_s_rec[0]*alpha_s_rec[0]+(100*sigma_rec/x_central_rec)*(100*sigma_rec/x_central_rec))}; printf("Acc-total syst CTEQ: %5.3f\n",total0[0]); printf("Rec-total syst CTEQ: %5.3f\n",total0[1]); double total1[2] = {sqrt((resultsN10[0]+resultsN10[1])*(resultsN10[0]+resultsN10[1])/4.+alpha_s_acc[1]*alpha_s_acc[1]+(100*sigma_acc/x_central_acc)*(100*sigma_acc/x_central_acc)), sqrt((resultsN11[0]+resultsN11[1])*(resultsN11[0]+resultsN11[1])/4.+alpha_s_rec[1]*alpha_s_rec[1]+(100*sigma_rec/x_central_rec)*(100*sigma_rec/x_central_rec))}; printf("Acc-total syst MSTW: %5.3f\n",total1[0]); printf("Rec-total syst MSTW: %5.3f\n",total1[1]); double total2[2] = {sqrt((resultsN20[0]+resultsN20[1])*(resultsN20[0]+resultsN20[1])/4.+alpha_s_acc[2]*alpha_s_acc[2]+(100*sigma_acc/x_central_acc)*(100*sigma_acc/x_central_acc)), sqrt((resultsN21[0]+resultsN21[1])*(resultsN21[0]+resultsN21[1])/4.+alpha_s_rec[2]*alpha_s_rec[2]+(100*sigma_rec/x_central_rec)*(100*sigma_rec/x_central_rec))}; printf("Acc-total syst NNPDF: %5.3f\n",total2[0]); printf("Rec-total syst NNPDF: %5.3f\n",total2[1]); }
/*int main{{{*/ void Check( TString Target_Name){ /*Define{{{*/ gROOT->SetStyle("Plain"); gStyle->SetFillColor(0); TString Input_File = ""; Input_File = Form("%s_L_kin5.1_unf.rho",Target_Name.Data()); ifstream infile1(Input_File); Input_File = Form("../%s_Yield_L_All.out",Target_Name.Data()); ifstream infile4(Input_File); Input_File = Form("%s.rho",Target_Name.Data()); ofstream outfile(Input_File); const int bin = 60; double I1=0.; if(Target_Name=="H2"){ I1=45.0; } else if(Target_Name=="He3"){ I1=120.0; } else if(Target_Name=="He4"){ I1 = 95.0; } else cerr<<"***ERROR, Unknow Target!!!"<<endl; double *VZ1 = new double[bin]; double *VZf = new double[bin]; double *Rho1 = new double[bin]; double *Rho1_Err = new double[bin]; double *Rho0 = new double[bin]; double *Rho0_Err = new double[bin]; double *Rho0f = new double[bin]; double *Rho0f_Err = new double[bin]; double *Rho1f = new double[bin]; double *Rho1f_Err = new double[bin]; double *Zero = new double[bin]; double *BF = new double[bin]; double *BF_Err = new double[bin]; double rho1_sum=0., rho0_sum=0.; double rho0f_sum=0.,rho1f_sum=0.; TString acom; infile4>>acom>>acom>>acom>>acom>>acom; /*}}}*/ double aa=0; for(int i=0;i<bin;i++){ infile1 >> VZ1[i] >> Rho1[i]; Rho1_Err[1]=sqrt(Rho1[i]); infile4 >> VZf[i] >> Rho0f[i] >> Rho0f_Err[i] >> BF[i] >> BF_Err[i]; Zero[i]=0.0; Rho0[i] = Correction_Inverse(Target_Name.Data(), VZ1[i], I1, Rho1[i] ); Rho0_Err[i] = Rho0[i]/Rho1[i]*Rho1_Err[i]; Rho1f[i] = Correction(Target_Name.Data(), VZf[i], I1, Rho0f[i] ); Rho1f_Err[i] = Rho1f[i]/Rho0f[i]*Rho0f_Err[i]; if(VZ1[i]>-0.075 && VZ1[i]<0.075){ rho0_sum+=Rho0[i]; rho1_sum+=Rho1[i]; } else{ Rho0[i]=0.0; Rho1[i]=0.0; Rho0_Err[i]=0.0; Rho1_Err[i]=0.0; } if(VZf[i]>-0.075 && VZf[i]<0.075){ rho0f_sum+=Rho0f[i]; rho1f_sum+=Rho1f[i]; } else{ Rho0f[i]=0.0; Rho1f[i]=0.0; Rho0f_Err[i]=0.0; Rho1f_Err[i]=0.0; } } infile1.close(); cerr<<Form("Rho=%f, Rho1=%f, Rhof=%f, Rho1f=%f", rho0_sum, rho1_sum, rho0f_sum, rho1f_sum)<<endl; outfile<<Form("%12s %12s %12s %12s %12s", "VZ","Y0","Y0_Err","BF","BF_Err")<<endl; for(int i=0;i<bin;i++){ Rho0[i]/=rho0_sum; Rho0_Err[i]/=rho0_sum; Rho1[i]/=rho1_sum; Rho1_Err[i]/=rho1_sum; Rho0f[i]/=rho0f_sum; Rho0f_Err[i]/=rho0f_sum; Rho1f[i]/=rho1f_sum; Rho1f_Err[i]/=rho1f_sum; outfile<<Form(" %12.8f %12.8f %12.8f %12.8f %12.8f",VZf[i],Rho0f[i], Rho0f_Err[i], BF[i],BF_Err[i])<<endl; } outfile.close(); TCanvas *c1 = new TCanvas("c1","c1",1200,700); c1->cd(); TH2F *h1 = new TH2F("h1","",300,-0.12,0.12,300,-0.01,0.04); h1->SetStats(kFALSE); h1->SetXTitle("z_{react} (m)"); h1->GetXaxis()->CenterTitle(1); h1->GetXaxis()->SetTitleFont(32); h1->GetXaxis()->SetTitleSize(0.06); h1->SetYTitle("#rho_{norm}"); h1->GetYaxis()->CenterTitle(1); h1->GetYaxis()->SetTitleFont(32); h1->GetYaxis()->SetTitleSize(0.06); h1->GetYaxis()->SetTitleOffset(0.8); h1->SetLineWidth(1.5); h1->Draw(); TGraphErrors *ex = new TGraphErrors(bin, VZ1, Rho0, Zero, Rho0_Err); ex->SetMarkerStyle(20); ex->SetMarkerColor(1); ex->SetLineColor(1); ex->SetLineWidth(1.5); TGraphErrors *ex4 = new TGraphErrors(bin, VZf, Rho0f, Zero, Rho0f_Err); ex4->SetMarkerStyle(20); ex4->SetMarkerColor(6); ex4->SetLineColor(6); ex4->SetLineWidth(1.5); TGraphErrors *ex1 = new TGraphErrors(bin, VZ1, Rho1, Zero, Rho1_Err); ex1->SetMarkerStyle(21); ex1->SetMarkerColor(6); ex1->SetLineColor(2); ex1->SetLineWidth(1.5); TGraphErrors *ex41 = new TGraphErrors(bin, VZf, Rho1f, Zero, Rho1f_Err); ex41->SetMarkerStyle(28); ex41->SetMarkerColor(4); ex41->SetLineColor(2); ex41->SetLineWidth(1.5); TLegend *l1 = new TLegend(0.33,0.2,0.72,0.45,Form("%s Density Profile:",Target_Name.Data())); l1->SetTextSize(0.03); l1->SetTextFont(32); c1->Clear(); h1->Draw(); ex->Draw("l"); l1->AddEntry(ex, Form("#rho_{0} calculated from #rho(%d uA) ",(int)(I1)),"l"); ex4->Draw("p"); l1->AddEntry(ex4, Form("#rho_{0} from Boiling Fitting"),"p"); ex1->Draw("l"); l1->AddEntry(ex1, Form("#rho(%d uA) from data",(int) (I1)),"l"); ex41->Draw("p"); l1->AddEntry(ex41, Form("#rho(%d uA) calculated from Boiling Fitting",(int) (I1)),"p"); l1->Draw(); // c1->Print(Form("%s_Check_%d.png",Target_Name.Data(), (int) (I1))); // c1->Print(Form("%s_Check_%d.pdf",Target_Name.Data(), (int) (I1))); delete VZ1; delete VZf; delete Rho1; delete Rho0; delete Rho1_Err; delete Rho0_Err; delete Rho0f; delete Rho1f; delete Rho0f_Err; delete Rho1f_Err; delete Zero; delete BF; delete BF_Err; }