Logo ROOT  
Reference Guide
rf801_mcstudy.C File Reference

Detailed Description

View in nbviewer Open in SWAN

Validation and MC studies: toy Monte Carlo study that perform cycles of event generation and fitting

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] PROGRESS:Generation -- RooMCStudy::run: sample 990
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 980
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 970
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 960
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 950
[#0] WARNING:Minization -- RooMinimizerFcn: Minimized function has error status.
Returning maximum FCN so far (-797.721) to force MIGRAD to back out of this region. Error log follows
Parameter values: a0=0.716236, a1=-0.675686, mean=5.04367, nbkg=115.661, nsig=155.327, sig1frac=0.880121
RooChebychev::bkg[ x=x coefList=(a0,a1) ] has 1 errors
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 940
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 930
[#0] WARNING:Minization -- RooMinimizerFcn: Minimized function has error status.
Returning maximum FCN so far (-867.289) to force MIGRAD to back out of this region. Error log follows
Parameter values: a0=0.907715, a1=-0.26012, mean=4.95881, nbkg=147.451, nsig=156.366, sig1frac=0.890535
RooChebychev::bkg[ x=x coefList=(a0,a1) ] has 1 errors
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 920
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 910
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 900
[#0] WARNING:Minization -- RooMinimizerFcn: Minimized function has error status.
Returning maximum FCN so far (-871.381) to force MIGRAD to back out of this region. Error log follows
Parameter values: a0=0.716361, a1=-0.355239, mean=5.05578, nbkg=159.647, nsig=151.993, sig1frac=0.742914
RooChebychev::bkg[ x=x coefList=(a0,a1) ] has 1 errors
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 890
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 880
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 870
[#0] WARNING:Minization -- RooMinimizerFcn: Minimized function has error status.
Returning maximum FCN so far (-903.916) to force MIGRAD to back out of this region. Error log follows
Parameter values: a0=0.877959, a1=-0.428367, mean=4.99746, nbkg=167.444, nsig=157.288, sig1frac=0.424997
RooChebychev::bkg[ x=x coefList=(a0,a1) ] has 1 errors
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 860
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 850
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 840
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 830
[#0] WARNING:Minization -- RooMinimizerFcn: Minimized function has error status.
Returning maximum FCN so far (-970.563) to force MIGRAD to back out of this region. Error log follows
Parameter values: a0=0.867793, a1=-0.296045, mean=5.10353, nbkg=164.822, nsig=173.566, sig1frac=0.899431
RooChebychev::bkg[ x=x coefList=(a0,a1) ] has 1 errors
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 820
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 810
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 800
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 790
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 780
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 770
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 760
[#0] WARNING:Minization -- RooMinimizerFcn: Minimized function has error status.
Returning maximum FCN so far (-915.472) to force MIGRAD to back out of this region. Error log follows
Parameter values: a0=0.807508, a1=-0.34963, mean=5.09438, nbkg=142.436, nsig=172.312, sig1frac=0.886183
RooChebychev::bkg[ x=x coefList=(a0,a1) ] has 1 errors
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 750
[#0] WARNING:Minization -- RooMinimizerFcn: Minimized function has error status.
Returning maximum FCN so far (-885.867) to force MIGRAD to back out of this region. Error log follows
Parameter values: a0=0.7962, a1=-0.414289, mean=5.07605, nbkg=135.514, nsig=167.164, sig1frac=0.927781
RooChebychev::bkg[ x=x coefList=(a0,a1) ] has 1 errors
[#0] WARNING:Minization -- RooMinimizerFcn: Minimized function has error status.
Returning maximum FCN so far (-848.597) to force MIGRAD to back out of this region. Error log follows
Parameter values: a0=0.577138, a1=-0.518554, mean=5.09299, nbkg=144.203, nsig=156.938, sig1frac=0.54541
RooChebychev::bkg[ x=x coefList=(a0,a1) ] has 1 errors
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 740
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 730
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 720
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 710
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 700
[#0] WARNING:Minization -- RooMinimizerFcn: Minimized function has error status.
Returning maximum FCN so far (-814.549) to force MIGRAD to back out of this region. Error log follows
Parameter values: a0=0.848973, a1=-0.489149, mean=5.08811, nbkg=132.911, nsig=150.647, sig1frac=0.826731
RooChebychev::bkg[ x=x coefList=(a0,a1) ] has 1 errors
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 690
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 680
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 670
[#0] WARNING:Minization -- RooMinimizerFcn: Minimized function has error status.
Returning maximum FCN so far (-809.662) to force MIGRAD to back out of this region. Error log follows
Parameter values: a0=0.713661, a1=-0.606754, mean=5.02862, nbkg=142.583, nsig=145.399, sig1frac=0.623944
RooChebychev::bkg[ x=x coefList=(a0,a1) ] has 1 errors
[#0] WARNING:Minization -- RooMinimizerFcn: Minimized function has error status.
Returning maximum FCN so far (-861.002) to force MIGRAD to back out of this region. Error log follows
Parameter values: a0=0.744046, a1=-0.311529, mean=5.09799, nbkg=161.409, nsig=148.884, sig1frac=0.512806
RooChebychev::bkg[ x=x coefList=(a0,a1) ] has 1 errors
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 660
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 650
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 640
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 630
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 620
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 610
[#0] WARNING:Minization -- RooMinimizerFcn: Minimized function has error status.
Returning maximum FCN so far (-809.027) to force MIGRAD to back out of this region. Error log follows
Parameter values: a0=0.719517, a1=-0.347533, mean=5.00927, nbkg=127.977, nsig=152.559, sig1frac=0.917291
RooChebychev::bkg[ x=x coefList=(a0,a1) ] has 1 errors
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 600
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 590
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 580
[#0] WARNING:Minization -- RooMinimizerFcn: Minimized function has error status.
Returning maximum FCN so far (-869.586) to force MIGRAD to back out of this region. Error log follows
Parameter values: a0=0.621299, a1=-0.442393, mean=5.13262, nbkg=131.7, nsig=167.982, sig1frac=0.776177
RooChebychev::bkg[ x=x coefList=(a0,a1) ] has 1 errors
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 570
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 560
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 550
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 540
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 530
[#0] WARNING:Minization -- RooMinimizerFcn: Minimized function has error status.
Returning maximum FCN so far (-820.086) to force MIGRAD to back out of this region. Error log follows
Parameter values: a0=0.699182, a1=-0.532303, mean=4.90748, nbkg=130.722, nsig=155.109, sig1frac=0.843514
RooChebychev::bkg[ x=x coefList=(a0,a1) ] has 1 errors
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 520
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 510
[#0] WARNING:Minization -- RooMinimizerFcn: Minimized function has error status.
Returning maximum FCN so far (-814.421) to force MIGRAD to back out of this region. Error log follows
Parameter values: a0=0.729962, a1=-0.49802, mean=4.92039, nbkg=146.276, nsig=144.44, sig1frac=0.620699
RooChebychev::bkg[ x=x coefList=(a0,a1) ] has 1 errors
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 500
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 490
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 480
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 470
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 460
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 450
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 440
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 430
[#0] WARNING:Minization -- RooMinimizerFcn: Minimized function has error status.
Returning maximum FCN so far (-926.481) to force MIGRAD to back out of this region. Error log follows
Parameter values: a0=0.653979, a1=-0.469539, mean=5.00078, nbkg=160.963, nsig=166.526, sig1frac=0.628924
RooChebychev::bkg[ x=x coefList=(a0,a1) ] has 1 errors
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 420
[#0] WARNING:Minization -- RooMinimizerFcn: Minimized function has error status.
Returning maximum FCN so far (-768.847) to force MIGRAD to back out of this region. Error log follows
Parameter values: a0=0.749295, a1=-0.303934, mean=4.98272, nbkg=121.461, nsig=145.338, sig1frac=0.822833
RooChebychev::bkg[ x=x coefList=(a0,a1) ] has 1 errors
[#0] WARNING:Minization -- RooMinimizerFcn: Minimized function has error status.
Returning maximum FCN so far (-798.509) to force MIGRAD to back out of this region. Error log follows
Parameter values: a0=0.791035, a1=-0.287544, mean=4.98693, nbkg=127.577, nsig=149.203, sig1frac=0.914567
RooChebychev::bkg[ x=x coefList=(a0,a1) ] has 1 errors
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 410
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 400
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 390
[#0] WARNING:Minization -- RooMinimizerFcn: Minimized function has error status.
Returning maximum FCN so far (-977.775) to force MIGRAD to back out of this region. Error log follows
Parameter values: a0=0.565967, a1=-0.529635, mean=5.0065, nbkg=153.38, nsig=185.083, sig1frac=0.751239
RooChebychev::bkg[ x=x coefList=(a0,a1) ] has 1 errors
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 380
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 370
[#0] WARNING:Minization -- RooMinimizerFcn: Minimized function has error status.
Returning maximum FCN so far (-945.036) to force MIGRAD to back out of this region. Error log follows
Parameter values: a0=0.824344, a1=-0.338546, mean=5.06339, nbkg=161.705, nsig=169.087, sig1frac=0.910016
RooChebychev::bkg[ x=x coefList=(a0,a1) ] has 1 errors
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 360
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 350
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 340
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 330
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 320
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 310
[#0] WARNING:Minization -- RooMinimizerFcn: Minimized function has error status.
Returning maximum FCN so far (-831.776) to force MIGRAD to back out of this region. Error log follows
Parameter values: a0=0.823781, a1=-0.287947, mean=4.96347, nbkg=133.185, nsig=155.535, sig1frac=0.887106
RooChebychev::bkg[ x=x coefList=(a0,a1) ] has 1 errors
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 300
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 290
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 280
[#0] WARNING:Minization -- RooMinimizerFcn: Minimized function has error status.
Returning maximum FCN so far (-867.974) to force MIGRAD to back out of this region. Error log follows
Parameter values: a0=0.806741, a1=-0.376486, mean=4.95962, nbkg=143.191, nsig=160.421, sig1frac=0.787531
RooChebychev::bkg[ x=x coefList=(a0,a1) ] has 1 errors
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 270
[#0] WARNING:Minization -- RooMinimizerFcn: Minimized function has error status.
Returning maximum FCN so far (-810.184) to force MIGRAD to back out of this region. Error log follows
Parameter values: a0=0.701119, a1=-0.376392, mean=4.96099, nbkg=126.85, nsig=153.527, sig1frac=0.880449
RooChebychev::bkg[ x=x coefList=(a0,a1) ] has 1 errors
[#0] WARNING:Minization -- RooMinimizerFcn: Minimized function has error status.
Returning maximum FCN so far (-845.198) to force MIGRAD to back out of this region. Error log follows
Parameter values: a0=0.74363, a1=-0.435344, mean=5.01952, nbkg=162.467, nsig=143.571, sig1frac=0.630815
RooChebychev::bkg[ x=x coefList=(a0,a1) ] has 1 errors
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 260
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 250
[#0] WARNING:Minization -- RooMinimizerFcn: Minimized function has error status.
Returning maximum FCN so far (-1003.82) to force MIGRAD to back out of this region. Error log follows
Parameter values: a0=0.674666, a1=-0.383697, mean=5.00365, nbkg=169.829, nsig=179.534, sig1frac=0.921743
RooChebychev::bkg[ x=x coefList=(a0,a1) ] has 1 errors
[#0] WARNING:Minization -- RooMinimizerFcn: Minimized function has error status.
Returning maximum FCN so far (-712.949) to force MIGRAD to back out of this region. Error log follows
Parameter values: a0=0.711808, a1=-0.34088, mean=4.99573, nbkg=115.49, nsig=133.015, sig1frac=0.908627
RooChebychev::bkg[ x=x coefList=(a0,a1) ] has 1 errors
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 240
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 230
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 220
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 210
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 200
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 190
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 180
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 170
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 160
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 150
[#0] WARNING:Minization -- RooMinimizerFcn: Minimized function has error status.
Returning maximum FCN so far (-750.903) to force MIGRAD to back out of this region. Error log follows
Parameter values: a0=0.726225, a1=-0.429497, mean=5.03871, nbkg=129.53, nsig=136.644, sig1frac=0.687558
RooChebychev::bkg[ x=x coefList=(a0,a1) ] has 1 errors
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 140
[#0] WARNING:Minization -- RooMinimizerFcn: Minimized function has error status.
Returning maximum FCN so far (-740.756) to force MIGRAD to back out of this region. Error log follows
Parameter values: a0=0.899536, a1=-0.345881, mean=5.03897, nbkg=135.176, nsig=129.13, sig1frac=0.899393
RooChebychev::bkg[ x=x coefList=(a0,a1) ] has 1 errors
[#0] WARNING:Minization -- RooMinimizerFcn: Minimized function has error status.
Returning maximum FCN so far (-677.604) to force MIGRAD to back out of this region. Error log follows
Parameter values: a0=0.766597, a1=-0.547838, mean=5.03836, nbkg=119.039, nsig=121.817, sig1frac=0.213703
RooChebychev::bkg[ x=x coefList=(a0,a1) ] has 1 errors
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 130
[#0] WARNING:Minization -- RooMinimizerFcn: Minimized function has error status.
Returning maximum FCN so far (-777.498) to force MIGRAD to back out of this region. Error log follows
Parameter values: a0=0.527582, a1=-0.893856, mean=5.24753, nbkg=162.951, nsig=65.9357, sig1frac=0.970262
RooChebychev::bkg[ x=x coefList=(a0,a1) ] has 1 errors
[#0] WARNING:Minization -- RooMinimizerFcn: Minimized function has error status.
Returning maximum FCN so far (-777.498) to force MIGRAD to back out of this region. Error log follows
Parameter values: a0=0.516095, a1=-0.955515, mean=5.14443, nbkg=157.502, nsig=97.2821, sig1frac=0.174928
RooChebychev::bkg[ x=x coefList=(a0,a1) ] has 1 errors
[#0] WARNING:Minization -- RooMinimizerFcn: Minimized function has error status.
Returning maximum FCN so far (-777.498) to force MIGRAD to back out of this region. Error log follows
Parameter values: a0=0.510348, a1=-0.776595, mean=5.09286, nbkg=154.805, nsig=114.979, sig1frac=0.0496841
RooChebychev::bkg[ x=x coefList=(a0,a1) ] has 1 errors
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 120
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 110
[#0] WARNING:Minization -- RooMinimizerFcn: Minimized function has error status.
Returning maximum FCN so far (-796.54) to force MIGRAD to back out of this region. Error log follows
Parameter values: a0=0.702991, a1=-0.414346, mean=5.11911, nbkg=145.466, nsig=141.134, sig1frac=0.532895
RooChebychev::bkg[ x=x coefList=(a0,a1) ] has 1 errors
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 100
[#0] WARNING:Minization -- RooMinimizerFcn: Minimized function has error status.
Returning maximum FCN so far (-920.777) to force MIGRAD to back out of this region. Error log follows
Parameter values: a0=0.726241, a1=-0.424659, mean=5.05565, nbkg=151.228, nsig=170.816, sig1frac=0.771802
RooChebychev::bkg[ x=x coefList=(a0,a1) ] has 1 errors
[#0] WARNING:Minization -- RooMinimizerFcn: Minimized function has error status.
Returning maximum FCN so far (-743.339) to force MIGRAD to back out of this region. Error log follows
Parameter values: a0=0.942558, a1=-0.775768, mean=4.99866, nbkg=187.872, nsig=63.0852, sig1frac=0.868175
RooChebychev::bkg[ x=x coefList=(a0,a1) ] has 1 errors
[#0] WARNING:Minization -- RooMinimizerFcn: Minimized function has error status.
Returning maximum FCN so far (-743.339) to force MIGRAD to back out of this region. Error log follows
Parameter values: a0=0.984478, a1=-0.59938, mean=4.99914, nbkg=173.959, nsig=90.3182, sig1frac=0.461117
RooChebychev::bkg[ x=x coefList=(a0,a1) ] has 1 errors
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 90
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 80
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 70
[#0] WARNING:Minization -- RooMinimizerFcn: Minimized function has error status.
Returning maximum FCN so far (-775.389) to force MIGRAD to back out of this region. Error log follows
Parameter values: a0=0.72761, a1=-0.375581, mean=5.04879, nbkg=141.143, nsig=137.402, sig1frac=0.495257
RooChebychev::bkg[ x=x coefList=(a0,a1) ] has 1 errors
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 60
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 50
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 40
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 30
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 20
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 10
[#0] PROGRESS:Generation -- RooMCStudy::run: sample 0
[#0] WARNING:Generation -- Fit parameter 'sigma1' does not have an error. A pull distribution cannot be generated. This might be caused by the parameter being constant or because the fits were not run.
[#0] WARNING:Generation -- Fit parameter 'sigma2' does not have an error. A pull distribution cannot be generated. This might be caused by the parameter being constant or because the fits were not run.
[#1] INFO:NumericIntegration -- RooRealIntegral::init(pullGauss_Int[meanpull]) using numeric integrator RooIntegrator1D to calculate Int(meanpull)
[#1] INFO:Minization -- RooMinimizer::optimizeConst: activating const optimization
[#1] INFO:Minization -- RooMinimizer::optimizeConst: deactivating const optimization
[#1] INFO:NumericIntegration -- RooRealIntegral::init(pullGauss_Int[meanpull]) using numeric integrator RooIntegrator1D to calculate Int(meanpull)
#include "RooRealVar.h"
#include "RooDataSet.h"
#include "RooGaussian.h"
#include "RooConstVar.h"
#include "RooChebychev.h"
#include "RooAddPdf.h"
#include "RooMCStudy.h"
#include "RooPlot.h"
#include "TCanvas.h"
#include "TAxis.h"
#include "TH2.h"
#include "RooFitResult.h"
#include "TStyle.h"
#include "TDirectory.h"
using namespace RooFit;
{
// C r e a t e m o d e l
// -----------------------
// Declare observable x
RooRealVar x("x", "x", 0, 10);
x.setBins(40);
// Create two Gaussian PDFs g1(x,mean1,sigma) anf g2(x,mean2,sigma) and their parameters
RooRealVar mean("mean", "mean of gaussians", 5, 0, 10);
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, -1, 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);
// Sum the composite signal and background
RooRealVar nbkg("nbkg", "number of background events,", 150, 0, 1000);
RooRealVar nsig("nsig", "number of signal events", 150, 0, 1000);
RooAddPdf model("model", "g1+g2+a", RooArgList(bkg, sig), RooArgList(nbkg, nsig));
// C r e a t e m a n a g e r
// ---------------------------
// Instantiate RooMCStudy manager on model with x as observable and given choice of fit options
//
// The Silence() option kills all messages below the PROGRESS level, leaving only a single message
// per sample executed, and any error message that occur during fitting
//
// The Extended() option has two effects:
// 1) The extended ML term is included in the likelihood and
// 2) A poisson fluctuation is introduced on the number of generated events
//
// The FitOptions() given here are passed to the fitting stage of each toy experiment.
// If Save() is specified, the fit result of each experiment is saved by the manager
//
// A Binned() option is added in this example to bin the data between generation and fitting
// to speed up the study at the expense of some precision
RooMCStudy *mcstudy =
// G e n e r a t e a n d f i t e v e n t s
// ---------------------------------------------
// Generate and fit 1000 samples of Poisson(nExpected) events
mcstudy->generateAndFit(1000);
// E x p l o r e r e s u l t s o f s t u d y
// ------------------------------------------------
// Make plots of the distributions of mean, the error on mean and the pull of mean
RooPlot *frame1 = mcstudy->plotParam(mean, Bins(40));
RooPlot *frame2 = mcstudy->plotError(mean, Bins(40));
RooPlot *frame3 = mcstudy->plotPull(mean, Bins(40), FitGauss(kTRUE));
// Plot distribution of minimized likelihood
RooPlot *frame4 = mcstudy->plotNLL(Bins(40));
// Make some histograms from the parameter dataset
TH1 *hh_cor_a0_s1f = mcstudy->fitParDataSet().createHistogram("hh", a1, YVar(sig1frac));
TH1 *hh_cor_a0_a1 = mcstudy->fitParDataSet().createHistogram("hh", a0, YVar(a1));
// Access some of the saved fit results from individual toys
TH2 *corrHist000 = mcstudy->fitResult(0)->correlationHist("c000");
TH2 *corrHist127 = mcstudy->fitResult(127)->correlationHist("c127");
TH2 *corrHist953 = mcstudy->fitResult(953)->correlationHist("c953");
// Draw all plots on a canvas
TCanvas *c = new TCanvas("rf801_mcstudy", "rf801_mcstudy", 900, 900);
c->Divide(3, 3);
c->cd(1);
gPad->SetLeftMargin(0.15);
frame1->GetYaxis()->SetTitleOffset(1.4);
frame1->Draw();
c->cd(2);
gPad->SetLeftMargin(0.15);
frame2->GetYaxis()->SetTitleOffset(1.4);
frame2->Draw();
c->cd(3);
gPad->SetLeftMargin(0.15);
frame3->GetYaxis()->SetTitleOffset(1.4);
frame3->Draw();
c->cd(4);
gPad->SetLeftMargin(0.15);
frame4->GetYaxis()->SetTitleOffset(1.4);
frame4->Draw();
c->cd(5);
gPad->SetLeftMargin(0.15);
hh_cor_a0_s1f->GetYaxis()->SetTitleOffset(1.4);
hh_cor_a0_s1f->Draw("box");
c->cd(6);
gPad->SetLeftMargin(0.15);
hh_cor_a0_a1->GetYaxis()->SetTitleOffset(1.4);
hh_cor_a0_a1->Draw("box");
c->cd(7);
gPad->SetLeftMargin(0.15);
corrHist000->GetYaxis()->SetTitleOffset(1.4);
corrHist000->Draw("colz");
c->cd(8);
gPad->SetLeftMargin(0.15);
corrHist127->GetYaxis()->SetTitleOffset(1.4);
corrHist127->Draw("colz");
c->cd(9);
gPad->SetLeftMargin(0.15);
corrHist953->GetYaxis()->SetTitleOffset(1.4);
corrHist953->Draw("colz");
// Make RooMCStudy object available on command line after
// macro finishes
gDirectory->Add(mcstudy);
}
Date
February 2018
Author
Wouter Verkerke

Definition in file rf801_mcstudy.C.

c
#define c(i)
Definition: RSha256.hxx:119
RooDataSet::createHistogram
TH2F * createHistogram(const RooAbsRealLValue &var1, const RooAbsRealLValue &var2, const char *cuts="", const char *name="hist") const
Create a TH2F histogram of the distribution of the specified variable using this dataset.
Definition: RooDataSet.cxx:1419
RooPlot::Draw
virtual void Draw(Option_t *options=0)
Draw this plot and all of the elements it contains.
Definition: RooPlot.cxx:691
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
RooChebychev.h
RooAddPdf
Definition: RooAddPdf.h:32
TDirectory.h
RooFit::Bins
RooCmdArg Bins(Int_t nbin)
Definition: RooGlobalFunc.cxx:174
RooMCStudy::plotParam
RooPlot * plotParam(const RooRealVar &param, 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())
Plot the distribution of the fitted value of the given parameter on a newly created frame.
Definition: RooMCStudy.cxx:1116
RooMCStudy.h
RooMCStudy::fitResult
const RooFitResult * fitResult(Int_t sampleNum) const
Return the RooFitResult of the fit with the given run number.
Definition: RooMCStudy.cxx:1019
RooFit::PrintEvalErrors
RooCmdArg PrintEvalErrors(Int_t numErrors)
Definition: RooGlobalFunc.cxx:205
RooChebychev
Definition: RooChebychev.h:25
RooMCStudy
Definition: RooMCStudy.h:32
RooMCStudy::plotPull
RooPlot * plotPull(const RooRealVar &param, const RooCmdArg &arg1, 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())
Plot the distribution of pull values for the specified parameter on a newly created frame.
Definition: RooMCStudy.cxx:1217
RooArgList
Definition: RooArgList.h:21
RooGaussian.h
TStyle.h
x
Double_t x[n]
Definition: legend1.C:17
RooGaussian
Definition: RooGaussian.h:25
RooAddPdf.h
TCanvas.h
RooFit::YVar
RooCmdArg YVar(const RooAbsRealLValue &var, const RooCmdArg &arg=RooCmdArg::none())
Definition: RooGlobalFunc.cxx:240
RooFitResult::correlationHist
TH2 * correlationHist(const char *name="correlation_matrix") const
Return TH2D of correlation matrix.
Definition: RooFitResult.cxx:1082
RooDataSet.h
RooMCStudy::plotNLL
RooPlot * plotNLL(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())
Plot the distribution of the -log(L) values on a newly created frame.
Definition: RooMCStudy.cxx:1150
RooFit::FitOptions
RooCmdArg FitOptions(const char *opts)
Definition: RooGlobalFunc.cxx:184
RooFit::FitGauss
RooCmdArg FitGauss(Bool_t flag=kTRUE)
Definition: RooGlobalFunc.cxx:282
gStyle
R__EXTERN TStyle * gStyle
Definition: TStyle.h:412
TH1::GetYaxis
TAxis * GetYaxis()
Definition: TH1.h:318
RooFit
Definition: RooCFunction1Binding.h:29
RooPlot.h
gDirectory
#define gDirectory
Definition: TDirectory.h:236
RooPlot::GetYaxis
TAxis * GetYaxis() const
Definition: RooPlot.cxx:1256
TH2
Definition: TH2.h:30
RooPlot
Definition: RooPlot.h:44
RooMCStudy::fitParDataSet
const RooDataSet & fitParDataSet()
Return a RooDataSet containing the post-fit parameters of each toy cycle.
Definition: RooMCStudy.cxx:981
RooRealVar.h
TH2.h
RooFit::Binned
RooCmdArg Binned(Bool_t flag=kTRUE)
Definition: RooGlobalFunc.cxx:268
TStyle::SetOptStat
void SetOptStat(Int_t stat=1)
The type of information printed in the histogram statistics box can be selected via the parameter mod...
Definition: TStyle.cxx:1592
RooFitResult.h
RooConstVar.h
TCanvas
Definition: TCanvas.h:23
RooMCStudy::plotError
RooPlot * plotError(const RooRealVar &param, 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())
Plot the distribution of the fit errors for the specified parameter on a newly created frame.
Definition: RooMCStudy.cxx:1174
TAxis.h
rf801_mcstudy
Definition: rf801_mcstudy.py:1
TH1
Definition: TH1.h:57
gPad
#define gPad
Definition: TVirtualPad.h:287
RooMCStudy::generateAndFit
Bool_t generateAndFit(Int_t nSamples, Int_t nEvtPerSample=0, Bool_t keepGenData=kFALSE, const char *asciiFilePat=0)
Generate and fit 'nSamples' samples of 'nEvtPerSample' events.
Definition: RooMCStudy.cxx:660
make_cnn_model.model
model
Definition: make_cnn_model.py:6
RooFit::Silence
RooCmdArg Silence(Bool_t flag=kTRUE)
Definition: RooGlobalFunc.cxx:260
TAttAxis::SetTitleOffset
virtual void SetTitleOffset(Float_t offset=1)
Set distance between the axis and the axis title.
Definition: TAttAxis.cxx:293
RooRealVar
Definition: RooRealVar.h:35
RooFit::Save
RooCmdArg Save(Bool_t flag=kTRUE)
Definition: RooGlobalFunc.cxx:187
RooArgSet
Definition: RooArgSet.h:28
TH1::Draw
virtual void Draw(Option_t *option="")
Draw this histogram with options.
Definition: TH1.cxx:2997
RooFit::Extended
RooCmdArg Extended(Bool_t flag=kTRUE)
Definition: RooGlobalFunc.cxx:155