Re: interactive handling of TClonesArray (ROOT 1.01/07)

From: Marthe Brun (codeme@alien.brun.com.cern.ch)
Date: Sun Jul 06 1997 - 08:21:00 MEST


>The problem I reported also reveals itself if one is trying to get pointer to 
>the track starting from the examples test/eventa.cxx and test/eventb.cxx
>(we start from the file Event.root created by Event executable):
>--------------------------------------------------------------------------------
>CINT/ROOT C/C++ Interpreter version 5.13.11, May 25 1997
>Type ? for help. Commands must be C++ statements.
>Enclose multiple statements between { }.
>root [0] .x eventload.cxx
>root [1] gROOT->Reset()
>root [2] TFile f("Event.root");
>root [3] TTree *T = (TTree*)f.Get("T");
>root [4]  Event *event = new Event();
>root [5]  T->SetBranchAddress("event", &event);
>root [6] Int_t nevent = T->GetEntries();
>root [7] .p nevent
>(Int_t)400
>root [8] Int_t nb = 0;
>root [9] Int_t i  = 0;
>root [10]  nb += T->GetEvent(i); 
>root [11] .p nb
>(Int_t)44744
>root [12] TClonesArray* track = event->GetTracks();
>root [13] .p (*track)[0]
>Error: Pointer to function 0x107cd188 can not access from interpreter(2) FILE: LINE:0
>Error: G__getvariable: expression [0] FILE: LINE:0
>*** Interpreter error recovered ***
>--------------------------------------------------------------------------------
>                What I'm doing wrong?

To accesss interactively the elements of a TClonesArray, use the
At or UncheckedAt functions. Fons, Masa could you comment why the
array notation does not work in this case?
Above, command root[13], do instead:
   Root > Track *t = track->At(0); // get pointer to track 0
   Root > t->Dump();

Rene Brun



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