TF2::GetHistogram() problem

Hi all,

I have two TF2 functions let say f1 and f2,
and also I have another TF2 f3 which is fraction of f1->Eval() and f2->Eval().

It works fine when I use TF2::GetHistogram for f1 and for f2,
but it crashes, when I use it for f3.
Note that it draws f3 fine, it only crashes on f3::GetHistogram().

A simple demonstration script is attached
GetHist_test.cc (1.27 KB)

Hi again,

I succeeded to avoid this crash by
TH2D h1 = (TH2D)f1->GetHistogram->Clone(“h1”);
TH2D h2 = (TH2D)f2->GetHistogram->Clone(“h2”);
TH2D h3 = (TH2D)f3->GetHistogram->Clone(“h3”);

As I understand the address of TH1::GetHistogram
can be overwritten during the execution. Am I right?

[quote] TH1::GetHistogram
can be overwritten during the execution. Am I right?[/quote]Yes, the underlying’s histogram might be deleted/recreated depending on what you do.

Cheers,
Philippe.

Thanks!