Re: [ROOT] Problems reading Objects

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Jul 26 2002 - 23:24:04 MEST


Hi Nuno,

Instead of:
Event *event=new Event();
event=(Event*)f->Get("Event;1");

you should do:
Event *event=(Event*)f->Get("Event;1");

otherwise you get two Event objects in memory and many troubles
later.

Rene Brun



On Thu, 25 Jul 2002, Nuno Almeida wrote:

> Hi all,
> 
> I have one root file with TObjects. These objects are using
> TClonesArray's.
> I read the objects by the following way:
> 
> TFile *f=new TFile("Evento.root");
> Event *event=new Event();
> event=(Event*)f->Get("Event;1");
> 
> but when i try to open another event i obtain a segmentaion violation.
> 
> Whithout TClonesArray it works fine.
> 
> The way i am using TClonesArray is like in root example Event.
> 
> Could you give any ideas why this happens ?
> 
> Thanks,
> 
> Nuno Almeida
> 



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:01 MET