LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
plotHisto.C
Go to the documentation of this file.
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 }
TH1D * hist2
Definition: plotHisto.C:12
TH1D * hist3
Definition: plotHisto.C:15
TFile f
Definition: plotHisto.C:6
TH1D * hist4
Definition: plotHisto.C:18
TCanvas * c1
Definition: plotHisto.C:7
TH1D * hist1
Definition: plotHisto.C:9