Dear experts,
I found a bug with the “pol” option of the TH2::Draw method for recent ROOT versions (6.36 and later). My guess is that something goes wrong with the mapping from the polar coordinate to the Cartesian coordinate.
The attached plots are produced by running a macro coded below in different ROOT versions:
{
auto c1 = new TCanvas("c1", "Polar Histogram", 600, 600);
auto h = new TH2D("h", Form("Version %s", gROOT->GetVersion()), 100, -12, 12, 100, -12, 12);
auto h2 = new TH2D("h2", "Polar Plot", 50, -1*TMath::Pi(), TMath::Pi(), 50, 5, 10);
gRandom->SetSeed(10);
for (int i = 0; i < 50000; i++) {
double angle = gRandom->Uniform(-TMath::Pi(), TMath::Pi());
double radius = gRandom->Uniform(5, 10);
h2->Fill(angle, radius);
}
h->Draw("");
h2->Draw("SAME COLZ POL");
}
Here, the region with 5 < \sqrt{x^2+y^2} < 10 in the histogram must be filled in the full -\pi<\theta<\pi range, as is the case for version 6.34. However, the attached plots produced by 6.36 and 6.38 are filled with the wrong radius only in the limited angle range.
All these plots were produced inside a container environment distributed on DockerHub, rootproject/root.
Tested versions used to produce the plots are
-
docker://rootproject/root:6.38.00-ubuntu25.10
-
docker://rootproject/root:6.36.00-ubuntu25.04
-
docker://rootproject/root:6.34.00-ubuntu24.10
Best regards,
Atsushi


