Logo ROOT  
Reference Guide
rf505_asciicfg.C File Reference

Detailed Description

View in nbviewer Open in SWAN Organisation and simultaneous fits: reading and writing ASCII configuration files

RooFit v3.60 -- Developed by Wouter Verkerke and David Kirkby
Copyright (C) 2000-2013 NIKHEF, University of California & Stanford University
All rights reserved, please read http://roofit.sourceforge.net/license.txt
[#0] WARNING:InputArguments -- The parameter 's' with range [-10, 10] of the RooGaussian 'g' exceeds the safe range of (0, inf). Advise to limit its range.
[#1] INFO:Minization -- RooMinimizer::optimizeConst: activating const optimization
[#1] INFO:Minization -- The following expressions will be evaluated in cache-and-track mode: (g,p)
**********
** 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 m 0.00000e+00 2.00000e+00 -1.00000e+01 1.00000e+01
3 p0 1.00000e-02 5.00000e-03 0.00000e+00 1.00000e+00
4 s 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 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=2578.08 FROM MIGRAD STATUS=INITIATE 16 CALLS 17 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 -1.53716e+01
2 m 0.00000e+00 2.00000e+00 2.01358e-01 -2.26705e+01
3 p0 1.00000e-02 5.00000e-03 5.20130e-02 4.33944e+00
4 s 1.00000e+00 2.00000e+00 2.02430e-01 1.92608e+02
ERR DEF= 0.5
MIGRAD MINIMIZATION HAS CONVERGED.
MIGRAD WILL VERIFY CONVERGENCE AND ERROR MATRIX.
COVARIANCE MATRIX CALCULATED SUCCESSFULLY
FCN=2577.55 FROM MIGRAD STATUS=CONVERGED 72 CALLS 73 TOTAL
EDM=8.24282e-07 STRATEGY= 1 ERROR MATRIX ACCURATE
EXT PARAMETER STEP FIRST
NO. NAME VALUE ERROR SIZE DERIVATIVE
1 f 5.07346e-01 2.09674e-02 1.38917e-03 -5.25373e-03
2 m 6.23214e-03 5.36796e-02 1.87122e-04 -5.00083e-02
3 p0 7.29872e-03 7.84582e-03 3.20927e-03 6.94096e-03
4 s 9.64897e-01 4.70258e-02 1.56237e-04 -8.82679e-02
ERR DEF= 0.5
EXTERNAL ERROR MATRIX. NDIM= 25 NPAR= 4 ERR DEF=0.5
4.399e-04 5.188e-05 -1.462e-06 3.236e-04
5.188e-05 2.882e-03 -3.245e-05 1.903e-04
-1.462e-06 -3.245e-05 6.173e-05 -5.278e-06
3.236e-04 1.903e-04 -5.278e-06 2.211e-03
PARAMETER CORRELATION COEFFICIENTS
NO. GLOBAL 1 2 3 4
1 0.32882 1.000 0.046 -0.009 0.328
2 0.10924 0.046 1.000 -0.077 0.075
3 0.07746 -0.009 -0.077 1.000 -0.014
4 0.33367 0.328 0.075 -0.014 1.000
**********
** 7 **SET ERR 0.5
**********
**********
** 8 **SET PRINT 1
**********
**********
** 9 **HESSE 2000
**********
COVARIANCE MATRIX CALCULATED SUCCESSFULLY
FCN=2577.55 FROM HESSE STATUS=OK 23 CALLS 96 TOTAL
EDM=8.2344e-07 STRATEGY= 1 ERROR MATRIX ACCURATE
EXT PARAMETER INTERNAL INTERNAL
NO. NAME VALUE ERROR STEP SIZE VALUE
1 f 5.07346e-01 2.09713e-02 2.77834e-04 1.46934e-02
2 m 6.23214e-03 5.36750e-02 3.74243e-05 6.23214e-04
3 p0 7.29872e-03 7.84576e-03 1.28371e-04 -1.39972e+00
4 s 9.64897e-01 4.70322e-02 6.24947e-06 9.66401e-02
ERR DEF= 0.5
EXTERNAL ERROR MATRIX. NDIM= 25 NPAR= 4 ERR DEF=0.5
4.401e-04 5.204e-05 -1.457e-06 3.242e-04
5.204e-05 2.881e-03 -3.217e-05 1.889e-04
-1.457e-06 -3.217e-05 6.173e-05 -5.241e-06
3.242e-04 1.889e-04 -5.241e-06 2.212e-03
PARAMETER CORRELATION COEFFICIENTS
NO. GLOBAL 1 2 3 4
1 0.32931 1.000 0.046 -0.009 0.329
2 0.10847 0.046 1.000 -0.076 0.075
3 0.07679 -0.009 -0.076 1.000 -0.014
4 0.33403 0.329 0.075 -0.014 1.000
[#1] INFO:Minization -- RooMinimizer::optimizeConst: deactivating const optimization
1) 0x7ffc14b94ea0 RooRealVar:: f = 0.50735 +/- 0.020971 L(0 - 1) "f"
2) 0x7ffc14b96320 RooRealVar:: m = 0.0062321 +/- 0.053675 L(-10 - 10) "m"
3) 0x7ffc14b95750 RooRealVar:: p0 = 0.0072987 +/- 0.0078458 L(0 - 1) "p0"
4) 0x7ffc14b95fa0 RooRealVar:: s = 0.9649 +/- 0.047032 L(-10 - 10) "s"
[#1] INFO:InputArguments -- RooArgSet::readFromStream(parameters): processing include file rf505_asciicfg_example.txt
1) 0x7ffc14b94ea0 RooRealVar:: f = 0.45 +/- 0.03 L(0 - 1) "f"
2) 0x7ffc14b96320 RooRealVar:: m = 0.025 +/- 0.02 L(-10 - 10) "m"
3) 0x7ffc14b95750 RooRealVar:: p0 = 0.0022 +/- 0.0001 L(0 - 1) "p0"
4) 0x7ffc14b95fa0 RooRealVar:: s = 0.98 +/- 0.03 L(-10 - 10) "s"
[#1] INFO:InputArguments -- RooArgSet::readFromStream(parameters): processing include file rf505_asciicfg_example.txt
The following parameters of the were _not_ read from Section3: (p0,s)
[#1] INFO:InputArguments -- RooArgSet::readFromStream(parameters): processing include file rf505_asciicfg_example.txt
1) 0x7ffc14b94ea0 RooRealVar:: f = 0.372 C L(0 - 1) "f"
2) 0x7ffc14b96320 RooRealVar:: m = 0.195 C L(-10 - 10) "m"
3) 0x7ffc14b95750 RooRealVar:: p0 = 0.0022 +/- 0.0001 L(0 - 1) "p0"
4) 0x7ffc14b95fa0 RooRealVar:: s = 0.98 +/- 0.03 L(-10 - 10) "s"
#include "RooRealVar.h"
#include "RooDataSet.h"
#include "RooGaussian.h"
#include "RooConstVar.h"
#include "RooPolynomial.h"
#include "RooAddPdf.h"
#include "TCanvas.h"
#include "TAxis.h"
#include "RooPlot.h"
using namespace RooFit;
{
// C r e a t e p d f
// ------------------
// Construct gauss(x,m,s)
RooRealVar x("x", "x", -10, 10);
RooRealVar m("m", "m", 0, -10, 10);
RooRealVar s("s", "s", 1, -10, 10);
RooGaussian gauss("g", "g", x, m, s);
// Construct poly(x,p0)
RooRealVar p0("p0", "p0", 0.01, 0., 1.);
RooPolynomial poly("p", "p", x, p0);
// Construct model = f*gauss(x) + (1-f)*poly(x)
RooRealVar f("f", "f", 0.5, 0., 1.);
RooAddPdf model("model", "model", RooArgSet(gauss, poly), f);
// F i t m o d e l t o t o y d a t a
// -----------------------------------------
RooDataSet *d = model.generate(x, 1000);
model.fitTo(*d);
// W r i t e p a r a m e t e r s t o a s c i i f i l e
// -----------------------------------------------------------
// Obtain set of parameters
RooArgSet *params = model.getParameters(x);
// Write parameters to file
params->writeToFile("rf505_asciicfg_example.txt");
TString dir1 = gROOT->GetTutorialDir() ;
dir1.Append("/roofit/rf505_asciicfg.txt") ;
TString dir2 = "rf505_asciicfg_example.txt";
// R e a d p a r a m e t e r s f r o m a s c i i f i l e
// ----------------------------------------------------------------
// Read parameters from file
params->readFromFile(dir2);
params->Print("v");
// Read parameters from section 'Section2' of file
params->readFromFile(dir1, 0, "Section2");
params->Print("v");
// Read parameters from section 'Section3' of file. Mark all
// variables that were processed with the "READ" attribute
params->readFromFile(dir1, "READ", "Section3");
// Print the list of parameters that were not read from Section3
cout << "The following parameters of the were _not_ read from Section3: "
<< (*params->selectByAttrib("READ", kFALSE)) << endl;
// Read parameters from section 'Section4' of file, which contains
// 'include file' statement of rf505_asciicfg_example.txt
// so that we effective read the same
params->readFromFile(dir1, 0, "Section4");
params->Print("v");
}
Date
July 2008
Author
Wouter Verkerke

Definition in file rf505_asciicfg.C.

m
auto * m
Definition: textangle.C:8
RooArgSet::writeToFile
void writeToFile(const char *fileName) const
Write contents of the argset to specified file.
Definition: RooArgSet.cxx:517
RooAddPdf
RooAddPdf is an efficient implementation of a sum of PDFs of the form.
Definition: RooAddPdf.h:32
f
#define f(i)
Definition: RSha256.hxx:104
RooGaussian.h
TGeant4Unit::s
static constexpr double s
Definition: TGeant4SystemOfUnits.h:162
x
Double_t x[n]
Definition: legend1.C:17
RooGaussian
Plain Gaussian p.d.f.
Definition: RooGaussian.h:24
RooAddPdf.h
TCanvas.h
TString
Basic string class.
Definition: TString.h:136
RooDataSet.h
RooPolynomial.h
rf505_asciicfg
Definition: rf505_asciicfg.py:1
TGeant4Unit::gauss
static constexpr double gauss
Definition: TGeant4SystemOfUnits.h:263
RooFit
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
Definition: RooCFunction1Binding.h:29
RooPolynomial
RooPolynomial implements a polynomial p.d.f of the form.
Definition: RooPolynomial.h:28
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
TString::Append
TString & Append(const char *cs)
Definition: TString.h:564
RooPlot.h
RooRealVar.h
RooConstVar.h
TAxis.h
RooArgSet::readFromFile
Bool_t readFromFile(const char *fileName, const char *flagReadAtt=0, const char *section=0, Bool_t verbose=kFALSE)
Read contents of the argset from specified file.
Definition: RooArgSet.cxx:533
d
#define d(i)
Definition: RSha256.hxx:102
RooDataSet
RooDataSet is a container class to hold unbinned data.
Definition: RooDataSet.h:33
make_cnn_model.model
model
Definition: make_cnn_model.py:6
RooAbsCollection::Print
virtual void Print(Option_t *options=0) const
This method must be overridden when a class wants to print itself.
Definition: RooAbsCollection.h:200
RooRealVar
RooRealVar represents a variable that can be changed from the outside.
Definition: RooRealVar.h:37
RooAbsCollection::selectByAttrib
RooAbsCollection * selectByAttrib(const char *name, Bool_t value) const
Create a subset of the current collection, consisting only of those elements with the specified attri...
Definition: RooAbsCollection.cxx:677
RooArgSet
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:29
gROOT
#define gROOT
Definition: TROOT.h:406