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.
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
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.
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.