Re: Reading single leaf of vector<> type

From: Philippe Canal <pcanal_at_fnal.gov>
Date: Mon, 25 Oct 2010 07:26:10 -0500


Hi,

TLeaf's GetValue does not work properly in this case. I will send more information in a little while.

Cheers,
Philippe.

On 10/25/10 6:36 AM, Philip Rodrigues wrote:
> Hi roottalk,
> Does anyone have any idea on this? Am I on the right track or should I be
> doing something entirely different?
>
> Thanks,
> Philip
>
> On Tuesday 19 Oct 2010 16:40:23 Philip Rodrigues wrote:
>> Hi roottalk,
>> I have a tree with a branch storing a class 'A' containing a vector data
>> member:
>>
>> class A : public TObject
>> {
>> public:
>> A();
>> double x;
>> std::vector<double> v;
>>
>> ClassDef(A, 1);
>> };
>>
>> I want to access items from the vector v without streaming the whole object
>> off of disk. I can do this for the simple double member (x) via TLeaf,
>> like this:
>>
>> TLeaf* l_x=tree->FindLeaf("x");
>> l_x->GetBranch()->GetEntry(someEntry);
>> double value_read = l_x->GetValue();
>>
>> but the corresponding code for the "v" branch always gives zero.
>>
>> How can I access just the data from the v branch? (It must be possible,
>> since TTree::Draw can do it, and I'm sure I've done it before with other
>> files...)
>>
>> I've attached a test file and macro to show exactly what I'm doing.
>>
>> Thanks,
>> Philip
>>
Received on Mon Oct 25 2010 - 14:26:17 CEST

This archive was generated by hypermail 2.2.0 : Mon Oct 25 2010 - 17:50:02 CEST