EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
test_style.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file test_style.C
1 //
2 {
3  TCanvas c;
4  TH1F h1("h1","H1;Mass [GeV];Counts [/ GeV];",20,0,20);
5  TH1F h2("h2","H2;Mass [GeV];Counts [/ GeV];",20,0,20);
6  for (int i = 0;i<1000;i++){h1.Fill(gRandom->Gaus(7,2));}
7  for (int i = 0;i<1000;i++){h1.Fill(gRandom->Exp(.5)*20);}
8  for (int i = 0;i<1000;i++){h2.Fill(gRandom->Exp(.5)*20);}
9  h1.Draw("e1");
10  h2.Draw("same");
11  h2.SetFillColor(5);
12  h1.Draw("e1same");
13 
14  TLegend leg(.55,.70,.85,.93);
15  leg.AddEntry("","#it{#bf{sPHENIX}} Simulation","");
16  leg.AddEntry("","Au+Au #sqrt{s_{NN}}=200 GeV","");
17  leg.AddEntry(&h1,"Data","LP");
18  leg.AddEntry(&h2,"MC","F");
19  leg.Draw();
20  c.RedrawAxis();
21  c.Print("test_style.pdf");
22  c.Print("test_style.png");
23 
24  TCanvas c2;
25  c2.SetRightMargin(.2);
26  TF2 f2("f2","exp(-x/5)*sin(y)",-5,5,-5,5);
27  //f2.SetContour(100);
28  f2.SetNpx(100);
29  f2.SetNpy(100);
30  f2.Draw("surf2z");
31  f2.GetXaxis()->SetTitle("X");
32  f2.GetYaxis()->SetTitle("Y");
33  f2.GetZaxis()->SetTitle("Z");
34  c2.Print("test_style_f2.pdf");
35  c2.Print("test_style_f2.png");
36 }