コード例 #1
0
ファイル: PlotTrigEff.cpp プロジェクト: abmorris/BsphiKK
void DrawGraph(string name, TGraphErrors* graph)
{
    TCanvas* canvas = new TCanvas(name.c_str(),"",1200,900);
    canvas->SetFillColor(kWhite);
    canvas->cd();
    TPad* pad = new TPad();
    // left right bottom top
    pad->SetMargin(0.15,0.05,0.15,0.05);
    pad->SetTicks(1,1);
    pad->SetFillColor(kWhite);
    pad->Draw();
    pad->cd();
    TGraphErrors* oldgraph = graph;
    graph = new TGraphErrors(*graph);
    delete oldgraph;
    float textsize = 0.055;
    graph->SetMinimum(0);
    graph->SetMaximum(100);
    graph->SetTitle("");
    graph->GetXaxis()->SetTitle("#it{m}(#it{K^{#plus}K^{#minus}}) [MeV/#it{c}^{2}]");
    graph->GetYaxis()->SetTitle("Efficiency [%]");
    graph->SetLineColor(kBlack);
    graph->SetLineWidth(1);
    graph->SetMarkerSize(1);
    graph->SetMarkerStyle(8);
    graph->SetMarkerColor(kBlack);
    graph->Draw("AP");
    graph->GetXaxis()->SetTitleSize(textsize*1.2);
    graph->GetYaxis()->SetTitleSize(textsize*1.2);
    graph->GetXaxis()->SetLabelSize(textsize);
    graph->GetYaxis()->SetLabelSize(textsize);
    graph->GetXaxis()->SetTitleFont(132);
    graph->GetYaxis()->SetTitleFont(132);
    graph->GetXaxis()->SetLabelFont(132);
    graph->GetYaxis()->SetLabelFont(132);
    graph->GetYaxis()->CenterTitle();
    double _blurbx        = 0.75;
    double _blurby        = 0.80;
    string _blurbtext     = "#splitline{LHCb}{#scale[0.75]{Preliminary}}";
    TLatex* _blurb = new TLatex(_blurbx,_blurby,_blurbtext.c_str());
    _blurb->SetTextFont(132);
    _blurb->SetTextColor(1);
    _blurb->SetNDC(kTRUE);
    _blurb->SetTextAlign(11);
    _blurb->SetTextSize(0.07);
    _blurb->Draw();
    canvas->SaveAs((name+".pdf").c_str());
    canvas->Write();
}