R. Holzmann (phone: 0049/6159/71-2645) wrote: > > Dear ROOTers, > > does TTree::Draw() support arrays of more than 1 dimension? > Also, what is the notation used to specify index ranges? > TTree::Draw supports only one dimension. In case you have a two-dim array, you should compute the 1d index number corresponding to your 2d array. For example, assuming an array a[10][20] specify a[0] for a[0][0] specify a[10] for a[1][0] In case of 2-d arrays or more complex constructs, I encourage you to automatically generate the analysis code corresponding to your ntuple definition via TTree::MakeCode. if you have an ntuple/tree h1, simply doing h1->MakeCode() will generate a file h1.C with the ntuple skeleton analysis function. In this code, you can use the normal two-dim array indexing mechanism. Rene Brun > My problem is the following: > > I have a tree generated with h2root from a PAW CWN tuple. > Here's the output of the PAW n/print command: > > PAW> n/print 3011 > > ****************************************************************** > * Ntuple ID = 3011 Entries = 10 MDC11 > ****************************************************************** > * Var numb * Type * Packing * Range * Block * Name * > ****************************************************************** > * 1 * U*4 * * * IEVT * IDEVT > * 1 * I*4 * * [0,100] * S1D1 * NHIT > * 2 * U*4 * 13 * [0,8000] * S1D1 * MDCTRK(NHIT) > * 3 * R*4 * * * S1D1 * MDCX(6,NHIT) > * 4 * R*4 * * * S1D1 * MDCY(6,NHIT) > * 5 * R*4 * * * S1D1 * MDCTHETA(6,NHIT) > * 6 * R*4 * * * S1D1 * MDCPHI(6,NHIT) > * 7 * R*4 * * * S1D1 * MDCTOF(6,NHIT) > ****************************************************************** > * Block * Entries * Unpacked * Packed * Packing Factor * > ****************************************************************** > * IEVT * 10 * 4 * 4 * 1.000 * > * S1D1 * 10 * 12404 * Var. * Variable * > * Total * --- * 12408 * Var. * Variable * > ****************************************************************** > * Blocks = 2 Variables = 8 Max. Columns = 3102 * > ****************************************************************** > > and the corresponding h3011->Print() output is: > > root [10] h3011->Print() > ****************************************************************************** > *Tree :h3011 : MDC11 * > *Entries : 10 : Total Size = 25608 bytes File Size = 25608 * > * : : Tree compression factor = 1.00 * > ****************************************************************************** > *Branch :Idevt : Idevt/i * > *Entries : 10 : Total Size = 0 bytes File Size = 0 * > *Baskets : 0 : Basket Size = 8000 bytes Compression= 1.00 * > *............................................................................* > *Branch :Nhit : Nhit/I * > *Entries : 10 : Total Size = 0 bytes File Size = 0 * > *Baskets : 0 : Basket Size = 8000 bytes Compression= 1.00 * > *............................................................................* > *Branch :Mdctrk : Mdctrk[Nhit]/i * > *Entries : 10 : Total Size = 0 bytes File Size = 0 * > *Baskets : 0 : Basket Size = 8000 bytes Compression= 1.00 * > *............................................................................* > *Branch :Mdcx : Mdcx[Nhit][6]/F * > *Entries : 10 : Total Size = 0 bytes File Size = 0 * > *Baskets : 0 : Basket Size = 8000 bytes Compression= 1.00 * > *............................................................................* > *Branch :Mdcy : Mdcy[Nhit][6]/F * > *Entries : 10 : Total Size = 0 bytes File Size = 0 * > *Baskets : 0 : Basket Size = 8000 bytes Compression= 1.00 * > *............................................................................* > *Branch :Mdctheta : Mdctheta[Nhit][6]/F * > *Entries : 10 : Total Size = 0 bytes File Size = 0 * > *Baskets : 0 : Basket Size = 8000 bytes Compression= 1.00 * > *............................................................................* > *Branch :Mdcphi : Mdcphi[Nhit][6]/F * > *Entries : 10 : Total Size = 0 bytes File Size = 0 * > *Baskets : 0 : Basket Size = 8000 bytes Compression= 1.00 * > *............................................................................* > *Branch :Mdctof : Mdctof[Nhit][6]/F * > *Entries : 10 : Total Size = 0 bytes File Size = 0 * > *Baskets : 0 : Basket Size = 8000 bytes Compression= 1.00 * > *............................................................................* > > Now, in PAW I could do nice things on the 2dim arrays, like > > PAW> n/plo 3011.mdcx(1,2) > > and > > PAW> n/plo 3011.mdcx(1,1:nhit) > > or even select subranges > > PAW> n/plo 3011.mdcx(1:3,nhit-10:nhit) > > i.e. I had full control over BOTH indices! > > How much of this can I do with the TTree::Draw() member function? > > Thanks a lot for any help. > > Romain Holzmann > > p.s. Tom Moog from ANL posted a similar question quite some time ago, but no > answer has apparently been threaded.
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:38 MET