Re: Playing with trees

From: Rene Brun (Rene.Brun@cern.ch)
Date: Mon Jan 17 2000 - 19:26:42 MET


Hi Manuel,
In the automatically generated file test.h, change the line:
   //fTree->SetBranchAddress("event"(void*)-1);
to
   fTree->SetBranchAddress("event",(void*)-1);

Thanks for reporting this oddity. I forgot to uncomment the line.

Rene Brun

Manuel Sanchez Garcia wrote:
> 
> Hello Rooters,
> 
> I have problems reading ROOT trees with the following sequence, in ROOT 2.23/11
> and ROOT 2.23/09 both in RedHat 6.1 and Linux Debian 2.1.
> 
> 1.- In $ROOTSYS/test directory. I execute ./Event, this generates a Event.root
> file
> 
> 2.- Add gSystem->Load("libEvent.so") to rootlogon.C so it is loaded every time
> I launch ROOT
> 
> 3.- In a ROOT session:
> root[0] TFile f("Event.root");
> root[1] T.MakeClass("test");
>         This creates a test.C and test.h
> 
> 4.- Modify the test::Loop() in test.C to look like:
>   if (fTree == 0) return;
> 
>    Int_t nentries = Int_t(fTree->GetEntries());
> 
>    Int_t nbytes = 0, nb = 0;
>    for (Int_t i=0; i<nentries;i++) {
>       nb = fTree->GetEntry(i);   nbytes += nb;
>       printf("%i\n",fTrack_);  // <--- This is the only addition.
>     }
> 
> 5.- In another ROOT session:
> root[0] .L test.C
> root[1] test t;
> root[2] t.Loop();
> 
>         This prints a lot of zeroes. However, the data seem to be there since I
> can do t.Show(200) and I get fTracks_ == 605 (for example).
> 
> This sequence was working nicely in ROOT 2.22/10. Am I doing anything wrong
> here?
> 
> Thanks in advance,
> Manuel
> 
> ---------------------
> Manuel Sanchez Garcia (manuel@fpddux.usc.es)
> Univ. Santiago.Spain.



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:17 MET