Writing array in tree again

From: Tadeusz Pytlos (pytlos@fizwe5.fic.uni.lodz.pl)
Date: Sun Mar 22 1998 - 18:06:52 MET


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                                                 



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:31 MET