Hi Rooters,
suppose I have a file that contains a number of objects (which I cannot
really influence):
root [1] .ls
TFile** temp.root TFile* temp.root OBJ: TH2F hist0 : 0 at: 0xaa08418 KEY: TH2F hist0;1 KEY: TGraphErrors Graph;44 Graph KEY: TGraphErrors Graph;43 Graph KEY: TGraphErrors Graph;42 Graph KEY: TGraphErrors Graph;41 Graph KEY: TGraphErrors Graph;40 Graph KEY: TGraphErrors Graph;39 Graph KEY: TGraphErrors Graph;38 Graph KEY: TGraphErrors Graph;37 Graph KEY: TGraphErrors Graph;36 Graph KEY: TGraphErrors Graph;35 Graph KEY: TGraphErrors Graph;34 Graph KEY: TGraphErrors Graph;33 Graph KEY: TGraphErrors Graph;32 Graph KEY: TGraphErrors Graph;31 Graph KEY: TGraphErrors Graph;30 Graph KEY: TGraphErrors Graph;29 Graph KEY: TGraphErrors Graph;28 Graph KEY: TGraphErrors Graph;27 Graph KEY: TGraphErrors Graph;26 Graph KEY: TGraphErrors Graph;25 Graph KEY: TGraphErrors Graph;24 Graph KEY: TGraphErrors Graph;23 Graph KEY: TGraphErrors Graph;22 Graph KEY: TGraphErrors Graph;21 Graph KEY: TGraphErrors Graph;20 Graph KEY: TGraphErrors Graph;19 Graph KEY: TGraphErrors Graph;18 Graph KEY: TGraphErrors Graph;17 Graph KEY: TGraphErrors Graph;16 Graph KEY: TGraphErrors Graph;15 Graph KEY: TGraphErrors Graph;14 Graph KEY: TGraphErrors Graph;13 Graph KEY: TGraphErrors Graph;12 Graph KEY: TGraphErrors Graph;11 Graph KEY: TGraphErrors Graph;10 Graph KEY: TGraphErrors Graph;9 Graph KEY: TGraphErrors Graph;8 Graph KEY: TGraphErrors Graph;7 Graph KEY: TGraphErrors Graph;6 Graph KEY: TGraphErrors Graph;5 Graph KEY: TGraphErrors Graph;4 Graph KEY: TGraphErrors Graph;3 Graph KEY: TGraphErrors Graph;2 Graph KEY: TGraphErrors Graph;1 Graph
I'm wondering why the following method of accessing the elements in a file does not work:
TFile *f = new TFile("temp.root","r");
TIter nextkey(f->GetListOfKeys());
TKey *key;
while (key = (TKey*)nextkey()) {
TObject *obj = (TObject*)key->ReadObj();
obj->Draw();
}
it doesn't complain but it doesn't show anything either. On the other hand, if i open the same file with the TBrowser it draws without complaints. As for the reference, I'm using Root 5.27/06 Could someone be so kind and help me figuring out what's going on here?
Cheers and thanks,
Stephan
-- Stephan Zimmer zimmerst_at_gmail.comReceived on Thu Apr 28 2011 - 00:37:30 CEST
This archive was generated by hypermail 2.2.0 : Thu Apr 28 2011 - 11:50:01 CEST