From 15c48fd3b32330c33d0c16f3728b9b3993ac72d2 Mon Sep 17 00:00:00 2001 From: Lorenzo Moneta <Lorenzo.Moneta@cern.ch> Date: Wed, 12 Oct 2011 09:53:08 +0000 Subject: [PATCH] add missing SetBins for variable bin sizes (see http://root.cern.ch/phpBB3//viewtopic.php?f=3&t=13537 ) git-svn-id: http://root.cern.ch/svn/root/trunk@41350 27541ba8-7e3a-0410-8455-c3a389f83636 --- hist/hist/src/TProfile2D.cxx | 18 ++++++++++++------ hist/hist/src/TProfile3D.cxx | 19 +++++++++++-------- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/hist/hist/src/TProfile2D.cxx b/hist/hist/src/TProfile2D.cxx index 34e1c56ca65..b251af16f53 100644 --- a/hist/hist/src/TProfile2D.cxx +++ b/hist/hist/src/TProfile2D.cxx @@ -1751,15 +1751,21 @@ void TProfile2D::SetBinEntries(Int_t bin, Double_t w) //______________________________________________________________________________ void TProfile2D::SetBins(Int_t nx, Double_t xmin, Double_t xmax, Int_t ny, Double_t ymin, Double_t ymax) { -//*-*-*-*-*-*-*-*-*Redefine x axis parameters*-*-*-*-*-*-*-*-*-*-*-* +//*-*-*-*-*-*-*-*-*Redefine x and y axis parameters*-*-*-*-*-*-*-*-*-*-*-* //*-* =========================== - fXaxis.Set(nx,xmin,xmax); - fYaxis.Set(ny,ymin,ymax); - fNcells = (nx+2)*(ny+2); - SetBinsLength(fNcells); + TH1::SetBins(nx,xmin, xmax,ny, ymin,ymax); + fBinEntries.Set(fNcells); + if (fBinSumw2.fN) fBinSumw2.Set(fNcells); +} + +//______________________________________________________________________________ +void TProfile2D::SetBins(Int_t nx, const Double_t *xbins, Int_t ny, const Double_t *ybins) +{ +//*-*-*-*-*-*-*-*-*Redefine x and y axis parameters for variable bin sizes -*-*-*-*-*-*-* +//*-* =========================== + TH1::SetBins(nx,xbins,ny,ybins); fBinEntries.Set(fNcells); - fSumw2.Set(fNcells); if (fBinSumw2.fN) fBinSumw2.Set(fNcells); } diff --git a/hist/hist/src/TProfile3D.cxx b/hist/hist/src/TProfile3D.cxx index 7b86089a3b9..80162403af8 100644 --- a/hist/hist/src/TProfile3D.cxx +++ b/hist/hist/src/TProfile3D.cxx @@ -1270,19 +1270,22 @@ void TProfile3D::SetBinEntries(Int_t bin, Double_t w) //______________________________________________________________________________ void TProfile3D::SetBins(Int_t nx, Double_t xmin, Double_t xmax, Int_t ny, Double_t ymin, Double_t ymax, Int_t nz, Double_t zmin, Double_t zmax) { -//*-*-*-*-*-*-*-*-*Redefine x axis parameters*-*-*-*-*-*-*-*-*-*-*-* +// -*-*-*-*-*-*-*Redefine x, y and z axis parameters*-*-*-*-*-*-*-*-*-*-*-* //*-* =========================== - - fXaxis.Set(nx,xmin,xmax); - fYaxis.Set(ny,ymin,ymax); - fZaxis.Set(ny,zmin,zmax); - fNcells = (nx+2)*(ny+2)*(nz+2); + TH1::SetBins(nx, xmin, xmax, ny, ymin, ymax, nz, zmin, zmax); fBinEntries.Set(fNcells); - fSumw2.Set(fNcells); if (fBinSumw2.fN) fBinSumw2.Set(fNcells); } - +//______________________________________________________________________________ +void TProfile3D::SetBins(Int_t nx, const Double_t *xBins, Int_t ny, const Double_t *yBins, Int_t nz, const Double_t *zBins) +{ + // -*-*-*-*-*-*-*Redefine x, y and z axis parameters with variable bin sizes *-*-*-*-*-*-*-*-* + // ============================================================ + TH1::SetBins(nx,xBins,ny,yBins,nz,zBins); + fBinEntries.Set(fNcells); + if (fBinSumw2.fN) fBinSumw2.Set(fNcells); +} //______________________________________________________________________________ void TProfile3D::SetBuffer(Int_t buffersize, Option_t *) { -- GitLab