Writing array in tree again
Tadeusz Pytlos (pytlos@fizwe5.fic.uni.lodz.pl)
Sun, 22 Mar 1998 18:06:52 +0100 (CET)
Hello Rooters,
I cannot understand what wrong with arrays written in the tree.
According to an article "Re: Newbie question..." I used simple macro arr.C
to generate adc.root.
{
gROOT->Reset();
Float_t adc[16];
TFile *file=new TFile("adc.root","RECREATE");
TTree *tree=new TTree("tree","Testing still");
tree->Branch("adc",adc,"adc[nadc]/F");
for(Int_t j=0;j<100;j++) {
for(Int_t i=0;i<16;i++) adc[i]=5.0;
tree->Fill();
}
tree->Print();
tree->Write();
file->Close();
}
Now while I'm trying to read the array
f=new TFile("adc.root")
f.ls()
tree.Print()
tree.Draw("adc")
I see 100 events of value 5.0 but I ecpected 100*16=1600 events!!
tree.Draw("adc[0])
I see 100 events of 5.0. It's OK.
tree.Draw("adc[1])
I see 100 events of 0.0 !!
Next are similar. Sometimes even stranger
tree.Draw("adc[15])
I see 100 events of 3.3 !!
What is also
tree.Draw("adc[16]) and next?
It seems that the array is write only into adc[0]. Why? The same with
the standalone program.
Would you tell me what I'm going wrong? I found a similar description in
the Thomas Hadig's article "Problem writing arrays", but I couldn't find
any answer.
Best wishes
Tadeusz Pytlos
--
Tadeusz Pytlos
mailto:pytlos@fizwe5.fic.uni.lodz.pl
Lodz, Poland