Spherical harmonics

I believe the bug related to “Deleting old histogram with different dimensions” is the same as: sft.its.cern.ch/jira/browse/ROOT-4508

Note that in this VERY OLD “bug report”, one claims that this “brutal fix” should work: TFile *f = new TFile("sferiche_nt.root"); TTree *t; f->GetObject("t", t); TCanvas *c = new TCanvas("c", "c"); if (t) t->Draw("z:y:x:p","","colz"); TH3F *ht=(TH3F *)gROOT->FindObject("htemp"); if (ht) { ht->GetXaxis()->SetLimits(-0.5, 0.5); ht->GetYaxis()->SetLimits(-0.5, 0.5); ht->GetZaxis()->SetLimits(-0.5, 0.5); c->Modified(); c->Update(); }

Thanks for the suggestion. The x, y, z limits are working with SetLimits!

I still have the problem with colors but this I can work around by adding two fake points so that the color range is computed automatically.

Yes SetLimits allows to enlarge the histogram limits whereas SetRangeUser changes the the visible range within these limits.

So, maybe it’s time to “reopen” https://sft.its.cern.ch/jira/browse/ROOT-4508 :stuck_out_tongue:

It was closed because it cannot be reproduced.

I’ve just been able to “reproduce” the (more than two years old) https://sft.its.cern.ch/jira/browse/ROOT-4508 bugs without any problems with ROOT 5.34/18 (actually “heads/v5-34-00-patches@v5-34-18-531-g9e42712”).

  1. Execute the unchanged original macro from [url]Problem with logarithmic X/Y axes with TNtuple then try “h->GetNbinsX()” and/or “h->GetNbinsY()” -> you will get 20, while you should have got 100.
  2. Edit the original macro from [url]Problem with logarithmic X/Y axes with TNtuple and comment out BOTH lines “h->Get[XY]axis()->SetLimits([xy]min, [xy]max);” then execute the modified macro and you will immediately see that 3 points with X <= 1 are missing in the canvas.

BTW. I tried this macro with the newest ROOT 6.00/01. If I enable the line “Double_t xmin = 0.01, xmax = 50, ymin = 0.01, ymax = 50;” (just change the first “#if 0” into “#if 1”), I immediately get “*** Break *** segmentation violation”.

Ok it is reopen. Thanks.

1- Yes the histogram is deleted but it is clearly said with a warning. I guess there is a good reason to have done it this way. ie: redefining the histogram and printing a warning. I am not the author of this code. I cannot tell why.

2- I am getting a weird behaviour. Depending if SetEstimate is used or not I get the right limits or not . Again I am not the author of this code. Hard for me to tell why it behaves like that.

If you change “b:a:c>>h” into “b:a:c>>+h” you will also notice that even in this case, in which is it just supposed to “append data to an existing histogram”, it simply recreates the histogram. So maybe you could notify the one who is the “author of this code” that there are serious problems around.

P.S. Just to make it clear -> if “h” already exists then in case “b:a:c>>h” I expect that “h->Reset();” is automatically executed (just the integral, contents, errors, statistics, minimum and maximum of the histogram are “reset”, but everything else, including the binning, remains untouched).

I updated the reopened Jira report with your macro and explanation.
I also assigned it to the author of this code.

This is now fixed. See sft.its.cern.ch/jira/browse/ROOT-4508

Your fix seems to work well in case the “h” histogram was manually created be the user. =D>

There’s still a “display” problem in case when the automatically created “htemp” is used. :unamused:

In order to reproduce it, change the second “#if 1” into “#if 0” then run the macro. You will see all points drawn in the canvas. Then comment out BOTH lines “htemp->Get[XY]axis()->SetLimits([xy]min, [xy]max);” and execute the modified macro again and you will immediately see that 3 points with X <= 1 are missing in the canvas.

Ah yes you are right. It is not that the points are missing, it is limits which are not wide enough to let them appear.

It is a side effect due to the log scales.
If you turn off the log scales the points reappear.
I’ll check.

That was written in the original report, too. :wink:

That was to refresh my mind … :slight_smile:

I guess this is a “side effect” of the fact that “htemp->GetXaxis()->GetXmin()” returns 0 and then the procedure which creates the axis in logarithmic mode “misbehaves” (so this problem will appear for any histogram for which “Xmin == 0”, and it’s possible that the same will happen for the “Y” axis if “Ymin == 0”).

Yes very likely … I do not think it is connected to the other problem I fixed.
Anyway you example shows clearly the issue.

If I remember well … in the “old times”, also the point with the highest “X” was missing in the canvas, but some time ago (not that very long ago, several months maybe) you fixed something in the automatic procedure which calculates automatic axes limits and now this point is always present (but the 3 points with “X < 1” are still missing). But maybe I remember it wrong.

Yes may be. I have to refresh my mind on that. I am back from a vacations week and there is some urgent matters to look at.