26d25
< #include "TProfile2D.h"
418,421d416
< <tt>TProfile2D</tt> histograms are handled differently because, for this type of 2D
< histograms, it is possible to know if an empty bin has been filled or not. So even
< if all the bins' contents are positive some empty bins might be painted. And vice versa,
< if some bins have a negative content some empty bins might be not painted.
1231,1235d1225
< <p><tt>TProfile2D</tt> histograms are handled differently because, for this type of 2D
< histograms, it is possible to know if an empty bin has been filled or not. So even
< if all the bins' contents are positive some empty bins might be painted. And vice versa,
< if some bins have a negative content some empty bins might be not painted.
< 
1603c1593
< 
---
>  
1659a1650
>    gStyle->SetPalette(1);
3232c3223
<    static char info[200];
---
>    static char info[100];
3292,3301c3283,3286
<       if (fH->InheritsFrom(TProfile::Class())) {
<          TProfile *tp = (TProfile*)fH;
<          snprintf(info,200,"(x=%g, y=%g, binx=%d, binc=%g, bine=%g, binn=%d)", x, y, binx, fH->GetBinContent(binx), fH->GetBinError(binx), (Int_t) tp->GetBinEntries(binx));
<       }
<       else {
<          Double_t integ = 0;
<          for (Int_t bin=binmin;bin<=binx;bin++) {integ += fH->GetBinContent(bin);}
<          snprintf(info,200,"(x=%g, y=%g, binx=%d, binc=%g, Sum=%g)",x,y,binx,fH->GetBinContent(binx),integ);
<       }
<    } else if (fH->GetDimension() == 2){
---
>       Double_t integ = 0;
>       for (Int_t bin=binmin;bin<=binx;bin++) {integ += fH->GetBinContent(bin);}
>       snprintf(info,100,"(x=%g, y=%g, binx=%d, binc=%g, Sum=%g)",x,y,binx,fH->GetBinContent(binx),integ);
>    } else {
3305,3311c3290
<          snprintf(info,200,"%s (x=%g, y=%g, bin=%d, binc=%g)",th2->GetBinTitle(biny),x,y,biny,th2->GetBinContent(biny));
<       } 
<       else if (fH->InheritsFrom(TProfile2D::Class())) {
<          TProfile2D *tp = (TProfile2D*)fH;
<          biny = fYaxis->FindFixBin(y);
<          Int_t bin = fH->GetBin(binx,biny);
<          snprintf(info,200,"(x=%g, y=%g, binx=%d, biny=%d, binc=%g, bine=%g, binn=%d)", x, y, binx, biny, fH->GetBinContent(bin), fH->GetBinError(bin), (Int_t) tp->GetBinEntries(bin));
---
>          snprintf(info,100,"%s (x=%g, y=%g, bin=%d, binc=%g)",th2->GetBinTitle(biny),x,y,biny,th2->GetBinContent(biny));
3314c3293
<          snprintf(info,200,"(x=%g, y=%g, binx=%d, biny=%d, binc=%g)",x,y,binx,biny,fH->GetBinContent(binx,biny));
---
>          snprintf(info,100,"(x=%g, y=%g, binx=%d, biny=%d, binc=%g)",x,y,binx,biny,fH->GetCellContent(binx,biny));
3316,3319d3294
<    } else { 
<       // 3d case: retrieving the x,y,z bin is not yet implemented 
<       // print just the x,y info
<       snprintf(info,200,"(x=%g, y=%g)",x,y);
3374d3348
<    Int_t hdim = fH->GetDimension();
3400c3374
<    if (hdim > 1) Hoption.Scat = 1;
---
>    if (fH->GetDimension() > 1) Hoption.Scat = 1;
3403c3377
<    if (fH->GetSumw2N() && hdim == 1) Hoption.Error = 2;
---
>    if (fH->GetSumw2N() && fH->GetDimension() == 1) Hoption.Error = 2;
3505,3516c3479,3485
<       strncpy(l,"    ",4);
<       if (hdim>1) {
<          Hoption.Scat = 0;
<          Hoption.Contour = 1;
<          if (l[4] == '1') { Hoption.Contour = 11; l[4] = ' '; }
<          if (l[4] == '2') { Hoption.Contour = 12; l[4] = ' '; }
<          if (l[4] == '3') { Hoption.Contour = 13; l[4] = ' '; }
<          if (l[4] == '4') { Hoption.Contour = 14; l[4] = ' '; }
<          if (l[4] == '5') { Hoption.Contour = 15; l[4] = ' '; }
<       } else {
<          Hoption.Hist = 1;
<       }
---
>       Hoption.Scat = 0;
>       Hoption.Contour = 1; strncpy(l,"    ",4);
>       if (l[4] == '1') { Hoption.Contour = 11; l[4] = ' '; }
>       if (l[4] == '2') { Hoption.Contour = 12; l[4] = ' '; }
>       if (l[4] == '3') { Hoption.Contour = 13; l[4] = ' '; }
>       if (l[4] == '4') { Hoption.Contour = 14; l[4] = ' '; }
>       if (l[4] == '5') { Hoption.Contour = 15; l[4] = ' '; }
3537,3546c3506
<    l = strstr(chopt,"ARR" );
<    if (l) {
<       strncpy(l,"   ", 3);
<       if (hdim>1) {
<          Hoption.Arrow  = 1;
<          Hoption.Scat = 0;
<       } else {
<          Hoption.Hist = 1;
<       }
<    }
---
>    l = strstr(chopt,"ARR" ); if (l) { Hoption.Arrow  = 1; strncpy(l,"   ", 3); Hoption.Scat = 0; }
3549,3577c3509,3511
<       strncpy(l,"   ", 3);
<       if (hdim>1) {
<          Hoption.Scat = 0;
<          Hoption.Box  = 1;
<          if (l[3] == '1') { Hoption.Box = 11; l[3] = ' '; }
<       } else {
<          Hoption.Hist = 1;
<       }
<    }
<    l = strstr(chopt,"COLZ");
<    if (l) {
<       strncpy(l,"    ",4);
<       if (hdim>1) {
<          Hoption.Color  = 2;
<          Hoption.Scat   = 0;
<          Hoption.Zscale = 1;
<       } else {
<          Hoption.Hist = 1;
<       }
<    }
<    l = strstr(chopt,"COL" );
<    if (l) {
<       strncpy(l,"   ", 3);
<       if (hdim>1) {
<          Hoption.Color = 1;
<          Hoption.Scat  = 0;
<       } else {
<          Hoption.Hist = 1;
<       }
---
>       Hoption.Scat = 0;
>       Hoption.Box  = 1; strncpy(l,"   ", 3);
>       if (l[3] == '1') { Hoption.Box = 11; l[3] = ' '; }
3578a3513,3514
>    l = strstr(chopt,"COLZ"); if (l) { Hoption.Color  = 2; strncpy(l,"    ",4); Hoption.Scat = 0; Hoption.Zscale = 1;}
>    l = strstr(chopt,"COL" ); if (l) { Hoption.Color  = 1; strncpy(l,"   ", 3); Hoption.Scat = 0; }
3654c3590
<       if (hdim == 1) {
---
>       if (fH->GetDimension() == 1) {
3972c3908
<                dx = fH->GetBinContent(i+1, j) - fH->GetBinContent(i, j);
---
>                dx = fH->GetCellContent(i+1, j) - fH->GetCellContent(i, j);
3974c3910
<                dx = fH->GetBinContent(i, j) - fH->GetBinContent(i-1, j);
---
>                dx = fH->GetCellContent(i, j) - fH->GetCellContent(i-1, j);
3976c3912
<                dx = 0.5*(fH->GetBinContent(i+1, j) - fH->GetBinContent(i-1, j));
---
>                dx = 0.5*(fH->GetCellContent(i+1, j) - fH->GetCellContent(i-1, j));
3979c3915
<                dy = fH->GetBinContent(i, j+1) - fH->GetBinContent(i, j);
---
>                dy = fH->GetCellContent(i, j+1) - fH->GetCellContent(i, j);
3981c3917
<                dy = fH->GetBinContent(i, j) - fH->GetBinContent(i, j-1);
---
>                dy = fH->GetCellContent(i, j) - fH->GetCellContent(i, j-1);
3983c3919
<                dy = 0.5*(fH->GetBinContent(i, j+1) - fH->GetBinContent(i, j-1));
---
>                dy = 0.5*(fH->GetCellContent(i, j+1) - fH->GetCellContent(i, j-1));
4677d4612
<    TProfile2D* prof2d = dynamic_cast<TProfile2D*>(fH);
4688,4698c4623
<          // if fH is a profile histogram do not draw empty bins
<          if (prof2d) {
<             const Double_t binEntries = prof2d->GetBinEntries(bin);
<             if (binEntries == 0)
<                continue;
<          } else {
<             // don't draw the empty bins for non-profile histograms
<             // with positive content
<             if (z == 0 && (zmin >= 0 || Hoption.Logz)) continue;
<          }
< 
---
>          if (z == 0 && (zmin >= 0 || Hoption.Logz)) continue; // don't draw the empty bins for histograms with positive content
5503c5428
<       xyerror = 0;
---
>       xyerror = 0 ;
6660c6585
<       return;
---
>       return ;
6663c6588
<    if (Hoption.System != kCARTESIAN) return;
---
>    if (Hoption.System != kCARTESIAN) return ;
7221c7146
<                        GetBestFormat(fit->GetParameter(ipar), fit->GetParError(ipar), stats->GetFitFormat()));
---
>                         GetBestFormat(fit->GetParameter(ipar), fit->GetParError(ipar), stats->GetFitFormat()));
7223c7148
<                                ,(Float_t)fit->GetParError(ipar));
---
>                         ,(Float_t)fit->GetParError(ipar));
7412,7427c7337,7345
<       Int_t cellsX = h2->GetXaxis()->GetNbins() + 1;
<       Int_t cellsY = h2->GetYaxis()->GetNbins() + 1;
<       Int_t firstX = std::max(1, h2->GetXaxis()->GetFirst());
<       Int_t firstY = std::max(1, h2->GetYaxis()->GetFirst());
<       Int_t lastX  = std::min(h2->GetXaxis()->GetLast(), h2->GetXaxis()->GetNbins());
<       Int_t lastY  = std::min(h2->GetYaxis()->GetLast(), h2->GetYaxis()->GetNbins());
< 
<       unov[0] = h2->Integral(      0, firstX-1, lastY+1, cellsY  );
<       unov[1] = h2->Integral(firstX , lastX   , lastY+1, cellsY  );
<       unov[2] = h2->Integral(lastX+1, cellsX  , lastY+1, cellsY  );
<       unov[3] = h2->Integral(      0, firstX-1, firstY , lastY   );
<       unov[4] = h2->Integral(firstX , lastX   , firstY , lastY   );
<       unov[5] = h2->Integral(lastX+1, cellsX  , firstY , lastY   );
<       unov[6] = h2->Integral(      0, firstX-1,       0, firstY-1);
<       unov[7] = h2->Integral(firstX, lastX,           0, firstY-1);
<       unov[8] = h2->Integral(lastX+1, cellsX  ,       0, firstY-1);
---
>       unov[0] = h2->Integral(0,h2->GetXaxis()->GetFirst()-1,h2->GetYaxis()->GetLast()+1,h2->GetYaxis()->GetNbins()+1);
>       unov[1] = h2->Integral(h2->GetXaxis()->GetFirst(),h2->GetXaxis()->GetLast(),h2->GetYaxis()->GetLast()+1,h2->GetYaxis()->GetNbins()+1);
>       unov[2] = h2->Integral(h2->GetXaxis()->GetLast()+1,h2->GetXaxis()->GetNbins()+1,h2->GetYaxis()->GetLast()+1,h2->GetYaxis()->GetNbins()+1);
>       unov[3] = h2->Integral(0,h2->GetXaxis()->GetFirst()-1,h2->GetYaxis()->GetFirst(),h2->GetYaxis()->GetLast());
>       unov[4] = h2->Integral(h2->GetXaxis()->GetFirst(),h2->GetXaxis()->GetLast(),h2->GetYaxis()->GetFirst(),h2->GetYaxis()->GetLast());
>       unov[5] = h2->Integral(h2->GetXaxis()->GetLast()+1,h2->GetXaxis()->GetNbins()+1,h2->GetYaxis()->GetFirst(),h2->GetYaxis()->GetLast());
>       unov[6] = h2->Integral(0,h2->GetXaxis()->GetFirst()-1,0,h2->GetYaxis()->GetFirst()-1);
>       unov[7] = h2->Integral(h2->GetXaxis()->GetFirst(),h2->GetXaxis()->GetLast(),0,h2->GetYaxis()->GetFirst()-1);
>       unov[8] = h2->Integral(h2->GetXaxis()->GetLast()+1,h2->GetXaxis()->GetNbins()+1,0,h2->GetYaxis()->GetFirst()-1);
9042c8960
<          c1 = fH->GetBinContent(i,j);
---
>          c1 = fH->GetCellContent(i,j);
9045c8963
<             e1 = fH->GetBinError(i,j);
---
>             e1 = fH->GetCellError(i,j);
