RooRarFit Tutorial Fergus Wilson RAL/STFC Based on original tutorial by author Lei Zhang 1st February 2011 Fergus Wilson, RAL/STFC1.

Slides:



Advertisements
Similar presentations
Fully Inclusive b->s  Status Report UCSC: Eisner, Schmitz, Schumm Edinburgh: Tinslay Pisa: Bucci, Walsh Royal Holloway: Brown, McMahon SLAC: Jessop,
Advertisements

1 Semiexclusive semileptonic B->charmdecays C. Gatto - INFN Napoli A. Mazzacane - Universita’ di Napoli April 10, 2003.
1/15 Sensitivity to  with B  D(KK  )K Decays CP Working Group Meeting - Thursday, 19 th April 2007 Introduction B  DK  Dalitz Analysis Summary.
16 May 2002Paul Dauncey - BaBar1 Measurements of CP asymmetries and branching fractions in B 0   +  ,  K +  ,  K + K  Paul Dauncey Imperial College,
8. Hypotheses 8.4 Two more things K. Desch – Statistical methods of data analysis SS10 Inclusion of systematic errors LHR methods needs a prediction (from.
DPF Victor Pavlunin on behalf of the CLEO Collaboration DPF-2006 Results from four CLEO Y (5S) analyses:  Exclusive B s and B Reconstruction at.
Search for B     with SemiExclusive reconstruction C.Cartaro, G. De Nardo, F. Fabozzi, L. Lista Università & INFN - Sezione di Napoli.
G. Cowan Lectures on Statistical Data Analysis 1 Statistical Data Analysis: Lecture 8 1Probability, Bayes’ theorem, random variables, pdfs 2Functions of.
7/12/2015 Top Pairs Meeting 1 A template fit technique to measure the top quark mass in the l+jets channel Ulrich Heintz, Vivek Parihar.
G. Cowan Lectures on Statistical Data Analysis Lecture 10 page 1 Statistical Data Analysis: Lecture 10 1Probability, Bayes’ theorem 2Random variables and.
Statistical aspects of Higgs analyses W. Verkerke (NIKHEF)
LINEAR REGRESSION Introduction Section 0 Lecture 1 Slide 1 Lecture 5 Slide 1 INTRODUCTION TO Modern Physics PHYX 2710 Fall 2004 Intermediate 3870 Fall.
Discovery Experience: CMS Giovanni Petrucciani (UCSD)
Fourier Studies: Looking at Data A. Cerri. 2 Outline Introduction Data Sample Toy Montecarlo –Expected Sensitivity –Expected Resolution Frequency Scans:
Statistical Methods for Data Analysis Parameter estimates with RooFit Luca Lista INFN Napoli.
880.P20 Winter 2006 Richard Kass 1 Confidence Intervals and Upper Limits Confidence intervals (CI) are related to confidence limits (CL). To calculate.
Analysis Meeting vol Shun University.
RooRarFit Tutorial Lei Zhang UC Riverside. 2 What is RooRarFit A general ML fitter based on ROOT/RooFit Why use RooRarFit? A question asked by many people:
G. Cowan Lectures on Statistical Data Analysis Lecture 3 page 1 Lecture 3 1 Probability (90 min.) Definition, Bayes’ theorem, probability densities and.
Ranjeet Department of Physics & Astrophysics University of Delhi Working with Origin.
Max Baak1 Impact of Tag-side Interference on Measurement of sin(2  +  ) with Fully Reconstructed B 0  D (*)  Decays Max Baak NIKHEF, Amsterdam For.
 Candidate events are selected by reconstructing a D, called a tag, in several hadronic modes  Then we reconstruct the semileptonic decay in the system.
Status of the Glasgow B→hh analysis CP Working group γ from loops 14 th October 2010 Paul Sail, Lars Eklund and Alison Bates.
RooFit – tools for ML fits Authors: Wouter Verkerke and David Kirkby.
1 Methods of Experimental Particle Physics Alexei Safonov Lecture #23.
Signal and Background Modeling for H → 4l Peter Vankov UK Higgs Meeting, RAL
Status of the Fourier Studies A. Cerri. Outline Introduction Description of the tool Validation –“lifetime fit” –Pulls Toy Montecarlo –Ingredients –Comparison.
Kalanand Mishra April 27, Branching Ratio Measurements of Decays D 0  π - π + π 0, D 0  K - K + π 0 Relative to D 0  K - π + π 0 Giampiero Mancinelli,
Sensitivity Prospects for Light Charged Higgs at 7 TeV J.L. Lane, P.S. Miyagawa, U.K. Yang (Manchester) M. Klemetti, C.T. Potter (McGill) P. Mal (Arizona)
WIN-03, Lake Geneva, WisconsinSanjay K Swain Hadronic rare B decays Hadronic rare B-decays Sanjay K Swain Belle collaboration B - -> D cp K (*)- B - ->
Parallelization of likelihood functions for data analysis Alfio Lazzaro CERN openlab Forum on Concurrent Programming Models and Frameworks.
1 The BaBar EMC, and B  J/  hh analysis Nick Barlow, Yaw Ming Chia January 2006.
Checks with the Fourier Method A. Cerri. Outline Description of the tool Validation devices –“lifetime fit” –Pulls Toy Montecarlo –Ingredients –Comparison.
1 Introduction to Statistics − Day 4 Glen Cowan Lecture 1 Probability Random variables, probability densities, etc. Lecture 2 Brief catalogue of probability.
Measurement of the D  e form factor A. Oyanguren (IFIC, Valencia) J. Costa, A. D’Orazio, P. Roudeau, J. Serrano (LAL, Orsay)  To do list  Background.
CP Violation Studies in B 0  D (*)  in B A B A R and BELLE Dominique Boutigny LAPP-CNRS/IN2P3 HEP2003 Europhysics Conference in Aachen, Germany July.
1 Koji Hara (KEK) For the Belle Collaboration Time Dependent CP Violation in B 0 →  +  - Decays [hep-ex/ ]
Tutorial I: Missing Value Analysis
Measurement of  2 /  using B   Decays at Belle and BaBar Alexander Somov CKM 06, Nagoya 2006 Introduction (CP violation in B 0   +   decays) Measurements.
Σ Eγ comparison using Woochun Park Univ of South Carolina Feb 26,
Andrzej Bożek for Belle Coll. I NSTITUTE OF N UCLEAR P HYSICS, K RAKOW ICHEP Beijing 2004  3 and sin(2  1 +  3 ) at Belle  3 and sin(2  1 +  3 )
4/12/05 -Xiaojian Zhang, 1 UIUC paper review Introduction to Bc Event selection The blind analysis The final result The systematic error.
Kalanand Mishra June 29, Branching Ratio Measurements of Decays D 0  π - π + π 0, D 0  K - K + π 0 Relative to D 0  K - π + π 0 Giampiero Mancinelli,
Wouter Verkerke, UCSB RooFitTools A general purpose tool kit for data modeling, developed in BaBar Wouter Verkerke (UC Santa Barbara) David Kirkby (Stanford.
Kalanand Mishra February 23, Branching Ratio Measurements of Decays D 0  π - π + π 0, D 0  K - K + π 0 Relative to D 0  K - π + π 0 decay Giampiero.
G. Cowan Lectures on Statistical Data Analysis Lecture 10 page 1 Statistical Data Analysis: Lecture 10 1Probability, Bayes’ theorem 2Random variables and.
QM2004 Version1 Measurements of the  ->     with PHENIX in Au+Au Collisions at 200 GeV at RHIC PPG016 Figures with Final Approval Charles F. Maguire.
Conditional Observables Joe Tuggle BaBar ROOT/RooFit Workshop December 2007.
Systematics in Hfitter. Reminder: profiling nuisance parameters Likelihood ratio is the most powerful discriminant between 2 hypotheses What if the hypotheses.
Guglielmo De Nardo for the BABAR collaboration Napoli University and INFN ICHEP 2010, Paris, 23 July 2010.
Tau31 Tracking Efficiency at BaBar Ian Nugent UNIVERSITY OF VICTORIA Sept 2005 Outline Introduction  Decays Efficiency Charge Asymmetry Pt Dependence.
Charm Mixing and D Dalitz analysis at BESIII SUN Shengsen Institute of High Energy Physics, Beijing (for BESIII Collaboration) 37 th International Conference.
1 Comparing Unbinned likelihood methods IceCube/Antares Common Point source analysis from IC22 & Antares 2007/2008 data sets J. Brunner.
Hands-on exercises *. Getting started – ROOT 5.25/02 setup Start a ROOT 5.25/02 session –On your local laptop installation, or –On lxplus (SLC4) or lx64slc5.
1 D *+ production Alexandr Kozlinskiy Thomas Bauer Vanya Belyaev
I'm concerned that the OS requirement for the signal is inefficient as the charge of the TeV scale leptons can be easily mis-assigned. As a result we do.
Analysis Model Zhengyun You University of California Irvine Mu2e Computing Review March 5-6, 2015 Mu2e-doc-5227.
LNF 12/12/06 1 F.Ambrosino-T. Capussela-F.Perfetto Update on        Dalitz plot slope Where we started from A big surprise Systematic checks.
Searches and limit analyses with the Fourier transform Alex, Amanda, Donatella, Franco, Giuseppe, Hung-Chung, Johannes, Juerg, Marjorie, Sandro, Stefano.
Wouter Verkerke, UCSB Data Analysis Exercises - Day 2 Wouter Verkerke (NIKHEF)
Investigation on CDF Top Physics Group Ye Li Graduate Student UW - Madison.
Analysis Tools interface - configuration Wouter Verkerke Wouter Verkerke, NIKHEF 1.
(Day 3).
Inclusive Tag-Side Vertex Reconstruction in Partially Reconstructed B decays -A Progress Report - 11/09/2011 TDBC-BRECO.
CMS RooStats Higgs Combination Package
° status report analysis details: overview; “where we are”; plans: before finalizing result.. I.Larin 02/13/2009.
Computing and Statistical Data Analysis / Stat 7
Paul Sail, Lars Eklund and Alison Bates
Dilepton Mass. Progress report.
° status report analysis details: overview; “where we are”; plans: before finalizing result.. I.Larin 02/13/2009.
Presentation transcript:

RooRarFit Tutorial Fergus Wilson RAL/STFC Based on original tutorial by author Lei Zhang 1st February 2011 Fergus Wilson, RAL/STFC1

Contents Maximum Likelihood Reminder Why RooRarFit How to setup RooRarFit How to write a RooRarFit configuration file How to run a RooRarFit action (with examples.) Tutorial files 1st February 2011 Fergus Wilson, RAL/STFC2

Maximum Likelihood Reminder 1st February 2011 Fergus Wilson, RAL/STFC3 Observables Parameters

4 What is RooRarFit? A general ML fitter based on ROOT/RooFit written by lei Zhang Why use RooRarFit? A question asked by many people: Why do so many people write their own fitters with ROOT/RooFit? What’s wrong? ROOT/RooFit are toolkits, engines, so one needs to build a fitter, an application, to make use of them. RooRarFit is one of such fitters, applications, but as a general fitter, it can be used by many different analyses, with benefits: Access to the full power of RooFit Coding free to final users (no C++ experience needed) Driven by readable text configuration files Flexible design, ‘programmable’ configuration files Lots of fitting, plotting functions implemented Fully documented, lots of working examples from many analyses already Automatically creates the plots you need 1st February 2011 Fergus Wilson, RAL/STFC

5 RooRarFit implementation Wrappers of RooRealVar, RooDataSet, RooPDFs, etc. implemented, so can be defined through ascii configs –Dataset classes –PDF classes Fitting actions implemented as functions driven by ascii configuration filess Auxiliary classes, main program, scripts –String parser class –NLL class to deal with NLL curve –Minuit class derived from RooMinuit for contour plot –Version control header file –Main program (rarFit) –submitToy (toy study batch processor for slac, cu-boulder, ed, ral) Assume users have experience with ROOT/RooFit, so no ROOT/RooFit details in this tutorial 1st February 2011 Fergus Wilson, RAL/STFC

RooRarFit status and the future RooRarFit and BaBar –At the moment, RooRarFit only runs in the BaBar analysis framework. –You need to check out a BaBar analysis and then add RooRarFit package. –This is because BaBar uses its own, older versions of RooFitCore and RooFitModels that are incompatible with the versions that come with Root/RooFit. –Do not check out RooFitCore and RooFitModels packages or you will get conflicts. –This tutorial based on the BaBar RooRarFit version. RooRarFit in the future –There is a project to free RooRarFit from the BaBar framework. –New version will run on any machine (linux, solaris, mac) with Root installed (even if BaBar code is not available). –Should become available early in –Will have same functionality as old version plus improvements. 1st February 2011 Fergus Wilson, RAL/STFC6

Setting up RooRarFit and Running tutorial.config 1st February 2011 Fergus Wilson, RAL/STFC7

8 Get and Run RooRarFit With BaBar SRT release version >= addpkg RooRarFit V gmake RooRarFit.all cd workdir In workdir, run the application ( rarFit ) without any args to get short help page: > rarFit rarFit [-options] -h this help page -D (default "Dataset Input") -C (default "mlFitter Config") -A (default "Fitter Action") -t (default 0) -n (default 0, use config) -d (default.toyData) e.g. To run rarFit from config file demo.config rarFit demo.config and with mlfitter config from section [myMLFitter] rarFit -C myMLFitter demo.config and with mlfitter action from section [my Fit Action] rarFit -C myMLFitter -A "my Fit Action" demo.config 1st February 2011 Fergus Wilson, RAL/STFC

Running the tutorial.config – getting ready Checkout RooRarFit package (page 8) Create the input datasets (both ascii and root). The dataset can be used to represent both a charge asymmetry (B + → ) and a time-dependent CP Violation (B 0 →) analysis dataset with 3 hypotheses (signal, uds bkg, peaking bkg) and 10 observables. Creates 3 datasets for signal, uds and peaking bkg. Merges together to form “real data” = signal (100 #evts), uds (4000) and peaking (500). The expected results are: 1st February 2011 Fergus Wilson, RAL/STFC9  cd workdir  mkdir Ntuples  $ROOTSYS/bin/root –l –q –b../RooRarFit/doc/tutorial/make_data.C  cp../RooRarFit/doc/tutorial/tutorial.config.  cp../RooRarFit/doc/tutorial/tutorial_v3.config. VariableInputFitted Yield (events) ± 18 BF (x ) ± 1.0 Charge asymmetry ± 0.16 S ± 0.22 C ± 0.15

1) Signal Yield Examples 1st February 2011 Fergus Wilson, RAL/STFC10 // The signal yield model is defined in “[mlFitter config]” (default if not specified on cmd line) // fit the individual PDFs -> creates plots  rarFit –A PdfAct tutorial.config // fit the whole model and extract the yields -> no plots created  rarFit –A MLAct tutorial.config // Do a “pure” toy study on ensemble of events created by the fitted PDFs -> creates ntuples rarFit –A ToyAct tutorial.config // Do an “embedded” toy study on ensemble of events created from the datasets  rarFit –A eToyAct tutorial.config // generate projection plots -> creates plots  rarFit –A ProjAct tutorial.config // generate sPlots -> creates plots  rarFit –A SPlotAct tutorial.config // scan the NLL about fitted yield ML minimum -> creates plots  rarFit –A YieldScan tutorial.config

2) Branching Fraction Examples 1st February 2011 Fergus Wilson, RAL/STFC11 //use the BF model in “[bfFitter Config]” section // fit the individual PDFs  rarFit –A PdfAct –C “bfFitter Config” tutorial.config // fit the whole model and extract the branching fraction  rarFit –A MLAct –C “bfFitter Config” tutorial.config // Do a “pure” toy study on an ensemble of events created // by the fitted PDFs > rarFit –A ToyAct –C “bfFitter Config” tutorial.config // Do an “embedded” toy study on an ensemble of events created // from the datasets  rarFit –A eToyAct –C “bfFitter Config” tutorial.config // projection and sPlots are meaningless for branching fraction fits // scan the NLL about fitted branching fraction ML minimum  rarFit –A BRScan –C “bfFitter Config” tutorial.config

3) Charge Asymmetry Example 1st February 2011 Fergus Wilson, RAL/STFC12 // Edit tutorial.config and change “simultaneousFit = no” to “simultaneousFit = yes” // in section “[mlFitter Config]” // fit the individual PDFs  rarFit –A PdfAct tutorial.config // fit the whole model and extract the Charged Asymmetries  rarFit –A MLAct tutorial.config // scan the NLL about fitted Charge Asymmetry ML minimum  rarFit –A AScan tutorial.config

4) Time Dependent Asymmetries Example 1st February 2011 Fergus Wilson, RAL/STFC13 // fit the individual PDFs  rarFit –A PdfAct tutorial_v3.config // fit the whole model and extract the asymmetries C and S and yield  rarFit –A MLAct tutorial_v3.config

14 Documentation You can make your own documentation Slightly out of date HTML/pdf/ps is on the web as well – Lots of working examples from many analyses –RooRarFit/doc/Sample_configs/ Sample scripts to deal with RooRarFit ROOT output –RooRarFit/doc/Sample_scripts/ Tutorial configuration file and examples –RooRarFit/doc/tutorial/ Source code documented using doxygen (but out of date) – 1st February 2011 Fergus Wilson, RAL/STFC // create pdf, ps and html documentation  cd RooRarFit/doc  gmake RooRarFitMakeInfo

Dataset Definition & Input Define the structure of dataset entry & Read in datasets 1st February 2011 Fergus Wilson, RAL/STFC

16 RooRarFit configuration file There are 3 main “Configuration sections” –Dataset definition section - define the variables to be read –Dataset input section – define and read in datasets –PDF configuration section – define the PDFs for each hypothesis and observable e.g. “signal mass”, “background MES”, … PDFs are created from top to bottom with PDF config sections. Composite PDFs can be created from simpler PDFs There can be zero or more “Action sections” 1.Fit the individual PDFs and create plots of fits - pdfFit 2.Fit the maximum likelihood model and output results - mlFit 3.Perform multiple toy fits to extract pulls and biases – toyStudy 4.Create plots of log-likelihood about the minimum – scanPlot 5.Create projection plots of the fitted yields – projPlot 6.Create contour plots of two variables – contourPlot 7.Create sPlot plots of the hypothesis yields – sPlot 8.Combine Log-likelihood distributions - combinePlot 1st February 2011 Fergus Wilson, RAL/STFC

Define dataset entry structure with dataset section –Default name is “[Dataset Definition]” –“Fields” declares observables/variables that will be used. –Then define each observable (name, type, title, range, etc..) –Observable definition syntax = “ ” –Possible types: RooRealVar, RooCategory, RooStringVar, RooConstVar, RooUnblindPrecision, RooMappedCategory, RooThresholdCategory, RooFormulaVar 17 [Dataset Definition] Fields = runNum mes de fisher runNum = RooRealVar “runNum” 0 1e10 mes = RooRealVar “M_{es}” B(50) “GeV/c^2” de = RooRealVar “#Delta E” B(45) “GeV” fisher = RooRealVar “Fisher” -4 5 B(45) Dataset definition section Latex in RooFit unit rangePlot binsTypeTitle 1st February 2011 Fergus Wilson, RAL/STFC […text…] starts a section

–“AddOns” declares derived columns –Define all declared ‘add-on’ columns in this section as well –columnType can be: RooMappedCategory, RooThresholdCategory, RooFormulaVar 18 [Dataset Definition] Fields = runNum mes de fisher runNum = RooRealVar “runNum” 0 1e10 mes = RooRealVar “M_{es}” B(50) “GeV/c^2” de = RooRealVar “#Delta E” B(45) “GeV” fisher = RooRealVar “Fisher” -4 5 B(45) AddOns = runBlock runBlock = RooMappedCategory "Run Block" noIdx runRange \\ “Run1” "*Run1" "Run1" "*Run2" "Run2" \\ "*Run3" "Run3" "*Run4" "Run4" runRange = RooThresholdCategory "Run Range" noIdx runNum \\ "mcRun2" "daRun1" "daRun2" \\ "daRun3" "daRun4" \\ "mcRun1" Dataset definition section (Cont.) 1st February 2011 Fergus Wilson, RAL/STFC

Input datasets with dataset input section –Default name is “[Dataset Input]” –“Datasets” declares all datasets to be used as input –Then define all declared datasets (in the order they were defined in “Datasets”). –Dataset definition syntax = “ ” –Dataset input types: ascii, root, reduce, add [Dataset Input] Datasets = onData sigMC bbMC gsbData desbData totMC onData = root “on peak data” “mydats/on.root” “ntout” sigMC = ascii “sig MC” “mydats/sigMC.txt” Q bbMC = ascii “peaking BB MC” “mydats/bbMC.txt” Q gsbData = reduce “gsb Data” onData “mes<5.27” desbData = reduce “de sb Data” onData “(de.1)” totMC = add “signal+bckg MC” sigMC 100 bbMC Dataset file name source datasetreduce cutsinputTypetitle Dataset input section Q for quiet mode 1st February 2011 Fergus Wilson, RAL/STFC

20 Dataset input section (Cont.) Other (optional) configs for “[Dataset Input]” section –dsdSec = Default: Dataset Definition –setWeightVar = Default: no weightVar for datasets Warning: may become obsolete in new versions. –tabulateDatasets = yes Tabulate datasets for each RooCategory observable. Default: no tabulation –computeCorrelations = Compute correlation matrices for (given) datasets. Default: yes 1st February 2011 Fergus Wilson, RAL/STFC

PDF Configuration Sections Define PDFs from top to bottom with configuration sections 1st February 2011 Fergus Wilson, RAL/STFC

Master fitter configuration section –Starting point for all PDFs, also include: –Global configurations –Simultaneous fit configuration for RooFit –All section headers have keyword “Config” [mlFitter Config] Comps = myModel // can have multiple ML models for simFit fitData = simData // Default dataset, also used as prototype dataset useNumCPU = 4 // number of cpu cores to use simultaneousFit = no // Build and use simPdf if set to yes physModels = the_myModel // models for simPdf splitCats = runBlock // List all splitting categories here the_myModel = runBlock : mesSig_shift 22 PDF configuration sections – Master fitter RooSimPdfBuilder Configs Configured in its own section, see next slide 1st February 2011 Fergus Wilson, RAL/STFC

23 Declared as full names Optional title [myModel Config] configStr = MLPdf “ml yield model” Comps = Sig Chls Bkg // component PDFs for this model Coeffs = nSig nChls nBkg // component yields for this model nSig = nSig 100 L(-100 – 1000) nChls = nChls 100 L(-100 – 1000) nBkg = nBkg 2000 L(-100 – 10000) postPdfFloat = nSig nChls nBkg PDF configuration sections – ML model Maximum Likelihood model config section –Each model declared in ML fitter section has its own configuration section –configStr set to ` MLPdf ’ for ML models –Declare as many hypotheses as wanted with config ` Comps ’ –Each hypothesis has its own configuration section (see next slide) –Corresponding yields listed with config ` Coeffs ’ –Declared yields defined within the section Float yields RRV stream output 1st February 2011 Fergus Wilson, RAL/STFC

24 PDF config sections – hypothesis configuration Hypothesis configuration sections –Each hypothesis in ML model has its own configuration section –configStr can be set to any valid PDF type in RooRarFit, but usually ` ProdPdf ’ for composite PDF as product of PDFs for observables included in the model [Sig Config] configStr = ProdPdf “Signal Pdf” Comps = deSig mesSig fisSig // Product components fitData = sigMC // Use sigMC to get pdf params [Chls Config] configStr = ProdPdf “Charmless B bkg” Comps = deChls mesChls fisChls fitData = bbMC // Use bbMC to get pdf params [Bkg Config] configStr = ProdPdf “Continuum Bkg” Comps = deBkg mesBkg fisBkg fitData = gsbData // Use gsbData to get pdf params Signal config section Chmls B Bkg config section Continuum config section Defined in their own sections 1st February 2011 Fergus Wilson, RAL/STFC

25 PDF config sections – (1) Signal PDFs examples Signal PDF config sections [deSig Config] configStr = TwoGauss “Signal” x = de meanC = 0. L( ) meanT = L( ) sigmaC = L( ) sigmaT = 0.09 L(0.0 – 0.3) fracC = 0.75 L(0.5 – 1.0) [mesSig Config] configStr = TwoGauss x = mes meanC = 5.28 L(5.25 – 5.29) meanT = 5.27 L(5.25 – 5.29) sigmaC = L(0.0 – 0.01) sigmaT = L(0.0 – 0.10) fracC = 0.95 L(0.5 – 1.0) shift = 0.0 C L( ) [fisSig Config] configStr = BGGauss x = fisher mean = -0.5 L(-2 - 2) rms = 0.6 L(0.0 – 1) asym = 0.1 L(-.5 – 0.5) If full name is not specified for params, RRV name will be prefixed with PDF name, for example, fisSig_mean, fisSig_rms, and fisSig_asym. In RooRarFit, params belong to RooRarFit PDF objects, so full names are needed to distinguish same param names from different PDFs. 1st February 2011 Fergus Wilson, RAL/STFC

Charmless B background PDF config sections [mesChlsA Config] configStr = ArgusBG x = mes max = 5.29 C c = -30 L( ) [fisChls Config] configStr = BGGauss x = fisher mean = -0.4 L(-2 - 2) rms = 0.6 L(0.0 – 1) asym = 0.1 L(-.5 – 0.5) 26 PDF config sections – (2) Chls PDFs examples [deChls Config] configStr = TwoGauss x = de meanC = 0.13 L( ) meanT = L( ) sigmaC = 0.06 L( ) sigmaT = 0.14 L(0.0 – 0.3) fracC = 0.35 L(0.0 – 1.0) [mesChls Config] configStr = AddPdf Comps = mesChlsG mesChlsA Coeffs = fracG fracG = T “f_{G}” 0.08 L(0-1) [mesChlsG Config] configStr = Gaussian x = mes mean = 5.28 L(5.25 – 5.29) sigma = L(0.0 – 0.1) 1st February 2011 Fergus Wilson, RAL/STFC AddPdf means: mesChls = fracG * mesChlsG + (1-fracG) * mesChlsA

27 [fisBkg Config] configStr = AddPdf Comps = fisBkgC fisBkgT Coeffs = fracC fracC = T “f_{C}” 0.97 L(0 -1) [fisBkgC Config] configStr = BGGauss x = fisher mean = T “#mu_{C}” -0.4 L(-2 - 2) rms = T “#sigma_{C}” 0.6 L(0 – 1) asym = T “A_{C}” 0.1 L(-.5 – 0.5) [fisBkgT Config] configStr = Gaussian x = fisher mean = T “#mu_{T}” 0.8 L(-1 – 2) sigma = T “#sigma_{T}” 2.0 L(0 – 5) PDF config sections – (3) Bkg PDFs examples Continuum background PDF config sections [deBkg Config] configStr = Polynomial x = de nOrder = 2 P01 = -1.5 L( ) P02 = 2.0 L( ) postPdfFloat = P01 [mesBkg Config] fitData = desbData configStr = ArgusBG x = mes max = 5.29 C c = -15 L( ) postPdfFloat = c 1st February 2011 Fergus Wilson, RAL/STFC This parameter will be floated after the PDF fit

We can reuse a fitted PDF in another PDF e.g. we wish to fit the continuum background but we know that it has a signal-like component –First fit signal PDF –Then use fitted signal PDF in background Reusing a PDF 1st February 2011 Fergus Wilson, RAL/STFC28 [massSig] configStr = RelBreitWigner “Signal” x = mass mean = 0.80 L(0.8 – 1.0) width = 0.05 L(0.01 – 0.1) [massBkg Config] configStr = AddPdf “Continuum” Comps = massSig massPolyBkg prePdfFix = massSig Coeffs = fracS fracS = T “f_{S}” 0.75 L(0.5 – 1.0) Reuse the PDF fitted in the “massSig” section

29 PDF config sections –ArgusBG –Ballack –BifurGauss –Binned –Decay, BDecay, BCPGenDecay –CBShape (Crystal Ball) –Cruijff –Exponential –Gaussian –BreitWigner, Relativistic BW –Landau –Voigtian –Novosibirsk –GaussModel –Generic Pdf –Keys, 2DKeys –Polynomial, Chebychev –Parametric Step Function –Triple Gaussian, Triple Guassian Model, Gexp –Double Gaussian (w/ scale and shift) –Histograms RooFit composite PDFs implemented: ProdPdf, AddPdf, AddModel, SimPdfBuild RooFit base PDFs implemented: 1st February 2011 Fergus Wilson, RAL/STFC

Fit Action Sections 1.Fit the individual PDFs and create plots of fits - pdfFit 2.Fit the maximum likelihood model - mlFit 3.Perform multiple toy fits to extract pulls and biases – toyStudy 4.Create plots of log-likelihood about the minimum – scanPlot 5.Create projection plots of the fitted yields – projPlot 6.Create contour plots of two variables – contourPlot 7.Create sPlot plots of the hypothesis yields – sPlot 8.Combine Log-likelihood distributions - combinePlot 1st February 2011 Fergus Wilson, RAL/STFC

31 Fit action (1) - pdfFit Get PDF parameters from fits of individual PDFs to datasets –Input: initial values in PDF configuration sections –Output: fitted parameters in intermediate file; PDF plots in ROOT file // Action section name, command line option –A PdfAct [PdfAct] // pdfFit options pdfFit = yes // enable pdfFit action postPdfMakePlot = yes // To output PDF plots into root file postPdfWriteParams = yes // To output params to text file Other configs for pdfFit action –pdfToFit = … Only those listed PDFs will be fitted if this config exists. –postPdfReadSecParams = Override params from PDF fits with values listed in action section (and section if specified here). 1st February 2011 Fergus Wilson, RAL/STFC

Fit action (1) – pdfFit output example 1st February 2011 Fergus Wilson, RAL/STFC32 heplnx111> rarFit –A PdfAct tutorial.config heplnx111> $ROOTSYS/bin/root -l results/tutorial.mlFitter.Config.pdfFit.PdfAct.root...using style 'Plain'...found RELEASE directory...found PARENT directory...running in release For approved plots use: gROOT->SetStyle("BABAR"); To add a BABAR label use: BABARLabel(); To add a better-scaling BABAR label use: BABARSmartLabel(); Type "BABARSmartLabel(-2);" for options root [0] Attaching file results/tutorial.mlFitterConfig.pdfFit.PdfAct.root as _file0... RooFit v Developed by Wouter Verkerke and David Kirkby Copyright (C) NIKHEF, University of California & Stanford University All rights reserved, please read root [1] _file0->ls() TFile** results/tutorial.mlFitter_Config.pdfFit.PdfAct.root TFile* results/tutorial.mlFitter_Config.pdfFit.PdfAct.root KEY: RooPlot mes_the_mesSig;1 M_{ES} CBShape signal KEY: RooPlot deltae_the_deSig;1 #DeltaE TwoGauss signal KEY: RooPlot nn_the_nnSig;1 Fisher Gaussian signal KEY: RooPlot mass_the_massSig;1 Mass BreitWigner signal KEY: RooPlot mes_the_mesBkg;1 M_{ES} AddPdf bkg KEY: RooPlot deltae_the_deBkg;1 #DeltaE Chebychev bkg KEY: RooPlot nn_the_nnBkg;1 Fisher Gaussian bkg KEY: RooPlot mass_the_massBkg;1 Mass Chebychev bkg KEY: RooPlot mes_the_mesUds;1 M_{ES} ArgusBG bkg KEY: RooPlot deltae_the_deUds;1 #DeltaE Chebychev uds KEY: RooPlot nn_the_nnUds;1 Fisher Gaussian uds KEY: RooPlot mass_the_massUds;1 Mass Chebychev uds Root [2] mes_the_mesBkg->Draw()

Fit full ML model on dataset to get yields, etc. –Input: parameters values from pdfFit action –Output: final parameters in intermediate file, mlFit results, including: Yields, floating parameters Significance of any floating parameters wrt any particular value Systematic errors of floating parameters due to the uncertainty of fixed parameters 33 // Action section name, command line option –A MLAct [MLAct] // mlFit options mlFit = yes // enable mlFit action mlFitData = onData postMLSignf = nSig // signal yield signf. (wrt 0 by default) postMLSysVars = nSig // calculate syst. error for nSig by varying fixed params postMLSysParams = deSig_meanC deSig_meanT \\ deSig_sigmaC deSig_sigmaT \\ deSig_fracC List all fixed params to vary for syst. errors Fit action (2)- mlFit 1st February 2011 Fergus Wilson, RAL/STFC

toyStudy action is to validate the fitter –Input: param values from pdfFit action –Output: toyStudy results (pulls, etc) in ROOT file 34 // Action section name, command line option –A ToyAct [ToyAct] // toyStudy options toyStudy = yes // enable toyStudy action preToyReadParams = yes preToyReadSecParams = yes nSig = 93 +/- 10 L(-10 – 3000) nChls = 200 +/- 50 L(-10 – 3000) protDatasets = onData toyNexp = 100 toyNevt = 0 floated // 0: nEvt from protDataset; and fluctuation. toySrc_nSig = sigMC nSig” toySrc_nChls = bbMC nChls” toySrc_nBkg = gsbData 1 pdf nBkg” Fit action (3) - toyStudy Override params from pdfFit or init values If not specified, `pure toy’. a variety of `embd toys’ if specified 1st February 2011 Fergus Wilson, RAL/STFC

35 [ToyAct] toyStudy = yes // enable toyStudy action nSig = 93 +/- 10 L(-10 – 3000) protDatasets = onData toyNexp = 100 preToyRandParams = nSig nSig nSigGen” \\ nBkg nBkg nSigGen” preToyRandGenerators = nSigGenPdf // PDF config section for param randomizer [nSigGenPdf Config] configStr = Generic formula = "1" nSigGen nSigGen = nSigGen 0 L( ) // nSig scan range (50, 150) Fit action (3) - toyStudy advanced features Parameter scanning Validate the fitter on all possible values for some parameters For example, scan signal yields from 50 to 150 events: 1st February 2011 Fergus Wilson, RAL/STFC

Fit action (3) - toyStudy output example 1st February 2011 Fergus Wilson, RAL/STFC36 heplnx111> rarFit –A ToyAct tutorial.config heplnx111> bbrroot –l results/tutorial.mlFitter_Config.toyPlot.ToyAct.root root [0] Attaching file all.root as _file0... root [1] _file0->ls() TFile** all.root chain files TFile* all.root chain files KEY: TTree toyResults;1 toyResults root [2] toyResults->Draw(“nSig”) ; toyResults->Draw(“nSigerr”) root [3] toyResults->Draw(“nSigpull”) ; htemp->Fit(“gaus”) Number of signal events fitted Error on number of signal events fitted Pull on number of signal events

37 Fit action (4)- scanPlot Scan –Log(L) [NLL] within interested parameter spaces –Input: parameters from mlFit action –Output: NLL points within parameter spaces, NLL plot (for 1D scanning), in ROOT file // Action section name, command line option –A ScanAct [ScanAct] // scanPlot options scanPlot = yes // enable scanPlot action scanPlotData = onData nScanPoints = 100 // Number of NLL values scanVars = nSig scanUnCorrErr = 5.1 // nll plot with uncorrelated error included scanCorrErr = 2.2 // nll plot with correlated error (and uncorrelated // if any) included 1st February 2011 Fergus Wilson, RAL/STFC

Fit action (4)- scanPlot output example 1st February 2011 Fergus Wilson, RAL/STFC38 heplnx111> rarFit –A YieldScan tutorial.config heplnx111> $ROOTSYS/bin/root -l results/tutorial.mlFitter_Config.scanPlot.YieldScan.root root [0] Attaching file results/tutorial.mlFitter_Config.scanPlot.YieldScan.root as _file0... root [1] _file0->ls() TFile** results/tutorial.mlFitter_Config.scanPlot.YieldScan.root TFile* results/tutorial.mlFitter_Config.scanPlot.YieldScan.root KEY: RooPlot NLLScanPlot_nSig;1 NLLScanPlot_nSig KEY: TTree scanDS;1 scanDS Root [2] NLLScanPlot_nSig->Draw()

39 Fit action (5) - projPlot Get projection plots for given hypothesis (signal etc…) –Input: parameters from mlFit action –Output: projection plots, LLR histograms, asym plots, in ROOT file // Action section name, command line option –A ProjAct [ProjAct] // projPlot options projPlot = yes // enable projPlot action projPlotData = onData projComps = Sig // signal PDF to be projected projLLRPlots = yes // create LLR histograms projVars = mes de fisher // obs to get projection plots projLRatioCut =.810 projLRatioCut_mes =.835 projLRatioCut_de =.920 projLRatioCut_fisher =.890 projFindOptimCut = yes projOptimRange_mes = "abs(mes-5.28)<0.006" projOptimRange_de = "abs(de)<0.07" projOptimRange_fisher = "fisher<0.0" projPlotCat = runBlock // get projection plot for each cat type Likelihood ratio cuts Find optimal cuts 1st February 2011 Fergus Wilson, RAL/STFC

Fit action (5) – projPlot output example 1st February 2011 Fergus Wilson, RAL/STFC40 heplnx111> rarFit –A ProjAct tutorial.config heplnx111> $ROOTSYS/bin/root -l results/tutorial.mlFitter_Config.projPlot.ProjAct.root root [0] Attaching file results/tutorial.mlFitter_Config.projPlot.ProjAct.root as _file0... root [1] _file0->ls() TFile** results/tutorial.mlFitter_Config.projPlot.ProjAct.root TFile* results/tutorial.mlFitter_Config.projPlot.ProjAct.root KEY: RooPlot proj_mes;1 projection of M_{ES} with lRatioFunc_mes>.90 KEY: RooPlot proj_deltae;1 projection of #DeltaE with lRatioFunc_deltae>.90 KEY: RooPlot proj_mass;1 projection of Mass with lRatioFunc_mass>.90 KEY: RooPlot proj_nn;1 projection of Fisher with lRatioFunc_nn>.90 KEY: TH1F LLR_simData;1 LLR ds KEY: TH1F LLR_mlFitter;1 LLR hist KEY: TH1F LLR_sigPdf;1 LLR hist KEY: TH1F LLR_bkgPdf;1 LLR hist KEY: TH1F LLR_udsPdf;1 LLR hist Root [2] proj_mes->Draw() Root [3] LLR_simData->draw(“PE”);LLR_sigPdf->Draw(“same”)

41 Fit action (6) - contourPlot Get contour plots for two floating params –Input: parameters from mlFit action –Output: contour plots in ROOT file // Action section name, command line option –A ContourAct [ContourAct] // contourPlot options contourPlot = yes // enable contourPlot action contourPlotData = onData nContours = 3 // Number of contours contourVars = nSig fL st February 2011 Fergus Wilson, RAL/STFC

42 Fit action (7)- sPlot Get sPlots –Input: parameters from mlFit action –Output: sPlots in ROOT file // Action section name, command line option –A SPlotAct [ProjAct] // sPlot options sPlot = yes // enable sPlot action sPlotData = onData sPlotComps = all // sPlots for all hypotheses sPlotVars = mes de fisher // observables to get sPlots sPlotPdfOverlay = direct // direct PDF used for PDF overlay sPlotIgnoredVars_heli = resMass sPlotNormIgnoredObs = tagFlav dtErr removed from PDF normalization due to PDF inconsistency across species correlated obs should be removed 1st February 2011 Fergus Wilson, RAL/STFC

Fit action (7)- sPlot output example 1st February 2011 Fergus Wilson, RAL/STFC43 heplnx111>heplnx111> rarFit –A SPlotAct tutorial.config $ROOTSYS/bin/root -l results/tutorial.mlFitter_Config.sPlot.SPlotAct.root root [0] Attaching file results/tutorial.mlFitter_Config.sPlot.SPlotAct.root as _file0... root [1] _file0->ls() TFile** results/tutorial.mlFitter_Config.sPlot.SPlotAct.root TFile* results/tutorial.mlFitter_Config.sPlot.SPlotAct.root KEY: RooPlot sPlot_mes_nSig;1 sPlot_mes_nSig KEY: RooPlot sPlot_mes_nBkg;1 sPlot_mes_nBkg KEY: RooPlot sPlot_mes_nUds;1 sPlot_mes_nUds KEY: RooPlot sPlot_deltae_nSig;1 sPlot_deltae_nSig KEY: RooPlot sPlot_deltae_nBkg;1 sPlot_deltae_nBkg KEY: RooPlot sPlot_deltae_nUds;1 sPlot_deltae_nUds KEY: RooPlot sPlot_mass_nSig;1 sPlot_mass_nSig KEY: RooPlot sPlot_mass_nBkg;1 sPlot_mass_nBkg KEY: RooPlot sPlot_mass_nUds;1 sPlot_mass_nUds KEY: RooPlot sPlot_nn_nSig;1 sPlot_nn_nSig KEY: RooPlot sPlot_nn_nBkg;1 sPlot_nn_nBkg KEY: RooPlot sPlot_nn_nUds;1 sPlot_nn_nUds Root [2] sPlot_mes_nSig->Draw() ; sPlot_mes_nUds->Draw()

Fit action (8) - combinePlot Can combine NLL from different model fits e.g. combine Branching Fraction for B →ρK *+ where K *+ has been fitted separately as K *+ →π + K 0 s and K *+ →π 0 K +. –Input: scan curves in files created by scanPlot action –Output: combined scan curve with optional systematic errors 1st February 2011 Fergus Wilson, RAL/STFC44 // Action section name, command line option –A combineAct [combineAct] // combinePlot options combinePlot = yes // enable scanPlot action combineNcurves = 2 combineFilenames = “results/f1.mlFitter_Config.scanplot.scan.root” \\ “results/f2.mlFitter_Config.scanplot.scan.root” combinePlotnames = “NLLScanPlot_measBR_Sig” \\ “NLLScanPlot_measBR_Sig” combineAdditive = // additive systematic errors combineMultiplicativeUncorrelated = // systematic errors combineMultiplicativeCorrelated = // systematic errors combineUpperLimit = yes 90 // calculate 90% CL upper limit CombineXaxisTitle = “Combined Branching Fraction”

Fit action (8) – combinePlot output example 1st February 2011 Fergus Wilson, RAL/STFC45 heplnx111> rarFit –A CombineAct tutorial.config heplnx111> $ROOTSYS/bin/root -l results/tutorial.mlFitter_Config.combinePlot.CombineAct.root root [0] Attaching file results/tutorial.mlFitter_Config.combinePlot.CombineAct.root as _file0... root [1] _file0->ls() TFile** results/tutorial.mlFitter_Config.combinePlot.CombineAct.root TFile* results/tutorial.mlFitter_Config.combinePlot.CombineAct.root KEY: RooPlot combinePlot_Mode0;1 NLL with syst+stat and stat. errs only KEY: RooPlot combinePlot_Mode1;1 NLL with syst+stat and stat. errs only KEY: RooPlot combinePlot;1 Combined curves root [2] combinePlot_Mode0->Draw() ; combinePlot_Mode1->Draw() ; combinePlot->Draw() Statistical only Statistical + Systematic 1 st mode 2 nd mode 1 st mode 2nd mode Combined Statistical + Systematic This example won’t work for you as you do not have the input files. Edit “CombineAct” section to pick up files from ~fwilson/BAS/