Logo ROOT   6.18/05
Reference Guide
rf407_latextables.C File Reference

Detailed Description

View in nbviewer Open in SWAN Data and categories: latex printing of lists and sets of RooArgSets

␛[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:Minization -- RooMinimizer::optimizeConst: activating const optimization
[#1] INFO:Minization -- The following expressions have been identified as constant and will be precalculated and cached: (bkg2,sig1,sig2)
[#1] INFO:Minization -- The following expressions will be evaluated in cache-and-track mode: (bkg1)
**********
** 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 bkgfrac 5.00000e-01 1.00000e-01 0.00000e+00 1.00000e+00
4 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 2000 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=1963.41 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 5.45557e+00
2 a1 2.00000e-01 1.00000e-01 2.57889e-01 2.12468e+00
3 bkgfrac 5.00000e-01 1.00000e-01 2.01358e-01 2.95374e+01
4 sig1frac 8.00000e-01 1.00000e-01 2.57889e-01 1.90239e+01
ERR DEF= 0.5
MIGRAD MINIMIZATION HAS CONVERGED.
MIGRAD WILL VERIFY CONVERGENCE AND ERROR MATRIX.
COVARIANCE MATRIX CALCULATED SUCCESSFULLY
FCN=1960.64 FROM MIGRAD STATUS=CONVERGED 100 CALLS 101 TOTAL
EDM=3.75265e-06 STRATEGY= 1 ERROR MATRIX ACCURATE
EXT PARAMETER STEP FIRST
NO. NAME VALUE ERROR SIZE DERIVATIVE
1 a0 6.45917e-01 2.21997e-01 7.59449e-03 -6.13466e-03
2 a1 2.39717e-01 1.63607e-01 8.68922e-03 8.68189e-04
3 bkgfrac 4.48723e-01 2.86509e-02 1.18450e-03 2.52740e-02
4 sig1frac 7.07467e-01 5.79941e-02 1.94490e-03 -2.93455e-02
ERR DEF= 0.5
EXTERNAL ERROR MATRIX. NDIM= 25 NPAR= 4 ERR DEF=0.5
5.330e-02 -1.068e-02 -1.772e-03 -1.095e-02
-1.068e-02 2.819e-02 -2.571e-03 1.770e-04
-1.772e-03 -2.571e-03 8.218e-04 8.391e-04
-1.095e-02 1.770e-04 8.391e-04 3.382e-03
PARAMETER CORRELATION COEFFICIENTS
NO. GLOBAL 1 2 3 4
1 0.85615 1.000 -0.276 -0.268 -0.815
2 0.68971 -0.276 1.000 -0.534 0.018
3 0.74062 -0.268 -0.534 1.000 0.503
4 0.86784 -0.815 0.018 0.503 1.000
**********
** 7 **SET ERR 0.5
**********
**********
** 8 **SET PRINT 1
**********
**********
** 9 **HESSE 2000
**********
COVARIANCE MATRIX CALCULATED SUCCESSFULLY
FCN=1960.64 FROM HESSE STATUS=OK 23 CALLS 124 TOTAL
EDM=3.75168e-06 STRATEGY= 1 ERROR MATRIX ACCURATE
EXT PARAMETER INTERNAL INTERNAL
NO. NAME VALUE ERROR STEP SIZE VALUE
1 a0 6.45917e-01 2.21223e-01 1.51890e-03 2.96143e-01
2 a1 2.39717e-01 1.63005e-01 3.47569e-04 -5.47513e-01
3 bkgfrac 4.48723e-01 2.85510e-02 2.36899e-04 -1.02734e-01
4 sig1frac 7.07467e-01 5.77889e-02 3.88981e-04 4.27870e-01
ERR DEF= 0.5
EXTERNAL ERROR MATRIX. NDIM= 25 NPAR= 4 ERR DEF=0.5
5.289e-02 -1.058e-02 -1.763e-03 -1.085e-02
-1.058e-02 2.797e-02 -2.538e-03 1.785e-04
-1.763e-03 -2.538e-03 8.161e-04 8.330e-04
-1.085e-02 1.785e-04 8.330e-04 3.358e-03
PARAMETER CORRELATION COEFFICIENTS
NO. GLOBAL 1 2 3 4
1 0.85497 1.000 -0.275 -0.268 -0.814
2 0.68674 -0.275 1.000 -0.531 0.018
3 0.73847 -0.268 -0.531 1.000 0.503
4 0.86683 -0.814 0.018 0.503 1.000
[#1] INFO:Minization -- RooMinimizer::optimizeConst: deactivating const optimization
\begin{tabular}{lc}
$\verb+a0+ $ & $ 0.6\pm 0.2$\\
$\verb+a1+ $ & $ 0.2\pm 0.2$\\
$\verb+alpha+ $ & $ -1.00$\\
$\verb+bkgfrac+ $ & $ 0.45\pm 0.03$\\
$\verb+mean+ $ & $ 5$\\
$\verb+sig1frac+ $ & $ 0.71\pm 0.06$\\
$\verb+sigma1+ $ & $ 0.5$\\
$\verb+sigma2+ $ & $ 1$\\
\end{tabular}
\begin{tabular}{lc|lc}
$\verb+a0+ $ & $ 0.6\pm 0.2$ & $\verb+mean+ $ & $ 5$\\
$\verb+a1+ $ & $ 0.2\pm 0.2$ & $\verb+sig1frac+ $ & $ 0.71\pm 0.06$\\
$\verb+alpha+ $ & $ -1.00$ & $\verb+sigma1+ $ & $ 0.5$\\
$\verb+bkgfrac+ $ & $ 0.45\pm 0.03$ & $\verb+sigma2+ $ & $ 1$\\
\end{tabular}
\begin{tabular}{lcc}
$\verb+a0+ $ & $ 0.6\pm 0.2$ & $ 0.5$\\
$\verb+a1+ $ & $ 0.2\pm 0.2$ & $ 0.2$\\
$\verb+alpha+ $ & $ -1.00$ & $-1.00$\\
$\verb+bkgfrac+ $ & $ 0.45\pm 0.03$ & $ 0.5$\\
$\verb+mean+ $ & $ 5$ & $ 5$\\
$\verb+sig1frac+ $ & $ 0.71\pm 0.06$ & $ 0.8$\\
$\verb+sigma1+ $ & $ 0.5$ & $ 0.5$\\
$\verb+sigma2+ $ & $ 1$ & $ 1$\\
\end{tabular}
\begin{tabular}{lcc|lcc}
$\verb+a0+ $ & $ 0.6\pm 0.2$ & $ 0.5$ & $\verb+mean+ $ & $ 5$ & $ 5$\\
$\verb+a1+ $ & $ 0.2\pm 0.2$ & $ 0.2$ & $\verb+sig1frac+ $ & $ 0.71\pm 0.06$ & $ 0.8$\\
$\verb+alpha+ $ & $ -1.00$ & $-1.00$ & $\verb+sigma1+ $ & $ 0.5$ & $ 0.5$\\
$\verb+bkgfrac+ $ & $ 0.45\pm 0.03$ & $ 0.5$ & $\verb+sigma2+ $ & $ 1$ & $ 1$\\
\end{tabular}
#include "RooRealVar.h"
#include "RooDataSet.h"
#include "RooGaussian.h"
#include "RooConstVar.h"
#include "RooChebychev.h"
#include "RooAddPdf.h"
#include "RooExponential.h"
#include "TCanvas.h"
#include "TAxis.h"
#include "RooPlot.h"
using namespace RooFit;
{
// S e t u p c o m p o s i t e p d f
// --------------------------------------
// Declare observable x
RooRealVar x("x", "x", 0, 10);
// 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);
// 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);
// Build Chebychev polynomial p.d.f.
RooRealVar a0("a0", "a0", 0.5, 0., 1.);
RooRealVar a1("a1", "a1", 0.2, 0., 1.);
RooChebychev bkg1("bkg1", "Background 1", x, RooArgSet(a0, a1));
// Build expontential pdf
RooRealVar alpha("alpha", "alpha", -1);
RooExponential bkg2("bkg2", "Background 2", x, alpha);
// Sum the background components into a composite background p.d.f.
RooRealVar bkg1frac("sig1frac", "fraction of component 1 in background", 0.2, 0., 1.);
RooAddPdf bkg("bkg", "Signal", RooArgList(bkg1, bkg2), sig1frac);
// Sum the composite signal and background
RooRealVar bkgfrac("bkgfrac", "fraction of background", 0.5, 0., 1.);
RooAddPdf model("model", "g1+g2+a", RooArgList(bkg, sig), bkgfrac);
// M a k e l i s t o f p a r a m e t e r s b e f o r e a n d a f t e r f i t
// ----------------------------------------------------------------------------------------
// Make list of model parameters
RooArgSet *params = model.getParameters(x);
// Save snapshot of prefit parameters
RooArgSet *initParams = (RooArgSet *)params->snapshot();
// Do fit to data, to obtain error estimates on parameters
RooDataSet *data = model.generate(x, 1000);
model.fitTo(*data);
// P r i n t l a t ex t a b l e o f p a r a m e t e r s o f p d f
// --------------------------------------------------------------------------
// Print parameter list in LaTeX for (one column with names, one column with values)
params->printLatex();
// Print parameter list in LaTeX for (names values|names values)
params->printLatex(Columns(2));
// Print two parameter lists side by side (name values initvalues)
params->printLatex(Sibling(*initParams));
// Print two parameter lists side by side (name values initvalues|name values initvalues)
params->printLatex(Sibling(*initParams), Columns(2));
// Write LaTex table to file
params->printLatex(Sibling(*initParams), OutputFile("rf407_latextables.tex"));
}
void printLatex(const RooCmdArg &arg1=RooCmdArg(), const RooCmdArg &arg2=RooCmdArg(), const RooCmdArg &arg3=RooCmdArg(), const RooCmdArg &arg4=RooCmdArg(), const RooCmdArg &arg5=RooCmdArg(), const RooCmdArg &arg6=RooCmdArg(), const RooCmdArg &arg7=RooCmdArg(), const RooCmdArg &arg8=RooCmdArg()) const
Output content of collection as LaTex table.
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
RooArgSet * snapshot(bool deepCopy=true) const
Use RooAbsCollection::snapshot(), but return as RooArgSet.
Definition: RooArgSet.h:134
Chebychev polynomial p.d.f.
Definition: RooChebychev.h:25
RooDataSet is a container class to hold unbinned data.
Definition: RooDataSet.h:31
Exponential p.d.f.
Plain Gaussian p.d.f.
Definition: RooGaussian.h:25
RooRealVar represents a fundamental (non-derived) real valued object.
Definition: RooRealVar.h:36
Double_t x[n]
Definition: legend1.C:17
Template specialisation used in RooAbsArg:
RooCmdArg Columns(Int_t ncol)
RooCmdArg Sibling(const RooAbsCollection &sibling)
RooCmdArg OutputFile(const char *fileName)
Author
07/2008 - Wouter Verkerke

Definition in file rf407_latextables.C.