Storing user defined class objects in TTree

Dear Rooters,
I am trying to store user myclass objects in ROOT TTree.
After going to through other similar post, I had created the all the required dictionary.

The program works and it writes the object to TTree, but while reading, I am not
get the expected data that i had stored.

May be some data member alignment issue, which i am not sure of.

Could you please help me in this.

Please find attached the required tar file of the code used to reproduce the problem.

Details are as follows:

This contains 4 class, Test classes A, B,

and the Real required class : ScintillatorBar, SingleMuon Track.

The test program that uses the above class and create the required ROOT file with required ROOT Tree is RootDict.cpp, and the program that reads this ROOT file is ReadTree.cpp.

For Test class A and B, i am getting expected results, but for the real class i am not getting the expected results and it alway gave me results which set the required data member using the default constructor of ScintillatorBar class. Ideally it should give me the value which is set from RootDict.cpp.

The work of dictionary creation for the classes is done in CMake.

Kindly let me know if you need any further information.

RootDict.tar.gz (45.5 KB)

The problem is the //! token in the comments of the ScintillatorBar class members. This special comment type tells cling to ignore the member when streaming. You can comment with just // (or with ///< if you want to make the comment available to Doxygen) in order to get the expected behavior.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.