RE: [ROOT] Problems with CINT and STL

From: Tommaso Chiarusi (Tommaso.Chiarusi@bo.infn.it)
Date: Sat Sep 15 2001 - 10:47:48 MEST


On Fri, 14 Sep 2001, Axel Naumann wrote:

> Hi,
> 
> which root version are you using,

Version   3.00/06 

> what are the error messages 

*** Break *** segmentation violation
Root > Function mappa_301_97() busy flag cleared
Function destroy() busy flag cleared
Function destroy() busy flag cleared
Function insert_aux() busy flag cleared
Function push_back() busy flag cleared


>and does TTrack derive from TObject, 

	OPS! No... I thought that TObject inheriting was compulsory
only if I used ROOT Containers, not the STL ones!!!!!

> where does it crash (exact line) 

It doesn't go further
     ve.push_back(tr);

> could you check wether the "tr" is filled correctly (with sensible
> data) at least for the first entry?

I use the track, just after the retrieval from the Tree and before trying
to fill the STL vector, so I'm sure it is properly filled!

Thanks & Cheers!
Tommaso

> 
> Cheers, Axel.
> 
> > -----Original Message-----
> > From: owner-roottalk@pcroot.cern.ch
> > [mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Tommaso Chiarusi
> > Sent: Friday, September 14, 2001 11:01 AM
> > To: Root Newsgroup
> > Subject: [ROOT] Problems with CINT and STL
> >
> >
> > Dear Rooters,
> >
> > I have problems as I try to build STL vector containing objects
> > which are related to a compile Classes (libMyClass.so).
> >
> > When I was using the not-compiled class, i.e. the include files,
> > it worked good!!!!!
> >
> > I explain myself better:
> > I have my own class Track.h .
> >
> > I want to build a STL vector of Track objects,
> > so I can do:
> >
> > #include <vector>
> > #include "Track.h"  // as header of the ROOT macro
> > ...
> > vector<Track> ve;
> > Track *tr=new Track(0.2,23.2);
> > ve.push_back(tr);
> >
> > THIS PROCEDURE WORKS GOOD!
> >
> > But now I need to retrieve tracks stored in a Tree, so I'm forced to use
> > the compiled class library: I have produced the libTrack.so.
> > Then, omitting the #include "Track.h" , I do:
> >
> >     if(!TClassTable::GetDict("Track")){
> >      gSystem->Load("mylib/libTrack.so");
> >     }
> >
> >
> >     vector<Track> ve;
> >
> > I make the usual opening of the Tree and addressing of the Track objects
> >
> >    TTree *myTree = (TTree*)file_root->Get("t1");
> >    TBranch *myBranch = myTree->GetBranch("tracks");
> >
> >    Track *tr = new Track();
> >    myBranch->SetAddress(&tr);
> >
> >
> > and get the entries one by one looping over the
> >
> >   Int_t nevent = myTree->GetEntries();
> >
> > so:
> >   for(Int_t i=0;i<nevent;i++){
> >     myBranch->GetEntry(i); // get the track
> >     ve.push_back(tr);
> >     }
> >
> >  THIS FAILS!!!!!
> >
> > What can it be?
> > Is it something related to some Errors in compiling my class?
> >
> >
> > sorry if I disturb you again with a new problem.
> >
> > Thanks and Cheers!
> >
> > Tommaso
> >
> >
> 
> 



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:00 MET