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