Hi,
The leaflist method of branch creation does not support two variable
dimensions.
Instead you should use a vector<vector<double> >. With 5.20/00:
std::vector<std::vector<double> > data; tree->Branch("data",&data);
Cheers,
Philippe.
PS. You also need to generate the dictionary for this vector. With
the file below,
do:
gROOT->ProcessLine(".L loader.C+");
// Start of loader.C
#include <vector> #ifdef __MAKECINT__ #pragma link C++ class vector<vector<double> >+; #endif
BetterWang wrote:
> Hi ROOT,
>
> Can I add a branch with a 2D variable length array?
> For example:
>
> const int MAX_IDX;
> const int MAX_N;
>
> int idx; // idx < MAX_IDX
> int n[MAX_IDX]; // n[MAX_IDX] < MAX_N
> double data[MAX_IDX][MAX_N];
>
> tree->Branch("idx",&idx,"idx/I");
> tree->Branch("n",n,"n[idx]/I");
> tree->Branch("data",data,"data[idx][n[idx]]/D"); // this is not
> working, I get all zero;
>
> Is it possible to do that in ROOT?
>
> Thanks.
>
>
Received on Tue Nov 04 2008 - 17:40:59 CET
This archive was generated by hypermail 2.2.0 : Wed Nov 05 2008 - 05:50:03 CET