Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
egs.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.msc93.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(kBlack);
13  h1->Draw("HIST");
14 
15  TFile f2("./Ta.1000keV.local.root");
16  TH1D* h2 = (TH1D*) f2.Get("8");
17  h2->SetStats(kFALSE); // Eliminate statistics box
18  h2->SetLineColor(kBlue);
19  h2->Draw("SAME HIST");
20 
21 /* EGSnrc
22 * Yann Perrot
23 */
24 
25  ifstream in;
26  in.open("./EGSnrc/Ta_1000keV_EGSnrc.ascii");
27 
28  TMarker *pt;
30  // First indicate number of data
31  int nbdata = 0;
32  in >> nbdata;
33  for ( int i = 0 ; i < nbdata ; i++ ) {
34  in >> x >> y ;
35  if (!in.good()) break;
36  pt = new TMarker(x,y,22); // 22 for triangle TMatker
37  pt->SetMarkerColor(kRed);
38  pt->Draw();
39  }
40  in.close();
41 
42  // Print the histograms legend
43  TLegend* legend = new TLegend(0.6,0.5,0.8,0.70);
44  legend->AddEntry(h1,"Urban93 ","l");
45  legend->AddEntry(h2,"Urban95 ","l");
46  legend->AddEntry(pt,"EGSnrc","P");
47  legend->Draw();
48 }