TTree with a vector<user defined class>


I have had a look at the topics related to filling a TTree with a vector (of floats) or with a user defined object, and succeeded in creating a dictionary from a makefile for my own class.

I have a class “Particle” (which holds a class “Point”) and I want to be able to fill the TTree with a vector without using the gInterpeter.

So far I have modified my Makefile with the following;

	$(CXX) $(OPTFLAG) -c -o $@ $<
$(DDIR)/Dictionnary.cpp: $(HEADERS)
	rootcint -f $@ -c -p $^

And have included in my headers and sources the macros ClassDef(MyClass, 1) and ClassImp(MyClass).

So far I have only succeeded in dealing with my “Particle” class, I can’t seem to hold a vector, I keep on getting the error message :

Thanks in advance for your help,

PS: I am using the latest ROOT version, i.e. v5.34.18

Maybe you’re missing a proper: $(DDIR)/Dictionnary.cpp: $(HEADERS) LinkDef.h where the “LinkDef.h” file is something like: [code]#ifdef MAKECINT

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

#pragma link C++ nestedclass;
#pragma link C++ nestedtypedef;

#pragma link C++ class Point+;
#pragma link C++ class Particle+;
#pragma link C++ class std::vector+;

#endif /* MAKECINT */[/code]
See also [url]Simple way to create and merge shared libraries? for some additional neat Philippe’s notes concerning “ClassDef” / “ClassImp” / “TObject inheritance”.

Thank you for clarifying the use of a LinkDef.h and updating my Makefile !