[ROOT] Question about my macro

From: Tobias Rustige (t.rustige@fz-juelich.de)
Date: Wed May 29 2002 - 14:41:58 MEST


Dear rooters,

I wrote the following macro:

{
   gROOT->Reset();
   TCanvas c1("c1","multipads",500,500);
   gStyle->SetPadBorderMode(0);
   gStyle->SetOptStat(0);
   c1.Divide(2,2,0,0);
   TH2F h1("h1","test1",100,-10,10,180,0,180);
   TH2F h2("h2","test3",50,-5,5,180,0,180);
   TH2F h3("h3","test4",10000,-10,10,1800,0,180);
   
   ifstream in;
   in.open("basic.dat", ios::in);

   Float_t x,y,z;
   Int_t nlines = 0;
   
   while (1) {
      in >> x >> y ;
      if (!in.good()) break;
      h1->Fill(x,y);
      h2->Fill(x,y);
      h3->Fill(x,y);
      
      nlines++;
   }
   printf(" found %d points\n",nlines);

   in.close();

   c1.cd(1);
   gPad->SetBottomMargin(0);
   gPad->SetRightMargin(0);
   gPad->SetTickx(2);
   h1->SetOption("lego");
   h1.Draw();

   c1.cd(2);
   gPad->SetLeftMargin(0);
   gPad->SetBottomMargin(0);
   gPad->SetTickx(2);
   gPad->SetTicky(2);
   h1.GetYaxis()->SetLabelOffset(0.01);
   h1->SetOption("surf3");
   h1.Draw();
   
   c1.cd(3);
   gPad->SetTopMargin(0);
   gPad->SetRightMargin(0);
   h2->SetOption("scat");
   h2.Draw();

   c1.cd(4);
   gPad->SetLeftMargin(0);
   gPad->SetTopMargin(0);
   gPad->SetTicky(2);
   h2->SetOption("surf3");
   h2.Draw();
}      



There, as you can see , are several plotting options, intended to get printout with two different types of plottingts in every line based on the values in the data basic.dat, which contains the raw data of a sinogram. But if you look what happens in root , it is the following:




So you see, although I sayd that ar least two pictures should be a scatter plot, always the same type of plotting appears.

I do not understand this, where is my mistake ??

Please heeelp me.


And how can I create between those pads of a canvas a little distance, that it looks more nice.

Thanks for your commands


With my best regards 

Tobias Rustige
























This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:54 MET