[ROOT] TGaxis with function

From: Tommaso Chiarusi (Tommaso.Chiarusi@bo.infn.it)
Date: Tue Mar 09 2004 - 20:31:49 MET


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?



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