Re: your mail

Otto Schaile (Otto.Schaile@Physik.uni-muenchen.de)
Thu, 18 Jun 1998 12:37:50 +0200 (MET DST)


Hi Stas,
you have to find the Pad by name, see modified code (+++++) below.
(see Roottalk: Re: TCanvas::Divide, Wed, 04 Jun 1997 08:22:58 +0200)

Otto
-----------
On Thu, 18 Jun 1998, Stas Tereshenko wrote:

> Hello Rooters.
> I'd like to draw 12 histograms from Ntuple on 12 different pads. Ntuple
> was created by: TNtuple *ntuple = new TNtuple("ntuple","ADC data",
> "data[0]:data[1]:data[2]:data[3]:data[4]:data[5]:data[6]:data[7]:data[8]:data[9]:data[10]:data[11]");
>
> That's I do:
>
> {
> gROOT->Reset();
> int i;
> TCanvas *c = new TCanvas("c","canvas");
> c->Divide(3,4);
>
> TFile *f = new TFile("q.root");
> f->Print();
> ntuple->Print();
>
> char dtstr[100];
char padname[10]; // <++++++++
> for(i=0;i<12;i++) {
// +++++
sprintf(padname,"page_%d",i+1);
TPad *pad = (TPad*)page->GetPrimitive(padname);
pad->cd();
> // c->cd(i);
// ++++++
> sprintf(dtstr,"data[%d]",i);
> ntuple->Draw(dtstr);
> }
> c->Update();
> }
>
> All 12 histograms are drawn "on the same place" i.e. on main 'c'
> canvas.
> What do I wrong?
> Thakns.
> Stas.
>
> ------------------------------------------------------------------------------
> Stanislav Tereshenko
> Institute for High Energy Physics Protvino, Russia
> Multi-Muon Spectrometer Department
> e-mail: tereshenko@mx.ihep.su
> sutasu@oea.ihep.su
> sutasu@afsmail.cern.ch
> ------------------------------------------------------------------------------
>
>
>
>

----------------------------------------------------------------------------
Otto Schaile Sektion Physik der LMU Muenchen
Phone: (+49 89)289 14070 Am Coulombwall 1, D-85748 Garching, Germany
FAX: (+49 89)289 14072 EMail: Otto.Schaile@Physik.Uni-Muenchen.DE