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’.
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
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) :
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.
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).
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
}
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).