Re: Drawing objects in a file

From: Stephan Zimmer <zimmerst_at_googlemail.com>
Date: Thu, 28 Apr 2011 10:48:45 +0200


Hi Rene,
thanks for this advice but it doesn't work - any other suggestions? Stephan

On 04/28/2011 08:20 AM, Rene Brun wrote:

> With your example you should at least get your TH2F object drawn.
> To draw the graphs you must specify a draw option, eg "alp" (default for
> the browser).
> 
> Rene Brun
> 
> On 28/04/2011 00:37, Stephan Zimmer wrote:

>> 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
>> root [2]
>>
>> 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.com
Received on Thu Apr 28 2011 - 10:48:53 CEST

This archive was generated by hypermail 2.2.0 : Thu Apr 28 2011 - 11:50:01 CEST