This tutorial shows how to fill any object the class of which exposes a Fill
method.
void fill_tree(const char *treeName, const char *fileName)
{
auto i = 0.;
d.Define(
"b1", [&i]() {
return i; })
.Define("b2",
[&i]() {
float j = i * i;
++i;
return j;
})
.Snapshot(treeName, fileName);
}
int df005_fillAnyObject()
{
auto fileName = "df005_fillAnyObject.root";
auto treeName = "myTree";
fill_tree(treeName, fileName);
auto th1d =
d.Fill<
double>(
TH1D(
"th1d",
"th1d", 64, 0, 128), {
"b1"});
auto th1i =
d.Fill<
float>(
TH1I(
"th1i",
"th1i", 64, 0, 128), {
"b2"});
auto th2d =
d.Fill<
double,
float>(
TH2D(
"th2d",
"th2d", 64, 0, 128, 64, 0, 1024), {
"b1",
"b2"});
th1d->DrawClone();
th1i->DrawClone();
th2d->DrawClone("COLZ");
return 0;
}
ROOT's RDataFrame offers a high level interface for analyses of data stored in TTrees,...
1-D histogram with a double per channel (see TH1 documentation)}
1-D histogram with an int per channel (see TH1 documentation)}
2-D histogram with a double per channel (see TH1 documentation)}
- Date
- March 2017
- Author
- Danilo Piparo
Definition in file df005_fillAnyObject.C.