Hi,
I am trying to draw an histogram with a secondary axis (showing calibrated values).
I used some exemples from the tutorials. It works well when the secondary scale/axis is a linear function of the main axis. But when I try to use a non-linear one then the result is not what I expect…
Here is a test code which reproduces my problem:
[code]#include “TH1.h”
#include “Riostream.h”
#include “TF1.h”
#include “TGaxis.h”
int test(void)
{
int tmax=200;
TH1F *ht=new TH1F(“ht”,"",200,0,tmax);
ht->Fill(100,20);
ht->Draw();
TF1 *f_calib=new TF1(“f_calib”,“pol2”,0,1);
f_calib->SetParameter(0,100);
f_calib->SetParameter(1,10);
//f_calib->SetParameter(2,0.); // works well!
f_calib->SetParameter(2,1.); // does work with non linear function…
f_calib->SetRange(f_calib->Eval(0),f_calib->Eval(tmax));
TGaxis *A1 = new TGaxis(0,20,tmax,20,“f_calib”);
A1->SetTitle(“calibrated axis”);
A1->Draw();
cout << " f(0) = " << f_calib->Eval(0) << endl;
cout << " f(100) = " << f_calib->Eval(100) << endl;
cout << " f(200) = " << f_calib->Eval(200) << endl;
return(0);
}
[/code]
In this example, the central value of the secondary axis ( corresponding to for x=100) is expected to be 11110 but the tick on the secondary axis indicates a value of about 30000!
Could anyone explain me clearly how the secondary axis values are calculated from the const char* funcname argument of the constructor?
thanks
Alain