Re: GetUserInfo() for TChain

From: Rene Brun <Rene.Brun_at_cern.ch>
Date: Wed, 2 Mar 2011 15:02:05 +0100


You must have a Tree in teh chain. You can for example force the first Tree (entry=0) with

     chain->LoadTree(0);
    TH1F* h = (TH1F*)chain->GetTree()->GetUserInfo()->At(0);

Rene

On 02/03/2011 14:56, Hovhannes Khandanyan wrote:
> Hello Rene,
>
>> TH1F* h = (TH1F*)chain->GetTree()->GetUserInfo()->At(0);
> This approach did not work causing segmentation violation, and that's probably due to the fact that I use the chain only to;
>
> chain->Draw("Leaf>> Histo","","goff")
>
> dump a leaf into a histo. Since the content of UserInfo is exactly the same for all of the trees in chain, I could do smth like
>
>> TH1F* h = (TH1F*)chain->GetTree(0)->GetUserInfo()->At(0);
> but GetTree() does not seem to take a tree index as an argument. What would be the best work around?
>
> Thanks,
> Hovhannes
>
>
>
>>
>> Rene
>>
>>
>> On 02/03/2011 13:08, Hovhannes Khandanyan wrote:
>>> Dear ROOTers,
>>>
>>> I have a TChain of TTrees each of which has UserInfo object with a TH1F in it. Things are OK when I operate with individual tree. Anyhow, as soon as I ask for :
>>>
>>> TH1F* h = (TH1F*)chain->GetUserInfo()->At(0);
>>>
>>> I get a NULL pointer. Please let me know what I am doing wrong.
>>>
>>> Thanks,
>>> Hovhannes
>>>
Received on Wed Mar 02 2011 - 15:03:12 CET

This archive was generated by hypermail 2.2.0 : Wed Mar 02 2011 - 17:50:01 CET