[ROOT] Problems with CINT and STL

From: Tommaso Chiarusi (Tommaso.Chiarusi@bo.infn.it)
Date: Fri Sep 14 2001 - 18:01:04 MEST


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