Geant4 Cross Reference |
1 // ROOT macro file for plotting example B4 ntu 1 // ROOT macro file for plotting example B4 ntuple 2 // 2 // 3 // Can be run from ROOT session: 3 // Can be run from ROOT session: 4 // root[0] .x plotNtuple.C 4 // root[0] .x plotNtuple.C 5 5 6 { 6 { 7 gROOT->Reset(); 7 gROOT->Reset(); 8 gROOT->SetStyle("Plain"); 8 gROOT->SetStyle("Plain"); 9 9 10 // Draw histos filled by Geant4 simulation 10 // Draw histos filled by Geant4 simulation 11 // 11 // 12 12 13 // Open file filled by Geant4 simulation 13 // Open file filled by Geant4 simulation 14 TFile f("B4.root"); 14 TFile f("B4.root"); 15 15 16 // Create a canvas and divide it into 2x2 pa 16 // Create a canvas and divide it into 2x2 pads 17 TCanvas* c1 = new TCanvas("c1", "", 20, 20, 17 TCanvas* c1 = new TCanvas("c1", "", 20, 20, 1000, 1000); 18 c1->Divide(2,2); 18 c1->Divide(2,2); 19 19 20 // Get ntuple 20 // Get ntuple 21 TNtuple* ntuple = (TNtuple*)f.Get("B4"); 21 TNtuple* ntuple = (TNtuple*)f.Get("B4"); 22 22 23 // Draw Eabs histogram in the pad 1 23 // Draw Eabs histogram in the pad 1 24 c1->cd(1); 24 c1->cd(1); 25 ntuple->Draw("Eabs"); 25 ntuple->Draw("Eabs"); 26 26 27 // Draw Labs histogram in the pad 2 27 // Draw Labs histogram in the pad 2 28 c1->cd(2); 28 c1->cd(2); 29 ntuple->Draw("Labs"); 29 ntuple->Draw("Labs"); 30 30 31 // Draw Egap histogram in the pad << 31 // Draw Egap histogram in the pad 3 >> 32 // with logaritmic scale for y ?? how to do this? 32 c1->cd(3); 33 c1->cd(3); 33 //set logarithmic scale for y << 34 gPad->SetLogy(1); 34 //gPad->SetLogy(1); << 35 ntuple->Draw("Egap"); 35 ntuple->Draw("Egap"); 36 36 37 // Draw Lgap histogram in the pad 4 37 // Draw Lgap histogram in the pad 4 >> 38 // with logaritmic scale for y ?? how to do this? 38 c1->cd(4); 39 c1->cd(4); 39 //set logarithmic scale for y << 40 gPad->SetLogy(1); 40 //gPad->SetLogy(1); << 41 ntuple->Draw("Egap"); 41 ntuple->Draw("Lgap"); << 42 } 42 } 43 43