Reading TObject with std::map in JSROOT

Hi all,

I’m having some trouble with reading a simple TObject which contains std::map as a member from the regular root file in JSROOT (using JSROOT.OpenFile and then ReadObject).
It works well for the files that were produced using root 6.14/06, but for the files produced with root 6.18/00 the browser always complains with “Offset is outside the bounds of the DataView” and the object is not read. I’m pretty sure that std::map is an issue, as if I remove it from the TObject it works fine.

(I’m actually not interested in the content of the map itself, I would only like to get the histogram which is also a member my TObject, but since the ReadObject crashes I can’t access it)

If anyone has some idea what could be causing this issue I would appreciate.

Thanks,
Luka

Hi Luka,

Can you provide such files?
Produced with old and newer ROOT?
I didnot check for a while this functionality.

Regards,
Sergey

1 Like

Hi Sergey,

thank you for prompt reply. Attached are the two root files and a definition file for my object. Then in javascript I just do JSROOT.OpenFile(…) and file.ReadObject(“arich”) and get the described error in case of root v18.

Thanks a lot for your help,
Luka

testMon.h (2.1 KB)
monObj_v6_14.root (6.7 KB) monObj_v6_18.root (4.1 KB)

Hi Luka,

Now I see a difference.
Latest ROOT uses member-wise streaming for std::map. It was not good tested with JSROOT.
I provide workaround, which should work:

http://jsroot.gsi.de/dev/?file=../files/tmp/monObj_v6_14.root&item=arich&opt=inspect
http://jsroot.gsi.de/dev/?file=../files/tmp/monObj_v6_18.root&item=arich&opt=inspect

You can try version from “jsroot.gsi.de/dev/” or directly from repository.

Regards,
Sergey

Hi Sergey,

indeed it works now, I will use the dev version for now. Thank you so much for your impressively prompt help!

Cheers,
Luka

Nice, but for me moment it is a workaround.
Some complex cases of std::map may not work.

I understand. At least at the moment this is sufficient for me, so thanks again.

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