Re: checking result of SetBranchAddress

From: Alexander Mann <amann_at_uni-goettingen.de>
Date: Fri, 11 Sep 2009 17:47:12 +0200


Hi Philippe,

 > I expect:
 > GetAddress() == &variable

Yes, that's correct, but unfortunately, cannot be used:

--> StacoMuon_nucone20 before (nil)
--> var before is 0x91a397c
--> now is 0x91a397c
--> var is 0x91a397c

--> StacoMuon_bestMatch before (nil)
--> var before is 0x91a3980
Error in <TTree::SetBranchAddress>: The pointer type give (vector<bool>) does not correspond to the class needed (vector<int>) by the branch: StacoMuon_bestMatch
--> now is 0x91a3980
--> var is 0x91a3980

My code:

    printf("--> now is %p\n", tree->GetBranch(branchName)->GetAddress());     printf("--> var is %p\n", &variable);

cu,
Alexander

Philippe Canal schrieb:
> Hi Alexander,
>
> With
>
> tree->SetBranchAddress( branchName, &variable, &br );
>
> I expect:
> GetAddress() == &variable
>
> Cheers,
> Philippe.
>
> Alexander Mann wrote:

>> Hi Philippe,
>>
>> (offline question)
>>
>> sorry, which value that I pass do you mean?
>>
>> cu,
>> Alexander
>>
>>
>> Philippe Canal schrieb:
>>> Hi Alexander,
>>>
>>> How does the new values compare to the one you passed?
>>>
>>> Cheers,
>>> Philippe
>>>
>>> Alexander Mann wrote:
>>>> Hi Philippe,
>>>>
>>>>> The example you sent prints the location of the branch object itself
>>>>> and __not__ the location of the user object the branch will use to
>>>>> fill in or read from the TTree. The location of the branch object is,
>>>>> of course, not affected by the call to SetBranchAddres.
>>>>
>>>> OK, that makes sense. (So SetBranchAddress does not set the address 
>>>> of the branch as one might deduce from its name :)
>>>>
>>>> The problem however remains, as on a failure of SetBranchAddress the
>>>> pointer is modified, too:
>>>>
>>>> --> StacoMuon_nucone20 before (nil)
>>>> --> now is 0x8e2797c
>>>>
>>>> --> StacoMuon_bestMatch before (nil)
>>>> Error in <TTree::SetBranchAddress>: The pointer type give 
>>>> (vector<bool>)
>>>> does not correspond to the class needed (vector<int>) by the branch:
>>>> StacoMuon_bestMatch
>>>> --> now is 0x8e27980
>>>>
>>>> cu,
>>>> Alexander
>>>>
>>
Received on Fri Sep 11 2009 - 17:47:20 CEST

This archive was generated by hypermail 2.2.0 : Fri Sep 11 2009 - 23:50:02 CEST