{ gROOT->Reset(); gStyle->SetOptStat(0); gStyle->SetPalette(1); // TPaveLabel pl; // Float_t x1=0.67, y1=0.875, x2=0.85, y2=0.95; 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; // TNtuple *ntuple = new TNtuple("Depos","Depos","x:y:z:depos"); TH2D hyz("hyz","YZ-Total",nbins,0.,r2,nbins,0.,r2); // hxy.SetFillColor(46); 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; if (y>=r1&&y<=r2&&z>=r1&&z<=r2) cout << nlines << " " << y << " " << z << " " << yz[y][z] <<" "<< endl; } in.close(); for (Int_t i=r1;i<=r2;i++) { for (Int_t j=r1;j<=r2;j++) { hyz->SetBinContent(i,j,yz[i][j]); // hxz->GetBinContent(i,j,xz[i][j]); } } TCanvas cont1("contours","contours",100,100,400,1200); gPad->SetGrid(); cont1.Divide(1,1); gPad->SetGrid(); // cont1.SetFillColor(1); cont1.cd(1); hyz->SetContour(ncontours); hyz->Draw("contz"); //pl.DrawPaveLabel(x1,y1,x2,y2,"X-Y plane","brNDC"); // Eshraq: Please try all other drawing options e.g. cont, surf, lego etc..... // TCanvas cont2("contours","contours",100,100,800,600); f->Write(); }