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