Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
B4d/plotNtuple.C
이 파일의 문서화 페이지로 가기
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 }
TTree * ntuple