ROOT
6.30.04
Reference Guide
All
Namespaces
Files
Pages
df031_Stats.C
Go to the documentation of this file.
1
/// \file
2
/// \ingroup tutorial_dataframe
3
/// \notebook
4
/// Extract the statistics relative to RDataFrame columns and store them
5
/// in TStatistic instances.
6
///
7
/// \macro_code
8
/// \macro_output
9
///
10
/// \date April 2019
11
/// \author Danilo Piparo
12
13
void
df031_Stats() {
14
15
// Create a data frame and add two columns: one for the values and one for the weight.
16
ROOT::RDataFrame r(256);
17
auto
rr = r.Define(
"v"
, [](ULong64_t e){
return
e;}, {
"rdfentry_"
})
18
.Define(
"w"
, [](ULong64_t e){
return
1./(e+1);}, {
"v"
});
19
20
// Now extract the statistics, weighted, unweighted - with and without explicit types.
21
auto
stats_eu = rr.Stats<ULong64_t>(
"v"
);
22
auto
stats_ew = rr.Stats<ULong64_t,
double
>(
"v"
,
"w"
);
23
auto
stats_iu = rr.Stats(
"v"
);
24
auto
stats_iw = rr.Stats(
"v"
,
"w"
);
25
26
// Now print them: they are all identical of course!
27
stats_eu->Print();
28
stats_ew->Print();
29
stats_iu->Print();
30
stats_iw->Print();
31
}
tutorials
dataframe
df031_Stats.C
Generated on Tue May 5 2020 14:03:41 for ROOT by
1.8.5