Histogram package
Modify implementation of the Fit function in the histograms and data classes to use a new common implementation, defined in the file HFitImpl.cxx. This file provides the implementation of the function used for bin fitting of the data objects of the histogram package, TH1's, TGraph, TMultiGraph, TGraph2D, and un-binned maximum likelihood fit for TTree data (used by the TTree::UnbinnedFit method).
HFitInterface.h
Header file defining functions in the namespace ROOT::Fit providing functions required for fitting the data objects of the histogram package. These functions are used for example from other libraries like the FitPanel or the TTreePlayer for performing the fits.
-
ROOT::Fit::FitObject: function for fitting the various data objects. The user must pass in addition to a pointer to the fit object, the fit options (via the FOption class and not a string), the minimizer options and the fit data range.
-
ROOT::Fit::FillData: function for filling the fit data from the histogram data objects. Used for fitting an histogram using the ROOT::Fit::Fitter class.
-
ROOT::Fit::UnBinFit:: function for fitting an unbinned data sets, for example obtained from TTree data.
TBackCompFitter
New class providing a backward compatible implementation of the
TVirtualFitter using the new fitting class. It is wrapping the functionality of the ROOT::Math::Fitter and it
can be used to retrieve the fit information (result and
configuration) via the
TVirtualFitter API from FitConfig and FitResult. A static instance of this class
is created after calling the histograms and graph Fit methods in order to retrieve the full fit information after having fit. This instace will be deleted only when the next fit is executed.
This gives full backward compatibility functionality in fitting.
This class in addition to the TVirtualFitter provides the following functionality:
- access direct to references to ROOT::Fit::FitResult and ROOT::FitConfig objects via the member functions TBackCompFitter::GetFitResult() and TBackCompFitter::GetFitConfig()
- Possibility to set the fit the fit function directly as a function pointer to a muldi-dimensional function interface instead of using the TMinuit FCN style API.
- New methods for making in a easy way contour , with TBackCompFitter::Contour, and scan plots of the objective function, with TBackCompFitter::Scan. Both Scan and Contour takes as input a TGraph which on exit will be filled with the scanned or contour points.
TH1
-
Re-implement TH1::Fit using the functions defined in HFitImpl.cxx.
- Add new function TH1::Interpolate to approximate the value via linear interpolation. Implementation from Any Mastbaum.
- Fixed a bug in rebinning in a new variable bin histogram.
- Fixed a bug in copy constructor of histograms
- define now kNstat as an enumeration in the TH1 class, to avoid using wrong values for this constant variable. This fixes a previous bug in TProfile3D
TH2
- Share a common implementation for (FitSlicesX,FitSclicesY) and (ProfileX, ProfileY) using a common protected method.
- Add possibility to be used in the FitPanel (add a TH2::FitPanel() method).
- Add also here the new function TH2::Interpolate.
- fix a bug in the resulting statistics in TH2::ProjectionX(Y) when all range was used
- fix a bug in getting the right axis and limits in TH2::ProfileX(Y)
TH3
- Add new option "NUF" and "NOF" in TH3::Project to have excluded the underflow/overflow (they are included by default).
- Add option "UF" and "OF" in TH3::ProjectProfile to include the underflow/overflow. By default they are now excluded while in the previous version they were included. This is consistent with the projection from a TH2.
-
Fixed a bug in TH3::Project reported by Marco Van Leeuwen in setting the bin error in the projected histogram when a range was set in the projected axis.
- Add possibility to be used in the FitPanel (add a TH3::FitPanel() method).
TProfile
- Fix a bug in TProfile::Rebin. The underflow and overflow were not properly taken into account
TProfile3D
- Fix a bug in the copy constructor and assignment operator
THnSparse
fix a bug in SetBinError
fix in THnSParse::Rebin
fix error calculation in Multiply
TGraph
-
Change the API of TGraph::GetPoint from
void TGraph::GetPoint(Int_t i, Double_t &x, Double_t &y) const
to
Int_t TGraph::GetPoint(Int_t i, Double_t &x, Double_t &y) const
The function returns -1 in case of an invalid request or the
point number otherwise.
- Re-implement TGraph::Fit using the functions defined in HFitImpl.cxx.
TGraph2D
- Re-implement TGraph2D::Fit using the functions defined in HFitImpl.cxx.
- Add possibility to be used in the FitPanel (add a TGraph2D::FitPanel() method).
TMultiGraph
- Re-implement TMultiGraph::Fit using the functions defined in
HFitImpl.cxx.
- Add possibility to be used in the FitPanel (add a
TMultiGraph::FitPanel() method).
- Protection added in Draw(): "Cannot draw empty TMultiGraph".
TGraphPainter
- When a histogram was drawn in a larger frame than its limits (using the
option "SAME"), the `outside' vertical lines for the first and last bins
were not drawn. The macro below demonstrates the problem:
{
TH1D h("h", "h", 10., 0., 1.);
h.SetBinContent(1, 1.);
h.SetBinContent(3, 1.);
h.SetBinContent(10, 1.);
h.SetFillColor(1001);
h.SetFillColor(kOrange-2);
h.SetLineColor(kBlack);
TCanvas canvas("canvas");
frame = canvas.DrawFrame(-1., 0., 2., 2.);
h.Draw("SAME");
}
TPaletteAxis
- New method Int_t TPaletteAxis::GetBinColor(Int_t i, Int_t j) to
return the color index of the bin (i,j).
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->GetBinColor(20,15);
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);
TFormula
-
Fixed a bug in TFormula::GetExprFormula. Now the correct formula is returned for expressions based on CINT type functions.
TF1
-
Fixed a bug in the calculation of the integral of multi-dimensional interpreted functions. The method TF1::operator() (const double *x, const double *p) calls now TF1::InitArgs in the case of CINT functions.
- Fixed a bug in using the TF1::GetMinimum(), TF1::GetMaximum(), TF1::GetMinimumX, TF1::GetMaximumX, TF1::GetX with default arguments.
- Fixed a bug when copying functions obtained from member functions of interpreted classes
THStack
-
In THStack::Paint() replace
fHistogram->Paint("axissame"); by
gPad->RedrawAxis(); in order to fix the bug described here:
https://savannah.cern.ch/bugs/?41423 .
The simple following macro was enough to show the problem:
{
TH1D h("h", "h", 10., 0., 1.); h.Fill(.5);
THStack s("s", "s"); s.Add(&h);
TCanvas canvas("canvas");
frame = canvas.DrawFrame(-1., 0., 2., 2.);
frame.SetLabelSize(0.05, "XY");
frame.Draw(); s.Draw("same");
}
- Make the data member fHistogram persistent in order to save the
axis attributes which may have been changed during a root session (like,
for instance, the axis titles).
- When a THStack is drawn with the option "pads", the number of lines is
now optimized to make sure there is no empty line.
TUnfold
-
Introduces this new class for solving inverse problems:
data histograms with Gaussian errors are decomposed into
several template distributions ("generator level" bins).
The result are new normalisation constants for the template
distributions (the unfolded "generator level" distribution).
The solution can be tuned by properly adjusting the
regularisation parameter tau. A standard method, the L-curve scan is
implemented to help finding a good choice of this parameter.
- Two example tutorials are included to show the usage of this class: tutorials/math/testUnfiold1.C and tutorials/math/testUnfiold2.C
FitPanel
Add a new revised version of the Fit Panel with the following functionality:
- Add support now for fitting, in addition to the TH1 and TGraph
also for TH2, TH3, TMultiGraph and TGraph2D and TTree (with un-binned
fits)
- Add possibility to select the data object directly from the Fit
panel. The Fit Panel can also be open directly from the TCanvas menu
(under Tools)
- Improve the function selection by having the possibility to
support user defined function, predefined functions and functions
used before for fitting.
- Allow the opening of the parameter dialog in case of linear
fitter. This is needed for example for fixing some of the
parameters
- Improve minimization panel by adding some extra methods, like
combined for a combined migrad-simplex minimization (option
"MINIMIZE" in Minuit).
- Improve the slider by adding a numeric entry.
- Add the Advanced Graphics dialog, that allows the user to perform
Contour and Scan operation on the last fit.
- Fix various bugs in setting the fit model function and in
setting the parameters (values, limits, etc..)
Here is how the fit panel is now:
These are the currently support methods for the new Advance Graphics dialog: