File indexing completed on 2025-02-23 09:19:27
0001 {
0002
0003 FILE *fg1=fopen("granero.txt", "r");
0004 Int_t n_points_granero =13;
0005 Float_t x1[n_points_granero], y1[n_points_granero];
0006 Float_t x, y;
0007 Int_t ncols_granero;
0008 Int_t nlines1 =0;
0009
0010 while(1)
0011 {
0012 ncols_granero = fscanf(fg1,"%f %f",&x, &y);
0013 if (ncols_granero<0) break;
0014
0015 x1[nlines1]=x;
0016 y1[nlines1]=y;
0017 nlines1++;
0018 }
0019
0020 fclose(fg1);
0021
0022
0023
0024 FILE *fg2=fopen("geant4.txt", "r");
0025 Int_t n_points_geant4 =398;
0026 Float_t x2[n_points_geant4], y2[n_points_geant4];
0027 Int_t ncols_geant4;
0028 Int_t nlines2 =0;
0029
0030 while(1)
0031 {
0032 ncols_geant4 = fscanf(fg2,"%f %f",&x, &y);
0033 if (ncols_geant4<0) break;
0034
0035 x2[nlines2]=x;
0036 y2[nlines2]=y;
0037 nlines2++;
0038 }
0039
0040 fclose(fg2);
0041
0042 TGraph *gr1 = new TGraph (nlines1, x1, y1);
0043 TGraph *gr2 = new TGraph (nlines2, x2, y2);
0044
0045 TCanvas *c1 = new TCanvas("c1","Graph Draw Options",
0046 200,10,600,400);
0047
0048 gPad->SetLogy();
0049
0050
0051
0052 gr1->SetTitle("Dose rate distribution");
0053 gr1-> GetXaxis()->SetTitle("Distance from the centre (cm)");
0054 gr1->GetYaxis()->SetTitle("Normalised dose rate distribution");
0055 gr1->SetLineWidth(1);
0056 gr1->SetMarkerColor(1);
0057 gr1->SetMarkerStyle(20);
0058 gr1->Draw("AP");
0059
0060 gr2->SetLineWidth(1);
0061 gr2->SetMarkerColor(2);
0062 gr2->SetMarkerStyle(21);
0063 gr2->SetMarkerSize(0.5);
0064 gr2->SetLineColor(2);
0065 gr2->Draw("CP");
0066
0067 TLegend *leg = new TLegend(0.3, 0.5, 0.6, 0.8);
0068 leg->SetFillColor(0);
0069 leg->AddEntry(gr1, "Reference data", "lp");
0070 leg->AddEntry(gr2, "Geant4 - 280 M events", "lp");
0071 leg->Draw();
0072
0073
0074 }