Example to use chi2 test for comparing two histograms One unweighted histogram is compared with a weighted histogram. 
The normalized residuals are retrieved and plotted in a simple graph. The QQ plot of the normalized residual using the normal distribution is also plotted.
  
Chi2 = 21.085124, Prob = 0.332116, NDF = 19, igood = 1
(TCanvas *) 0x55f074cca3d0
   
 
{
   
   
   
 
   
 
 
 
 
 
 
   
 
   
   for (
Int_t i=0; i<
n; i++) 
x[i]= 4.+i*12./20.+12./40.;
 
   resgr->
SetTitle(
"Normalized Residuals");
 
 
   
   TF1 *
f = 
new TF1(
"f",
"TMath::Gaus(x,0,1)",-10,10);
 
   qqplot->
SetTitle(
"Q-Q plot of Normalized Residuals");
 
 
   
 
   
 
 
 
 
 
 
}
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
 
virtual void SetMarkerStyle(Style_t mstyle=1)
Set the marker style.
 
virtual void SetMarkerSize(Size_t msize=1)
Set the marker size.
 
virtual void SetRangeUser(Double_t ufirst, Double_t ulast)
Set the viewing range for the axis from ufirst to ulast (in user coordinates).
 
This class allows to draw quantile-quantile plots.
 
A Graph is a graphics object made of two arrays X and Y with npoints each.
 
virtual void SetTitle(const char *title="")
Change (i.e.
 
virtual void Draw(Option_t *chopt="")
Draw this graph with its current attributes.
 
TAxis * GetXaxis() const
Get x axis of the graph.
 
TAxis * GetYaxis() const
Get y axis of the graph.
 
1-D histogram with a double per channel (see TH1 documentation)}
 
virtual void SetTitle(const char *title)
See GetStatOverflows for more information.
 
virtual Double_t Chi2Test(const TH1 *h2, Option_t *option="UU", Double_t *res=0) const
test for comparing weighted and unweighted histograms
 
virtual void SetBinError(Int_t bin, Double_t error)
Set the bin Error Note that this resets the bin eror option to be of Normal Type and for the non-empt...
 
virtual void SetBinContent(Int_t bin, Double_t content)
Set bin content see convention for numbering bins in TH1::GetBin In case the bin number is greater th...
 
virtual void Draw(Option_t *option="")
Draw this histogram with options.
 
virtual void SetEntries(Double_t n)
 
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
 
- Author
 - Nikolai Gagunashvili, Daniel Haertl, Lorenzo Moneta 
 
Definition in file chi2test.C.