'LIKELIHOOD AND MINIMIZATION' RooFit tutorial macro #609
Setting up a chi^2 fit to an unbinned dataset with X,Y,err(Y) values (and optionally err(X) values)
Processing /mnt/build/workspace/root-makedoc-v610/rootspi/rdoc/src/v6-10-00-patches/tutorials/roofit/rf609_xychi2fit.C...
void rf609_xychi2fit()
{
for (int i=0 ; i<=10 ; i++) {
x = -10 + 2*i;
y.setError(
sqrt(y.getVal())) ;
}
RooPlot* frame = x.
frame(
Title(
"Chi^2 fit of function set of (X#pmdX,Y#pmdY) values")) ;
dxy.plotOnXY(frame,
YVar(y)) ;
f.chi2FitTo(dxy,
YVar(y)) ;
f.plotOn(frame) ;
new TCanvas(
"rf609_xychi2fit",
"rf609_xychi2fit",600,600) ;
}
- Author
- 07/2008 - Wouter Verkerke
Definition in file rf609_xychi2fit.C.