TF3::GetHistogram() seg violation

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


Hi,

I have a problem creating 3D histogram from 3D function.

I put the essential code that reproduce the bug below.
#include <TF2.h>
#include <TF3.h>
#include <TH2.h>
#include <TH3.h>

Double_t test(Double_t *x, Double_t *par) {

        return 100;
}

void bugtest(Int_t nPoints=5){

	TF2* test_f2=new TF2("test_f2",test,0,10,0,10,2);
	test_f2->SetParameters(1,2);
	test_f2->SetNpx(nPoints);
	test_f2->SetNpy(nPoints);
	
	TF3* test_f3=new TF3("test_f3",test,0,10,0,10,2);
	test_f3->SetParameters(1,2);
	test_f3->SetNpx(nPoints);
	test_f3->SetNpy(nPoints);
	test_f3->SetNpz(nPoints);
	
	cout<<"Test function2 test = "<<test_f2->Eval(5,5)<<endl;
	cout<<"Test function3 test = "<<test_f3->Eval(5,5,5)<<endl;
	
	TH2F* test2_hist=(TH2F*)test_f2->GetHistogram();
	TH3F* test3_hist=(TH3F*)test_f3->GetHistogram();
}

ROOT version is 5.26.00b

The segmentation violation appears in the last line when getting histo from TF3 object. The same operation in 2D case works well.

Any suggestions are welcome.

Regards,
Serhiy. Received on Wed Mar 30 2011 - 12:11:55 CEST

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