I am having a problem getting the member variables of the objects in my TClonesArray to be written to file properly. When I open my output root file and browse to those member variables, they are always set to zero! The number of entries is correct, but the value is always zero.
In my output root file the values of var4 and var5 are always zero. But the values of var1, var2, var3 are written correctly.
In my code, If I “remove” the SystemRecord class and have the following structure, it works exactly as expected. So the problem occurs when I put the TClonesArray in SystemRecord. For example, the following works and I see all of the vars correctly in my output file.
Like I said, I can fill the objects in TClonesArray and write out the values in the second scenario where the TClonesArray pointers are not contained within my SystemRecord class.
I can reproduce my problem by adding a SystemRecord class to the example in $ROOTSYS/test.
Attached is my code. When I compile and then run Event, the resulting output root file shows the same problem. The members in the SystemRecord branch (fSysRec) are always set to zero.
I can not reproduce your problem. I download your zip file, overlaid it into $ROOTSYS/test, did make Event and ran ./Event 100 and then did:[code]poire:test pcanal$ root.exe -l -b Event.root
root [0]
Attaching file Event.root as _file0…
Warning in TClass::TClass: no dictionary for class Event is available
Warning in TClass::TClass: no dictionary for class EventHeader is available
Warning in TClass::TClass: no dictionary for class SystemRecord is available
Warning in TClass::TClass: no dictionary for class Track is available
root [1] T->Scan(“fSysRec.fTracks.fNpoint”)
Row * Instance * fSysRec.f *
0 * 0 * 64 *
0 * 1 * 61 *
0 * 2 * 65 *
0 * 3 * 64 *
0 * 4 * 66 *
0 * 5 * 64 *
0 * 6 * 65 *[/code]which shows non-zero value in fSysRec ....
Ah … [quote]and root 5.26.00 – no patches.[/quote]this was the missing piece of information . This problem has been fixed a few days ago in revision 32772 of the trunk (and today in the patch branch of v5-26).