Re: [ROOT] TGaxis with function

From: Tommaso Chiarusi (Tommaso.Chiarusi@bo.infn.it)
Date: Wed Mar 10 2004 - 19:02:36 MET


Ok, the algorithm is simply
fu = 90 -x[0];

But the substance of the problem does not change: with this function
the range is not modified as I wanted...


ok...
On Wed, 10 Mar 2004, Olivier Couet wrote:

> 
> 
> 
> Hi Tommaso,
> 
>  are you sure that the real algorithm is:
> 
>      if(x[0]<=90) fu = 90 - x[0];
>      else fu = 90-x[0];
> 
>  ??
> 
>  because seems to me these two lines are the same as:
> 
>  fu = 90-x[0];
> 
>  Cheers,        Olivier
> 
> 
> On Wed, 10 Mar 2004, Tommaso Chiarusi wrote:
> 
> > Hi Olivier,
> > you were right, I made a mistake, in fact the real algorithm is
> > 
> >     if(x[0]<=90) fu = 90 - x[0];
> >     else fu = 90-x[0]; 
> > 
> > and not 
> >     else fu = x[0]-270; 
> > 
> > Well yesterday I fused...:) 
> > 
> > 
> > buy the way the devicing fact is that, neither with the 
> > correct algorithm, the labels on to  the plot are not modified 
> > accordingly!!!
> > In fact I get simply 
> > 180 160 140 120 100 80 60 40 20 0
> > 
> > Moreover, if in the function you set:
> >       fu = x[0]*2;
> > 
> > just for trying, you get no effect on the range.
> > 
> > may be I didn't well understand how TGaxis works with a function.
> > 
> > any suggestion?
> > Thank you.
> > Tommaso
> > 
> > On Wed, 10 Mar 2004, Olivier Couet wrote:
> > 
> > > 
> > > Hi Tommaso,
> > > 
> > >  I looked closer at your examples. I agree with you that the first one 
> > > transform the following labels:
> > > 
> > > -80 -60 -40 -20  0  20  40  60  80
> > > 
> > > into:
> > > 
> > >  80  60  40  20  0 -20 -40 -60 -80
> > > 
> > > But, seems to me the 2nd example transform:
> > >  
> > >   0  20  40  60  80  100  120  140  160 180
> > > 
> > > into:
> > > 
> > >  90  70  50  30  10 -170 -150 -130 -110 -90
> > > 
> > >  Which, I guess, is not what you want. I think you did a mistake in your 
> > > 2nd example.
> > > 
> > >  Cheers,      Olivier
> > > 
> > > 
> > > On Tue, 9 Mar 2004, Tommaso Chiarusi wrote:
> > > 
> > > > 
> > > > Hello everybody:
> > > > 
> > > > OS Linux RH 9
> > > > ROOT 3.10/02  16 December 2003
> > > > 
> > > > well, I need to reset the labels onto an histogram.
> > > > It has the x axis which ranges from 0 to +180
> > > > I like it to span from +90 to -90 (yes from positive to negative
> > > > like 90 80 70..10 0 -10 ... -80 -90).
> > > > 
> > > > So decided to  
> > > > TGaxis method together with a function
> > > > 
> > > > 
> > > > So I've written the function:
> > > > 
> > > > double funz(double *x,double *par)
> > > > {
> > > >   double fu=0;
> > > >   fu = -x[0];
> > > >   return fu;
> > > > }
> > > > 
> > > > and in the body of the macro, 
> > > > 
> > > >  TF1 *f = new TF1("f",funz,-90,90,0);
> > > >  TGaxis *tga = new TGaxis(0,0,180,0,"f",510);
> > > >  tga->Draw();
> > > > 
> > > > and it works!
> > > > 
> > > > note that the spanning of the new scale is independent from the original
> > > > range.
> > > > -----
> > > > THE QUESTION:
> > > > 
> > > > Why the following doesn't give the same result?
> > > > 
> > > > I redefine the function,
> > > > 
> > > > double funz(double *x,double *par)
> > > > {
> > > >   double fu=0;
> > > >   if(x[0]<=90) fu = 90 -x[0];
> > > >   if(x[0]>90) fu = x[0]-270;
> > > > 
> > > >   return fu;
> > > > }
> > > >                                                                                                  
> > > > and in the body of the macro,
> > > >                                                                                                  
> > > >  TF1 *f = new TF1("f",funz,0,180,0);
> > > >  TGaxis *tga = new TGaxis(0,0,180,0,"f",510);
> > > >  tga->Draw();
> > > > 
> > > > note the different range for f
> > > > 
> > > > Best regards, Tommaso
> > > > 
> > > > P.S.
> > > > is this mailing list hard-contamined by spam?
> > > > is it true that it will be removed by the CERN mailing list?
> > > > 
> > > > 
> > > > 
> > > > 
> > > 
> > > 
> > 
> > 
> 
> 

-- 
-----------------------

Dr. Tommaso Chiarusi 

Dipartimento di Fisica 
Universita' di Bologna
INFN. Sez. Bologna

Tel +39.051.209.5234 
Fax +39.051.209.5269

-----------------------



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:06 MET