### Histogram package

#### TPaletteAxis

- New method `Int_t TPaletteAxis::GetValueColor(z)` to return the color index of the given z value.
  This function should be used after an histogram has been plotted with the option COL or COLZ like in the following example:

             h2->Draw("COLZ");
             gPad->Update();
             TPaletteAxis *palette =
                (TPaletteAxis*)h2->GetListOfFunctions()->FindObject("palette");
             Int_t ci = palette->GetValueColor(30.);

  Then it is possible to retrieve the RGB components in the following way:

             TColor *c = gROOT->GetColor(ci);
             float x,y,z;
             c->GetRGB(x,y,z);

  This function is used by `TPaletteAxis::GetBinColor()`.

#### TAxis

- Implement a new function, `TAxis::GetBinCenterLog(Int_t bin)`, as suggested at the issue #8263.

#### TGraph

- When adding an object in the list of functions of a `TGraph`, there was a crash at the `TGraph` drawing time if the fitting option (`gStyle->SetOptFit(1)`) was on. This was reported in: https://savannah.cern.ch/bugs/?46525 The following macro reproduces the problem:

           {
              gStyle->SetOptFit(1);
              TGraph *gr = new TGraph(2);
              gr->SetPoint(0,1,1);
              gr->SetPoint(1,2,2);
              TLatex *l1 = new TLatex(gr->GetX()[0], gr->GetY()[0], "#1");
              gr->GetListOfFunctions()->Add(l1);
              gr->Draw("APL");
           }

- Fixed the bug #45607 by creating a list of functions when using TGraph default constructor.
- Fixed a bug when fitting TGraphErrors with zero error in y but non-zero error in x
- In GetHistogram: if fHistogram exists, and the log scale is on, and the computed range minimum is > 0, and the fHistogram minimum is zero, then it means fHistogram limits have been computed in linear scale therefore they might be too strict and cut some points. In that case the fHistogram limits should be recomputed ie: the existing fHistogram should not be returned. A example covering this case has been added in stressGraphics.

#### TH1

- Speed up `TH1::GetStats, TH2::GetStats, TH3::GetStats` in case the sum of weights is null and the number of entries is also null
- Optimize the way the function integral is computed in `TH1::FillRandom`
- Add new functions `TH1::IsBinUnderflow(bin)` and `TH1::IsBinOverflow(bin)` which use the global bin number.
- Add new functions `Int_t TH1::FindFirstBinAbove(Double_t threshold, Int_t axis)` and `Int_t TH1::FindLastBinAbove(Double_t threshold, Int_t axis)` which find first (and last) bin with the content above the given threshold. Same function have been added in TH2 and TH3.
- Add a protection in TH1::Sumw2() to avoid calling GetBinContent when the histograms are empty.
- In TH1::Copy reset temporarily the kCanRebin bit before calling SetBinContent.
- Fix the bug #48649in TH1::Add.
- Fix a bug when calling TH1::Sumw2() on a non-empty histogram with default sum2 (i.e when TH1::GetDefaultSumw2() is true).
- Add a method, `TH1::ResetStats()` to reset the internal statistics and force then the re-calculation suing the bin center first time is needed
- Fix some problem with the statistics (in particular the number of entries) after some of the histogram operations

#### TH2

- Consider in the projection of TH2 the axis range set by the user. This fix the issue https://savannah.cern.ch/bugs/index.php?47946
- Add a new option, option "o", in the projection methods: `TH2::ProjectionX`, `TH2::ProjectionY`, `TH2::ProfileX` and `TH2::ProfileY`. When an axis range is set, using option "o", the original axis range of the taget axes will be kept, but only the bins inside the selected range will be filled, while bins outside the range will be empty.

#### TH3

- Add implementation of `TH3::Interpolate` using a tri-linear interpolation method
- Fix a bug in TH3::Project3D (https://savannah.cern.ch/bugs/?46432) for the error calculation in case of weighted histogram (or when using option "E") and no axis range is set.
- In the projection to Profile's, when Sumw2 is set, have the correct projected errors now with the new TProfile data member.
- Add `TH3::ProjectionX` and TH3::ProjectionY to complement the already existing ProjectionZ. They are all impelmented using the Project3D method.
- Re-implement the `TH3::Project3D` method using the internal methods DoProject1D and DoProject2D depending on the option. This new implementation is faster in case sub-ranges are selected and fix this issue (https://savannah.cern.ch/bugs/index.php?45494).
- A similar new implementation is done for `TH3::ProjectProfile`.
- Add the new option "o", as in `TH2` for the histogram and profile projections.

#### TProfile, TProfile2D, TProfile3D

- Add a new data member (TArrayD fBinSumw2) for storing the sum of weight square per bin. This is needed for correct error calculation in case of profile filled with weights different than 1. The new structure is filled only when TProfile::Sumw2() is called or when TH1::SetDefaultSumw2() is set.
- Add a new internal class, `TProfileHelper` for providing a common implementations for all TProfile classes for complex methods like Add and Merge.
- Fix a bug in `TProfile::GetStats` method.

#### THnSparse

- Fix a bug where the axes of a THnSparse created by THnSparse::Projection() would be filled wrongly if the axis's range was set.
- Fix a bug where the TAxis::kAxisRange bit was not reset for the new TH1/2/3 axes created by THnSparse::Projection(), if the original axis had a range and "A" was not given.
- Implement new option "O" for Projection(): respect the range set for the target axis (i.e. only project bins that are in range) but create the target histogram with the full axis.
- Fix a bug in the multiplication of THnSparse.
- Fix a bug whe creating with a given set of axis. Ensure that the first bin of the axis is >= 1.

#### THistPainter

- In case the errors of the fit parameters had large values (>E+07) the errors in the fit box looked weird. The Method GetBestFormat has been changed. The problem was visible with the following macro:

           {
              gStyle->SetOptFit(1111);
              h = new TH1F("h","h", 2,0.,1.);
              h->SetBinContent(1, 5E8);
              h->SetBinError(1, 4.9E8);
              h->Fit("pol0");
           }

- In `THistPainter::PaintAxis` repainting (`gPad->RedrawAxis()`) alphanumeric labels axis on a plot done with the option HBAR (horizontal) needed some adjustements. The following macro showed the problem. The axis labels were wrongly painted:

           {
              TCanvas* canvas = new TCanvas("Canvas", "Canvas", 0, 0, 1000, 500);
              canvas->Divide(2,1);
              THStack* stack = new THStack("Stack", "StackTitle");
              TH1F* hist1 = new TH1F("Hist1", "Title1", 1, 0, 100);
              TH1F* hist2 = new TH1F("Hist2", "Title2", 1, 0, 100);
              hist1->SetFillColor(kBlack);
              hist2->SetFillColor(kGray);
              for (int i = 0; i < 4; ++i) {
                 char dataName[50];
                 sprintf(dataName, "Data%d", i);
                 hist1->Fill(dataName, 10 + 50*i);
                 hist2->Fill(dataName, 145 - 40*i);
              }
              stack->Add(hist1);
              stack->Add(hist2);
              canvas->cd(1); stack->Draw("nostack,bar");
              canvas->cd(2); stack->Draw("nostack,hbar");
           }

- In `THistPainter::PaintTriangles` if the option SAME is used, the view limits are taken from the current TView.

#### TGraphPainter

- The painting option "][" did not work if the frame line width (set with gStyle->SetFrameLineWidth()) was bigger than 1.
- The clipping in case of option "same" was not correct since the move from TGraph to TGraphPainter. The following small example showed the problem:

              {
                 TH1F * h1 = new TH1F("h1", "h1", 100, -3., 3.);
                 TH1F * h2 = new TH1F("h2", "h2", 100, -3., 3.);
                 h1->FillRandom("gaus", 5000);
                 h2->FillRandom("gaus", 4000);
                 h1->SetMaximum(100);
                 h1->Draw();
                 h2->Draw("same");
              }

- In some case, when a graph had some vertical parts, the exclusion zone was not drawn correctly. The following small example shows the problem:

              {
                  TCanvas *c1 = new TCanvas();
                  gPad->DrawFrame(-1,-1,3,3);

                  TGraph * graph=new TGraph(3);
                  graph->SetFillColor(3);
                  graph->SetFillStyle(3001);
                  graph->SetLineWidth(2000);

                  graph->SetPoint(0,1.,1.);
                  graph->SetPoint(1,1.,0);
                  graph->SetPoint(2,0.,0.);
                  graph->Draw("*L");
               }

#### TUnfold

- Add a new version. A new class `TUnfoldSys` provides support for the propagation of systematic errors.
- Some bugs were also fixed due to multiplication of addition of sparse matrices.

#### Fitting Methods

- Introduce a better treatment of the step size used when fitting an object with a TF1. Use now by default is not zero the error provided by TF1. In case of limits use an appropriate step size to avoid Minuit to go over the limits.
- Fix bug https://savannah.cern.ch/bugs/?45909 when fitting with bad range values (outside the histogram range).
- detect the case when the data set is empty and don't perform any minimizationin this case but exits from fitting and produce a warning message
- Fix a bug when fitting histograms with option W and the bin errors are = 0.
- Fix a bug in the InitGaus function when having only one data point (see https://savannah.cern.ch/bugs/?48936)
- Fix a bug in calculating the error on the integral after having fitted when fix parameters were present
- Fix a bug in calculating the confidence intervas when the number of bins for the given object is different from the number of bins of the fitted object.

#### FitPanel

- Add support for drawing the fit function confidence levels.
- Make gaus the default function when fitting 1D objects.
- Add GSL minimizer and use now a new widget for showing and selecting the list of available algorithms according to the minimizer.