SLAC PEP-II
BABAR
SLAC<->RAL
Babar logo
HEPIC E,S & H Databases PDG HEP preprints
Organization Detector Computing Physics Documentation
Personnel Glossary Sitemap Search Hypernews
Unwrap page!
Comp. Search
Who's who?
Meetings
FAQ Homepage
Archive
Environment
Administration
New User Info.
Web Info/Tools
Monitoring
Training
Tools & Utils
Programming
C++ Standard
SRT, AFS, CVS
QA and QC
Remedy
Histogramming
Operations
PromptReco
Simulation Production
Online SW
Dataflow
Detector Control
Evt Processing
Run Control
Calibration
Databases
Offline
Workbook
Coding Standards
Simulation
Reconstruction
Prompt Reco.
BaBar Grid
Data Distribution
Beta & BetaTools
Kanga & Root
Analysis Tools
RooFit Toolkit
Data Management
Data Quality
Event display
Event Browser
Code releases
Databases
Check this page for HTML 4.01 Transitional compliance with the
W3C Validator
(More checks...)

CP/Mixing fit implementation in RooFit

Introduction

This page describes the setup of the 'standard' CP/mixing fit in RooFit. The setup is, like RooFit itself, a modular toolkit that allows for simple flexibility and easy extension.

This document assumes a basic understanding of RooFit. If you have never worked with RooFit before, you will find introductory material on the RooFit home page (A 68-page introductory tutorial talk from the Dec 2001 collaborating meeting, a set of accompanying tutorial macros and basic ROOT-style class documentation)

A large part of the sin2beta fits implementational complexity stems from the large number of sub-data sets that are fitted simultaneously. Many of these subsets are fitted with very similar PDFs (e.g. only parameter names are different) and the bookkeeping involved in maintaining and checking this setup can present a substantial burden.

In RooFit CP/mixing fi setup, we seek to factorize the definition of the 'prototype' PDFs that implement the physics models for the various event types from the bookkeeping involved in replicating and tayloring these 'proto'-PDFs for the various data subsets they are fitted to.

The components

The CP/mixing fit setup consists of 3 major components:

  • RooCPMixFit - A class that builds of the 'proto'-PDFs and provides methods to read ASCII data files
  • RooSimPdfBuilder - The generic RooFit tool that is used to build full-fledged CP/mixing fit from the proto-PDFs defined in RooCPMixFit
  • cpmix.cc - A small driver macro that reads the data, builds the PDFs and runs the fit

RooCPMixFit

RooCPMixFit is a class in the RooFitModels package that constructs and owns all the ingredients necessary for a cp/mixing fit.

RooCPMixFit provides several services, it

  • Creates RooRealVars/RooCategories representing all dataset dependents (representing the columns of the ASCII file) and all PDF parameters

  • Creates a set of mappings and functions that converts 'raw' ASCII quantities such as the breco mode into a 'physics class' for fitting.

  • Provides a function, loadAsciiFiles(), that reads in one or more standard breco/charmonium ASCII files and converts it into a RooDataSet, appending the above mentioned derived values.

  • Creates the prototype PDFs for CP-golden events, BReco mixing events and CP-Klong events.
Nearly all data members of the RooCPMixFit class are public. While this is not common practice in C++, it makes good sense for RooCPMixFit because all those datamembers can be accessed in an interactive session for plotting, testing etc. The following example illustrates some of the uses
    // --- Instantiate RooCPMixFit --- 
    root> RooCPMixFit c 
    RooCPMixFit: Initializing data variables
    RooCPMixFit: Building deltaT PDF components
    RooCPMixFit: Building signal event selection components

    // --- Load the Run-1 J/Psi KS in a dataset ---
    root> RooDataSet *data = c.loadAsciiFiles("/nfs/farm/babar/AWG/sin2b/
                                data_run2/Charmonium/ASCII/anal-12a/dt_JpsiKs_run1.fit") ;
    RooCPMixFit: Reading ascii data files
    RooDataSet::read: reading file /nfs/farm/babar/AWG/sin2b/.../anal-12a/dt_JpsiKs_run1.fit
    RooDataSet::read: read 466 events (ignored 36 out of range events)

    // --- Plot the mB distribution of the Run-1 Jpsi KS data ---
    root> RooPlot* mbframe = c.mB->frame() ;
    root> data->plotOn(mbframe) ;
    root> mbframe->Draw() ; 
    TCanvas::MakeDefCanvas: created default TCanvas with name c1

    // --- Tabulate the tagging categories of the Run-1 J/psi KS data for events with mB>5.27 GeV ---
    root> RooTable* table = data->table(*c->tagCat,"mB>5.27")
    root> table->Print()
 
      Table tagCat : dataset(mB>5.27)
      +-----+-----+
      | Lep | 158 |
      | Kao | 137 |
      | NT1 |  32 |
      | NT2 |  55 |
      +-----+-----+
                  

    // --- Plot the delta-t shape of the mixed component of 
    //     the BReco mixing signal PDF with the mistag rate set to 0 ---
    root> RooPlot* dtframe = c.dtReco->frame()
    root> c.mixState->setLabel("Mixed") ;
    root> c.sig_eta->setVal(0) ;
    root> c.bmixSigModel->plotOn(dtframe) ;
    root> dtframe->Draw()

    // --- Plot the shape of the background resolution model in the deltat-t range (-2,2) ---
    root> RooPlot* dtframe = c.dtReco->frame(-2,2)
    root> c.bkgResModel->plotOn(dtframe) ;
    root> dtframe->Draw()

    

RooSimPdfBuilder

RooSimPdfBuilder is a generic RooFit tool that takes one (or more) prototype PDFs and constructs a RooSimultaneous with clones of that prototype PDF, each taylored with small modifications (such as the parameter names).

We use RooSimPdfBuilder in the CP/mixing fit to replicate and customize the CPgold and BMixing PDFs for each of the 4 tagging categories, as well as the KLong PDF for each of the 16 (ee/mumu) X (IFR/EMC) x (tagCat) permutations.

A basic writeup of RooSimPdfBuilders use and options are provided in the source code (click here for HTML version). There is also a tutorial macro #8 on the RooFit home page that gives some additional illustrations on how to use RooSimPdfBuilder.

cpmix.cc

The driver macro cpmix.cc is located in the RooFitMacros package in the directory BBDecays/CPrfc and sets up and executes the standard sin2beta fit using RooCPMixFit and RooSimPdfBuilder. All parameters and inputs (ascii file list, RooSimPdfBuilder configuration and initial parameters for the various fit stages) are read from ascii files. Configuration files for some standard fits are stored in the BBDecays/CPrfc/config_winter2002 directory.

The driver macro is short (~130 lines) and easily readable. It performs the following actions

  • Get blinding information from configuration file
  • Instantiate RooCPMixFit with given blinding information
  • Instantiate RooSimPdfBuilder
  • Get list of ascii files to read
  • Read ascii files from various sources
  • Produce data subsets for mbGold prefit, mbBreco prefit and cpmixing fit
  • Read RooSimPdfBuilder configurations for mbGold prefit, mbBReco prefit and cpmixing fit
  • Build mbGold, mbBreco and cpMixing pdfs
  • Read in initial parameter values from configuration file
  • Run mbGold and mbBreco pre-fits
  • Fix mb shape parameters
  • Run cp/mixing fit
  • Print out fit results

Setting up RooFit and the CP/mixing fit

Start with the setup of RooFit: check out the RooFitCore, RooFitModels packages and follow the instructions on the RooFit home page how to compile them and how to tailor your RooLogon.C to load in them in your ROOT session.

When all that works, check out the RooFitMacros package. To avoid checking out the entire package (which is rather large) do cvs co RooFitMacros/BBDecays/CPrfc, instead of addpkg RooFitMacros. Once checked out you can run one of the standard fits as follows

    root> .x ../RooFitMacros/BBDecays/CPrfc/cpmix.cc("../RooFitMacros/
                          BBDecays/CPrfc/config_winter2002/XXXX.config") ;
    

Questions and comments?

This page is still under constructions. If you have any questions or comments about this page the CP/mixing fit setup or RooFit in general please send me (verkerke@slac.stanford.edu) a mail.


Wouter Verkerke
Last modified: Wed Jan 30 15:05:14 PST 2002