Hi,
I have asked this question before here:
https://root-forum.cern.ch/t/adding-a-vector-of-vectors-to-a-tree/11345/1
and have also been pointed towards the documentation for adding a class, but I am still having trouble understanding exactly what I must do.
I am using Geant4 and I want to store output in a TTree. I want to know how to do this for
- some class MyClass
- some standard library template class like std::vector< std::vector< double > > or even vector< vector< MyClass > >.
For case 1: MyClass,
a. does myClass /have/ to derive from TObject?
b. does myClass /have/ to use the ClassDef and ClassImp macros?
if either of these are true, what can I do in the case that I cannot edit the class code or change the object hierarchy, such as in the case of built in Geant4 classes like G4ThreeVector etc?
c. Is the process for generating the dictionary to run this command?
rootcint -f MyClassDictionary.cc -c MyClass.h MyLibraryLinkDef.h
where MyLibraryLinkDef.h contains:
#pragma link C++ class MyClass+
This generates MyClassDictionary.cc and MyClassDictionary.h
What do we do in the case of MyClass being in a namespace like MyNamespace::MyClass ?
d) What do I do with these files? Do I /have/ to create a shared library with them? If so, what is the exact process for doing that? Where do I need to include MyClassDictionary.h in my program if at all?
for case 2: some standard library container or nested container
a) how is the process different from MyClass?
If anyone could take the time to handhold me through a simple example of getting this to work without using the root command line (I am compiling a geant4 executable) I would be very very grateful. I know the documentation shows an example with Event and Track, but I just haven’t been able to get anything to work.
Thank you.