RooStats_RooStatsTutorialsJune2013
上传者:莫德敏|上传时间:2015-04-15|密次下载
RooStats_RooStatsTutorialsJune2013
Table of Contents
RooFit/RooStats tutorials for INFN School of Statistics 2013.......................................................................1
Introduction.............................................................................................................................................1
Getting started with the software......................................................................................................1
Terminology and Conventions.........................................................................................................2
RooFit Exercises: Create and fitting a model..................................................................................................3
Exercise 1: Gaussian model and fit it to random generated data............................................................3
Exercise 2: Fit of a Signal over an Exponential Background.................................................................5
Exercise 3: Fit to a Combined model......................................................................................................8
RooStats Exercises...........................................................................................................................................13
Exercise 1: Create aModelConfig from the Gaussian plus Exponential Model used in the RooFit
Exercise 2..............................................................................................................................................13
Exercise 2: Profile Likelihood Calculator.............................................................................................14
Exercise 3a: Bayesian MCMC Calculator............................................................................................16
Exercise 3b: Bayesian Numerical Calculator.......................................................................................19
Exercise 4: Create a Poisson Counting Model......................................................................................22
Exercise 5: Compute a 95% Upper Limit with the Counting Model....................................................24
Exercise 6: Compute the significance (Hypothesis Test).....................................................................25
Exercise 6b: Compute significance (p-value) as function of the signal mass.......................................29
Exercise 7: Compute Limits using Hypothesis Test Inversion (CLs Limits).......................................31
Exercise 7b: Using theStandardHypoTestInvDemo.C tutorial............................................................35
RooFit/RooStats tutorials for INFN School of
Statistics 2013
This is a set of RooFit/RooStats tutorials given at INFN school of statistics (3-7 June 2013) , see the schoolagenda.
The required materials used during the RooFit/RooStats tutorials is described. The materials consist ofexercises that can be solved from what has been presented in the lecture. Two levels of help are provided: ahint and a full solution.
Hint Hide
Here the hint is shown.
Solution Hide
Here the solution is shown.
The hint allows to create the ROOT macro required to complete the exercise step by step, while the solutionprovides the full running code. The hint consists of code snippets, which can be combined to write a fullROOT macro to solve the exercise. If you are not able to write the macro yourself, because you find toodifficult or because the time is not sufficient, you can go directly to the solution, which will contain therunning code and (hopefully) you will be able to run the macro and get the result of the tutorial exercise.You can find the single code attached (links at the end of the page) or you can use the provided tar file. Somepoints linked to the exercises are optional and marked with a icon: they are useful to scrutinise in moredetail some aspects. Try to solve or look at them if you have the time.
Additional material can be found on:
the ROOT Web page;
the RooFit Web page and User Guide,Quick Start Guide;
the RooStats Twiki WebHome where you find links also to past tutorials;
the lecture slides (see Timetable for June 7);
RooFit and RooStats tutorials available in $ROOTSYS/tutorials/roofit and
$ROOTSYS/tutorials/roostats.
Introduction
Getting started with the software
A few advice words before starting. The tutorials are based on the ROOT version 5.34, possibly the latest one,
5.34.07 which is also installed in the Virtual Machine available for the school.
See the computer setup instructions if you need to install the virtual machine.
If you are going to use your installed version of ROOT, make sure you have configured with RooFit (./configure --enable-roofit). You can check if roofit is installed in your version of
ROOT by typing the command root-config --has-roofit. The answer must be yes. If not,you must re-configure ROOT and rebuild it or install a new binary version. See again the computersetup instructions for a detailed description on how to install and configure ROOT.
A basic knowledge of ROOT is assumed, in particular how to run a ROOT macro in interpreted mode(CINT) and in compiled mode (ACLIC)
root> .x myMacro.C // interpreted
root> .x myMacro.C+ // compiled
内容需要下载文档才能查看
RooStatsTutorialsJune2013 < RooStats < TWiki
It is recommended to add the following lines at the beginning of your ROOT macro, that will load
automatically the Roofit and Roostats libraries (note that the RooStats calculator are defined in the
RooStats namespace):
using namespace RooFit;
using namespace RooStats;
Avoid running a macro multiple times in the same ROOT CINT sessions (it might unfortunately crash
sometimes if you do it, because some objects might not be properly deleted in the macro)
Note that Roostats methods start with capital letter (as in ROOT) while Roofit ones start with lower
letter
The Roostats calculator are quite verbose, you can suppress the output by doing:
RooMsgService::instance().setGlobalKillBelow(RooFit::WARNING) ;
Some links to documentation:
ROOT reference guide: http://root.cern.ch/drupal/content/reference-guide
Roofit user's manual: http://root.cern.ch/drupal/content/users-guide
ROOT, Roofit, Roostats tutorials: http://root.cern.ch/root/html/tutorials/ or within the local ROOT
installation under $ROOTSYS/tutorials
Terminology and Conventions
Here we give pragmatic definitions for a few basic concepts that we will use.
observable - something you measure in an experiment, for example a particle's momentum. Often, a
function of measured quantities, for example an invariant mass of several particles
global observable or auxiliary observable - an observable from another measurement, for example,
the integrated luminosity
model - a set of probability density functions (PDFs), which describe distributions of the observables
or functions of observables
model parameter - any variable in your PDF expression, which is not an observable
parameter of interest (POI) - a model parameter that you study, for example a cross section of your
signal process
nuisance parameter - every other model parameter, which is not your parameter of interest
data or dataset - a set of values of observables, either measured in an experiment, or simulated
likelihood - a model computed for a particular dataset
hypothesis - a particular model, with specified observables, POI, nuisance parameters, and prior
PDFs (in case of Bayesian inference)
prior PDF - a probability density for an observable or a model parameter, which is known a priori,
i.e. before a measurement is considered. This is a Bayesian concept exclusively. Prior has no meaning
or place in a frequentist type of inference
Bayesian - a type of statistical inference that usually produces probability of the hypothesis given the
data. Requires a prior.
frequentist - a type of statistical inference that usually produces probability of the data given the
hypothesis.
RooFit Exercises: Create and fitting a model
The aim of the RooFit exercises is to learn how to build a RooFit model, how to fit the model on a set of datathat we will generate and how to plot the result. We will also learn how to save the full RooFit workspace
containing the model and data in a file which we can read back later, for example when we will do the
RooStats exercises. We will learn also how to generate the data from the model. The same generated data wewill then use to fit the model
Using the snippets of code, one can build a full ROOT macro which can be run interactively in ROOT or
compiled using ACLIC.
Exercise 1: Gaussian model and fit it to random generated
data
We will start with a very simple exercise. If you already know a bit of RooFit you might skip this exercise andgo directly to the next one. The aim of this exercise is to show and make you practise the basic functionalityof RooFit.
We will create a Gaussian model from which we will generate a pseudo-data set and then we will fit this dataset. After fitting, we will plot the result. You can find the instruction for each steps in the lecture slides.
Start creating the Gaussian model using the workspace factory, with the syntax introduced in the
lecture slides.
Use the generate(...) method of the RooAbsPdf class to generate a data set with 1000 events.
Plot the data set using RooPlot in a ROOT Canvas.
Fit the generate data using the fitTo(...) method of the RooAbsPdf class
Plot the resulting fit function on top of the data
Hint Hide
Creating the model
Use the syntax of the RooWorkspace factory to create first the Gaussian p.d.f. function with the
variables (observables and parameters).
Every variable in RooFit, needs to be created with a defined range [xmin,xmax]. Use very large value
if you don't know the range. If you provided only a value, the variable is considered constant. If you
provide only the minimum and the maximum, the initial value will be taken in the middle of the
range. It is important, to avoid undesired side effect, to have the initial value within the given range.
Note one can create using the workspace factory syntax any existing RooFit pdf class by using the Pdf
class name stripped by the Roo suffix. The exact signature required (variables to be passed) is defined
in the Pdf class constructor (You can browse the reference documentation here.
You need to define the [value, min, max] of a variable only the first time you create in the factory.
Afterwards you can reference the variable by its name.
// create Gaussian Pdf
RooWorkspace w("w");
w.factory("Gaussian:pdf(x[-10,10],mu[1,-1000,1000],s[2,0,1000])");
Retrieving objects from the workspace.
After you have created the variable and p.d.f in the workspace, you can access their pointers, by using
RooWorkspace::var for variables or RooWorkspace::pdf for p.d.f. Example:
// retrieving model components
RooAbsPdf * pdf = w.pdf("pdf"); // access object from workspace
内容需要下载文档才能查看
RooStatsTutorialsJune2013 < RooStats < TWiki
RooRealVar * x = w.var("x"); // access object from workspace
Generating a dataset:
We need to pass the observable we want to generate the data on (x) and the number of events
Note that we can generate also binned data sets. In that case we have two options:
use a RooDataHist and generateBinned: RooDataHist * binData =
pdf->generateBinned(*x, 1000);.
use the option AllBinned() which will generate a weighted data set: RooDataSet *
data = pdf->generate(*x, NumEvents(1000), AllBinned());.
// generate an unbinned dataset of 1000 events
RooDataSet * data = pdf->generate( *x, 1000);
Plot the data:
// create a RooPlot object and plot the data
RooPlot * plot = x->frame();
data->plotOn(plot);
Fit the data: you need to call the RooAbsPdf::fitTo.
// fit the data and save its result. Use the optional =Minuit2= minimiser
RooFitResult * res = pdf->fitTo(*data, Minimizer("Minuit2","Migrad"), Save(true) );
Plot the resulting fit function in the same plot
pdf->plotOn(plot);
plot->Draw(); // to show the RooPlot in the current ROOT Canvas
Solution Hide
<span class='twikiAlert'>
Failed to include URL https://twiki.cern.ch/twiki/pub/RooStats/RooStatsTutorialsJune2013/Ga</span>
Gaussian Fit Result:
Fit of the Gaussian model using RooFit
下载文档
热门试卷
- 2016年四川省内江市中考化学试卷
- 广西钦州市高新区2017届高三11月月考政治试卷
- 浙江省湖州市2016-2017学年高一上学期期中考试政治试卷
- 浙江省湖州市2016-2017学年高二上学期期中考试政治试卷
- 辽宁省铁岭市协作体2017届高三上学期第三次联考政治试卷
- 广西钦州市钦州港区2016-2017学年高二11月月考政治试卷
- 广西钦州市钦州港区2017届高三11月月考政治试卷
- 广西钦州市钦州港区2016-2017学年高一11月月考政治试卷
- 广西钦州市高新区2016-2017学年高二11月月考政治试卷
- 广西钦州市高新区2016-2017学年高一11月月考政治试卷
- 山东省滨州市三校2017届第一学期阶段测试初三英语试题
- 四川省成都七中2017届高三一诊模拟考试文科综合试卷
- 2017届普通高等学校招生全国统一考试模拟试题(附答案)
- 重庆市永川中学高2017级上期12月月考语文试题
- 江西宜春三中2017届高三第一学期第二次月考文科综合试题
- 内蒙古赤峰二中2017届高三上学期第三次月考英语试题
- 2017年六年级(上)数学期末考试卷
- 2017人教版小学英语三年级上期末笔试题
- 江苏省常州西藏民族中学2016-2017学年九年级思想品德第一学期第二次阶段测试试卷
- 重庆市九龙坡区七校2016-2017学年上期八年级素质测查(二)语文学科试题卷
- 江苏省无锡市钱桥中学2016年12月八年级语文阶段性测试卷
- 江苏省无锡市钱桥中学2016-2017学年七年级英语12月阶段检测试卷
- 山东省邹城市第八中学2016-2017学年八年级12月物理第4章试题(无答案)
- 【人教版】河北省2015-2016学年度九年级上期末语文试题卷(附答案)
- 四川省简阳市阳安中学2016年12月高二月考英语试卷
- 四川省成都龙泉中学高三上学期2016年12月月考试题文科综合能力测试
- 安徽省滁州中学2016—2017学年度第一学期12月月考高三英语试卷
- 山东省武城县第二中学2016.12高一年级上学期第二次月考历史试题(必修一第四、五单元)
- 福建省四地六校联考2016-2017学年上学期第三次月考高三化学试卷
- 甘肃省武威第二十三中学2016—2017学年度八年级第一学期12月月考生物试卷
网友关注
- 2015特岗教师招考“现代生物进化理论”典型习题(6)
- 特岗教师招考高中物理高频考点:机械能守恒定律(一)
- 2015特岗教师招考中国美术史综合测试题(五)
- 2015年特岗教师招聘西方音乐史之巴洛克时期解答题(5)
- 2015年特岗教师招聘西方音乐史之巴洛克时期解答题(3)
- 2015特岗教师招考高中物理“牛顿运动定律”练习题(2)
- 2015特岗教师招聘历史“人类文明的开端”测试题(2)
- 特岗教师招考化学知识点精讲:非金属及其化合物(一)
- 2015特岗教师招考英语“同位语从句”专项练习及答案(5)
- 2015特岗教师招考“人体的内环境与稳态”典型习题(4)
- 特岗教师招聘生物知识点:人体的内环境与稳态(二)
- 2015年特岗教师招聘西方音乐史之巴洛克时期解答题(4)
- 2015特岗教师招考中国美术史综合测试题(一)
- 2015特岗教师招考“现代生物进化理论”典型习题(5)
- 2015年特岗教师招聘西方音乐史名词解释题集锦(十三)
- 特岗教师招考高中物理“机械能守恒定律”典例精析(1)
- 特岗教师招聘生物知识点:人体的内环境与稳态(一)
- 特岗教师招考化学知识点精讲:非金属及其化合物(三)
- 2015特岗教师招考体育学科选择题专项练习(6)
- 特岗招考历史备考:“人类文明的开端”考点梳理(三)
- 2015年特岗教师招聘西方音乐史名词解释题集锦(十四)
- 特岗教师招考化学知识点精讲:非金属及其化合物(二)
- 2015特岗教师招考中国美术史综合测试题(六)
- 2015特岗教师招考高中物理“牛顿运动定律”练习题(3)
- 2015年特岗教师招聘西方音乐史名词解释题集锦(十一)
- 2015年特岗教师招聘西方音乐史名词解释题集锦(十二)
- 2015特岗教师招考中国美术史综合测试题(三)
- 2015特岗教师招考中国美术史综合测试题(四)
- 2015特岗教师招考体育学科选择题专项练习(3)
- 2015年特岗教师招聘西方音乐史之巴洛克时期解答题(6)
网友关注视频
- 七年级英语下册 上海牛津版 Unit9
- 二年级下册数学第二课
- 第4章 幂函数、指数函数和对数函数(下)_六 指数方程和对数方程_4.7 简单的指数方程_第一课时(沪教版高一下册)_T1566237
- 【部编】人教版语文七年级下册《泊秦淮》优质课教学视频+PPT课件+教案,天津市
- 外研版英语三起6年级下册(14版)Module3 Unit1
- 苏科版数学七年级下册7.2《探索平行线的性质》
- 三年级英语单词记忆下册(沪教版)第一二单元复习
- 北师大版八年级物理下册 第六章 常见的光学仪器(二)探究凸透镜成像的规律
- 【部编】人教版语文七年级下册《老山界》优质课教学视频+PPT课件+教案,安徽省
- 冀教版小学数学二年级下册第二单元《有余数除法的竖式计算》
- 沪教版牛津小学英语(深圳用) 四年级下册 Unit 8
- 30.3 由不共线三点的坐标确定二次函数_第一课时(市一等奖)(冀教版九年级下册)_T144342
- 人教版二年级下册数学
- 化学九年级下册全册同步 人教版 第22集 酸和碱的中和反应(一)
- 3.2 数学二年级下册第二单元 表内除法(一)整理和复习 李菲菲
- 冀教版小学数学二年级下册第二单元《租船问题》
- 七年级下册外研版英语M8U2reading
- 冀教版小学数学二年级下册第二单元《有余数除法的整理与复习》
- 沪教版八年级下册数学练习册20.4(2)一次函数的应用2P8
- 苏科版八年级数学下册7.2《统计图的选用》
- 外研版英语七年级下册module3 unit2第一课时
- 沪教版牛津小学英语(深圳用) 四年级下册 Unit 12
- 化学九年级下册全册同步 人教版 第25集 生活中常见的盐(二)
- 外研版英语七年级下册module1unit3名词性物主代词讲解
- 河南省名校课堂七年级下册英语第一课(2020年2月10日)
- 沪教版牛津小学英语(深圳用) 四年级下册 Unit 3
- 北师大版数学四年级下册第三单元第四节街心广场
- 【部编】人教版语文七年级下册《老山界》优质课教学视频+PPT课件+教案,安徽省
- 北师大版小学数学四年级下册第15课小数乘小数一
- 七年级英语下册 上海牛津版 Unit5
精品推荐
- 2016-2017学年高一语文人教版必修一+模块学业水平检测试题(含答案)
- 广西钦州市高新区2017届高三11月月考政治试卷
- 浙江省湖州市2016-2017学年高一上学期期中考试政治试卷
- 浙江省湖州市2016-2017学年高二上学期期中考试政治试卷
- 辽宁省铁岭市协作体2017届高三上学期第三次联考政治试卷
- 广西钦州市钦州港区2016-2017学年高二11月月考政治试卷
- 广西钦州市钦州港区2017届高三11月月考政治试卷
- 广西钦州市钦州港区2016-2017学年高一11月月考政治试卷
- 广西钦州市高新区2016-2017学年高二11月月考政治试卷
- 广西钦州市高新区2016-2017学年高一11月月考政治试卷
分类导航
- 互联网
- 电脑基础知识
- 计算机软件及应用
- 计算机硬件及网络
- 计算机应用/办公自动化
- .NET
- 数据结构与算法
- Java
- SEO
- C/C++资料
- linux/Unix相关
- 手机开发
- UML理论/建模
- 并行计算/云计算
- 嵌入式开发
- windows相关
- 软件工程
- 管理信息系统
- 开发文档
- 图形图像
- 网络与通信
- 网络信息安全
- 电子支付
- Labview
- matlab
- 网络资源
- Python
- Delphi/Perl
- 评测
- Flash/Flex
- CSS/Script
- 计算机原理
- PHP资料
- 数据挖掘与模式识别
- Web服务
- 数据库
- Visual Basic
- 电子商务
- 服务器
- 搜索引擎优化
- 存储
- 架构
- 行业软件
- 人工智能
- 计算机辅助设计
- 多媒体
- 软件测试
- 计算机硬件与维护
- 网站策划/UE
- 网页设计/UI
- 网吧管理