Logo ROOT  
Reference Guide
rf204a_extrangefit_RooAddPdf.C File Reference

Detailed Description

View in nbviewer Open in SWAN 'ADDITION AND CONVOLUTION' RooFit tutorial macro #204a

Extended maximum likelihood fit in multiple ranges. When an extended pdf and multiple ranges are used, the RooExtendPdf cannot correctly interpret the coefficients used for extension. This can be solved by using a RooAddPdf for extending the model.

␛[1mRooFit v3.60 -- Developed by Wouter Verkerke and David Kirkby␛[0m
Copyright (C) 2000-2013 NIKHEF, University of California & Stanford University
All rights reserved, please read http://roofit.sourceforge.net/license.txt
[#1] INFO:Eval -- RooRealVar::setRange(x) new range named 'signalRange' created with bounds [4,6]
[#1] INFO:Minization -- p.d.f. provides expected number of events, including extended term in likelihood.
[#1] INFO:Minization -- RooMinimizer::optimizeConst: activating const optimization
[#1] INFO:Minization -- The following expressions have been identified as constant and will be precalculated and cached: (sig1,sig2)
[#1] INFO:Minization -- The following expressions will be evaluated in cache-and-track mode: (bkg)
**********
** 1 **SET PRINT 1
**********
**********
** 2 **SET NOGRAD
**********
PARAMETER DEFINITIONS:
NO. NAME VALUE STEP SIZE LIMITS
1 a0 5.00000e-01 1.00000e-01 0.00000e+00 1.00000e+00
2 a1 2.00000e-01 1.00000e-01 0.00000e+00 1.00000e+00
3 nbkg 5.00000e+02 2.50000e+02 0.00000e+00 1.00000e+04
4 nsig 5.00000e+02 2.50000e+02 0.00000e+00 1.00000e+04
5 sig1frac 8.00000e-01 1.00000e-01 0.00000e+00 1.00000e+00
**********
** 3 **SET ERR 0.5
**********
**********
** 4 **SET PRINT 1
**********
**********
** 5 **SET STR 1
**********
NOW USING STRATEGY 1: TRY TO BALANCE SPEED AGAINST RELIABILITY
**********
** 6 **MIGRAD 2500 1
**********
FIRST CALL TO USER FUNCTION AT NEW START POINT, WITH IFLAG=4.
START MIGRAD MINIMIZATION. STRATEGY 1. CONVERGENCE WHEN EDM .LT. 1.00e-03
FCN=-3871.89 FROM MIGRAD STATUS=INITIATE 14 CALLS 15 TOTAL
EDM= unknown STRATEGY= 1 NO ERROR MATRIX
EXT PARAMETER CURRENT GUESS STEP FIRST
NO. NAME VALUE ERROR SIZE DERIVATIVE
1 a0 5.00000e-01 1.00000e-01 2.01358e-01 6.22718e+00
2 a1 2.00000e-01 1.00000e-01 2.57889e-01 -1.46786e+00
3 nbkg 5.00000e+02 2.50000e+02 1.18625e-01 3.78614e+00
4 nsig 5.00000e+02 2.50000e+02 1.18625e-01 -3.78710e+00
5 sig1frac 8.00000e-01 1.00000e-01 2.57889e-01 -2.60731e+00
ERR DEF= 0.5
MIGRAD MINIMIZATION HAS CONVERGED.
MIGRAD WILL VERIFY CONVERGENCE AND ERROR MATRIX.
COVARIANCE MATRIX CALCULATED SUCCESSFULLY
FCN=-3872.49 FROM MIGRAD STATUS=CONVERGED 92 CALLS 93 TOTAL
EDM=8.63054e-05 STRATEGY= 1 ERROR MATRIX ACCURATE
EXT PARAMETER STEP FIRST
NO. NAME VALUE ERROR SIZE DERIVATIVE
1 a0 4.26471e-01 7.58981e-02 6.35013e-03 2.23263e-02
2 a1 1.75944e-01 1.10401e-01 8.49976e-03 -2.48705e-02
3 nbkg 5.11008e+02 3.60346e+01 4.85975e-04 -2.28108e-01
4 nsig 4.88988e+02 3.57357e+01 4.87261e-04 2.14226e-01
5 sig1frac 8.63918e-01 1.08330e-01 8.79881e-03 -1.87106e-02
ERR DEF= 0.5
EXTERNAL ERROR MATRIX. NDIM= 25 NPAR= 5 ERR DEF=0.5
5.806e-03 2.284e-03 -6.486e-01 6.487e-01 -2.172e-03
2.284e-03 1.255e-02 -2.540e+00 2.540e+00 -8.020e-03
-6.486e-01 -2.540e+00 1.299e+03 -7.878e+02 2.592e+00
6.487e-01 2.540e+00 -7.878e+02 1.277e+03 -2.593e+00
-2.172e-03 -8.020e-03 2.592e+00 -2.593e+00 1.215e-02
PARAMETER CORRELATION COEFFICIENTS
NO. GLOBAL 1 2 3 4 5
1 0.29577 1.000 0.268 -0.236 0.238 -0.259
2 0.73433 0.268 1.000 -0.629 0.635 -0.650
3 0.72344 -0.236 -0.629 1.000 -0.612 0.653
4 0.72920 0.238 0.635 -0.612 1.000 -0.658
5 0.75608 -0.259 -0.650 0.653 -0.658 1.000
**********
** 7 **SET ERR 0.5
**********
**********
** 8 **SET PRINT 1
**********
**********
** 9 **HESSE 2500
**********
COVARIANCE MATRIX CALCULATED SUCCESSFULLY
FCN=-3872.49 FROM HESSE STATUS=OK 31 CALLS 124 TOTAL
EDM=8.60976e-05 STRATEGY= 1 ERROR MATRIX ACCURATE
EXT PARAMETER INTERNAL INTERNAL
NO. NAME VALUE ERROR STEP SIZE VALUE
1 a0 4.26471e-01 7.58562e-02 1.27003e-03 -1.47593e-01
2 a1 1.75944e-01 1.10000e-01 1.69995e-03 -7.05103e-01
3 nbkg 5.11008e+02 3.59610e+01 9.71951e-05 -1.11474e+00
4 nsig 4.88988e+02 3.56576e+01 9.74523e-05 -1.12485e+00
5 sig1frac 8.63918e-01 1.08098e-01 1.75976e-03 8.15160e-01
ERR DEF= 0.5
EXTERNAL ERROR MATRIX. NDIM= 25 NPAR= 5 ERR DEF=0.5
5.800e-03 2.258e-03 -6.425e-01 6.425e-01 -2.152e-03
2.258e-03 1.245e-02 -2.515e+00 2.516e+00 -7.942e-03
-6.425e-01 -2.515e+00 1.293e+03 -7.824e+02 2.576e+00
6.425e-01 2.516e+00 -7.824e+02 1.272e+03 -2.576e+00
-2.152e-03 -7.942e-03 2.576e+00 -2.576e+00 1.209e-02
PARAMETER CORRELATION COEFFICIENTS
NO. GLOBAL 1 2 3 4 5
1 0.29405 1.000 0.266 -0.235 0.237 -0.257
2 0.73196 0.266 1.000 -0.627 0.632 -0.647
3 0.72209 -0.235 -0.627 1.000 -0.610 0.651
4 0.72779 0.237 0.632 -0.610 1.000 -0.657
5 0.75482 -0.257 -0.647 0.651 -0.657 1.000
[#1] INFO:Minization -- RooMinimizer::optimizeConst: deactivating const optimization
RooFitResult: minimized FCN value: -3872.49, estimated distance to minimum: 8.60976e-05
covariance matrix quality: Full, accurate covariance matrix
Status : MINIMIZE=0 HESSE=0
Floating Parameter FinalValue +/- Error
-------------------- --------------------------
a0 4.2647e-01 +/- 7.59e-02
a1 1.7594e-01 +/- 1.10e-01
nbkg 5.1101e+02 +/- 3.60e+01
nsig 4.8899e+02 +/- 3.57e+01
sig1frac 8.6392e-01 +/- 1.08e-01
[#1] INFO:Eval -- RooRealVar::setRange(x) new range named 'left' created with bounds [0,4]
[#1] INFO:Eval -- RooRealVar::setRange(x) new range named 'right' created with bounds [6,10]
[#1] INFO:Minization -- p.d.f. provides expected number of events, including extended term in likelihood.
[#1] INFO:Fitting -- RooAbsOptTestStatistic::ctor(nll_model_modelData_left) constructing test statistic for sub-range named left
[#1] INFO:Eval -- RooRealVar::setRange(x) new range named 'NormalizationRangeForleft' created with bounds [0,11]
[#1] INFO:Eval -- RooRealVar::setRange(x) new range named 'fit_nll_model_modelData_left' created with bounds [0,4]
[#1] INFO:Fitting -- RooAbsOptTestStatistic::ctor(nll_model_modelData_left) fixing interpretation of coefficients of any RooAddPdf to full domain of observables
[#1] INFO:Fitting -- RooAbsOptTestStatistic::ctor(nll_model_modelData_right) constructing test statistic for sub-range named right
[#1] INFO:Eval -- RooRealVar::setRange(x) new range named 'NormalizationRangeForright' created with bounds [0,11]
[#1] INFO:Eval -- RooRealVar::setRange(x) new range named 'fit_nll_model_modelData_right' created with bounds [6,10]
[#1] INFO:Fitting -- RooAbsOptTestStatistic::ctor(nll_model_modelData_right) fixing interpretation of coefficients of any RooAddPdf to full domain of observables
[#1] INFO:Fitting -- RooAddition::defaultErrorLevel(nll_model_modelData) Summation contains a RooNLLVar, using its error level
[#1] INFO:Minization -- RooMinimizer::optimizeConst: activating const optimization
[#1] INFO:Minization -- The following expressions have been identified as constant and will be precalculated and cached: (sig1,sig2)
[#1] INFO:Minization -- The following expressions will be evaluated in cache-and-track mode: (bkg)
[#1] INFO:Minization -- The following expressions have been identified as constant and will be precalculated and cached: (sig1,sig2)
[#1] INFO:Minization -- The following expressions will be evaluated in cache-and-track mode: (bkg)
**********
** 10 **SET PRINT 1
**********
**********
** 11 **SET NOGRAD
**********
PARAMETER DEFINITIONS:
NO. NAME VALUE STEP SIZE LIMITS
1 a0 4.26471e-01 7.58562e-02 0.00000e+00 1.00000e+00
2 a1 1.75944e-01 1.10000e-01 0.00000e+00 1.00000e+00
3 nbkg 5.11008e+02 3.59610e+01 0.00000e+00 1.00000e+04
4 nsig 4.88988e+02 3.56576e+01 0.00000e+00 1.00000e+04
5 sig1frac 8.63918e-01 1.08098e-01 0.00000e+00 1.00000e+00
**********
** 12 **SET ERR 0.5
**********
**********
** 13 **SET PRINT 1
**********
**********
** 14 **SET STR 1
**********
NOW USING STRATEGY 1: TRY TO BALANCE SPEED AGAINST RELIABILITY
**********
** 15 **MIGRAD 2500 1
**********
FIRST CALL TO USER FUNCTION AT NEW START POINT, WITH IFLAG=4.
START MIGRAD MINIMIZATION. STRATEGY 1. CONVERGENCE WHEN EDM .LT. 1.00e-03
FCN=-1133.19 FROM MIGRAD STATUS=INITIATE 14 CALLS 15 TOTAL
EDM= unknown STRATEGY= 1 NO ERROR MATRIX
EXT PARAMETER CURRENT GUESS STEP FIRST
NO. NAME VALUE ERROR SIZE DERIVATIVE
1 a0 4.26471e-01 7.58562e-02 1.54029e-01 2.97025e+00
2 a1 1.75944e-01 1.10000e-01 3.04490e-01 3.05683e+00
3 nbkg 5.11008e+02 3.59610e+01 1.63406e-02 4.24214e+01
4 nsig 4.88988e+02 3.56576e+01 1.65451e-02 5.45919e-01
5 sig1frac 8.63918e-01 1.08098e-01 3.48778e-01 7.27615e-01
ERR DEF= 0.5
MIGRAD MINIMIZATION HAS CONVERGED.
MIGRAD WILL VERIFY CONVERGENCE AND ERROR MATRIX.
COVARIANCE MATRIX CALCULATED SUCCESSFULLY
FCN=-1134.15 FROM MIGRAD STATUS=CONVERGED 149 CALLS 150 TOTAL
EDM=1.94982e-05 STRATEGY= 1 ERROR MATRIX ACCURATE
EXT PARAMETER STEP FIRST
NO. NAME VALUE ERROR SIZE DERIVATIVE
1 a0 3.23929e-01 1.10404e-01 4.10351e-03 8.17015e-03
2 a1 2.88453e-02 5.45830e-01 1.39787e-02 -5.49618e-03
3 nbkg 5.01892e+02 3.98714e+01 2.93870e-04 -1.33300e-01
4 nsig 4.10983e+02 2.63611e+02 1.44231e-03 -6.59247e-03
5 sig1frac 8.58940e-01 2.76155e-01 7.42299e-03 1.70743e-03
ERR DEF= 0.5
EXTERNAL ERROR MATRIX. NDIM= 25 NPAR= 5 ERR DEF=0.5
1.242e-02 1.300e-02 -1.353e+00 -5.302e+00 -1.528e-02
1.300e-02 3.091e-02 -3.948e+00 -1.123e+01 -3.495e-02
-1.353e+00 -3.948e+00 1.590e+03 2.791e+03 7.770e+00
-5.302e+00 -1.123e+01 2.791e+03 6.990e+04 6.730e+01
-1.528e-02 -3.495e-02 7.770e+00 6.730e+01 1.017e-01
PARAMETER CORRELATION COEFFICIENTS
NO. GLOBAL 1 2 3 4 5
1 0.67241 1.000 0.664 -0.304 -0.180 -0.430
2 0.82439 0.664 1.000 -0.563 -0.242 -0.623
3 0.72220 -0.304 -0.563 1.000 0.265 0.611
4 0.88430 -0.180 -0.242 0.265 1.000 0.798
5 0.93740 -0.430 -0.623 0.611 0.798 1.000
**********
** 16 **SET ERR 0.5
**********
**********
** 17 **SET PRINT 1
**********
**********
** 18 **HESSE 2500
**********
COVARIANCE MATRIX CALCULATED SUCCESSFULLY
FCN=-1134.15 FROM HESSE STATUS=OK 31 CALLS 181 TOTAL
EDM=1.87888e-05 STRATEGY= 1 ERROR MATRIX ACCURATE
EXT PARAMETER INTERNAL INTERNAL
NO. NAME VALUE ERROR STEP SIZE VALUE
1 a0 3.23929e-01 1.08109e-01 8.20702e-04 -3.59858e-01
2 a1 2.88453e-02 5.40605e-01 5.59149e-04 -1.22946e+00
3 nbkg 5.01892e+02 3.94665e+01 5.87740e-05 -1.11890e+00
4 nsig 4.10983e+02 2.68024e+02 2.88462e-04 -1.16251e+00
5 sig1frac 8.58940e-01 2.76392e-01 2.96920e-04 8.00751e-01
ERR DEF= 0.5
EXTERNAL ERROR MATRIX. NDIM= 25 NPAR= 5 ERR DEF=0.5
1.190e-02 1.198e-02 -1.213e+00 -5.251e+00 -1.425e-02
1.198e-02 2.901e-02 -3.680e+00 -1.127e+01 -3.307e-02
-1.213e+00 -3.680e+00 1.558e+03 2.890e+03 7.605e+00
-5.251e+00 -1.127e+01 2.890e+03 7.228e+04 6.954e+01
-1.425e-02 -3.307e-02 7.605e+00 6.954e+01 1.020e-01
PARAMETER CORRELATION COEFFICIENTS
NO. GLOBAL 1 2 3 4 5
1 0.65435 1.000 0.645 -0.282 -0.179 -0.409
2 0.81152 0.645 1.000 -0.547 -0.246 -0.608
3 0.71533 -0.282 -0.547 1.000 0.272 0.603
4 0.88834 -0.179 -0.246 0.272 1.000 0.810
5 0.93756 -0.409 -0.608 0.603 0.810 1.000
[#1] INFO:Minization -- RooMinimizer::optimizeConst: deactivating const optimization
RooFitResult: minimized FCN value: -1134.15, estimated distance to minimum: 1.87888e-05
covariance matrix quality: Full, accurate covariance matrix
Status : MINIMIZE=0 HESSE=0
Floating Parameter FinalValue +/- Error
-------------------- --------------------------
a0 3.2393e-01 +/- 1.08e-01
a1 2.8845e-02 +/- 5.41e-01
nbkg 5.0189e+02 +/- 3.95e+01
nsig 4.1098e+02 +/- 2.68e+02
sig1frac 8.5894e-01 +/- 2.76e-01
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) p.d.f was fitted in range and no explicit plot,norm range was specified, using fit range as default
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) only plotting range 'fit_nll_model_modelData_left,fit_nll_model_modelData_right'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) p.d.f. curve is normalized using explicit choice of ranges 'fit_nll_model_modelData_left,fit_nll_model_modelData_right'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) only plotting range 'fit_nll_model_modelData_left'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) p.d.f. curve is normalized using explicit choice of ranges 'fit_nll_model_modelData_left,fit_nll_model_modelData_right'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) only plotting range 'fit_nll_model_modelData_left'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) p.d.f. curve is normalized using explicit choice of ranges 'fit_nll_model_modelData_left,fit_nll_model_modelData_right'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) only plotting range 'fit_nll_model_modelData_left'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) p.d.f. curve is normalized using explicit choice of ranges 'fit_nll_model_modelData_left,fit_nll_model_modelData_right'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) only plotting range 'fit_nll_model_modelData_left'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) p.d.f. curve is normalized using explicit choice of ranges 'fit_nll_model_modelData_left,fit_nll_model_modelData_right'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) only plotting range 'fit_nll_model_modelData_left'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) p.d.f. curve is normalized using explicit choice of ranges 'fit_nll_model_modelData_left,fit_nll_model_modelData_right'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) only plotting range 'fit_nll_model_modelData_left'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) p.d.f. curve is normalized using explicit choice of ranges 'fit_nll_model_modelData_left,fit_nll_model_modelData_right'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) only plotting range 'fit_nll_model_modelData_left'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) p.d.f. curve is normalized using explicit choice of ranges 'fit_nll_model_modelData_left,fit_nll_model_modelData_right'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) only plotting range 'fit_nll_model_modelData_left'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) p.d.f. curve is normalized using explicit choice of ranges 'fit_nll_model_modelData_left,fit_nll_model_modelData_right'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) only plotting range 'fit_nll_model_modelData_left'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) p.d.f. curve is normalized using explicit choice of ranges 'fit_nll_model_modelData_left,fit_nll_model_modelData_right'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) only plotting range 'fit_nll_model_modelData_left'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) p.d.f. curve is normalized using explicit choice of ranges 'fit_nll_model_modelData_left,fit_nll_model_modelData_right'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) only plotting range 'fit_nll_model_modelData_left'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) p.d.f. curve is normalized using explicit choice of ranges 'fit_nll_model_modelData_left,fit_nll_model_modelData_right'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) only plotting range 'fit_nll_model_modelData_right'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) p.d.f. curve is normalized using explicit choice of ranges 'fit_nll_model_modelData_left,fit_nll_model_modelData_right'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) only plotting range 'fit_nll_model_modelData_right'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) p.d.f. curve is normalized using explicit choice of ranges 'fit_nll_model_modelData_left,fit_nll_model_modelData_right'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) only plotting range 'fit_nll_model_modelData_right'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) p.d.f. curve is normalized using explicit choice of ranges 'fit_nll_model_modelData_left,fit_nll_model_modelData_right'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) only plotting range 'fit_nll_model_modelData_right'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) p.d.f. curve is normalized using explicit choice of ranges 'fit_nll_model_modelData_left,fit_nll_model_modelData_right'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) only plotting range 'fit_nll_model_modelData_right'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) p.d.f. curve is normalized using explicit choice of ranges 'fit_nll_model_modelData_left,fit_nll_model_modelData_right'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) only plotting range 'fit_nll_model_modelData_right'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) p.d.f. curve is normalized using explicit choice of ranges 'fit_nll_model_modelData_left,fit_nll_model_modelData_right'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) only plotting range 'fit_nll_model_modelData_right'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) p.d.f. curve is normalized using explicit choice of ranges 'fit_nll_model_modelData_left,fit_nll_model_modelData_right'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) only plotting range 'fit_nll_model_modelData_right'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) p.d.f. curve is normalized using explicit choice of ranges 'fit_nll_model_modelData_left,fit_nll_model_modelData_right'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) only plotting range 'fit_nll_model_modelData_right'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) p.d.f. curve is normalized using explicit choice of ranges 'fit_nll_model_modelData_left,fit_nll_model_modelData_right'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) only plotting range 'fit_nll_model_modelData_right'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) p.d.f. curve is normalized using explicit choice of ranges 'fit_nll_model_modelData_left,fit_nll_model_modelData_right'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) only plotting range 'fit_nll_model_modelData_right'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) p.d.f. curve is normalized using explicit choice of ranges 'fit_nll_model_modelData_left,fit_nll_model_modelData_right'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) p.d.f was fitted in range and no explicit plot,norm range was specified, using fit range as default
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) only plotting range 'fit_nll_model_modelData_left,fit_nll_model_modelData_right'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) p.d.f. curve is normalized using explicit choice of ranges 'fit_nll_model_modelData_left,fit_nll_model_modelData_right'
[#1] INFO:Eval -- RooRealVar::setRange(x) new range named 'leftToMiddle' created with bounds [0,5]
[#1] INFO:Minization -- p.d.f. provides expected number of events, including extended term in likelihood.
[#1] INFO:Fitting -- RooAbsOptTestStatistic::ctor(nll_model_modelData) constructing test statistic for sub-range named leftToMiddle
[#1] INFO:Eval -- RooRealVar::setRange(x) new range named 'NormalizationRangeForleftToMiddle' created with bounds [0,11]
[#1] INFO:Eval -- RooRealVar::setRange(x) new range named 'fit_nll_model_modelData' created with bounds [0,5]
[#1] INFO:Fitting -- RooAbsOptTestStatistic::ctor(nll_model_modelData) fixing interpretation of coefficients of any RooAddPdf to full domain of observables
[#1] INFO:Minization -- RooMinimizer::optimizeConst: activating const optimization
[#1] INFO:Minization -- The following expressions have been identified as constant and will be precalculated and cached: (sig1,sig2)
[#1] INFO:Minization -- The following expressions will be evaluated in cache-and-track mode: (bkg)
**********
** 19 **SET PRINT 1
**********
**********
** 20 **SET NOGRAD
**********
PARAMETER DEFINITIONS:
NO. NAME VALUE STEP SIZE LIMITS
1 a0 3.23929e-01 1.08109e-01 0.00000e+00 1.00000e+00
2 a1 2.88453e-02 5.40605e-01 0.00000e+00 1.00000e+00
MINUIT WARNING IN PARAMETR
============== VARIABLE2 BROUGHT BACK INSIDE LIMITS.
3 nbkg 5.01892e+02 3.94665e+01 0.00000e+00 1.00000e+04
4 nsig 4.10983e+02 2.68024e+02 0.00000e+00 1.00000e+04
5 sig1frac 8.58940e-01 2.76392e-01 0.00000e+00 1.00000e+00
MINUIT WARNING IN PARAMETR
============== VARIABLE5 BROUGHT BACK INSIDE LIMITS.
**********
** 21 **SET ERR 0.5
**********
**********
** 22 **SET PRINT 1
**********
**********
** 23 **SET STR 1
**********
NOW USING STRATEGY 1: TRY TO BALANCE SPEED AGAINST RELIABILITY
**********
** 24 **MIGRAD 2500 1
**********
FIRST CALL TO USER FUNCTION AT NEW START POINT, WITH IFLAG=4.
START MIGRAD MINIMIZATION. STRATEGY 1. CONVERGENCE WHEN EDM .LT. 1.00e-03
FCN=-1618.32 FROM MIGRAD STATUS=INITIATE 14 CALLS 15 TOTAL
EDM= unknown STRATEGY= 1 NO ERROR MATRIX
EXT PARAMETER CURRENT GUESS STEP FIRST
NO. NAME VALUE ERROR SIZE DERIVATIVE
1 a0 3.23929e-01 1.08109e-01 2.34083e-01 4.08551e-01
2 a1 2.88453e-02 5.40605e-01 8.54097e-01 -2.73477e-01
3 nbkg 5.01892e+02 3.94665e+01 1.80897e-02 -6.58003e+00
4 nsig 4.10983e+02 2.68024e+02 1.43768e-01 -1.02034e+02
5 sig1frac 8.58940e-01 2.76392e-01 7.01495e-01 -4.26596e+00
ERR DEF= 0.5
MIGRAD MINIMIZATION HAS CONVERGED.
MIGRAD WILL VERIFY CONVERGENCE AND ERROR MATRIX.
EIGENVALUES OF SECOND-DERIVATIVE MATRIX:
-1.9268e-03 1.4073e-01 1.2202e+00 1.3132e+00 2.3278e+00
MINUIT WARNING IN HESSE
============== MATRIX FORCED POS-DEF BY ADDING 0.004255 TO DIAGONAL.
FCN=-1620.15 FROM HESSE STATUS=NOT POSDEF 35 CALLS 127 TOTAL
EDM=0.00100154 STRATEGY= 1 ERR MATRIX NOT POS-DEF
EXT PARAMETER APPROXIMATE STEP FIRST
NO. NAME VALUE ERROR SIZE DERIVATIVE
1 a0 3.43232e-01 6.29734e-01 5.61952e-03 -2.08276e-02
2 a1 1.02853e-01 5.84687e-01 1.07156e-02 4.02420e-03
3 nbkg 4.96425e+02 5.58143e+02 5.33145e-04 4.79276e-02
4 nsig 4.64995e+02 7.12947e+01 4.44597e-04 -9.78209e-02
5 sig1frac 9.25999e-01 1.76430e-01 1.11400e-02 -7.64957e-03
ERR DEF= 0.5
MIGRAD MINIMIZATION HAS CONVERGED.
MIGRAD WILL VERIFY CONVERGENCE AND ERROR MATRIX.
COVARIANCE MATRIX CALCULATED SUCCESSFULLY
FCN=-1620.17 FROM MIGRAD STATUS=CONVERGED 342 CALLS 343 TOTAL
EDM=0.000217441 STRATEGY= 1 ERROR MATRIX ACCURATE
EXT PARAMETER STEP FIRST
NO. NAME VALUE ERROR SIZE DERIVATIVE
1 a0 7.69361e-01 8.83057e-01 3.86565e-03 -2.13936e-02
2 a1 2.46425e-01 2.97584e-01 4.87451e-03 -2.30492e-02
3 nbkg 7.73200e+02 8.70057e+02 6.44465e-04 2.32140e-01
4 nsig 4.38086e+02 8.85580e+01 4.50255e-04 -8.74793e-02
5 sig1frac 9.85817e-01 8.72235e-01 2.19213e-02 -1.54609e-02
ERR DEF= 0.5
EXTERNAL ERROR MATRIX. NDIM= 25 NPAR= 5 ERR DEF=0.5
7.281e-01 2.677e-01 7.525e+02 -6.291e+01 1.261e-01
2.677e-01 1.079e-01 2.722e+02 -2.028e+01 3.655e-02
7.525e+02 2.722e+02 7.854e+05 -6.768e+04 1.398e+02
-6.291e+01 -2.028e+01 -6.768e+04 7.847e+03 -1.635e+01
1.261e-01 3.655e-02 1.398e+02 -1.635e+01 4.920e-02
PARAMETER CORRELATION COEFFICIENTS
NO. GLOBAL 1 2 3 4 5
1 0.99765 1.000 0.955 0.995 -0.832 0.666
2 0.97507 0.955 1.000 0.935 -0.697 0.502
3 0.99750 0.995 0.935 1.000 -0.862 0.711
4 0.92717 -0.832 -0.697 -0.862 1.000 -0.832
5 0.87584 0.666 0.502 0.711 -0.832 1.000
**********
** 25 **SET ERR 0.5
**********
**********
** 26 **SET PRINT 1
**********
**********
** 27 **HESSE 2500
**********
COVARIANCE MATRIX CALCULATED SUCCESSFULLY
FCN=-1620.17 FROM HESSE STATUS=OK 31 CALLS 374 TOTAL
EDM=0.000231401 STRATEGY= 1 ERROR MATRIX ACCURATE
EXT PARAMETER INTERNAL INTERNAL
NO. NAME VALUE ERROR STEP SIZE VALUE
1 a0 7.69361e-01 7.93382e-01 7.73130e-04 5.68919e-01
2 a1 2.46425e-01 6.23108e-01 9.74903e-04 -5.31876e-01
3 nbkg 7.73200e+02 1.28455e+03 1.28893e-04 -1.00724e+00
4 nsig 4.38086e+02 1.32091e+02 9.00510e-05 -1.14907e+00
5 sig1frac 9.85817e-01 9.88101e-01 8.76851e-04 1.33204e+00
ERR DEF= 0.5
EXTERNAL ERROR MATRIX. NDIM= 25 NPAR= 5 ERR DEF=0.5
1.621e+00 5.715e-01 1.702e+03 -1.549e+02 3.399e-01
5.715e-01 2.117e-01 5.948e+02 -5.131e+01 1.082e-01
1.702e+03 5.948e+02 1.796e+06 -1.658e+05 3.681e+02
-1.549e+02 -5.131e+01 -1.658e+05 1.747e+04 -3.895e+01
3.399e-01 1.082e-01 3.681e+02 -3.895e+01 1.024e-01
PARAMETER CORRELATION COEFFICIENTS
NO. GLOBAL 1 2 3 4 5
1 0.99894 1.000 0.975 0.998 -0.920 0.834
2 0.98737 0.975 1.000 0.965 -0.844 0.735
3 0.99891 0.998 0.965 1.000 -0.936 0.858
4 0.96797 -0.920 -0.844 -0.936 1.000 -0.921
5 0.94231 0.834 0.735 0.858 -0.921 1.000
[#1] INFO:Minization -- RooMinimizer::optimizeConst: deactivating const optimization
RooFitResult: minimized FCN value: -1620.17, estimated distance to minimum: 0.000231401
covariance matrix quality: Full, accurate covariance matrix
Status : MINIMIZE=0 HESSE=0
Floating Parameter FinalValue +/- Error
-------------------- --------------------------
a0 7.6936e-01 +/- 7.93e-01
a1 2.4642e-01 +/- 6.23e-01
nbkg 7.7320e+02 +/- 1.28e+03
nsig 4.3809e+02 +/- 1.32e+02
sig1frac 9.8582e-01 +/- 9.88e-01
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) p.d.f was fitted in range and no explicit plot,norm range was specified, using fit range as default
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) only plotting range 'fit_nll_model_modelData'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) p.d.f. curve is normalized using explicit choice of ranges 'fit_nll_model_modelData'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) only plotting range 'fit_nll_model_modelData'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) p.d.f. curve is normalized using explicit choice of ranges 'fit_nll_model_modelData'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) only plotting range 'fit_nll_model_modelData'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) p.d.f. curve is normalized using explicit choice of ranges 'fit_nll_model_modelData'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) only plotting range 'fit_nll_model_modelData'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) p.d.f. curve is normalized using explicit choice of ranges 'fit_nll_model_modelData'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) only plotting range 'fit_nll_model_modelData'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) p.d.f. curve is normalized using explicit choice of ranges 'fit_nll_model_modelData'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) only plotting range 'fit_nll_model_modelData'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) p.d.f. curve is normalized using explicit choice of ranges 'fit_nll_model_modelData'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) only plotting range 'fit_nll_model_modelData'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) p.d.f. curve is normalized using explicit choice of ranges 'fit_nll_model_modelData'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) only plotting range 'fit_nll_model_modelData'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) p.d.f. curve is normalized using explicit choice of ranges 'fit_nll_model_modelData'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) only plotting range 'fit_nll_model_modelData'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) p.d.f. curve is normalized using explicit choice of ranges 'fit_nll_model_modelData'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) only plotting range 'fit_nll_model_modelData'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) p.d.f. curve is normalized using explicit choice of ranges 'fit_nll_model_modelData'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) only plotting range 'fit_nll_model_modelData'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) p.d.f. curve is normalized using explicit choice of ranges 'fit_nll_model_modelData'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) only plotting range 'fit_nll_model_modelData'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) p.d.f. curve is normalized using explicit choice of ranges 'fit_nll_model_modelData'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) p.d.f was fitted in range and no explicit plot,norm range was specified, using fit range as default
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) only plotting range 'fit_nll_model_modelData'
[#1] INFO:Plotting -- RooAbsPdf::plotOn(model) p.d.f. curve is normalized using explicit choice of ranges 'fit_nll_model_modelData'
#include "RooRealVar.h"
#include "RooDataSet.h"
#include "RooGaussian.h"
#include "RooChebychev.h"
#include "RooAddPdf.h"
#include "RooExtendPdf.h"
#include "RooFitResult.h"
#include "TCanvas.h"
#include "TAxis.h"
#include "RooPlot.h"
using namespace RooFit ;
void rf204a_extrangefit_RooAddPdf()
{
// S e t u p c o m p o n e n t p d f s
// ---------------------------------------
// Declare observable x
RooRealVar x("x","x",0,11) ;
// Create two Gaussian PDFs g1(x,mean1,sigma) anf g2(x,mean2,sigma) and their parameters
RooRealVar mean("mean","mean of gaussians",5) ;
RooRealVar sigma1("sigma1","width of gaussians",0.5) ;
RooRealVar sigma2("sigma2","width of gaussians",1) ;
RooGaussian sig1("sig1","Signal component 1",x,mean,sigma1) ;
RooGaussian sig2("sig2","Signal component 2",x,mean,sigma2) ;
// Build Chebychev polynomial p.d.f.
RooRealVar a0("a0","a0",0.5,0.,1.) ;
RooRealVar a1("a1","a1",0.2,0.,1.) ;
RooChebychev bkg("bkg","Background",x,RooArgSet(a0,a1)) ;
// Sum the signal components into a composite signal p.d.f.
RooRealVar sig1frac("sig1frac","fraction of component 1 in signal",0.8,0.,1.) ;
RooAddPdf sig("sig","Signal",RooArgList(sig1,sig2),sig1frac) ;
// E x t e n d t h e p d f s
// -----------------------------
// Define signal range in which events counts are to be defined
x.setRange("signalRange",4,6) ;
// Associated nsig/nbkg as expected number of events with sig/bkg _in_the_range_ "signalRange"
RooRealVar nsig("nsig","number of signal events in signalRange",500,0.,10000) ;
RooRealVar nbkg("nbkg","number of background events in signalRange",500,0,10000) ;
// Use AddPdf to extend the model. Giving as many coefficients as pdfs switches
// on extension.
RooAddPdf model("model","(g1+g2)+a", RooArgList(bkg,sig), RooArgList(nbkg,nsig)) ;
// S a m p l e d a t a , f i t m o d e l
// -------------------------------------------
// Generate 1000 events from model so that nsig,nbkg come out to numbers <<500 in fit
RooDataSet *data = model.generate(x,1000) ;
auto canv = new TCanvas("Canvas", "Canvas", 1500, 600);
canv->Divide(3,1);
// Fit full range
// -------------------------------------------
canv->cd(1);
// Perform unbinned ML fit to data, full range
// IMPORTANT:
// The model needs to be copied when fitting with different ranges because
// the interpretation of the coefficients is tied to the fit range
// that's used in the first fit
RooAddPdf model1(model);
RooFitResult* r = model1.fitTo(*data,Save()) ;
r->Print() ;
RooPlot * frame = x.frame(Title("Full range fitted"));
data->plotOn(frame);
model1.plotOn(frame, VisualizeError(*r));
model1.plotOn(frame);
model1.paramOn(frame);
frame->Draw();
// Fit in two regions
// -------------------------------------------
canv->cd(2);
x.setRange("left", 0., 4.);
x.setRange("right", 6., 10.);
RooAddPdf model2(model);
RooFitResult* r2 = model2.fitTo(*data,
Range("left,right"),
Save()) ;
r2->Print();
RooPlot * frame2 = x.frame(Title("Fit in left/right sideband"));
data->plotOn(frame2);
model2.plotOn(frame2, VisualizeError(*r2));
model2.plotOn(frame2);
model2.paramOn(frame2);
frame2->Draw();
// Fit in one region
// -------------------------------------------
// Note how restricting the region to only the left tail increases
// the fit uncertainty
canv->cd(3);
x.setRange("leftToMiddle", 0., 5.);
RooAddPdf model3(model);
RooFitResult* r3 = model3.fitTo(*data,
Range("leftToMiddle"),
Save()) ;
r3->Print();
RooPlot * frame3 = x.frame(Title("Fit from left to middle"));
data->plotOn(frame3);
model3.plotOn(frame3, VisualizeError(*r3));
model3.plotOn(frame3);
model3.paramOn(frame3);
frame3->Draw();
canv->Draw();
}
ROOT::R::TRInterface & r
Definition: Object.C:4
virtual RooPlot * plotOn(RooPlot *frame, const RooCmdArg &arg1=RooCmdArg::none(), const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none(), const RooCmdArg &arg6=RooCmdArg::none(), const RooCmdArg &arg7=RooCmdArg::none(), const RooCmdArg &arg8=RooCmdArg::none()) const
Calls RooPlot* plotOn(RooPlot* frame, const RooLinkedList& cmdList) const ;.
Definition: RooAbsData.cxx:550
RooAddPdf is an efficient implementation of a sum of PDFs of the form.
Definition: RooAddPdf.h:29
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgList.h:21
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:28
Chebychev polynomial p.d.f.
Definition: RooChebychev.h:25
RooDataSet is a container class to hold unbinned data.
Definition: RooDataSet.h:31
RooFitResult is a container class to hold the input and output of a PDF fit to a dataset.
Definition: RooFitResult.h:40
virtual void Print(Option_t *options=0) const
Print TNamed name and title.
Definition: RooFitResult.h:66
Plain Gaussian p.d.f.
Definition: RooGaussian.h:25
A RooPlot is a plot frame and a container for graphics objects within that frame.
Definition: RooPlot.h:44
virtual void Draw(Option_t *options=0)
Draw this plot and all of the elements it contains.
Definition: RooPlot.cxx:712
RooRealVar represents a variable that can be changed from the outside.
Definition: RooRealVar.h:35
The Canvas class.
Definition: TCanvas.h:31
virtual void Print(Option_t *option="") const
This method must be overridden when a class wants to print itself.
Definition: TObject.cxx:550
Double_t x[n]
Definition: legend1.C:17
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
RooCmdArg VisualizeError(const RooDataSet &paramData, Double_t Z=1)
RooCmdArg Save(Bool_t flag=kTRUE)
const char * Title
Definition: TXMLSetup.cxx:67
Ta Range(0, 0, 1, 1)
Author
12/2018 - Stephan Hageboeck

Definition in file rf204a_extrangefit_RooAddPdf.C.