This tutorial illustrates how use the TDataFrame in combination with a TDataSource.
In this case we use a TRootDS. This data source allows to read a ROOT dataset from a TDataFrame in a different way, not based on the regular TDataFrame code. This allows to perform all sorts of consistency checks and illustrate the usage of the TDataSource in a didactic context.
void fill_tree(const char *treeName, const char *fileName)
{
auto i = 0.;
d.Define("b1", [&i]() { return i++; }).Snapshot(treeName, fileName);
}
{
auto fileName = "tdf011_ROOTDataSources.root";
auto treeName = "myTree";
fill_tree(treeName, fileName);
auto h_s = d_s.Define("x", "1./(b1 + 1.)").Histo1D({"h_s", "h_s", 128, 0, .6}, "x");
auto h = d.Define("x", "1./(b1 + 1.)").Histo1D({"h", "h", 128, 0, .6}, "x");
c_s->SetLogy();
h_s->DrawClone();
c->SetLogy();
h->DrawClone();
return 0;
}
- Date
- September 2017
- Author
- Danilo Piparo
Definition in file tdf011_ROOTDataSource.C.