Geant4 Cross Reference |
1 // ROOT macro file for plotting example B4 his 1 // ROOT macro file for plotting example B4 histograms 2 // 2 // 3 // Can be run from ROOT session: 3 // Can be run from ROOT session: 4 // root[0] .x plotHisto.C 4 // root[0] .x plotHisto.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 // Draw Eabs histogram in the pad 1 20 // Draw Eabs histogram in the pad 1 21 c1->cd(1); 21 c1->cd(1); 22 TH1D* hist1 = (TH1D*)f.Get("Eabs"); 22 TH1D* hist1 = (TH1D*)f.Get("Eabs"); 23 hist1->Draw("HIST"); 23 hist1->Draw("HIST"); 24 24 25 // Draw Labs histogram in the pad 2 25 // Draw Labs histogram in the pad 2 26 c1->cd(2); 26 c1->cd(2); 27 TH1D* hist2 = (TH1D*)f.Get("Labs"); 27 TH1D* hist2 = (TH1D*)f.Get("Labs"); 28 hist2->Draw("HIST"); 28 hist2->Draw("HIST"); 29 29 30 // Draw Egap histogram in the pad 3 30 // Draw Egap histogram in the pad 3 31 31 32 TH1D* hist3 = (TH1D*)f.Get("Egap"); 32 TH1D* hist3 = (TH1D*)f.Get("Egap"); 33 c1->cd(3); 33 c1->cd(3); 34 // set logarithmic scale for y 34 // set logarithmic scale for y 35 //gPad->SetLogy(1); 35 //gPad->SetLogy(1); 36 hist3->Draw("HIST"); 36 hist3->Draw("HIST"); 37 37 38 // Draw Lgap histogram in the pad 4 38 // Draw Lgap histogram in the pad 4 39 c1->cd(4); 39 c1->cd(4); 40 // set logarithmic scale for y 40 // set logarithmic scale for y 41 //gPad->SetLogy(1); 41 //gPad->SetLogy(1); 42 TH1D* hist4 = (TH1D*)f.Get("Lgap"); 42 TH1D* hist4 = (TH1D*)f.Get("Lgap"); 43 hist4->Draw("HIST"); 43 hist4->Draw("HIST"); 44 } 44 } 45 45