#include <iostream>
{
tagCat.defineType("Lepton");
tagCat.defineType("Kaon");
tagCat.defineType("NetTagger-1");
tagCat.defineType("NetTagger-2");
tagCat.Print();
b0flav["B0"] = -1;
b0flav["B0bar"] = 1;
b0flav.Print("V");
RooCategory largeCat(
"largeCat",
"A category with many states");
largeCat.defineTypes({
{"A", 0}, {"b", 2}, {"c", 8}, {"dee", 4},
{"F", 133}, {"g", 15}, {"H", -20}
});
std::cout << "\nThis is the for loop over states of 'largeCat':";
for (const auto& idxAndName : largeCat)
std::cout <<
"\n\t" << idxAndName.
first <<
"\t" << idxAndName.second;
std::cout << '\n' << std::endl;
std::cout << "Has label 'A': " << largeCat.hasLabel("A");
std::cout << "\nHas index '-20': " << largeCat.hasIndex(-20);
std::cout << "\nLabel corresponding to '2' is " << largeCat.lookupName(2);
std::cout << "\nIndex corresponding to 'A' is " << largeCat.lookupIndex("A");
std::cout << "\nCurrent index is " << largeCat.getCurrentIndex();
std::cout << "\nCurrent label is " << largeCat.getCurrentLabel();
std::cout << std::endl;
largeCat.setIndex(8);
largeCat.setLabel("c");
double nb0 = btable->
get(
"B0");
std::cout << "Number of events with B0 flavor is " << nb0 << std::endl;
double fracLep = ttable->
getFrac(
"Lepton");
std::cout << "Fraction of events tagged with Lepton tag is " << fracLep << std::endl;
tagCat.setRange("good", "Lepton,Kaon");
tagCat.addToRange("soso", "NetTagger-1");
tagCat.addToRange("soso", "NetTagger-2");
}
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
double get(const char *label, bool silent=false) const
Return the table entry named 'label'.
double getFrac(const char *label, bool silent=false) const
Return the fraction of entries in the table contained in the slot named 'label'.
void Print(Option_t *options=nullptr) const override
This method must be overridden when a class wants to print itself.
virtual Roo1DTable * table(const RooArgSet &catSet, const char *cuts="", const char *opts="") const
Construct table for product of categories in catSet.
RooFit::OwningPtr< RooDataSet > generate(const RooArgSet &whatVars, Int_t nEvents, const RooCmdArg &arg1, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={})
See RooAbsPdf::generate(const RooArgSet&,const RooCmdArg&,const RooCmdArg&,const RooCmdArg&,...
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Object to represent discrete states.
RooDataSet is a container class to hold unbinned data.
RooPolynomial implements a polynomial p.d.f of the form.
RooRealVar represents a variable that can be changed from the outside.
RooCmdArg CutRange(const char *rangeName)
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
RooCategory::tagCat = Lepton(idx = 0)
--- RooAbsArg ---
Value State: clean
Shape State: clean
Attributes:
Address: 0x7ffd8618dc88
Clients:
Servers:
Proxies:
--- RooAbsCategory ---
Value = -1 "B0)
Possible states:
B0 -1
B0bar 1
This is the for loop over states of 'largeCat':
A 0
F 133
H -20
b 2
c 8
dee 4
g 15
Has label 'A': 1
Has index '-20': 1
Label corresponding to '2' is b
Index corresponding to 'A' is 0
Current index is 0
Current label is A
Roo1DTable::b0flav = (B0=5058,B0bar=4942)
Table b0flav : pData
+-------+------+
| B0 | 5058 |
| B0bar | 4942 |
+-------+------+
[#1] INFO:InputArguments -- The formula cutVar claims to use the variables (x,b0flav,tagCat) but only (x) seem to be in use.
inputs: x>8.23
Roo1DTable::tagCat = (Lepton=454,Kaon=450,NetTagger-1=432,NetTagger-2=429)
Table tagCat : pData(x>8.23)
+-------------+-----+
| Lepton | 454 |
| Kaon | 450 |
| NetTagger-1 | 432 |
| NetTagger-2 | 429 |
+-------------+-----+
Table (tagCat x b0flav) : pData
+---------------------+------+
| {Lepton;B0} | 1302 |
| {Kaon;B0} | 1232 |
| {NetTagger-1;B0} | 1242 |
| {NetTagger-2;B0} | 1282 |
| {Lepton;B0bar} | 1192 |
| {Kaon;B0bar} | 1314 |
| {NetTagger-1;B0bar} | 1208 |
| {NetTagger-2;B0bar} | 1228 |
+---------------------+------+
Number of events with B0 flavor is 5058
Fraction of events tagged with Lepton tag is 0.257224
Table tagCat : pData
+-------------+------+
| Lepton | 2494 |
| Kaon | 2546 |
| NetTagger-1 | 0 |
| NetTagger-2 | 0 |
+-------------+------+