#include "StandardLabels.C" void pmean_vs_p_vs_theta_discrete(const char *suffix="") { gROOT->Reset(); gStyle->SetPalette(1); TCanvas *c1 = new TCanvas("c1"); c1->SetTicks(); c1->SetGrid(); char fname[256]; sprintf(fname, "hd_res_charged%s.root", suffix); TFile *f = new TFile(fname); TH2D *dp_over_p_mean = (TH2D*)gROOT->FindObject("dp_over_p_mean"); // Draw empty axes TH2D *axes = new TH2D("axes", "Total momentum systematic", 100, 0.0, 165, 100, -0.1, 0.1); axes->SetStats(0); axes->SetXTitle("Polar angle #theta (degrees)"); axes->SetYTitle("Total momentum systematic error (fraction)"); axes->Draw(); // Make legend TLegend *leg = new TLegend(0.430, 0.684, 0.615, 0.839); leg->SetFillColor(kWhite); // Loop over momenta to plot TAxis *yaxis = dp_over_p_mean->GetYaxis(); double mom[]={0.35, 0.5, 1.0, 2.0}; int Nmom = 4; int colors[] = {kBlue, kRed, kGreen, kMagenta}; int styles[] = {20, 21, 22, 23}; for(int i=0; iFindBin(mom[i]); cout<<"Projecting for momentum="<ProjectionX("_px",ybin,ybin); dp_over_p_mean_px = (TH1D*)gROOT->FindObject("dp_over_p_mean_px"); char hname[256]; sprintf(hname, "h%d", i); TH1D *h = (TH1D*)dp_over_p_mean_px->Clone(hname); h->SetLineColor(colors[i]); h->SetMarkerColor(colors[i]); h->SetMarkerStyle(styles[i]); h->Draw("sameP"); char lab[256]; sprintf(lab, "%3.3f GeV/c", mom[i]); leg->AddEntry(h, lab); } leg->Draw(); // Add standard labeling StandardLabels2D(axes, suffix); char fname[256]; sprintf(fname, "pmean_vs_p_vs_theta_discrete%s.gif", suffix); c1->SaveAs(fname); sprintf(fname, "pmean_vs_p_vs_theta_discrete%s.pdf", suffix); c1->SaveAs(fname); }