Branching a map<type, int > in a TTree

I am actually writing simulation library in c++ and I would like to save the output data in a TTree.

In this simulation software, 2 class are involved in my problem:
one call ZAI (which correspond to a nuclei, which references , its Z, A, and its isomeric state)
and one call IsotopicVector, wich correspond to a composition of ZAI, which contain a map<ZAI, int>

I think I made the appropriate inheriting : ZAI and Isotopic vector are public TObjet, and have a ClassDef & ClassImp (in .h and .c respectively).
I generate the root Dictionary and include it into my library
The program compile and run without any error.
In root after loading my library, I can open the generated root file without any error message.
but when I try to read the map, they are empty…

I try to check if the problem comes from my side by adding a vector of long int (vector) in the IsotopicVector. (The long int here, are not necessary… but I use it in the real program…)
And this vector is correctly filled and ridden when the map remains empty…

So I wonder, if I made a mistake in branching my IsotopicVector on my TTree, or if their is some “special treatment” to do in order to fill correctly a map in the TTree or…

I join an .tar archive to this mail, containing :

  • a simplified source of my library (only the ZAI and Isotopicvector Class)
  • the makefile I used
  • a small piece of code showing the problem as describe previously (where I print the IsotopicVector before filling it to be sure it is not empty)
  • the small macro I used to check if it’s working

I use :

  • DELL latitude E6420 (intel i7 quad core)
  • gcc version 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3)
  • "ROOT 5.32/00 (tags/v5-32-00@42375, Dec 02 2011, 12:42:25 on linuxx8664gcc)
  • CINT/ROOT C/C++ Interpreter version 5.18.00, July 2, 2010"
  • And I am running on a Ubuntu system : 11.10 64 bits

After compiling my 2 class, I do the following command :

  > g++ -o Test test.cpp -I ./source/include/ -I ${ROOTSYS}/ -L ./ -lCLASSpkg `root-config --libs`
  > ./Test
  > root

root [0] .L libCLASSpkg.so
root [1] .L read.C
root [2] TFile *_file0 = TFile::Open(“Test.root”)
root [3] read(Data)

I hope I am clear enough, If not please tell me, I can provide any information you could need…

Thank you for your time,
Baptiste,

PS : I hope my approximative English is understandable…
rootTalk.tar (830 KB)

Hi,

map<ZAI ,double> fIsotopicQuantity; //!< Isotopic vector composition in gramme map<ZAI ,double> fIsotopicQuantityNeeded; //!< Isotopic vector request and not present The //! is a special marker for ROOT I/O which means that the member should not be saved. Once you remove the !, everything is working as expected.

Cheers,
Philippe.

thank you !

I try that in a few hour

it works, thanks…
but I loose my doxygen commentary…

Didi you know if it is possible to have both ?

Hi,

According to: stack.nl/~dimitri/doxygen/docblocks.html
you can also use:///< Isotopic vector composition in gramme

Cheers,
Philippe.

thanks :slight_smile:

you provide me everything I need :slight_smile: