File indexing completed on 2024-04-06 11:57:20
0001 #include "TCanvas.h"
0002 #include "TH1.h"
0003 #include "TH1D.h"
0004 #include "TLegend.h"
0005 #include "TPad.h"
0006 #include "TPaveText.h"
0007 #include "TROOT.h"
0008
0009 #include "../interface/TkAlStyle.h"
0010
0011 void testTkAlStyle() {
0012
0013 TkAlStyle::set(PRELIMINARY);
0014
0015 TCanvas* can = new TCanvas("can", "can", 500, 500);
0016 can->cd();
0017
0018
0019
0020
0021 TH1* h1 = new TH1D("h1", ";x title;y title", 100, -10, 10);
0022 h1->FillRandom("gaus", 1000);
0023 h1->SetLineColor(TkAlStyle::color(IDEALAlign));
0024 h1->SetLineStyle(TkAlStyle::style(IDEALAlign));
0025 h1->GetYaxis()->SetRangeUser(0, 110);
0026
0027 TH1* h2 = new TH1D("h2", ";x title;y title", 100, -10, 10);
0028 h2->FillRandom("gaus", 500);
0029 h2->SetLineColor(TkAlStyle::color(CRAFTAlign));
0030 h2->SetLineStyle(TkAlStyle::style(CRAFTAlign));
0031 h2->GetYaxis()->SetRangeUser(0, 110);
0032
0033 h1->Draw();
0034 h2->Draw("same");
0035
0036
0037
0038
0039 TPaveText* title = TkAlStyle::standardRightTitle(CRAFT15);
0040 title->Draw("same");
0041
0042
0043
0044
0045 TLegend* leg = TkAlStyle::legend("top left", 2, 0.6);
0046 leg->AddEntry(h1, TkAlStyle::toTString(IDEALAlign), "L");
0047 leg->AddEntry(h2, TkAlStyle::toTString(CRAFTAlign), "L");
0048 leg->Draw("same");
0049
0050 gPad->RedrawAxis();
0051 can->SaveAs("test.pdf");
0052 }
0053
0054
0055 int main(int argc, char** argv) { testTkAlStyle(); }