data analysis scripts
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

440 lines
19 KiB

{
gROOT->ProcessLine(".x lhcbStyle.C");
TCanvas c1_g1_c;
TGraphErrors * g1_c = new TGraphErrors("beamenergyfile_int_c.txt","%lg %lg %lg");
for (int i=0;i<g1_c->GetN();i++) g1_c->GetY()[i] *= 0.001; //scale graph
for (int i=0;i<g1_c->GetN();i++) g1_c->GetEY()[i] *= 0.001; //scale errors
g1_c->SetMarkerStyle(22);
g1_c->SetTitle("Carbon Ions");
g1_c->GetXaxis()->SetTitle("Intensity / 10^{6}s^{-1}");
g1_c->GetYaxis()->SetTitle("#bar{A}_{BPM} / 10^{3} a.u.");
g1_c->GetYaxis()->SetRangeUser(0,6);
g1_c->Draw("AP");
g1_c->Fit("pol1");
c1_g1_c.SaveAs("figs/beamenergyfile_int_c.pdf");
c1_g1_c.SaveAs("figs/beamenergyfile_int_c.png");
c1_g1_c.SaveAs("figs/beamenergyfile_int_c.C");
TCanvas c1_g1_p;
TGraphErrors * g1_p = new TGraphErrors("beamenergyfile_int_p.txt","%lg %lg %lg");
for (int i=0;i<g1_p->GetN();i++) g1_p->GetY()[i] *= 0.001; //scale graph
for (int i=0;i<g1_p->GetN();i++) g1_p->GetEY()[i] *= 0.001; //scale errors
g1_p->SetMarkerStyle(20);
g1_p->SetTitle("Protons");
g1_p->GetXaxis()->SetTitle("Intensity / 10^{6}s^{-1}");
g1_p->GetYaxis()->SetTitle("#bar{A}_{BPM} / 10^{3} a.u.");
g1_p->GetYaxis()->SetRangeUser(0,20);
g1_p->Draw("AP");
g1_p->Fit("pol1");
c1_g1_p.SaveAs("figs/beamenergyfile_int_p.pdf");
c1_g1_p.SaveAs("figs/beamenergyfile_int_p.png");
c1_g1_p.SaveAs("figs/beamenergyfile_int_p.C");
TCanvas c1_mg1_e1;
TGraphErrors * ge1_p = new TGraphErrors("energylist_p_bpm1.txt","%lg %lg %lg");
TGraphErrors * ge1_he = new TGraphErrors("energylist_he_bpm1.txt","%lg %lg %lg");
TGraphErrors * ge1_c = new TGraphErrors("energylist_c_bpm1.txt","%lg %lg %lg");
TGraphErrors * ge1_o = new TGraphErrors("energylist_o_bpm1.txt","%lg %lg %lg");
TMultiGraph * mg_e1 = new TMultiGraph();
mg_e1->Add(ge1_p,"p"); ge1_p->SetMarkerStyle(20);
mg_e1->Add(ge1_he,"p"); ge1_he->SetMarkerStyle(21);
mg_e1->Add(ge1_c,"p"); ge1_c->SetMarkerStyle(22);
mg_e1->Add(ge1_o,"p"); ge1_o->SetMarkerStyle(23);
mg_e1->Draw("a");
mg_e1->SetTitle(" ");
mg_e1->GetXaxis()->SetTitle("Stopping Power / MeV#upointcm^{2}g^{-1}");
mg_e1->GetYaxis()->SetTitle("#bar{A}_{BPM} / a.u.#upoint10^{-6}#upointion^{-1}s^{-1}");
mg_e1->GetXaxis()->SetRangeUser(2,600);
mg_e1->GetYaxis()->SetRangeUser(2,600);
mg_e1->SetMinimum(1.);
mg_e1->SetMaximum(1000.);
c1_mg1_e1.SetLogy(1);
c1_mg1_e1.SetLogx(1);
TF1 * tf1_birk1 = new TF1("tf1_birk1","[0]*x*(1/(1+[1]*x))",3,14);
TF1 * tf1_birk2 = new TF1("tf1_birk2","[0]*x*(1/(1+[1]*x))",15,44);
TF1 * tf1_birk3 = new TF1("tf1_birk3","[0]*x*(1/(1+[1]*x))",100,300);
TF1 * tf1_birk4 = new TF1("tf1_birk4","[0]*x*(1/(1+[1]*x))",180,460);
TF1 * tf1_btv1 = new TF1("tf1_btv1","[0]*x*((1-[1])/(1+[2]*(1-[1])*x)+[1])",3,14);
TF1 * tf1_btv2 = new TF1("tf1_btv2","[0]*x*((1-[1])/(1+[2]*(1-[1])*x)+[1])",15,44);
TF1 * tf1_btv3 = new TF1("tf1_btv3","[0]*x*((1-[1])/(1+[2]*(1-[1])*x)+[1])",100,300);
TF1 * tf1_btv4 = new TF1("tf1_btv4","[0]*x*((1-[1])/(1+[2]*(1-[1])*x)+[1])",180,460);
tf1_birk1->SetParameters(1,0.01);tf1_birk1->SetLineStyle(2);
tf1_birk2->SetParameters(1,0.01);tf1_birk2->SetLineStyle(2);
tf1_birk3->SetParameters(1,0.01);tf1_birk3->SetLineStyle(2);
tf1_birk4->SetParameters(1,0.01);tf1_birk4->SetLineStyle(2);
//ge1_p->Fit(tf1_birk1);
// ge1_he->Fit(tf1_birk2);
//ge1_c->Fit(tf1_birk3);
// ge1_o->Fit(tf1_birk4);
tf1_btv1->SetParameters(1,0.5,0.01);;tf1_btv1->SetLineColor(kRed);
tf1_btv2->SetParameters(1,0.5,0.01);tf1_btv2->SetLineColor(kRed);
tf1_btv3->SetParameters(1,0.5,0.01);tf1_btv3->SetLineColor(kRed);
tf1_btv4->SetParameters(1,0.5,0.01);tf1_btv4->SetLineColor(kRed);
tf1_btv1->SetParLimits(1,0.,1.0);
tf1_btv2->SetParLimits(1,0.,1.0);
tf1_btv3->SetParLimits(1,0.,1.0);
tf1_btv4->SetParLimits(1,0.,1.0);
// ge1_p->Fit(tf1_btv1);tf1_birk1->Draw("same");
// ge1_he->Fit(tf1_btv2);tf1_birk2->Draw("same");
// ge1_c->Fit(tf1_btv3);tf1_birk3->Draw("same");
// ge1_o->Fit(tf1_btv4);tf1_birk4->Draw("same");
TLegend * mylegend = new TLegend(0.20,0.6,0.45,0.9);
mylegend->SetFillColor(0); // white background
mylegend->SetTextFont(22);
mylegend->SetBorderSize(0); // get rid of the box
mylegend->SetTextSize(0.045); // set text size
mylegend->AddEntry(ge1_p,"Protons","p"); // options: p,l,f
mylegend->AddEntry(ge1_he,"Helium","p"); // options: p,l,f
mylegend->AddEntry(ge1_c,"Carbon","p"); // options: p,l,f
mylegend->AddEntry(ge1_o,"Oxygen","p"); // options: p,l,f
// mylegend->AddEntry(tf1_birk1,"Birk's Model","l"); // options: p,l,f
// mylegend->AddEntry(tf1_btv1,"BVT Model","l"); // options: p,l,f
mylegend->Draw();
gPad->Modified();
c1_mg1_e1.SaveAs("figs/energylist_p_bpm1.pdf");
c1_mg1_e1.SaveAs("figs/energylist_p_bpm1.png");
c1_mg1_e1.SaveAs("figs/energylist_p_bpm1.C");
TCanvas c1_mg1_e1ic;
TGraphErrors * ge1ic_p = new TGraphErrors("energylist_p_ic1.txt","%lg %lg %lg");
TGraphErrors * ge1ic_he = new TGraphErrors("energylist_he_ic1.txt","%lg %lg %lg");
TGraphErrors * ge1ic_c = new TGraphErrors("energylist_c_ic1.txt","%lg %lg %lg");
TGraphErrors * ge1ic_o = new TGraphErrors("energylist_o_ic1.txt","%lg %lg %lg");
TMultiGraph * mg_e1ic = new TMultiGraph();
mg_e1ic->Add(ge1ic_p,"p"); ge1ic_p->SetMarkerStyle(20);
mg_e1ic->Add(ge1ic_he,"p"); ge1ic_he->SetMarkerStyle(21);
mg_e1ic->Add(ge1ic_c,"p"); ge1ic_c->SetMarkerStyle(22);
mg_e1ic->Add(ge1ic_o,"p"); ge1ic_o->SetMarkerStyle(23);
mg_e1ic->Draw("a");
mg_e1ic->SetTitle(" ");
mg_e1ic->GetXaxis()->SetTitle("Stopping Power / MeV#upointcm^{2}g^{-1}");
mg_e1ic->GetYaxis()->SetTitle("#bar{A}_{BPM} / a.u.#upoint10^{-6}#upointion^{-1}s^{-1}");
TLegend * mylegendic = new TLegend(0.20,0.6,0.45,0.9);
mylegendic->SetFillColor(0); // white background
mylegendic->SetTextFont(22);
mylegendic->SetBorderSize(0); // get rid of the box
mylegendic->SetTextSize(0.045); // set text size
mylegendic->AddEntry(ge1ic_p,"Protons","p"); // options: p,l,f
mylegendic->AddEntry(ge1ic_he,"Helium","p"); // options: p,l,f
mylegendic->AddEntry(ge1ic_c,"Carbon","p"); // options: p,l,f
mylegendic->AddEntry(ge1ic_o,"Oxygen","p"); // options: p,l,f
mylegendic->Draw();
gPad->Modified();
c1_mg1_e1ic.SaveAs("figs/energylist_p_ic1.pdf");
c1_mg1_e1ic.SaveAs("figs/energylist_p_ic1.png");
c1_mg1_e1ic.SaveAs("figs/energylist_p_ic1.C");
// c1->SetLogx();
TCanvas c1_mg1_e2;
TGraphErrors * ge2_p = new TGraphErrors("energylist_p_bpm1ratio.txt","%lg %lg %lg");
TGraphErrors * ge2_he = new TGraphErrors("energylist_he_bpm1ratio.txt","%lg %lg %lg");
TGraphErrors * ge2_c = new TGraphErrors("energylist_c_bpm1ratio.txt","%lg %lg %lg");
TGraphErrors * ge2_o = new TGraphErrors("energylist_o_bpm1ratio.txt","%lg %lg %lg");
TMultiGraph * mg_e2 = new TMultiGraph();
mg_e2->Add(ge2_p,"p"); ge2_p->SetMarkerStyle(20);
mg_e2->Add(ge2_he,"p"); ge2_he->SetMarkerStyle(21);
mg_e2->Add(ge2_c,"p"); ge2_c->SetMarkerStyle(22);
mg_e2->Add(ge2_o,"p"); ge2_o->SetMarkerStyle(23);
mg_e2->Draw("a");
mg_e2->SetTitle(" ");
mg_e2->GetXaxis()->SetTitle("S_{ps} / MeV#upointcm^{2}g^{-1}");
mg_e2->GetYaxis()->SetTitle("(#bar{A}_{BPM} / #bar{A}_{IC})#upoint(S_{air} / S_{ps}) ");
mg_e2->SetMinimum(0.);
mg_e2->SetMaximum(1.3);
gPad->SetLogx();
TLegend * mylegend2 = new TLegend(0.20,0.2,0.45,0.5);
mylegend2->SetFillColor(0); // white background
mylegend2->SetTextFont(22);
mylegend2->SetBorderSize(0); // get rid of the box
mylegend2->SetTextSize(0.045); // set text size
mylegend2->AddEntry(ge2_p,"Protons","p"); // options: p,l,f
mylegend2->AddEntry(ge2_he,"Helium","p"); // options: p,l,f
mylegend2->AddEntry(ge2_c,"Carbon","p"); // options: p,l,f
mylegend2->AddEntry(ge2_o,"Oxygen","p"); // options: p,l,f
mylegend2->Draw();
gPad->Modified();
c1_mg1_e2.SaveAs("figs/energylist_p_bpm1ratio.pdf");
c1_mg1_e2.SaveAs("figs/energylist_p_bpm1ratio.png");
c1_mg1_e2.SaveAs("figs/energylist_p_bpm1ratio.C");
// c1->SetLogx();
TCanvas c1_mg1_e3;
TGraphErrors * ge3_p = new TGraphErrors("energylist_p_ic1ratio.txt","%lg %lg %lg");
TGraphErrors * ge3_he = new TGraphErrors("energylist_he_ic1ratio.txt","%lg %lg %lg");
TGraphErrors * ge3_c = new TGraphErrors("energylist_c_ic1ratio.txt","%lg %lg %lg");
TGraphErrors * ge3_o = new TGraphErrors("energylist_o_ic1ratio.txt","%lg %lg %lg");
TMultiGraph * mg_e3 = new TMultiGraph();
mg_e3->Add(ge3_p,"p"); ge3_p->SetMarkerStyle(20);
mg_e3->Add(ge3_he,"p"); ge3_he->SetMarkerStyle(21);
mg_e3->Add(ge3_c,"p"); ge3_c->SetMarkerStyle(22);
mg_e3->Add(ge3_o,"p"); ge3_o->SetMarkerStyle(23);
mg_e3->Draw("a");
mg_e3->SetTitle(" ");
mg_e3->GetXaxis()->SetTitle("S_{ps} / MeV#upointcm^{2}g^{-1}");
mg_e3->GetYaxis()->SetTitle("(#bar{A}_{BPM}: #bar{A}_{IC}) correlation ");
mg_e3->SetMinimum(0.6);
mg_e3->SetMaximum(1.3);
gPad->SetLogx();
TLegend * mylegend3 = new TLegend(0.20,0.7,0.45,0.9);
mylegend3->SetFillColor(0); // white background
mylegend3->SetTextFont(22);
mylegend3->SetBorderSize(0); // get rid of the box
mylegend3->SetTextSize(0.045); // set text size
mylegend3->AddEntry(ge3_p,"Protons","p"); // options: p,l,f
mylegend3->AddEntry(ge3_he,"Helium","p"); // options: p,l,f
mylegend3->AddEntry(ge3_c,"Carbon","p"); // options: p,l,f
mylegend3->AddEntry(ge3_o,"Oxygen","p"); // options: p,l,f
mylegend3->Draw();
gPad->Modified();
c1_mg1_e3.SaveAs("figs/energylist_p_ic1ratio.pdf");
c1_mg1_e3.SaveAs("figs/energylist_p_ic1ratio.png");
c1_mg1_e3.SaveAs("figs/energylist_p_ic1ratio.C");
TCanvas c1_mg1_e4;
TGraphErrors * ge4_p = new TGraphErrors("energylist_p_focusfit.txt","%lg %lg %lg");
TGraphErrors * ge4_he = new TGraphErrors("energylist_he_focusfit.txt","%lg %lg %lg");
TGraphErrors * ge4_c = new TGraphErrors("energylist_c_focusfit.txt","%lg %lg %lg");
TGraphErrors * ge4_o = new TGraphErrors("energylist_o_focusfit.txt","%lg %lg %lg");
TGraph * ge4_hit = new TGraph("focusHITfile.txt","%lg %lg");
TMultiGraph * mg_e4 = new TMultiGraph();
mg_e4->Add(ge4_p,"p"); ge4_p->SetMarkerStyle(20);
mg_e4->Add(ge4_he,"p"); ge4_he->SetMarkerStyle(21);
mg_e4->Add(ge4_c,"p"); ge4_c->SetMarkerStyle(22);
mg_e4->Add(ge4_o,"p"); ge4_o->SetMarkerStyle(23);
mg_e4->Add(ge4_hit,"p"); ge4_hit->SetMarkerStyle(30);
mg_e4->Draw("a");
mg_e4->SetTitle(" ");
mg_e4->GetXaxis()->SetTitle("S_{ps} / MeV#upointcm^{2}g^{-1}");
mg_e4->GetYaxis()->SetTitle("Beam Width (FWHM) / mm");
mg_e4->SetMinimum(0.0);
mg_e4->SetMaximum(40.);
gPad->SetLogx();
TLegend * mylegend4 = new TLegend(0.60,0.7,0.9,0.9);
mylegend4->SetFillColor(0); // white background
mylegend4->SetTextFont(22);
mylegend4->SetBorderSize(0); // get rid of the box
mylegend4->SetTextSize(0.045); // set text size
mylegend4->AddEntry(ge4_p,"Protons","p"); // options: p,l,f
mylegend4->AddEntry(ge4_he,"Helium","p"); // options: p,l,f
mylegend4->AddEntry(ge4_c,"Carbon","p"); // options: p,l,f
mylegend4->AddEntry(ge4_o,"Oxygen","p"); // options: p,l,f
mylegend4->AddEntry(ge4_hit,"HIT nominal","p"); // options: p,l,f
mylegend4->Draw();
gPad->Modified();
c1_mg1_e4.SaveAs("figs/energylist_p_focusfit.pdf");
c1_mg1_e4.SaveAs("figs/energylist_p_focusfit.png");
c1_mg1_e4.SaveAs("figs/energylist_p_focusfit.C");
TCanvas c1_mg1_e5;
TGraphErrors * ge5_p = new TGraphErrors("energylist_p_focus1.txt","%lg %lg %lg");
TGraphErrors * ge5_he = new TGraphErrors("energylist_he_focus1.txt","%lg %lg %lg");
TGraphErrors * ge5_c = new TGraphErrors("energylist_c_focus1.txt","%lg %lg %lg");
TGraphErrors * ge5_o = new TGraphErrors("energylist_o_focus1.txt","%lg %lg %lg");
TGraph * ge5_hit = new TGraph("focusHITfile.txt","%lg %lg");
TMultiGraph * mg_e5 = new TMultiGraph();
mg_e5->Add(ge5_p,"p"); ge5_p->SetMarkerStyle(20);
mg_e5->Add(ge5_he,"p"); ge5_he->SetMarkerStyle(21);
mg_e5->Add(ge5_c,"p"); ge5_c->SetMarkerStyle(22);
mg_e5->Add(ge5_o,"p"); ge5_o->SetMarkerStyle(23);
mg_e5->Add(ge5_hit,"p"); ge5_hit->SetMarkerStyle(30);
mg_e5->Draw("a");
mg_e5->SetTitle(" ");
mg_e5->GetXaxis()->SetTitle("S_{ps} / MeV#upointcm^{2}g^{-1}");
mg_e5->GetYaxis()->SetTitle("Beam Width (FWHM) / mm");
mg_e5->SetMinimum(0.0);
mg_e5->SetMaximum(40.);
gPad->SetLogx();
TLegend * mylegend5 = new TLegend(0.60,0.7,0.9,0.9);
mylegend5->SetFillColor(0); // white background
mylegend5->SetTextFont(22);
mylegend5->SetBorderSize(0); // get rid of the box
mylegend5->SetTextSize(0.045); // set text size
mylegend5->AddEntry(ge5_p,"Protons","p"); // options: p,l,f
mylegend5->AddEntry(ge5_he,"Helium","p"); // options: p,l,f
mylegend5->AddEntry(ge5_c,"Carbon","p"); // options: p,l,f
mylegend5->AddEntry(ge5_o,"Oxygen","p"); // options: p,l,f
mylegend5->AddEntry(ge5_hit,"HIT nominal","p"); // options: p,l,f
mylegend5->Draw();
gPad->Modified();
c1_mg1_e5.SaveAs("figs/energylist_p_focus.pdf");
c1_mg1_e5.SaveAs("figs/energylist_p_focus.png");
c1_mg1_e5.SaveAs("figs/energylist_p_focus.C");
TCanvas c1_mg1_e6;
TGraphErrors * ge6_p = new TGraphErrors("energylist_p_skew1.txt","%lg %lg %lg");
TGraphErrors * ge6_he = new TGraphErrors("energylist_he_skew1.txt","%lg %lg %lg");
TGraphErrors * ge6_c = new TGraphErrors("energylist_c_skew1.txt","%lg %lg %lg");
TGraphErrors * ge6_o = new TGraphErrors("energylist_o_skew1.txt","%lg %lg %lg");
TMultiGraph * mg_e6 = new TMultiGraph();
mg_e6->Add(ge6_p,"p"); ge6_p->SetMarkerStyle(20);
mg_e6->Add(ge6_he,"p"); ge6_he->SetMarkerStyle(21);
mg_e6->Add(ge6_c,"p"); ge6_c->SetMarkerStyle(22);
mg_e6->Add(ge6_o,"p"); ge6_o->SetMarkerStyle(23);
mg_e6->Draw("a");
mg_e6->SetTitle(" ");
mg_e6->GetXaxis()->SetTitle("S_{ps} / MeV#upointcm^{2}g^{-1}");
mg_e6->GetYaxis()->SetTitle("Beam Skew");
mg_e6->SetMinimum(0.0);
// mg_e6->SetMaximum(40.);
gPad->SetLogx();
TLegend * mylegend6 = new TLegend(0.60,0.7,0.9,0.9);
mylegend6->SetFillColor(0); // white background
mylegend6->SetTextFont(22);
mylegend6->SetBorderSize(0); // get rid of the box
mylegend6->SetTextSize(0.046); // set text size
mylegend6->AddEntry(ge6_p,"Protons","p"); // options: p,l,f
mylegend6->AddEntry(ge6_he,"Helium","p"); // options: p,l,f
mylegend6->AddEntry(ge6_c,"Carbon","p"); // options: p,l,f
mylegend6->AddEntry(ge6_o,"Oxygen","p"); // options: p,l,f
mylegend6->Draw();
gPad->Modified();
c1_mg1_e6.SaveAs("figs/energylist_p_skew.pdf");
c1_mg1_e6.SaveAs("figs/energylist_p_skew.png");
c1_mg1_e6.SaveAs("figs/energylist_p_skew.C");
TCanvas c1_mg1_e7;
TGraphErrors * ge7_p = new TGraphErrors("energylist_p_kurt1.txt","%lg %lg %lg");
TGraphErrors * ge7_he = new TGraphErrors("energylist_he_kurt1.txt","%lg %lg %lg");
TGraphErrors * ge7_c = new TGraphErrors("energylist_c_kurt1.txt","%lg %lg %lg");
TGraphErrors * ge7_o = new TGraphErrors("energylist_o_kurt1.txt","%lg %lg %lg");
TMultiGraph * mg_e7 = new TMultiGraph();
mg_e7->Add(ge7_p,"p"); ge7_p->SetMarkerStyle(20);
mg_e7->Add(ge7_he,"p"); ge7_he->SetMarkerStyle(21);
mg_e7->Add(ge7_c,"p"); ge7_c->SetMarkerStyle(22);
mg_e7->Add(ge7_o,"p"); ge7_o->SetMarkerStyle(23);
mg_e7->Draw("a");
mg_e7->SetTitle(" ");
mg_e7->GetXaxis()->SetTitle("S_{ps} / MeV#upointcm^{2}g^{-1}");
mg_e7->GetYaxis()->SetTitle("Beam Kurt");
mg_e7->SetMinimum(0.0);
// mg_e7->SetMaximum(40.);
gPad->SetLogx();
TLegend * mylegend7 = new TLegend(0.70,0.7,0.9,0.9);
mylegend7->SetFillColor(0); // white background
mylegend7->SetTextFont(22);
mylegend7->SetBorderSize(0); // get rid of the box
mylegend7->SetTextSize(0.047); // set text size
mylegend7->AddEntry(ge7_p,"Protons","p"); // options: p,l,f
mylegend7->AddEntry(ge7_he,"Helium","p"); // options: p,l,f
mylegend7->AddEntry(ge7_c,"Carbon","p"); // options: p,l,f
mylegend7->AddEntry(ge7_o,"Oxygen","p"); // options: p,l,f
mylegend7->Draw();
gPad->Modified();
c1_mg1_e7.SaveAs("figs/energylist_p_kurt.pdf");
c1_mg1_e7.SaveAs("figs/energylist_p_kurt.png");
c1_mg1_e7.SaveAs("figs/energylist_p_kurt.C");
TCanvas c1_mg1_e8;
TGraph * ge8_p = new TGraph("betadedxz2_p.prn","%lg %lg ");
TGraph * ge8_he = new TGraph("betadedxz2_he.prn","%lg %lg");
TGraph * ge8_c = new TGraph("betadedxz2_c.prn","%lg %lg ");
TGraph * ge8_o = new TGraph("betadedxz2_o.prn","%lg %lg ");
TGraph * ge8_sum = new TGraph("betadedxz2_sum.prn","%lg %lg ");
TMultiGraph * mg_e8 = new TMultiGraph();
mg_e8->Add(ge8_p,"p"); ge8_p->SetMarkerStyle(20);
mg_e8->Add(ge8_he,"p"); ge8_he->SetMarkerStyle(21);
mg_e8->Add(ge8_c,"p"); ge8_c->SetMarkerStyle(22);
mg_e8->Add(ge8_o,"p"); ge8_o->SetMarkerStyle(23);
mg_e8->Add(ge8_sum,"p"); ge8_sum->SetMarkerStyle(1);
mg_e8->Draw("a");
mg_e8->SetTitle(" ");
mg_e8->GetXaxis()->SetTitle("Lorentz #beta");
mg_e8->GetYaxis()->SetTitle("#frac{1}{Z^{2}} #upoint #frac{dE}{dx}");
mg_e8->SetMinimum(0.0);
TF1 * tf1_pow1 = new TF1("tf1_pow1","[0]*pow(x,[1])",0,1);
tf1_pow1->SetParameters(1.6,-1.7);
tf1_pow1->SetLineColor(kRed);
ge8_sum->Fit(tf1_pow1);
// mg_e8->SetMaximum(40.);
// gPad->SetLogx();
TLegend * mylegende8 = new TLegend(0.70,0.7,0.9,0.9);
mylegende8->SetFillColor(0); // white background
mylegende8->SetTextFont(22);
mylegende8->SetBorderSize(0); // get rid of the box
mylegende8->SetTextSize(0.047); // set text size
mylegende8->AddEntry(ge8_p,"Protons","p"); // options: p,l,f
mylegende8->AddEntry(ge8_he,"Helium","p"); // options: p,l,f
mylegende8->AddEntry(ge8_c,"Carbon","p"); // options: p,l,f
mylegende8->AddEntry(ge8_o,"Oxygen","p"); // options: p,l,f
mylegende8->AddEntry(tf1_pow1,"[1]#upointpow(#beta,[2])}","l"); // options: p,l,f
mylegende8->Draw();
gPad->Modified();
c1_mg1_e8.SaveAs("figs/betadedxz2.pdf");
c1_mg1_e8.SaveAs("figs/betadedxz2.png");
c1_mg1_e8.SaveAs("figs/betadedxz2.C");
TCanvas c1_mg1_e9;
TGraph * ge9_p = new TGraph("energylist_p_bpmbeta1.txt","%lg %lg ");
TGraph * ge9_he = new TGraph("energylist_he_bpmbeta1.txt","%lg %lg");
TGraph * ge9_c = new TGraph("energylist_c_bpmbeta1.txt","%lg %lg ");
TGraph * ge9_o = new TGraph("energylist_o_bpmbeta1.txt","%lg %lg ");
TMultiGraph * mg_e9 = new TMultiGraph();
mg_e9->Add(ge9_p,"p"); ge9_p->SetMarkerStyle(20);
mg_e9->Add(ge9_he,"p"); ge9_he->SetMarkerStyle(21);
mg_e9->Add(ge9_c,"p"); ge9_c->SetMarkerStyle(22);
mg_e9->Add(ge9_o,"p"); ge9_o->SetMarkerStyle(23);
// mg_e9->Add(ge9_sum,"p"); ge9_sum->SetMarkerStyle(1);
TF1 * tf1_btvbeta1 = new TF1("tf1_btvbeta1","[0]*( (1- 0.5*(TMath::Log(2*0.511E6*x*x/(1-x*x)/[1] -x*x) )/TMath::Log(2*0.511E6*x*x/(1-x*x)/68.7 -x*x) ) / (1+[2]*(1- 0.5*(TMath::Log(2*0.511E6*x*x/(1-x*x)/[1] -x*x) )/TMath::Log(2*0.511E6*x*x/(1-x*x)/68.7 -x*x) )*1*1.65901*TMath::Power(x,-1.7218))+ (0.5*(TMath::Log(2*0.511E6*x*x/(1-x*x)/[1] -x*x) )/TMath::Log(2*0.511E6*x*x/(1-x*x)/68.7 -x*x) ) )",0,1);
tf1_btvbeta1->SetParameters(1,9.7, 0.05);
mg_e9->Draw("a");
mg_e9->SetTitle(" ");
mg_e9->GetXaxis()->SetTitle("Lorentz #beta");
mg_e9->GetYaxis()->SetTitle("#frac{dA}{dE}");
mg_e9->SetMinimum(0.0);
// mg_e9->SetMaximum(40.);
// gPad->SetLogx();
ge9_p->Fit(tf1_btvbeta1);
TLegend * mylegende9 = new TLegend(0.70,0.7,0.9,0.9);
mylegende9->SetFillColor(0); // white background
mylegende9->SetTextFont(22);
mylegende9->SetBorderSize(0); // get rid of the box
mylegende9->SetTextSize(0.047); // set text size
mylegende9->AddEntry(ge9_p,"Protons","p"); // options: p,l,f
mylegende9->AddEntry(ge9_he,"Helium","p"); // options: p,l,f
mylegende9->AddEntry(ge9_c,"Carbon","p"); // options: p,l,f
mylegende9->AddEntry(ge9_o,"Oxygen","p"); // options: p,l,f
// mylegende9->AddEntry(tf1_pow1,"[1]#upointpow(#beta,[2])}","l"); // options: p,l,f
mylegende9->Draw();
gPad->Modified();
c1_mg1_e9.SaveAs("figs/betadedxz2.pdf");
c1_mg1_e9.SaveAs("figs/betadedxz2.png");
c1_mg1_e9.SaveAs("figs/betadedxz2.C");
}