Wrap 2D histogram over a sphere surface

Dear colleagues,

I have been struggling to try to achieve the following:

I have a 2D distribution store as TH2F, for which X represents the spherical coordinate phi ranging [-pi,+pi], and Y represents theta ranging [0,+pi]. (Attached image)

I want to wrap this 2D image around a sphere of constant radius R.
So create a 3D representation of a 2D image such the color of each point on the surface corresponds to a cell in the 2D histograms.

I tried an orthodox way of creating a collection of geometries (sphere sectors) and adding them as nodes to a top volume. But for high-resolution 2D distribution, this is far from optimal, so I am looking for some helpful drawing options.

Thanks in advance for any hint,
Dario

Hi @Dario_Ramirez; maybe @couet can help here.

Cheers,
J.

May the option SPH combined with one of the LEGO or SURF options ?

indeed: h->Draw("surf5 sph")

I got this:

I am looking for something like this:

But this was generated by building geometries with TGeoManager, and I had to rebin the histograms to reduce the resolution

Which graphics backend are you using ? with SURF5 SPH you should get a sphere (I do)

root --web file

TBrowser xx

Then I write the drawing options in the box

I tried not without --web opt, and I got

Looking better, but for some positions, it looks weird:

Could it be the reason the angle ranges?, so I am seeing a half-sphere so when rotated part of the sharp edge covers the “hot spot”

Different view: image

It is not always working . it depends on the axis. Try with lego options. In any cases that does not work with the --web version of ROOT (@linev)

Thanks a lot!

Spherical coordinates for lego plots not yet implemented in web graphics.

I implement cylindrical coordinates:

All other kinds should be straightforward.

1 Like

For completeness - all other coordinates system were implemented as well:

New feature will be merged into master with following PR:

1 Like

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