[ROOT] Creating a tree with 3 classes

From: Luis Silva (lsilva@mail.desy.de)
Date: Fri Nov 16 2001 - 15:12:32 MET


	hi,

	I'm creating a tree with 3 classes: Evento, Track and Vertice.

	The problem is that the cint cannot recognize the Track and
vertice classes.


	they are defined as folow:

//------Evento.h----

#include "TObject.h"
#include "TClonesArray.h"
#include "TRefArray.h"
#include "TRef.h"
#include "TH1.h"
#include "TMath.h"

#include <iostream.h>

class TDirectory;

class Evento : public TObject{
  public:
  Evento();
  ~Evento();
  Int_t fNtrack;
  Int_t evt;
  Int_t run;
  Int_t exp;


  TClonesArray *fTracks;
  TClonesArray *fVertice;

  static TClonesArray *fgTracks;
  static TClonesArray *fgVertice;

  ClassDef(Evento,1)
};
class Track : public TObject{
 public:
  Track();
  ~Track();

  Int_t evt;
  Int_t track_id;
  Double_t xf;
  Double_t yf;
  Double_t zf;
  Double_t txf;
  Double_t tyf;
  Double_t tzf;
  Double_t pf;
  TClonesArray *fVertices;

  ClassDef(Track,1)
};

class Vertice : public TObject{
 public:
  Vertice();
  Int_t evt;
  Int_t verticeid;
  Double_t xv;
  Double_t yv;
  Double_t zv;
TClonesArray *fTracks;

  ClassDef(Vertice,1)
};

//--------Evento.cxx
#include "TRandom.h"
#include "TDirectory.h"
#include "Evento.h"

ClassImp(Evento)
ClassImp(Track)
ClassImp(Vertice)

TClonesArray *Evento::fgTracks=0;
TClonesArray *Evento::fgVertice=0;

Evento::Evento()
{
  if(!fgTracks) fgTracks=new TClonesArray("Track",1000);
  if(!fgVertice) fgVertice=new TClonesArray("Vertice",1000);
  fTracks=fgTracks;
  fVertice=fgVertice;
}

Track::Track()
{

}


Vertice::Vertice()
{

}


	Then i have the LinkDef.h file, like:

//-------EventoLinkDef.h
#ifdef __CINT__

#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;

#pragma link C++ class Evento+;
#pragma link C++ class Track+;
#pragma link C++ class Vertice+;

#endif

	To gererate the dictionary file, i do:

>rootcint -f EventoDict.cxx -c Evento.h EventoLinkDef.h

	To compile...

>g++ -c -fPIC -I /usr/local/root/include/ EventoDict.cxx

>g++ -c -fPIC -I /usr/local/root/include/ Evento.cxx

	To make the shared library...

>g++ -shared -fPIC Evento.o EventoDict.o -o libEvento.so


	My problem comes now. When i load libEvento.so in root, i get this
error:

>root [0] .L libEvento.so
dlopen error: undefined symbol: __vt_5Track
Load Error: Failed to load Dynamic link library
/home/lsilva/Root/nuno2/./libEvento.so
*** Interpreter error recovered ***


	what am i doing wrong?.

	thank you very much for your help.


	Um abraço,
	Luís Silva.

+*************************+***********************************+
|Luís Silva		  |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|
|Colaborator at DESY 	  |Adress:FCUL 	      		      |
|in Hamburg Germany	  |Campo Grande, Edifício C8,room 8518|
|Experiment Hera-b        |1749-016 Lisboa-Portugal           |
|e-mail:Luis.Silva@desy.de|Tel.: +351 21 750 00 00 Ext.:28518 |
+=========================+===================================+



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