IsoDose contours is not centred

Dear root users,
I’m trying to create an isodose contour from the attached ASCII file using the attached ROOT code.
The contour looks good ( see the attached pic), but it is not centered ( it is in the corner ).
I’m using a “0.3 cm * 4.0 cm* 4.0 cm” detector divided into 1600 voxels ( 0.3 cm * 0.1 cm* 0.1 cm for each voxel ) and the beam hits the detector in the center.

How can I replace to the center without changing the shape of the isodose contour ?
any Idea ?

Respectfully,

Morad.
Dose.out.tar.gz (10.4 KB)



contours-yz.C (1.67 KB)

{
   gStyle->SetOptStat(0);
   gStyle->SetPalette(1);
   TFile *f = new TFile("final.root","RECREATE");

   int ncontours = 20;
   int rr=40;        // Set the range of x, y and z data -rr to rr
   int nbins=(2*rr)+1;
   int nbins3dmax = 81;
   int r1=0, r2=rr;

   TH2D* hyz = new TH2D("hyz","YZ-Total",nbins,0.,r2,nbins,0.,r2);
   
   ifstream in;
   in.open("Dose.out");
   int x,y,z;
   double total;
   double yz[nbins][nbins];
   
   int nlines=0;
   for (Int_t i=r1;i<=r2;i++) {
     for (Int_t j=r1;j<=r2;j++) {
          yz[i][j]=0.;
      }
   }


   while (!in.eof()) {
      in >>x>>y>>z>>total;
      if (y>=r1&&y<=r2&&z>=r1&&z<=r2) yz[y][z]+=total;
      nlines+=1;
   }
   in.close();

   int d = rr/2;
   for (Int_t i=r1;i<=r2;i++) {
     for (Int_t j=r1;j<=r2;j++) {
        hyz->SetBinContent(i+d,j+d,yz[i][j]);
      }
   }
   

   TCanvas* cont1 = new TCanvas("contours","contours",100,100,800,800);
   cont1->SetGrid();
   gPad->SetGrid();
   hyz->SetContour(ncontours);
   hyz->Draw("contz");
   f->Write();
}

Perfect !

so many thanks.

Cheers.
Morad.