LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
compare_6711.C
Go to the documentation of this file.
1 {
2 // Read reference data in dolan.txt
3 FILE * fg1=fopen("dolan.txt", "r");
4 Int_t n_points_dolan = 8;
6 Float_t x, y;
7 Int_t ncols_dolan;
8 Int_t nlines1 = 0;
9 
10 while(1)
11 {
12  ncols_dolan = fscanf(fg1, "%f %f", &x, &y);
13  if (ncols_dolan<0) break;
14  x1[nlines1]= x;
15  y1[nlines1] = y;
16  nlines1++;
17 }
18 
19 fclose(fg1);
20 
21 // Read the results of the brachyadvanced example
22 // OncuraSourceMacro.mac with 20 B events
23 
24 FILE *fg2=fopen("geant4_6711_dose.txt", "r");
25 Int_t n_points_geant4 = 398;
28 Int_t nlines2 = 0;
29 
30 while(1)
31 {
32  ncols_geant4 = fscanf(fg2, "%f %f", &x, &y);
33  if (ncols_geant4<0) break;
34  x2[nlines2] = x;
35  y2[nlines2] = y;
36  nlines2++;
37 }
38 
39 fclose(fg2);
40 
41 TGraph *gr1 = new TGraph (nlines1, x1, y1);
42 TGraph *gr2 = new TGraph (nlines2, x2, y2);
43 
44 TCanvas *c1 = new TCanvas("c1", "Graph Draw Options", 200, 10, 600, 400);
45 
46 gPad->SetLogy();
47 
48 // Draw the graph with axis, continuous line, and put a '*' at each point
49 
50 gr1->SetTitle("Dose rate distribution");
51 gr1->GetXaxis()->SetTitle("Distance from the centre (cm)");
52 gr1->GetYaxis()->SetTitle("Normalised dose rate distribution");
53 gr1->SetLineWidth(1);
54 gr1->SetMarkerColor(1);
55 gr1->SetMarkerStyle(20);
56 gr1->Draw("AP");
57 
58 gr2->SetLineWidth(1);
59 gr2->SetMarkerColor(2);
60 gr2->SetMarkerStyle(21);
61 gr2->SetMarkerSize(0.5);
62 gr2->SetLineColor(2);
63 gr2->Draw("CP");
64 
65 TLegend *leg = new TLegend(0.3, 0.5, 0.6, 0.8);
66 leg->SetFillColor(0);
67 leg->AddEntry(gr1, "Reference data", "lp");
68 leg->AddEntry(gr2, "Geant4 - 20B Events", "lp");
69 leg->Draw();
70 
71 }
72 
73 
fclose(fg1)
TGraph * gr1
Definition: compare_6711.C:41
TGraph * gr2
Definition: compare_6711.C:42
Int_t n_points_dolan
Definition: compare_6711.C:4
Int_t nlines1
Definition: compare_6711.C:8
Float_t y1[n_points_dolan]
Definition: compare_6711.C:5
Float_t y2[n_points_geant4]
Definition: compare_6711.C:26
Float_t x1[n_points_dolan]
Definition: compare_6711.C:5
TCanvas * c1
Definition: compare_6711.C:44
TLegend * leg
Definition: compare_6711.C:65
Float_t y
Definition: compare_6711.C:6
Int_t ncols_dolan
Definition: compare_6711.C:7
FILE * fg2
Definition: compare_6711.C:24
Int_t n_points_geant4
Definition: compare_6711.C:25
Float_t x2[n_points_geant4]
Definition: compare_6711.C:26
Float_t x
Definition: compare_6711.C:6
Int_t ncols_geant4
Definition: compare_6711.C:27
Int_t nlines2
Definition: compare_6711.C:28