Logo ROOT  
Reference Guide
rf312_multirangefit.C File Reference

Detailed Description

View in nbviewer Open in SWAN Multidimensional models: performing fits in multiple (disjoint) ranges in one or more dimensions

␛[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 'SB1' created with bounds [-10,10]
[#1] INFO:Eval -- RooRealVar::setRange(y) new range named 'SB1' created with bounds [-10,0]
[#1] INFO:Eval -- RooRealVar::setRange(x) new range named 'SB2' created with bounds [-10,0]
[#1] INFO:Eval -- RooRealVar::setRange(y) new range named 'SB2' created with bounds [0,10]
[#1] INFO:Eval -- RooRealVar::setRange(x) new range named 'SIG' created with bounds [0,10]
[#1] INFO:Eval -- RooRealVar::setRange(y) new range named 'SIG' created with bounds [0,10]
[#1] INFO:Eval -- RooRealVar::setRange(x) new range named 'FULL' created with bounds [-10,10]
[#1] INFO:Eval -- RooRealVar::setRange(y) new range named 'FULL' created with bounds [-10,10]
[#1] INFO:Fitting -- RooAbsOptTestStatistic::ctor(nll_model_modelData) constructing test statistic for sub-range named SB1
[#1] INFO:Eval -- RooRealVar::setRange(x) new range named 'NormalizationRangeForSB1' created with bounds [-10,10]
[#1] INFO:Eval -- RooRealVar::setRange(x) new range named 'fit_nll_model_modelData' created with bounds [-10,10]
[#1] INFO:Eval -- RooRealVar::setRange(y) new range named 'NormalizationRangeForSB1' created with bounds [-10,10]
[#1] INFO:Eval -- RooRealVar::setRange(y) new range named 'fit_nll_model_modelData' created with bounds [-10,0]
[#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: (bkg)
[#1] INFO:Minization -- The following expressions will be evaluated in cache-and-track mode: (gx,gy)
**********
** 1 **SET PRINT 1
**********
**********
** 2 **SET NOGRAD
**********
PARAMETER DEFINITIONS:
NO. NAME VALUE STEP SIZE LIMITS
1 f 5.00000e-01 1.00000e-01 0.00000e+00 1.00000e+00
2 mx 1.00000e+00 2.00000e+00 -1.00000e+01 1.00000e+01
3 my 1.00000e+00 2.00000e+00 -1.00000e+01 1.00000e+01
**********
** 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 1500 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=16262.2 FROM MIGRAD STATUS=INITIATE 12 CALLS 13 TOTAL
EDM= unknown STRATEGY= 1 NO ERROR MATRIX
EXT PARAMETER CURRENT GUESS STEP FIRST
NO. NAME VALUE ERROR SIZE DERIVATIVE
1 f 5.00000e-01 1.00000e-01 2.01358e-01 -5.77275e+01
2 mx 1.00000e+00 2.00000e+00 2.02430e-01 7.82209e+01
3 my 1.00000e+00 2.00000e+00 2.02430e-01 4.26863e+02
ERR DEF= 0.5
MIGRAD MINIMIZATION HAS CONVERGED.
MIGRAD WILL VERIFY CONVERGENCE AND ERROR MATRIX.
COVARIANCE MATRIX CALCULATED SUCCESSFULLY
FCN=16261.4 FROM MIGRAD STATUS=CONVERGED 65 CALLS 66 TOTAL
EDM=6.58779e-08 STRATEGY= 1 ERROR MATRIX ACCURATE
EXT PARAMETER STEP FIRST
NO. NAME VALUE ERROR SIZE DERIVATIVE
1 f 5.11324e-01 3.57757e-02 1.91429e-03 -3.36872e-03
2 mx 9.87405e-01 4.03232e-02 3.56822e-04 2.97325e-02
3 my 9.92960e-01 9.38758e-02 2.52190e-04 1.62080e-03
ERR DEF= 0.5
EXTERNAL ERROR MATRIX. NDIM= 25 NPAR= 3 ERR DEF=0.5
1.282e-03 1.633e-06 3.203e-03
1.633e-06 1.626e-03 -2.189e-06
3.203e-03 -2.189e-06 8.813e-03
PARAMETER CORRELATION COEFFICIENTS
NO. GLOBAL 1 2 3
1 0.95284 1.000 0.001 0.953
2 0.00557 0.001 1.000 -0.001
3 0.95284 0.953 -0.001 1.000
**********
** 7 **SET ERR 0.5
**********
**********
** 8 **SET PRINT 1
**********
**********
** 9 **HESSE 1500
**********
COVARIANCE MATRIX CALCULATED SUCCESSFULLY
FCN=16261.4 FROM HESSE STATUS=OK 16 CALLS 82 TOTAL
EDM=6.53294e-08 STRATEGY= 1 ERROR MATRIX ACCURATE
EXT PARAMETER INTERNAL INTERNAL
NO. NAME VALUE ERROR STEP SIZE VALUE
1 f 5.11324e-01 3.55416e-02 7.65715e-05 2.26501e-02
2 mx 9.87405e-01 4.03233e-02 7.13643e-05 9.89017e-02
3 my 9.92960e-01 9.32603e-02 1.00876e-05 9.94599e-02
ERR DEF= 0.5
EXTERNAL ERROR MATRIX. NDIM= 25 NPAR= 3 ERR DEF=0.5
1.265e-03 1.698e-06 3.159e-03
1.698e-06 1.626e-03 -2.338e-06
3.159e-03 -2.338e-06 8.698e-03
PARAMETER CORRELATION COEFFICIENTS
NO. GLOBAL 1 2 3
1 0.95220 1.000 0.001 0.952
2 0.00585 0.001 1.000 -0.001
3 0.95220 0.952 -0.001 1.000
[#1] INFO:Minization -- RooMinimizer::optimizeConst: deactivating const optimization
[#1] INFO:Fitting -- RooAbsOptTestStatistic::ctor(nll_model_modelData) constructing test statistic for sub-range named SB2
[#1] INFO:Eval -- RooRealVar::setRange(x) new range named 'NormalizationRangeForSB2' created with bounds [-10,10]
[#1] INFO:Eval -- RooRealVar::setRange(y) new range named 'NormalizationRangeForSB2' created with bounds [-10,10]
[#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: (bkg)
[#1] INFO:Minization -- The following expressions will be evaluated in cache-and-track mode: (gx,gy)
**********
** 10 **SET PRINT 1
**********
**********
** 11 **SET NOGRAD
**********
PARAMETER DEFINITIONS:
NO. NAME VALUE STEP SIZE LIMITS
1 f 5.11324e-01 3.55416e-02 0.00000e+00 1.00000e+00
2 mx 9.87405e-01 4.03233e-02 -1.00000e+01 1.00000e+01
3 my 9.92960e-01 9.32603e-02 -1.00000e+01 1.00000e+01
**********
** 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 1500 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=7580.37 FROM MIGRAD STATUS=INITIATE 10 CALLS 11 TOTAL
EDM= unknown STRATEGY= 1 NO ERROR MATRIX
EXT PARAMETER CURRENT GUESS STEP FIRST
NO. NAME VALUE ERROR SIZE DERIVATIVE
1 f 5.11324e-01 3.55416e-02 7.11616e-02 5.76142e+01
2 mx 9.87405e-01 4.03233e-02 4.05214e-03 -5.36255e+02
3 my 9.92960e-01 9.32603e-02 9.37249e-03 1.50798e+02
ERR DEF= 0.5
MIGRAD MINIMIZATION HAS CONVERGED.
MIGRAD WILL VERIFY CONVERGENCE AND ERROR MATRIX.
COVARIANCE MATRIX CALCULATED SUCCESSFULLY
FCN=7578.28 FROM MIGRAD STATUS=CONVERGED 58 CALLS 59 TOTAL
EDM=5.99393e-06 STRATEGY= 1 ERROR MATRIX ACCURATE
EXT PARAMETER STEP FIRST
NO. NAME VALUE ERROR SIZE DERIVATIVE
1 f 5.45866e-01 4.48627e-02 1.58044e-03 2.70551e-02
2 mx 1.12762e+00 1.10647e-01 1.95873e-04 -3.91797e-01
3 my 9.64618e-01 5.59523e-02 3.27587e-04 2.27176e-01
ERR DEF= 0.5
EXTERNAL ERROR MATRIX. NDIM= 25 NPAR= 3 ERR DEF=0.5
2.018e-03 4.741e-03 -2.496e-04
4.741e-03 1.224e-02 -1.695e-04
-2.496e-04 -1.695e-04 3.131e-03
PARAMETER CORRELATION COEFFICIENTS
NO. GLOBAL 1 2 3
1 0.95665 1.000 0.954 -0.099
2 0.95624 0.954 1.000 -0.027
3 0.24521 -0.099 -0.027 1.000
**********
** 16 **SET ERR 0.5
**********
**********
** 17 **SET PRINT 1
**********
**********
** 18 **HESSE 1500
**********
COVARIANCE MATRIX CALCULATED SUCCESSFULLY
FCN=7578.28 FROM HESSE STATUS=OK 16 CALLS 75 TOTAL
EDM=5.96577e-06 STRATEGY= 1 ERROR MATRIX ACCURATE
EXT PARAMETER INTERNAL INTERNAL
NO. NAME VALUE ERROR STEP SIZE VALUE
1 f 5.45866e-01 4.46434e-02 3.16088e-04 9.18610e-02
2 mx 1.12762e+00 1.10110e-01 3.91746e-05 1.13002e-01
3 my 9.64618e-01 5.59522e-02 6.55175e-05 9.66120e-02
ERR DEF= 0.5
EXTERNAL ERROR MATRIX. NDIM= 25 NPAR= 3 ERR DEF=0.5
1.998e-03 4.693e-03 -2.465e-04
4.693e-03 1.212e-02 -1.613e-04
-2.465e-04 -1.613e-04 3.131e-03
PARAMETER CORRELATION COEFFICIENTS
NO. GLOBAL 1 2 3
1 0.95621 1.000 0.953 -0.099
2 0.95580 0.953 1.000 -0.026
3 0.24520 -0.099 -0.026 1.000
[#1] INFO:Minization -- RooMinimizer::optimizeConst: deactivating const optimization
[#1] INFO:Fitting -- RooAbsOptTestStatistic::ctor(nll_model_modelData_SB1) constructing test statistic for sub-range named SB1
[#1] INFO:Eval -- RooRealVar::setRange(x) new range named 'fit_nll_model_modelData_SB1' created with bounds [-10,10]
[#1] INFO:Eval -- RooRealVar::setRange(y) new range named 'fit_nll_model_modelData_SB1' created with bounds [-10,0]
[#1] INFO:Fitting -- RooAbsOptTestStatistic::ctor(nll_model_modelData_SB1) fixing interpretation of coefficients of any RooAddPdf to full domain of observables
[#1] INFO:Fitting -- RooAbsOptTestStatistic::ctor(nll_model_modelData_SB2) constructing test statistic for sub-range named SB2
[#1] INFO:Eval -- RooRealVar::setRange(x) new range named 'fit_nll_model_modelData_SB2' created with bounds [-10,0]
[#1] INFO:Eval -- RooRealVar::setRange(y) new range named 'fit_nll_model_modelData_SB2' created with bounds [0,10]
[#1] INFO:Fitting -- RooAbsOptTestStatistic::ctor(nll_model_modelData_SB2) 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: (bkg)
[#1] INFO:Minization -- The following expressions will be evaluated in cache-and-track mode: (gx,gy)
[#1] INFO:Minization -- The following expressions have been identified as constant and will be precalculated and cached: (bkg)
[#1] INFO:Minization -- The following expressions will be evaluated in cache-and-track mode: (gx,gy)
**********
** 19 **SET PRINT 1
**********
**********
** 20 **SET NOGRAD
**********
PARAMETER DEFINITIONS:
NO. NAME VALUE STEP SIZE LIMITS
1 f 5.45866e-01 4.46434e-02 0.00000e+00 1.00000e+00
2 mx 1.12762e+00 1.10110e-01 -1.00000e+01 1.00000e+01
3 my 9.64618e-01 5.59522e-02 -1.00000e+01 1.00000e+01
**********
** 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 1500 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=23854.7 FROM MIGRAD STATUS=INITIATE 12 CALLS 13 TOTAL
EDM= unknown STRATEGY= 1 NO ERROR MATRIX
EXT PARAMETER CURRENT GUESS STEP FIRST
NO. NAME VALUE ERROR SIZE DERIVATIVE
1 f 5.45866e-01 4.46434e-02 8.97886e-02 2.03175e+02
2 mx 1.12762e+00 1.10110e-01 1.10819e-02 8.77800e+02
3 my 9.64618e-01 5.59522e-02 5.62146e-03 -1.47793e+03
ERR DEF= 0.5
MIGRAD MINIMIZATION HAS CONVERGED.
MIGRAD WILL VERIFY CONVERGENCE AND ERROR MATRIX.
COVARIANCE MATRIX CALCULATED SUCCESSFULLY
FCN=23840.4 FROM MIGRAD STATUS=CONVERGED 61 CALLS 62 TOTAL
EDM=1.97734e-06 STRATEGY= 1 ERROR MATRIX ACCURATE
EXT PARAMETER STEP FIRST
NO. NAME VALUE ERROR SIZE DERIVATIVE
1 f 5.01559e-01 1.30669e-02 1.78830e-03 -1.50525e-02
2 mx 1.00778e+00 3.32769e-02 2.78855e-04 -3.15587e-01
3 my 9.67772e-01 3.52773e-02 2.72572e-04 4.67726e-01
ERR DEF= 0.5
EXTERNAL ERROR MATRIX. NDIM= 25 NPAR= 3 ERR DEF=0.5
1.708e-04 2.699e-04 3.183e-04
2.699e-04 1.107e-03 5.550e-04
3.183e-04 5.550e-04 1.244e-03
PARAMETER CORRELATION COEFFICIENTS
NO. GLOBAL 1 2 3
1 0.76699 1.000 0.621 0.691
2 0.62365 0.621 1.000 0.473
3 0.69283 0.691 0.473 1.000
**********
** 25 **SET ERR 0.5
**********
**********
** 26 **SET PRINT 1
**********
**********
** 27 **HESSE 1500
**********
COVARIANCE MATRIX CALCULATED SUCCESSFULLY
FCN=23840.4 FROM HESSE STATUS=OK 16 CALLS 78 TOTAL
EDM=1.97636e-06 STRATEGY= 1 ERROR MATRIX ACCURATE
EXT PARAMETER INTERNAL INTERNAL
NO. NAME VALUE ERROR STEP SIZE VALUE
1 f 5.01559e-01 1.30555e-02 7.15321e-05 3.11894e-03
2 mx 1.00778e+00 3.32599e-02 5.57710e-05 1.00949e-01
3 my 9.67772e-01 3.52499e-02 5.45143e-05 9.69289e-02
ERR DEF= 0.5
EXTERNAL ERROR MATRIX. NDIM= 25 NPAR= 3 ERR DEF=0.5
1.705e-04 2.693e-04 3.176e-04
2.693e-04 1.106e-03 5.535e-04
3.176e-04 5.535e-04 1.243e-03
PARAMETER CORRELATION COEFFICIENTS
NO. GLOBAL 1 2 3
1 0.76652 1.000 0.620 0.690
2 0.62315 0.620 1.000 0.472
3 0.69224 0.690 0.472 1.000
[#1] INFO:Minization -- RooMinimizer::optimizeConst: deactivating const optimization
RooFitResult: minimized FCN value: 16261.4, estimated distance to minimum: 6.53294e-08
covariance matrix quality: Full, accurate covariance matrix
Status : MINIMIZE=0 HESSE=0
Floating Parameter FinalValue +/- Error
-------------------- --------------------------
f 5.1132e-01 +/- 3.55e-02
mx 9.8741e-01 +/- 4.03e-02
my 9.9296e-01 +/- 9.33e-02
RooFitResult: minimized FCN value: 7578.28, estimated distance to minimum: 5.96577e-06
covariance matrix quality: Full, accurate covariance matrix
Status : MINIMIZE=0 HESSE=0
Floating Parameter FinalValue +/- Error
-------------------- --------------------------
f 5.4587e-01 +/- 4.46e-02
mx 1.1276e+00 +/- 1.10e-01
my 9.6462e-01 +/- 5.60e-02
RooFitResult: minimized FCN value: 23840.4, estimated distance to minimum: 1.97636e-06
covariance matrix quality: Full, accurate covariance matrix
Status : MINIMIZE=0 HESSE=0
Floating Parameter FinalValue +/- Error
-------------------- --------------------------
f 5.0156e-01 +/- 1.31e-02
mx 1.0078e+00 +/- 3.33e-02
my 9.6777e-01 +/- 3.52e-02
#include "RooRealVar.h"
#include "RooDataSet.h"
#include "RooGaussian.h"
#include "RooConstVar.h"
#include "RooProdPdf.h"
#include "RooAddPdf.h"
#include "RooPolynomial.h"
#include "TCanvas.h"
#include "TAxis.h"
#include "RooPlot.h"
#include "RooFitResult.h"
using namespace RooFit;
{
// C r e a t e 2 D p d f a n d d a t a
// -------------------------------------------
// Define observables x,y
RooRealVar x("x", "x", -10, 10);
RooRealVar y("y", "y", -10, 10);
// Construct the signal pdf gauss(x)*gauss(y)
RooRealVar mx("mx", "mx", 1, -10, 10);
RooRealVar my("my", "my", 1, -10, 10);
RooGaussian gx("gx", "gx", x, mx, RooConst(1));
RooGaussian gy("gy", "gy", y, my, RooConst(1));
RooProdPdf sig("sig", "sig", gx, gy);
// Construct the background pdf (flat in x,y)
RooPolynomial px("px", "px", x);
RooPolynomial py("py", "py", y);
RooProdPdf bkg("bkg", "bkg", px, py);
// Construct the composite model sig+bkg
RooRealVar f("f", "f", 0., 1.);
RooAddPdf model("model", "model", RooArgList(sig, bkg), f);
// Sample 10000 events in (x,y) from the model
RooDataSet *modelData = model.generate(RooArgSet(x, y), 10000);
// D e f i n e s i g n a l a n d s i d e b a n d r e g i o n s
// -------------------------------------------------------------------
// Construct the SideBand1,SideBand2,Signal regions
//
// |
// +-------------+-----------+
// | | |
// | Side | Sig |
// | Band1 | nal |
// | | |
// --+-------------+-----------+--
// | |
// | Side |
// | Band2 |
// | |
// +-------------+-----------+
// |
x.setRange("SB1", -10, +10);
y.setRange("SB1", -10, 0);
x.setRange("SB2", -10, 0);
y.setRange("SB2", 0, +10);
x.setRange("SIG", 0, +10);
y.setRange("SIG", 0, +10);
x.setRange("FULL", -10, +10);
y.setRange("FULL", -10, +10);
// P e r f o r m f i t s i n i n d i v i d u a l s i d e b a n d r e g i o n s
// -------------------------------------------------------------------------------------
// Perform fit in SideBand1 region (RooAddPdf coefficients will be interpreted in full range)
RooFitResult *r_sb1 = model.fitTo(*modelData, Range("SB1"), Save());
// Perform fit in SideBand2 region (RooAddPdf coefficients will be interpreted in full range)
RooFitResult *r_sb2 = model.fitTo(*modelData, Range("SB2"), Save());
// P e r f o r m f i t s i n j o i n t s i d e b a n d r e g i o n s
// -----------------------------------------------------------------------------
// Now perform fit to joint 'L-shaped' sideband region 'SB1|SB2'
// (RooAddPdf coefficients will be interpreted in full range)
RooFitResult *r_sb12 = model.fitTo(*modelData, Range("SB1,SB2"), Save());
// Print results for comparison
r_sb1->Print();
r_sb2->Print();
r_sb12->Print();
}
#define f(i)
Definition: RSha256.hxx:104
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
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
RooPolynomial implements a polynomial p.d.f of the form.
Definition: RooPolynomial.h:28
RooProdPdf is an efficient implementation of a product of PDFs of the form.
Definition: RooProdPdf.h:31
RooRealVar represents a variable that can be changed from the outside.
Definition: RooRealVar.h:35
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
RooConstVar & RooConst(Double_t val)
RooCmdArg Save(Bool_t flag=kTRUE)
Ta Range(0, 0, 1, 1)
Author
07/2008 - Wouter Verkerke

Definition in file rf312_multirangefit.C.