Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion hist/histpainter/inc/TPainter3dAlgorithms.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ class TPainter3dAlgorithms : public TObject, public TAttLine, public TAttFill {
private:
Double_t fRmin[3]; /// Lower limits of lego
Double_t fRmax[3]; /// Upper limits of lego
Double_t fAphi[183]; ///
Double_t *fAphi; ///
Int_t fNaphi; /// Size of fAphi
Int_t fSystem; /// Coordinate system
Int_t *fColorMain; ///
Int_t *fColorDark; ///
Expand Down
71 changes: 51 additions & 20 deletions hist/histpainter/src/TPainter3dAlgorithms.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ ClassImp(TPainter3dAlgorithms);
TPainter3dAlgorithms::TPainter3dAlgorithms(): TObject(), TAttLine(1,1,1), TAttFill(1,0)
{
Int_t i;
fAphi = 0;
fNaphi = 0;
fIfrast = 0;
fMesh = 1;
fRaster = 0;
Expand Down Expand Up @@ -124,7 +126,6 @@ TPainter3dAlgorithms::TPainter3dAlgorithms(): TObject(), TAttLine(1,1,1), TAttFi
for (i=0;i<2*NumOfSlices;i++) { fU[i] = 0.; fD[i] = 0.; }
for (i=0;i<12;i++) { fVls[i] = 0.; }
for (i=0;i<257;i++) { fFunLevel[i] = 0.; }
for (i=0;i<183;i++) { fAphi[i] = 0.; }
for (i=0;i<8;i++) { fF8[i] = 0.; }

fLoff = 0;
Expand Down Expand Up @@ -163,6 +164,8 @@ TPainter3dAlgorithms::TPainter3dAlgorithms(Double_t *rmin, Double_t *rmax, Int_t
Int_t i;
Double_t psi;

fAphi = 0;
fNaphi = 0;
fIfrast = 0;
fMesh = 1;
fRaster = 0;
Expand Down Expand Up @@ -207,7 +210,6 @@ TPainter3dAlgorithms::TPainter3dAlgorithms(Double_t *rmin, Double_t *rmax, Int_t
for (i=0;i<2*NumOfSlices;i++) { fU[i] = 0.; fD[i] = 0.; }
for (i=0;i<12;i++) { fVls[i] = 0.; }
for (i=0;i<257;i++) { fFunLevel[i] = 0.; }
for (i=0;i<183;i++) { fAphi[i] = 0.; }
for (i=0;i<8;i++) { fF8[i] = 0.; }

fLoff = 0;
Expand Down Expand Up @@ -247,6 +249,7 @@ TPainter3dAlgorithms::TPainter3dAlgorithms(Double_t *rmin, Double_t *rmax, Int_t

TPainter3dAlgorithms::~TPainter3dAlgorithms()
{
if (fAphi) { delete [] fAphi; fAphi = 0; }
if (fRaster) { delete [] fRaster; fRaster = 0; }
if (fNStack > kVSizeMax) {
delete [] fColorMain;
Expand Down Expand Up @@ -2446,8 +2449,14 @@ void TPainter3dAlgorithms::LegoPolar(Int_t iordr, Int_t na, Int_t nb, const char
nr = nb;
nphi = na;
}
if (nphi > 180) {
Error("LegoPolar", "too many PHI sectors (%d)", nphi);
if (fNaphi < nphi + 3) {
if (fAphi) { delete [] fAphi; fAphi = 0; }
fNaphi = nphi + 3;
fAphi = new Double_t[fNaphi];
}
if (fAphi == 0) {
Error("LegoPolar", "failed to allocate array fAphi[%d]", fNaphi);
fNaphi = 0;
return;
}
iopt = 2;
Expand Down Expand Up @@ -2658,8 +2667,14 @@ void TPainter3dAlgorithms::LegoCylindrical(Int_t iordr, Int_t na, Int_t nb, cons
nz = nb;
nphi = na;
}
if (nphi > 180) {
Error("LegoCylindrical", "too many PHI sectors (%d)", nphi);
if (fNaphi < nphi + 3) {
if (fAphi) { delete [] fAphi; fAphi = 0; }
fNaphi = nphi + 3;
fAphi = new Double_t[fNaphi];
}
if (fAphi == 0) {
Error("LegoCylindrical", "failed to allocate array fAphi[%d]", fNaphi);
fNaphi = 0;
return;
}
iopt = 2;
Expand Down Expand Up @@ -2874,12 +2889,14 @@ void TPainter3dAlgorithms::LegoSpherical(Int_t ipsdr, Int_t iordr, Int_t na, Int
nth = nb;
nphi = na;
}
if (nth > 180) {
Error("LegoSpherical", "too many THETA sectors (%d)", nth);
return;
if (fNaphi < nth + 3 || fNaphi < nphi + 3) {
if (fAphi) { delete [] fAphi; fAphi = 0; }
fNaphi = TMath::Max(nth, nphi) + 3;
fAphi = new Double_t[fNaphi];
}
if (nphi > 180) {
Error("LegoSpherical", "too many PHI sectors (%d)", nphi);
if (fAphi == 0) {
Error("LegoSpherical", "failed to allocate array fAphi[%d]", fNaphi);
fNaphi = 0;
return;
}
iopt = 2;
Expand Down Expand Up @@ -3725,8 +3742,14 @@ void TPainter3dAlgorithms::SurfacePolar(Int_t iordr, Int_t na, Int_t nb, const c
nr = nb;
nphi = na;
}
if (nphi > 180) {
Error("SurfacePolar", "too many PHI sectors (%d)", nphi);
if (fNaphi < nphi + 3) {
if (fAphi) { delete [] fAphi; fAphi = 0; }
fNaphi =nphi + 3;
fAphi = new Double_t[fNaphi];
}
if (fAphi == 0) {
Error("SurfacePolar", "failed to allocate array fAphi[%d]", fNaphi);
fNaphi = 0;
return;
}
iopt = 2;
Expand Down Expand Up @@ -3848,8 +3871,14 @@ void TPainter3dAlgorithms::SurfaceCylindrical(Int_t iordr, Int_t na, Int_t nb, c
nz = nb;
nphi = na;
}
if (nphi > 180) {
Error("SurfaceCylindrical", "too many PHI sectors (%d)", nphi);
if (fNaphi < nphi + 3) {
if (fAphi) { delete [] fAphi; fAphi = 0; }
fNaphi =nphi + 3;
fAphi = new Double_t[fNaphi];
}
if (fAphi == 0) {
Error("SurfaceCylindrical", "failed to allocate array fAphi[%d]", fNaphi);
fNaphi = 0;
return;
}
iopt = 2;
Expand Down Expand Up @@ -3963,12 +3992,14 @@ void TPainter3dAlgorithms::SurfaceSpherical(Int_t ipsdr, Int_t iordr, Int_t na,
nth = nb;
nphi = na;
}
if (nth > 180) {
Error("SurfaceSpherical", "too many THETA sectors (%d)", nth);
return;
if (fNaphi < nth + 3 || fNaphi < nphi + 3) {
if (fAphi) { delete [] fAphi; fAphi = 0; }
fNaphi = TMath::Max(nth, nphi) + 3;
fAphi = new Double_t[fNaphi];
}
if (nphi > 180) {
Error("SurfaceSpherical", "too many PHI sectors (%d)", nphi);
if (fAphi == 0) {
Error("SurfaceSpherical", "failed to allocate array fAphi[%d]", fNaphi);
fNaphi = 0;
return;
}
iopt = 2;
Expand Down