'DATA AND CATEGORIES' RooFit tutorial macro #402
Tools for manipulation of (un)binned datasets
Processing /mnt/build/workspace/root-makedoc-v608/rootspi/rdoc/src/v6-08-00-patches/tutorials/roofit/rf402_datahandling.C...
void rf402_datahandling()
{
c.defineType("Plus",+1) ;
c.defineType("Minus",-1) ;
for (i=0 ; i<1000 ; i++) {
x = i/50 - 10 ;
c.setLabel((i%2)?"Plus":"Minus") ;
}
cout << endl ;
cout << endl ;
cout << endl ;
cout << endl << ">> d1 has only columns x,c" << endl ;
cout << endl << ">> d2 has only column y" << endl ;
cout << endl << ">> d3 has only the points with y>5.17" << endl ;
cout << endl << ">> d4 has only columns x,c for data points with y>5.17" << endl ;
cout << endl << ">> merge d2(y) with d1(x,c) to form d1(x,c,y)" << endl ;
cout << endl << ">> append data points of d3 to d1" << endl ;
cout << ">> construct dh (binned) from d(unbinned) but only take the x and y dimensions," << endl
<< ">> the category 'c' will be projected in the filling process" << endl ;
x.setBins(10) ;
y.setBins(10) ;
cout <<
">> number of bins in dh : " << dh.
numEntries() << endl ;
cout <<
">> sum of weights in dh : " << dh.
sum(
kFALSE) << endl ;
cout <<
">> integral over histogram: " << dh.
sum(
kTRUE) << endl ;
x = 0.3 ; y = 20.5 ;
cout << ">> retrieving the properties of the bin enclosing coordinate (x,y) = (0.3,20.5) " << endl ;
cout << " bin center:" << endl ;
cout <<
" weight = " << dh.
weight() << endl ;
cout << ">> Creating 1-dimensional projection on y of dh for bins with x>0" << endl ;
cout << endl << ">> Persisting d via ROOT I/O" << endl ;
TFile
f(
"rf402_datahandling.root",
"RECREATE") ;
new TCanvas(
"rf402_datahandling",
"rf402_datahandling",600,600) ;
}
- Author
- 07/2008 - Wouter Verkerke
Definition in file rf402_datahandling.C.