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