Re: Reading single leaf of vector<> type

From: Philippe Canal <pcanal_at_fnal.gov>
Date: Mon, 25 Oct 2010 13:30:43 -0500


Hi Philip,

This problem has been fixed by revision 36421 of the trunk. To work around this problem with older version of ROOT, you will need to use MakeSelector or MakeProxy to create a skeleton to access the data (and/or use a library defining the class A).

Cheers,
Philippe.

On 10/19/10 3:40 PM, 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 - 20:30:49 CEST

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