Re: Drawing objects in a file

From: Rene Brun <Rene.Brun_at_cern.ch>
Date: Thu, 28 Apr 2011 11:29:31 +0200


OK, the problem is quite different of your description in your first post. I have modified your script (see attachment) . Look carefully at the difference.

Rene

On 28/04/2011 11:15, Stephan Zimmer wrote:
> Okay, so the problem is that I have a file generated with some
> conglomerate of python and root that saves a canvas. In step 1 I extract
> this information and write everything into a temporary file and step 2
> should be to draw the stuff. The script test.C should be accessible
> through the standard root -l script.C command.
>
> Also, the idea is basically draw the stuff from file 1 into one part of
> a new canvas and then the stuff from file 2 into another. But since the
> canvas itself cannot be drawn inside a canvas, I have to get access to
> the objects natively and request explicit drawing.
>
> Thank you very much,
> Stephan
>
>
>
> On 04/28/2011 10:51 AM, Rene Brun wrote:
>> Could you send your script and data file showing what you are doing?
>>
>> Rene
>>
>> On 28/04/2011 10:48, Stephan Zimmer wrote:
>>> 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
>

Received on Thu Apr 28 2011 - 11:29:39 CEST

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