[ROOT] problem with multipads

From: Nicolas de Sereville (deserevi@csnsm.in2p3.fr)
Date: Fri Aug 17 2001 - 10:18:58 MEST


Hi rooters,

I want to divide a canvas into 16 sub-pads and draw in each one, let's say
the same histogram. I did two different ways. The first one is something
like that :
  c1->Divide(4,4);
  c1->cd(1);
  h137->Draw();
  c1->cd(2);
  h138->Draw();
  c1->cd(3);
  h139->Draw();
  ..... and so on. It works well but it's not realy satisfaying!


The second way, I do a loop over the sub-pad with the following macro. The
only result I obtain is the graph of the last histogram drawed not in a
sub-pad but in the whole canvas!!

void nico(Int_t secteur)
{
  TFile *f = new TFile("file.root");
  TCanvas *c1 = new TCanvas("c1","c1",1000,800);
  c1->Divide(4,4);

  for(Int_t i = 0; i < 16; i++){
    Char_t h[4];
    Int_t s = secteur * 16 + 128;

    c1->cd(i);
    sprintf(h,"h%3d",s+i+1);
    TH1F *histo = (TH1F*) gFile->Get(h);
    histo->Draw();
   }
}

Can anybody tell me what is the difference between the two methods?
Thanks in advance.

Nicolas.

P.S : I am using ROOT 3.00/01 on a Sun ultra 10
-- 
:-------------------------------:
:     Nicolas DE SEREVILLE      :
:         C.S.N.S.M.            :
:        Batiment 104           :
:     91405 ORSAY Campus        :
: Tel : (+ 33) (0)1 69 15 48 57 :
: Fax : (+ 33) (0)1 69 15 50 08 :
:-------------------------------:



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:57 MET