Geant4 Cross Reference |
1 // ------------------------------------------- 1 // ------------------------------------------------------------------- >> 2 // $Id$ 2 // ------------------------------------------- 3 // ------------------------------------------------------------------- 3 4 4 // This macro requires the pdb4dna_output.root 5 // This macro requires the pdb4dna_output.root file generated from PDB4DNA example 5 6 6 { 7 { 7 gROOT->Reset(); 8 gROOT->Reset(); 8 << 9 9 gStyle->SetOptStat("em"); 10 gStyle->SetOptStat("em"); 10 11 11 TCanvas *c1; 12 TCanvas *c1; 12 TPad *pad1, *pad2, *pad3; 13 TPad *pad1, *pad2, *pad3; 13 c1 = new TCanvas("c1","PDB DNA outputs",200, 14 c1 = new TCanvas("c1","PDB DNA outputs",200,10,700,780); 14 c1->SetFillColor(0); 15 c1->SetFillColor(0); 15 16 16 pad1 = new TPad("pad1","pad1",0.02,0.52,0.98 17 pad1 = new TPad("pad1","pad1",0.02,0.52,0.98,0.98,21); 17 pad2 = new TPad("pad2","pad2",0.02,0.02,0.48 18 pad2 = new TPad("pad2","pad2",0.02,0.02,0.48,0.48,21); 18 pad3 = new TPad("pad3","pad3",0.52,0.02,0.98 19 pad3 = new TPad("pad3","pad3",0.52,0.02,0.98,0.48,21); 19 20 20 pad1->SetFillColor(0); 21 pad1->SetFillColor(0); 21 pad1->Draw(); 22 pad1->Draw(); 22 pad2->SetFillColor(0); 23 pad2->SetFillColor(0); 23 pad2->Draw(); 24 pad2->Draw(); 24 pad3->SetFillColor(0); 25 pad3->SetFillColor(0); 25 pad3->Draw(); 26 pad3->Draw(); 26 27 27 28 28 TFile f("pdb4dna_output.root"); << 29 TFile f = TFile("pdb4dna_output.root"); 29 30 30 // Draw histograms 31 // Draw histograms 31 32 32 TH1D* hist1 = (TH1D*)f.Get("1"); 33 TH1D* hist1 = (TH1D*)f.Get("1"); 33 pad1->cd(); 34 pad1->cd(); 34 hist1->Draw("HIST"); 35 hist1->Draw("HIST"); 35 36 36 TH1D* hist2 = (TH1D*)f.Get("2"); 37 TH1D* hist2 = (TH1D*)f.Get("2"); 37 pad2->cd(); 38 pad2->cd(); 38 hist2->Draw("HIST"); 39 hist2->Draw("HIST"); 39 40 40 TH1D* hist3 = (TH1D*)f.Get("3"); 41 TH1D* hist3 = (TH1D*)f.Get("3"); 41 pad3->cd(); 42 pad3->cd(); 42 hist3->Draw("HIST"); 43 hist3->Draw("HIST"); 43 44 44 c1->Modified(); 45 c1->Modified(); 45 c1->Update(); 46 c1->Update(); 46 47 47 48 48 // Read stats to get global quantities 49 // Read stats to get global quantities 49 50 50 double* pdbStats=new double[4]; 51 double* pdbStats=new double[4]; 51 52 52 hist1->GetStats(pdbStats); << 53 hist1.GetStats(pdbStats); 53 cout << "-> Edep in the target : " << pdbSta 54 cout << "-> Edep in the target : " << pdbStats[2]/1E6 << " MeV" << endl; 54 55 55 hist2->GetStats(pdbStats); << 56 hist2.GetStats(pdbStats); 56 cout << "-> Number of SSB : " << pdbStats[2] 57 cout << "-> Number of SSB : " << pdbStats[2] << endl; 57 58 58 hist3->GetStats(pdbStats); << 59 hist3.GetStats(pdbStats); 59 cout << "-> Number of DSB : " << pdbStats[2] 60 cout << "-> Number of DSB : " << pdbStats[2] << endl; 60 } 61 } 61 62