ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
plotHisto.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file plotHisto.C
1 // ROOT macro file for plotting example B4 histograms
2 //
3 // Can be run from ROOT session:
4 // root[0] .x plotHisto.C
5 
6 {
7  gROOT->Reset();
8  gROOT->SetStyle("Plain");
9 
10  // Draw histos filled by Geant4 simulation
11  //
12 
13  // Open file filled by Geant4 simulation
14  TFile f("B4.root");
15 
16  // Create a canvas and divide it into 2x2 pads
17  TCanvas* c1 = new TCanvas("c1", "", 20, 20, 1000, 1000);
18  c1->Divide(2,2);
19 
20  // Draw Eabs histogram in the pad 1
21  c1->cd(1);
22  TH1D* hist1 = (TH1D*)f.Get("Eabs");
23  hist1->Draw("HIST");
24 
25  // Draw Labs histogram in the pad 2
26  c1->cd(2);
27  TH1D* hist2 = (TH1D*)f.Get("Labs");
28  hist2->Draw("HIST");
29 
30  // Draw Egap histogram in the pad 3
31  // with logaritmic scale for y
32  TH1D* hist3 = (TH1D*)f.Get("Egap");
33  c1->cd(3);
34  gPad->SetLogy(1);
35  hist3->Draw("HIST");
36 
37  // Draw Lgap histogram in the pad 4
38  // with logaritmic scale for y
39  c1->cd(4);
40  gPad->SetLogy(1);
41  TH1D* hist4 = (TH1D*)f.Get("Lgap");
42  hist4->Draw("HIST");
43 }