Why the max phi sectors is 180 in TPainter3dAlgorithms?

for phi is 2pi, so the min bin is 2 degree?

in TPainter3dAlgorithms.cxx

if (nphi > 180) {
      Error("SurfacePolar", "too many PHI sectors (%d)", nphi);
      return;
   }

ROOT Version: 6
Platform: Not Provided
Compiler: Not Provided


I will ask the author of this code.

Thank you very much.

There is no particular reason. This value has been inherited from FORTRAN era. Can be increased, if required.

Hi Evgeni, thanks for your answer. So you suggest to change 180 to 360 ?

@lichuanlong is this really a blocker for you ? after discussion with Evgeni it appears that it is not enough to change only 180 to 360 in that test but it also implies more memory allocation in some other part of this code. So, unless you have a real issue you cannot work around, I will leave it like that.

Yes ,it is a blocker for me.
When I draw a hist with x->phi, y->r, ROOT will give me a full circle, the range of x only have 180 bins(max).
But the full circle has 360 degree, if setting 1 degree per bin, so the picture seem to be not right.
If setting 2 degree per bin, picture seem right, but it is not 1degree per bin.
@couet

I think the max phi sectors number should be 360 at least.
If so one needs to draw 0.5 degree per bin, 720 will be needed.

Can you provide a small macro reproducing the problem ?

Let me have a try.:v:

draw2dopt.C (781 Bytes)

// modified from draw2dopt.C
// h2 has 180 x bins and 10 y bins.
// but ROOT draw a picture with a full circle.
void draw2dopt()
{
   gStyle->SetOptStat(0);
   gStyle->SetCanvasColor(33);
   gStyle->SetFrameFillColor(18);
   auto h2 = new TH2F("h2","test",180,0,180,10,0,10);
   for (Int_t i=0; i<180; i++) {
     for (Int_t j=0; j<10; j++) {
       h2->Fill(i,j,i+j); 
     }
   }
   auto pl = new TPaveLabel();

   Float_t xMin=0.67, yMin=0.875, xMax=0.85, yMax=0.95;
   Int_t cancolor = 17;

   //lego options
   auto lego = new TCanvas("lego","lego options",150,150,800,600);
   lego->SetFillColor(cancolor);
   lego->cd(1);
   gPad->SetTheta(61); gPad->SetPhi(-82);
   h2->Draw("surf1pol"); pl->DrawPaveLabel(xMin,yMin,xMax+0.05,yMax,"SURF1POL","brNDC");
   lego->Update();
}

if 180 x bins means 180 degree, the full circle is not right.

@tcherniaev: Can you have a look and may be submit a pull request ?

I’ll look and try to fix the issue.

@tcherniaev fixed this issue. His fix is now merged in the master.

The limitation on max number of phi sectors has been removed, see pull request #2265

Thank you very much.

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