Geant4 Cross Reference |
1 1 2 { 2 { 3 gROOT->Reset(); 3 gROOT->Reset(); 4 4 5 // Draw histogram fill by Geant4 TestBruce 5 // Draw histogram fill by Geant4 TestBruce simulation 6 TFile f("./Au3.local.root"); 6 TFile f("./Au3.local.root"); 7 TH1D* h1d = (TH1D*) f.Get("4"); 7 TH1D* h1d = (TH1D*) f.Get("4"); 8 h1d->SetTitle("Fluence distribution of 13 M 8 h1d->SetTitle("Fluence distribution of 13 MeV e- in Au (93.7 mg/cm2)"); 9 h1d->GetXaxis()->SetTitle("r (mm)"); 9 h1d->GetXaxis()->SetTitle("r (mm)"); 10 h1d->GetYaxis()->SetTitle("Fluence"); 10 h1d->GetYaxis()->SetTitle("Fluence"); 11 h1d->SetStats(kFALSE); // Eliminate statis 11 h1d->SetStats(kFALSE); // Eliminate statistics box 12 h1d->Draw("HIST"); 12 h1d->Draw("HIST"); 13 13 14 /* data 14 /* data 15 * Bruce et al. 15 * Bruce et al. 16 */ 16 */ 17 17 18 ifstream in; 18 ifstream in; 19 in.open("../data/Au3.13MeV.ascii"); 19 in.open("../data/Au3.13MeV.ascii"); 20 20 21 TMarker *pt; 21 TMarker *pt; 22 Double_t x, y; 22 Double_t x, y; 23 // First indicate number of data 23 // First indicate number of data 24 int nbdata = 0; 24 int nbdata = 0; 25 in >> nbdata; 25 in >> nbdata; 26 for ( int i = 0 ; i < nbdata ; i++ ) { 26 for ( int i = 0 ; i < nbdata ; i++ ) { 27 in >> x >> y ; 27 in >> x >> y ; 28 if (!in.good()) break; 28 if (!in.good()) break; 29 pt = new TMarker(x,y,22); // 22 for tria 29 pt = new TMarker(x,y,22); // 22 for triangle TMatker 30 pt->SetMarkerColor(kRed); 30 pt->SetMarkerColor(kRed); 31 pt->Draw(); 31 pt->Draw(); 32 } 32 } 33 in.close(); 33 in.close(); 34 34 35 // Print the histograms legend 35 // Print the histograms legend 36 TLegend* legend = new TLegend(0.6,0.55,0.8, 36 TLegend* legend = new TLegend(0.6,0.55,0.8,0.68); 37 legend->AddEntry(h1d,"msc95","l"); 37 legend->AddEntry(h1d,"msc95","l"); 38 legend->AddEntry(pt,"Faddegon data","P"); 38 legend->AddEntry(pt,"Faddegon data","P"); 39 legend->Draw(); 39 legend->Draw(); 40 } 40 } 41 41