Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
sandia.C
Go to the documentation of this file.
1 
2 {
3  gROOT->Reset();
4 
5  // Draw histograms fill by Geant4 TestEm11 simulation
6  TFile f1("./Ta.1000keV.opt0.root");
7  TH1D* h1 = (TH1D*) f1.Get("8");
8  h1->SetTitle("Depth dose distribution of 1000 keV e- in Ta");
9  h1->GetXaxis()->SetTitle("Edep (Mev.cm2/g) along x/r0 x/r0");
10  h1->GetYaxis()->SetTitle("MeV*cm2/g");
11  h1->SetStats(kFALSE); // Eliminate statistics box
12  h1->SetLineColor(4); // blue
13  h1->Draw("HIST");
14 
15  TFile f2("./Ta.1000keV.opt2.root");
16  TH1D* h2 = (TH1D*) f2.Get("8");
17  h2->SetStats(kFALSE); // Eliminate statistics box
18  h2->SetLineColor(3); // green
19  h2->Draw("SAME HIST");
20 /* data
21 * G.J.Lockwood et al.
22 * Sandia report SAND79-0414.UC-34a, February 1987
23 * O.Kadri et al. NIM B 258 (2007) 381
24 */
25 
26  ifstream in;
27  in.open("./data/Ta_1000keV.ascii");
28 
29  TMarker *pt;
31  // First indicate number of data
32  int nbdata = 0;
33  in >> nbdata;
34  for ( int i = 0 ; i < nbdata ; i++ ) {
35  in >> x >> y ;
36  if (!in.good()) break;
37  pt = new TMarker(x,y,22); // 22 for triangle TMatker
38  pt->SetMarkerColor(kRed);
39  pt->Draw();
40  }
41  in.close();
42 
43  // Print the histograms legend
44  TLegend* legend = new TLegend(0.6,0.55,0.8,0.68);
45  legend->AddEntry(h1,"ref10-opt0 ","l");
46  legend->AddEntry(h2,"ref10-opt2 ","l");
47  legend->AddEntry(pt,"Sandia data","P");
48  legend->Draw();
49 }