Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:17:16

0001 // ROOT macro file for plotting example B4 ntuple
0002 //
0003 // Can be run from ROOT session:
0004 // root[0] .x plotNtuple.C
0005 
0006 {
0007   gROOT->Reset();
0008   gROOT->SetStyle("Plain");
0009 
0010   // Draw histos filled by Geant4 simulation
0011   //
0012 
0013   // Open file filled by Geant4 simulation
0014   TFile f("B4.root");
0015 
0016   // Create a canvas and divide it into 2x2 pads
0017   TCanvas* c1 = new TCanvas("c1", "", 20, 20, 1000, 1000);
0018   c1->Divide(2,2);
0019 
0020   // Get ntuple
0021   TNtuple* ntuple = (TNtuple*)f.Get("B4");
0022 
0023   // Draw Eabs histogram in the pad 1
0024   c1->cd(1);
0025   ntuple->Draw("Eabs");
0026 
0027   // Draw Labs histogram in the pad 2
0028   c1->cd(2);
0029   ntuple->Draw("Labs");
0030 
0031   // Draw Egap histogram in the pad 
0032   c1->cd(3);
0033   //set logarithmic scale for y
0034   //gPad->SetLogy(1);
0035   ntuple->Draw("Egap");
0036 
0037   // Draw Lgap histogram in the pad 4
0038   c1->cd(4);
0039   //set logarithmic scale for y
0040   //gPad->SetLogy(1); 
0041   ntuple->Draw("Lgap");
0042 }