RE: TF3::GetHistogram() seg violation

From: Serhiy Senyukov <Serhiy.Senyukov_at_cern.ch>
Date: Wed, 30 Mar 2011 11:53:09 +0000


Hi Oliver,

> The TF3 constructor had a wrong number of parameter.
> GetHistogram works after a Draw()

> Try:

> TF3* test_f3=new TF3("test_f3",test,0,10,0,10,0,10,2);
> test_f3->SetParameters(1,2);
> test_f3->SetNpx(nPoints);
> test_f3->SetNpy(nPoints);
> test_f3->SetNpz(nPoints);

> cout<<"Test function3 test = "<<test_f3->Eval(5,5,5)<<endl;

> test_f3->Draw();
> TH3F* test3_hist=(TH3F*)test_f3->GetHistogram();
I tried your solution. There are 2 issues however. 1) Execution of the Draw() gives me a series of error messages:

Error in <TView3D::ResetView>: Error in min-max scope
Error in <TView3D::ResetView>: Error in min-max scope
Error in <TView3D::ResetView>: Error in min-max scope
Error in <TView3D::SetRange>: problem setting view
Error in <TView3D::ResetView>: Error in min-max scope

2) Second issue is more critical.
I check the content of the created histogram. It should be 100 for every cell by construction. It is indeed so in 2D case. test2_hist->GetBinContent(1,1) returns 100. Contrary in 3D case test3_hist->GetBinContent(1,1,1) returns always 0.

Regards,
Serhiy. Received on Wed Mar 30 2011 - 13:53:15 CEST

This archive was generated by hypermail 2.2.0 : Wed Mar 30 2011 - 17:50:01 CEST