Crash when drawing a TH2F, but not if colz is specified

Hello !

I have encountered a strange thing. In an application modules create objects (histo usually) and publish them, while clients retrieve and display them. There is 1 object that makes the client crashes when drawing it. I have saved the object in a file that I attach to this thread.
What is weird is that the object can be drawn if we use ‘colz’.

Here is an example :

TFile f("test.root")
TIter nextkey(f.GetListOfKeys());
TKey *key = (TKey*)nextkey()
TObject *obj = key->ReadObj();
TH2F* h2 = dynamic_cast<TH2F*>(obj)
h2->Draw("colz");  // --> fine
h2->Draw(); // --> crash

Moreover, if we zoom on the y axis, it is ok :

TFile f("test.root")
TIter nextkey(f.GetListOfKeys());
TKey *key = (TKey*)nextkey()
TObject *obj = key->ReadObj();
TH2F* h2 = dynamic_cast<TH2F*>(obj)
h2->Draw("colz");  // --> fine
// Here zoom on the bottom of the Y axis
h2->Draw(); // --> fine
// Unzoom --> still fine

Any idea what i am doing wrong here ?

Thanks,
Barth
test.root (9.75 KB)

I cannot reproduce your problem. Which version and OS are you using?

Rene

Hello,

I am using ROOT 5.26.00b with SLC4

[pcald02] /home/bvonhall > uname -a
Linux pcald02 2.6.9-89.0.26.EL.cernsmp #1 SMP Wed Jun 16 16:46:13 CEST 2010 i686 i686 i386 GNU/Linux

Cheers,
Barth

Could you post a complete short script reproducing the problem ?

Rene

Well, the code that generates the object stored in the file is not mine. I have no easy way of extracting this. But what I can say is that the problem can be reproduced on lxplus machines (SLC5/64) :

  1. connect to lxplus
  2. get the test.root file attached to the first post
  3. start ROOT
  4. Type in :
TFile f("test.root")
TIter nextkey(f.GetListOfKeys());
TKey *key = (TKey*)nextkey()
TObject *obj = key->ReadObj();
TH2F* h2 = dynamic_cast<TH2F*>(obj)
h2->Draw("colz");  // --> fine
h2->Draw(); // --> crash

I don’t know what to provide in addition.

Best regards,
Barth

I can reproduce the problem on lxplus. Olivier will investigate.

Rene

I am investigating. I found that it crashes in THistPainter on the line 7673 (nothing new) which is:

     if (obj->InheritsFrom(TF1::Class())) {

I also found that it crashes only when I execute the macro putting the macro name as argument to the root command:

root test.C

If I start root and then execute the macro, it works correctly. Also , adding the Z option to the Draw() command makes it work (but you saw that already).

I continue to investigate. I have not yet understood what goes work.

Hi,

If you need information about the context in which the object was created and the code used, don’t hesitate to contact me (or for any other information that might help).

Cheers,
Barth

Yes please, if the procedure to create the faulty histogram is not too complex I would like to have it (a macro ?).

I have found where the problem comes from, but I do not have a fix yet.
In THistPainter::PaintTable there is code similar to the following macro.
That causes the problem. But the problem shows up with your histogram only.
I have tried with other histograms and it is fine.

{
   TFile f("test.root");
   TH2F *h2 = (TH2F*)f.Get("Default_H2D_ChargeEoI");

   TList *l = h2->GetListOfFunctions();
   l->ls();
   printf("\n");
   delete l->FindObject("palette");
   l->ls();  // this line provokes the crash 
}

Investigations are going on …

Hi,

Thank you for the investigation.
I will try to extract the code that create this histo. However, I develop a framework and the code that makes the histo is in a plugin, developed by a sub-detector team outside CERN. Thus it will take some time for me to extract it (I will contact the author).

Cheers,
Barth

Thanks for reporting this problem. the cause is now understood and fixed in the SVN trunk.

Rene

Great !

Thank you for the very quick fix.

Barth