hi forum
The problem I have most probably is a trivial one, but please bare with me. I have a tree with several branches, called chip, col, row, test etc. Now, I want to read this tree and pipe it into an array of integers like test[chip][col][row]. I know I can draw a 2d histogram by, e.g.
TCut c1 = "chip==1"
tree->Draw(“row:col”,“test”*c1,“colz”)
but how can I get the values plotted into an array?
Thanks a lot!
We show several examples in the tutorials. Here is a short example
void geta() {
TFile f("hsimple.root");
const Int_t N=10000;
Double_t px[N],py[N],pz[N];
TTree *T = (TTree*)f.Get("ntuple");
//Get pointers to some leaves (3 out of 5)
TLeaf *lpx = T->GetLeaf("px");
TLeaf *lpy = T->GetLeaf("py");
TLeaf *lpz = T->GetLeaf("pz");
for (Int_t i=0;i<N;i++) {
//read one entry (branch/leaf values are stored in ROOT memory
T->GetEntry(i);
//copy from ROOT memory to local arrays
px[i] = lpx->GetValue();
py[i] = lpy->GetValue();
pz[i] = lpz->GetValue();
}
}
Rene
Rene,
Thanks a lot!