root-project / jsroot

JavaScript ROOT
MIT License
187 stars 80 forks source link

Unable to plot root object from browser but it works via NodeJS #269

Closed graduta closed 11 months ago

graduta commented 11 months ago

Hi,

I am trying to understand an issue we have with plotting ROOT objects in ALICE via the JSROOT GUI.

Currently, we are using JSROOT from 2 sources:

We have encountered some ROOT files which work fine with the first option (parsing on NodeJS) but we are unable to plot them via the JSROOT GUI. I have tried loading the objects in both JSROOT v6 and v7 from https://jsroot.gsi.de/7.4.3/ and https://jsroot.gsi.de/6.3.4/ but I am unable to plot the object.

I am attaching to this issue the archive containing:

Could you point us to where the mistake is done and how we can get the object plotted with JSROOT GUI as well?

Archive.zip

Thank you, George

linev commented 11 months ago

Object in the ROOT file is not directly supported by JSROOT.

But it is derived from TH2D class. When you are using ROOT from Node.js - most probably you first cast this object to TH2D and only then converted into JSON. Therefore on the client side such object it seen as normal ROOT histogram.

If files reading directly by JSROOT - object type is not recognized as histogram.

But this I can fix fast. I will enable treating of all derived classes as histograms.

graduta commented 11 months ago

Thank you for the quick investigation and solution proposed!

linev commented 11 months ago

I add support for derived from histograms classes. It is now in dev version https://jsroot.gsi.de/dev/ Will be released soon as 7.5.0

linev commented 11 months ago

Feature released in version 7.5.0