LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
plotNtuple.C
Go to the documentation of this file.
1 // ROOT macro file for plotting example B4 ntuple
2 //
3 // Can be run from ROOT session:
4 // root[0] .x plotNtuple.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  // Get ntuple
21  TNtuple* ntuple = (TNtuple*)f.Get("B4");
22 
23  // Draw Eabs histogram in the pad 1
24  c1->cd(1);
25  ntuple->Draw("Eabs");
26 
27  // Draw Labs histogram in the pad 2
28  c1->cd(2);
29  ntuple->Draw("Labs");
30 
31  // Draw Egap histogram in the pad 3
32  // with logaritmic scale for y ?? how to do this?
33  c1->cd(3);
34  gPad->SetLogy(1);
35  ntuple->Draw("Egap");
36 
37  // Draw Lgap histogram in the pad 4
38  // with logaritmic scale for y ?? how to do this?
39  c1->cd(4);
40  gPad->SetLogy(1);
41  ntuple->Draw("Egap");
42 }
TNtuple * ntuple
Definition: plotNtuple.C:21
TCanvas * c1
Definition: plotNtuple.C:17
TFile f("B4.root")