Root version 0.9 supports variable length arrays (for example the ones
converted from hbook column-wise ntuples), but (yes), it does not
support fixed one or more dimension arrays!
However, you can still do the following as illustrated by a small
macro generating a Tree file and a second macro reading this file
and doing one histogram.
The Producer macro
==================
{
gROOT->Reset();
Int_t i,j,event;
Float_t adc[16][16];
TFile *file = new TFile("adc.root","RECREATE");
TTree *tree = new TTree("tree","Testing root trees");
tree->Branch("adc",adc,"adc[nadc]/F");
for (event=0;event<100;event++) {
for (j=0;j<16;j++) {
for (i=0;i<16;i++) {
adc[i][j] = 100*i +j;
}
}
tree->Fill();
}
tree->Print();
tree->Write();
file->Close();
}
The read macro
==============
{
//////////////////////////////////////////////////////////
// This file has been automatically generated
// (Thu Feb 27 08:36:42 1997 by ROOT version 1.00/00)
// from TTree tree/Testing root trees
// found on file: adc.root
//////////////////////////////////////////////////////////
//Reset ROOT and connect tree file
gROOT->Reset();
TFile *f = new TFile("adc.root");
//Declaration of leaves types
Float_t adc[256];
//Get a pointer to individual leaves and set their addresses
TObjArray *leaves = tree->GetListOfLeaves();
TLeaf *l_adc = (TLeaf*)leaves->At(0);
l_adc->SetAddress(&adc[0]);
//This is the loop skeleton
//To read only selected branches, Insert a statement like:
// afname->GetBranch()->GetEvent(i); instead of tree->GetEvent(i);
TH1F *hadc = new TH1F("hadc","ADC distribution",100,0,1600);
Int_t nentries = tree->GetEntries();
for (Int_t i=0; i<nentries;i++) {
tree->GetEvent(i);
hadc->Fill(adc[64]);
}
hadc->Draw();
}
The skeleton of the "read macro" can be generated automatically
in version 0.9:
see http://root.cern.ch/root/html/examples/MakeCode.C.html
in version 1.0, TTree::MakeCode replaces this macro.
Version 1.0 supports fix arrays in TTree::Draw
Rene Brun