RE: TPaveStats and Divide

From: Manuel Mussini <Manuel.Mussini_at_bo.infn.it>
Date: Sat, 19 Apr 2008 16:55:56 -0600


Great! It works!

Thanks!

Bye...

> -----Original Message-----
> From: owner-roottalk_at_lxbuild091.cern.ch [mailto:owner-
> roottalk_at_lxbuild091.cern.ch] On Behalf Of Rene Brun
> Sent: Saturday, April 19, 2008 14:48
> To: Manuel Mussini
> Cc: roottalk_at_lxbuild091.cern.ch
> Subject: Re: [ROOT] TPaveStats and Divide
>
> Do:
>
> fMCVerticesCanvas = new TCanvas("MCVerticesCanvas", "MC Vertices", 0, 0,
> 1100, 1100);
>
> fMCVerticesCanvas->Divide(2, 2);
>
> fMCVerticesCanvas->cd(1);
>
> fMCVerticesCanvas->cd(1)->SetLogy();
>
> fVerticesClass->Draw();
>
> fMCVerticesCanvas->Update();
> ((TPaveStats
> *)fVerticesClass->GetListOfFunctions()->FindObject("stats"))-
> >SetOptStat(1111);
>
>
>
> Rene
>
>
>
> Manuel Mussini wrote:
> >
> > Hi,
> >
> > I have a script that:
> >
> > - sets a global style using gStyle->SetOptStat(11)
> >
> > - opens a root file
> >
> > - gets some TH1D
> >
> > - creates a canvas
> >
> > - divides the canvas in 4 (2x2)
> >
> > - draws a histo in each subcanvas
> >
> > - saves the canvas in a eps file
> >
> > Now the problem! How to change the OptStat options only for the first
> > histo?
> >
> > I've searched for it on the web site but this solution doesn't fix the
> > problem in my script:
> >
> > fMCVerticesCanvas = new TCanvas("MCVerticesCanvas", "MC Vertices", 0,
> > 0, 1100, 1100);
> >
> > fMCVerticesCanvas->Divide(2, 2);
> >
> > fMCVerticesCanvas->cd(1);
> >
> > fMCVerticesCanvas->cd(1)->SetLogy();
> >
> > fVerticesClass->Draw();
> >
> > ((TPaveStats
> > *)fVerticesClass->GetListOfFunctions()->FindObject("stats"))-
> >SetOptStat(1111);
> >
> > The tricky point is that if I try this interactively it works!!!
> >
> > Running from the script I get:
> >
> > Error: illegal pointer to class object
> > (TPaveStats*)fVerticesClass->GetListOfFunctions()->FindObject("stats")
> > 0x0 638 C:\root\ManuC\THeavyFlavoursAllPlots.C(198)
> >
> > I'm running 5.17.02 on WinXP!
> >
> > Bye.
> >
Received on Sat Apr 19 2008 - 23:56:39 CEST

This archive was generated by hypermail 2.2.0 : Sun Apr 20 2008 - 11:50:02 CEST