#include using namespace std; #include "Angle.h" #include "Geom.h" #include "StandardLabels.C" void Eres_pars_vs_thresh(void) { TColor::CreateColorWheel(); ifstream ifs("Eres_vs_E_thresh.dat"); vector thresh; vector thresh_plus; vector thresh_minus; vector a; vector a_err; vector b; vector b_err; vector c; vector c_err; while(!ifs.eof()){ double _thresh, _a, _a_err, _b, _b_err, _c, _c_err; double scale = 100.0; // convert to percent ifs>>_thresh>>_a>>_a_err>>_b>>_b_err>>_c>>_c_err; thresh.push_back(_thresh); thresh_plus.push_back(_thresh+1.0); thresh_minus.push_back(_thresh-1.0); a.push_back(_a*scale); a_err.push_back(_a_err*scale); b.push_back(_b*scale); b_err.push_back(_b_err*scale); c.push_back(_c*scale); c_err.push_back(_c_err*scale); } TGraphErrors *ga = new TGraphErrors(thresh.size(), &thresh[0], &a[0], 0, &a_err[0]); TGraphErrors *gb = new TGraphErrors(thresh.size(), &thresh_minus[0], &b[0], 0, &b_err[0]); TGraphErrors *gc = new TGraphErrors(thresh.size(), &thresh_plus[0], &c[0], 0, &c_err[0]); TCanvas *c1 = new TCanvas("c1"); c1->SetTicks(); c1->SetGrid(); TH2D *axes = new TH2D("axes", "Energy Resolution Fit parameters", 100, 0.0, 110.0, 100, -2.0, 10.0); axes->SetStats(0); axes->SetXTitle("Threshold (mV)"); axes->SetYTitle("Parameter from fit (%)"); axes->Draw(); ga->SetLineColor(kRed); gb->SetLineColor(kBlue); gc->SetLineColor(kGreen+3); ga->SetMarkerColor(ga->GetLineColor()); gb->SetMarkerColor(gb->GetLineColor()); gc->SetMarkerColor(gc->GetLineColor()); ga->SetMarkerStyle(22); gb->SetMarkerStyle(23); gc->SetMarkerStyle(21); ga->SetLineWidth(2); gb->SetLineWidth(2); gc->SetLineWidth(2); ga->SetFillColor(kWhite); gb->SetFillColor(kWhite); gc->SetFillColor(kWhite); ga->Draw("Psame"); gb->Draw("Psame"); gc->Draw("Psame"); TLegend *leg = new TLegend(0.783, 0.635, 0.895, 0.894); leg->SetFillColor(kWhite); leg->AddEntry(ga, "a"); leg->AddEntry(gb, "b"); leg->AddEntry(gc, "c"); leg->Draw(); TLatex *lab = new TLatex(65.0, 12.0, "#frac{#sigma}{E} = #frac{a}{#sqrt{E}} #oplus b #oplus #frac{c}{E}"); lab->SetTextAlign(22); lab->SetTextSize(0.040); lab->Draw(); StandardLabels(axes, Scheme(), AngleStr("#theta_{#gamma}=")); c1->SaveAs("Eres_vs_pars_vs_thresh.png"); c1->SaveAs("Eres_vs_pars_vs_thresh.pdf"); }