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] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

  1 {
  2 // Read reference data in granero.txt
  3 FILE *fg1=fopen("granero.txt", "r");
  4 Int_t n_points_granero =13;
  5 Float_t x1[n_points_granero], y1[n_points_granero];
  6 Float_t x, y;
  7 Int_t ncols_granero;
  8 Int_t nlines1 =0;
  9 
 10 while(1)
 11  {
 12   ncols_granero = fscanf(fg1,"%f %f",&x, &y);
 13   if (ncols_granero<0) break;
 14  // std::cout << "x " << x << std::endl;
 15   x1[nlines1]=x;
 16   y1[nlines1]=y;
 17   nlines1++;
 18 }
 19 
 20 fclose(fg1);
 21 
 22 // Read the results of the brachytherapy advanced example
 23 // FlexiSorceMacro.mac with 280 M events
 24 FILE *fg2=fopen("geant4.txt", "r");
 25 Int_t n_points_geant4 =398;
 26 Float_t x2[n_points_geant4], y2[n_points_geant4];
 27 Int_t ncols_geant4;
 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  // std::cout << "x " << x << std::endl;
 35   x2[nlines2]=x;
 36   y2[nlines2]=y;
 37   nlines2++;
 38 }
 39 
 40 fclose(fg2);
 41 
 42 TGraph *gr1 = new TGraph (nlines1, x1, y1);
 43 TGraph *gr2 = new TGraph (nlines2, x2, y2);
 44 
 45 TCanvas *c1 = new TCanvas("c1","Graph Draw Options",
 46                              200,10,600,400);
 47 
 48 gPad->SetLogy();
 49 
 50 // draw the graph with axis, continuous line, and put
 51 // a * at each point
 52 gr1->SetTitle("Dose rate distribution");
 53 gr1-> GetXaxis()->SetTitle("Distance from the centre (cm)");
 54 gr1->GetYaxis()->SetTitle("Normalised dose rate distribution");
 55 gr1->SetLineWidth(1);
 56 gr1->SetMarkerColor(1);
 57 gr1->SetMarkerStyle(20);
 58 gr1->Draw("AP");
 59 
 60 gr2->SetLineWidth(1);
 61 gr2->SetMarkerColor(2);
 62 gr2->SetMarkerStyle(21);
 63 gr2->SetMarkerSize(0.5);
 64 gr2->SetLineColor(2);
 65 gr2->Draw("CP");
 66 
 67 TLegend *leg = new TLegend(0.3, 0.5, 0.6, 0.8);
 68 leg->SetFillColor(0);
 69 leg->AddEntry(gr1, "Reference data", "lp");
 70 leg->AddEntry(gr2, "Geant4 - 280 M events", "lp");
 71 leg->Draw();
 72 
 73 
 74 }
 75