Geant4_10
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_opt3.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 /* EGSnrc
16 * Yann Perrot
17 */
18 
19  ifstream in;
20  in.open("./EGSnrc/Ta_1000keV_EGSnrc.ascii");
21 
22  TMarker *pt;
24  // First indicate number of data
25  int nbdata = 0;
26  in >> nbdata;
27  for ( int i = 0 ; i < nbdata ; i++ ) {
28  in >> x >> y ;
29  if (!in.good()) break;
30  pt = new TMarker(x,y,22); // 22 for triangle TMatker
31  pt->SetMarkerColor(kRed);
32  pt->Draw();
33  }
34  in.close();
35 
36  // Print the histograms legend
37  TLegend* legend = new TLegend(0.6,0.5,0.8,0.70);
38  legend->AddEntry(h1,"ref10 ","l");
39  legend->AddEntry(pt,"EGSnrc","P");
40  legend->Draw();
41 }
TLegend * legend
Definition: egs.C:37
int nbdata
Definition: egs.C:25
TH1F * h1
Definition: plot.C:43
ifstream in
Definition: comparison.C:7
tuple x
Definition: test.py:50
Double_t y
Definition: plot.C:279
Float_t f1
TMarker * pt
Definition: egs.C:22
G4double Double_t