[ROOT] Re: SetRange crash

From: Rene Brun (Rene.Brun@cern.ch)
Date: Tue Aug 08 2000 - 16:55:03 MEST


Hi Victor,
The TAxis::SetRange function expects a bin range. May be it should have been
called
TAxis::SetBinRange instead.
In your example, you are setting the bin range with SetBins. You do not need to
call TAxis::SetRange in addition. My guess is that you meant calling
TAxis::SetLimits instead of TAxis::SetRange

I have protected TAxis::SetRange in case of inconsistent parameters

Rene Brun


Victor Krylov wrote:
> 
> Hello Rene,
> 
> I have:
> ROOT Version   2.23/12   1 February 2000 for linux Radhat 6.1
> SetRange crash macro:
> {
>     gROOT->Reset();
>     gROOT->Time();
> 
>     TCanvas c1("c1","Banana Plant Items",1);
>     TPad p1("p1","p1",0.1,0.1,0.99,0.99);
>     p1.Draw();
>     p1.cd();
>     TH1F h1("h1","h1",10,0,10);
> //...
>     h1.SetBins( 10, 101, 110 );
>     h1.GetXaxis()->SetRange( 101, 110 );
> //...
>     h1.Draw();
> 
>     gROOT->Time();
> }
> root [0] .x Range.C
> Error in <TPad::Range>: illegal world coordinates range: x1=201.125000,
> y1=-13125001765323666448603752169472.000000, x2=99.875000,
> y2=118125002589728982276512847757312.000000
> Error in <TPad::RangeAxis>: illegal axis coordinates range: xmin=191.000000,
> ymin=0.000000, xmax=110.000000, ymax=105000004451182774671796619706368.000000
> 
> Fatal in <operator new>: storage exhausted
> aborting
> Aborted (core dumped)
> ///////////////
> By the way, if I change draw options or change range
> of some axis on the screen by hand and then call
> SetBins(... for a histogram that we will have unpredictable
> results of the axis range on the screen (it reason for using
> TAxis::SetRange after calling TH1::SetBins).
> Now I call TAxis::SetRange() with default parameters,
> it works...
> 
> Regards,
>     Victor
> Phobos/RHIC/BNL
> 
> Rene Brun wrote:
> 
> > Hi Victor,
> > I suppose that you mean SetRange and not SetRegion.
> > I cannot repdoduce your problem. Could you specify which version/machine
> > you use?
> > Could you send me a short macro featuring this problem?
> >
> > Rene Brun
> >
> > Victor Krylov wrote:
> > >
> > > Hello everybody,
> > >
> > > Please, check function TAxis::SetRegion()
> > > If you set wrong limits (for example not starting from zero)
> > > sometimes ROOT will be crashed after call Draw function without
> > > any notes...
> > >
> > > Debuger info:
> > > #Error in <TPad::Range>: illegal world coordinates range: x1=427.500000,
> > > y1=0.640624, x2=182.500000, y2=0.950798
> > > #Error in <TPad::RangeAxis>: illegal axis coordinates range:
> > > xmin=403.000000, ymin=0.671641, xmax=207.000000, ymax=0.919780
> > > #Fatal in <operator new>: storage exhausted
> > > #aborting...
> > >
> > > Regards,
> > >     Viktor



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:31 MET