Logo ROOT  
Reference Guide
rf406_cattocatfuncs.C File Reference

Detailed Description

View in nbviewer Open in SWAN

Data and categories: demonstration of discrete-->discrete (invertible) functions

␛[1mRooFit v3.60 -- Developed by Wouter Verkerke and David Kirkby␛[0m
Copyright (C) 2000-2013 NIKHEF, University of California & Stanford University
All rights reserved, please read http://roofit.sourceforge.net/license.txt
RooCategory::tagCat = Lepton(idx = 0)
RooCategory::b0flav = B0(idx = -1)
Table tcatType : pData
| Cut based | 5040 |
| Neural Network | 4960 |
Table b0Xtcat : pData
| {B0;Lepton} | 1302 |
| {B0bar;Lepton} | 1192 |
| {B0;Kaon} | 1232 |
| {B0bar;Kaon} | 1314 |
| {B0;NetTagger-1} | 1242 |
| {B0bar;NetTagger-1} | 1208 |
| {B0;NetTagger-2} | 1282 |
| {B0bar;NetTagger-2} | 1228 |
Table b0Xttype : pData
| {B0;Cut based} | 2534 |
| {B0bar;Cut based} | 2506 |
| {B0;Neural Network} | 2524 |
| {B0bar;Neural Network} | 2436 |
#include "RooRealVar.h"
#include "RooDataSet.h"
#include "RooPolynomial.h"
#include "RooCategory.h"
#include "Roo1DTable.h"
#include "TCanvas.h"
#include "TAxis.h"
#include "RooPlot.h"
using namespace RooFit;
// C o n s t r u c t t w o c a t e g o r i e s
// ----------------------------------------------
// Define a category with labels only
RooCategory tagCat("tagCat", "Tagging category");
// Define a category with explicitly numbered states
RooCategory b0flav("b0flav", "B0 flavour eigenstate");
b0flav.defineType("B0", -1);
b0flav.defineType("B0bar", 1);
// Construct a dummy dataset with random values of tagCat and b0flav
RooRealVar x("x", "x", 0, 10);
RooPolynomial p("p", "p", x);
RooDataSet *data = p.generate(RooArgSet(x, b0flav, tagCat), 10000);
// C r e a t e a c a t - > c a t m a p p i n g c a t e g o r y
// ---------------------------------------------------------------------
// A RooMappedCategory is category->category mapping function based on string expression
// The constructor takes an input category an a default state name to which unassigned
// states are mapped
RooMappedCategory tcatType("tcatType", "tagCat type", tagCat, "Cut based");
// Enter fully specified state mappings
tcatType.map("Lepton", "Cut based");
tcatType.map("Kaon", "Cut based");
// Enter a wilcard expression mapping
tcatType.map("NetTagger*", "Neural Network");
// Make a table of the mapped category state multiplicity in data
Roo1DTable *mtable = data->table(tcatType);
// C r e a t e a c a t X c a t p r o d u c t c a t e g o r y
// ----------------------------------------------------------------------
// A SUPER-category is 'product' of _lvalue_ categories. The state names of a super
// category is a composite of the state labels of the input categories
RooSuperCategory b0Xtcat("b0Xtcat", "b0flav X tagCat", RooArgSet(b0flav, tagCat));
// Make a table of the product category state multiplicity in data
Roo1DTable *stable = data->table(b0Xtcat);
// Since the super category is an lvalue, assignment is explicitly possible
// A MULTI-category is a 'product' of any category (function). The state names of a super
// category is a composite of the state labels of the input categories
RooMultiCategory b0Xttype("b0Xttype", "b0flav X tagType", RooArgSet(b0flav, tcatType));
// Make a table of the product category state multiplicity in data
Roo1DTable *xtable = data->table(b0Xttype);
Roo1DTable implements a one-dimensional table.
Definition: Roo1DTable.h:23
virtual void Print(Option_t *options=0) const
Print TNamed name and title.
Definition: Roo1DTable.h:50
virtual Roo1DTable * table(const RooArgSet &catSet, const char *cuts="", const char *opts="") const
Construct table for product of categories in catSet.
Definition: RooAbsData.cxx:748
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:28
RooCategory is an object to represent discrete states.
Definition: RooCategory.h:23
RooDataSet is a container class to hold unbinned data.
Definition: RooDataSet.h:33
RooMappedCategory provides a category-to-category mapping defined by pattern matching on their state ...
RooMultiCategory connects several RooAbsCategory objects into a single category.
RooPolynomial implements a polynomial p.d.f of the form.
Definition: RooPolynomial.h:28
RooRealVar represents a variable that can be changed from the outside.
Definition: RooRealVar.h:35
The RooSuperCategory can join several RooAbsCategoryLValue objects into a single category.
Double_t x[n]
Definition: legend1.C:17
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
Wouter Verkerke

Definition in file rf406_cattocatfuncs.C.