Trying to change the box width in a TH3

Hello,

I’d like to make a TH3 using the option BOX but with the box size fixed. To do this I tried to boost each bin “heigth” to a value from where the box seemed to have its volume fixed, like shown in the first picture. But I only achieved this by editing the macros after compiling my code.

When I try to do it directly from my code (using this ZOffset3D.cc (422 Bytes) ), it returns the next graphic, “resetting” the scale. I also tried adding one extra bin, un-boosted, so that the scale changed to what it looked like in the first graph, but that didn’t work.

I’d appreciate your help with this problem.

If by the other hand there’s a way to fix the TH3 using the box function, that would also be really helpful.

Thanks in advance to you all.

ROOT Version: 6.14/04
Platform: Ubuntu

The size of the boxes is proportional to the bin content.

I assumed that would be the case.

But when a bin has enough content, the box seems to have its sized fixed, as seen in the first image, so as I said I boosted all bin contents to that value but when I execute it, the palette/width scale is not the same as when I do it manually from the macro.

What is the TH3 you are using ? you only posted the macro which adds a constant to all the bins.

This is the main code: Many3DHistograms.cc (1.5 KB)
(the line 44 is commented so that it doesn’t boost the content then)

This is the macro: TH3BOX.C (8.4 KB) . It is edited manually to boost the histogram content (for example, h__2->SetBinContent(245,1+30);, here the +30 is the manual boost I wanted)

Solved it!

Just had to add two lines to the ZOffset3D code, this is the new one: ZOffset3D.cc (634 Bytes)

First, I added the h->SetMinimum(0) line at the end, which solved the scale issue. But that also filled all the bins to a “volume” z0, even the ones which were unfilled before, so I had to ask to make the boost only on bins which weren’t empty before.

Thank you for your help!