TList::Draw() method do not work?

Hi,

My ROOT: ROOT 5.27/02 (trunk@33229, Apr 27 2010, 11:38:29 on win32) Debug version.

I have a TList contains some TGraph, I want to draw them with the TList::Draw(), however this method do not work. Is this normal? For the moment I used a TIter to draw all the TGraph objects in a TList.

Thank you!
Han

TList::Draw should work like all collections.
See the implementation and help in TCollection::Draw

Rene

Thanks Rene.

I checked my code, found that my problem may due to ‘type conversion’.
For this code the TList::Draw() method do not work:

TGraph *pl = (TGraph*)rf->Get("name"); //rf is a TFile
lines->Add(pl); // lines is a TList
rf->Close();
lines->Draw(); //This do not work

For this code the TList::Draw() method works:

TGraph *pl = (TGraph*)rf->Get("name"); //rf is a TFile
TGraph *tpl = new TGraph(*pl);
lines->Add(tpl); // lines is a TList
rf->Close();
lines->Draw(); //This do work

Thank you.
Han

I do not understand this problem.
Could you post a short script reproducing it?

Rene

Hi Rene,

I uploaded a simple example.
It seems that my previous explaination of the problem is not right.
Please check the cpp source I uploaded, mybe I made some stupid mistakes.

Thank you very much!
Han
listdraw.cpp (1.25 KB)
Fit_t344.root (52.6 KB)

OK the problem is understood and fixed in the SVN trunk (TCollection::Draw).
Instead of using a TList, I suggest to call TGraph::Draw directly or better use a TMultiGraph.

Rene