Performing queries#
There are a total of three steps in fully specifying a query:
Definition (concrete type and constructor arguments) of the query itself.
Input column(s) with which it is filled with.
Associated selection(s) at which it is performed.
Template
auto q = df.get(query::output<DEF>(ARGS...))
.fill(COLS...)
.at(SELS...);
Defining a query#
Call dataflow::get() specifying the definition and constructor arguments of the query.
using h1d = qty::boost::histogram::histogram<double>;
using linax = qty::boost::histogram::axis::regular;
auto q1 = df.get(query::output<h1d>(linax(100, 0.0, 1.0)));
Filling a query#
A defined query can be fill()ed with input columns:
auto q1x = q.fill(x);
A query can be filled multiple times, as long as the dimensionality of each fill is valid:
auto q1xy = df.get(query::output<h1d>(linax(10, 0.0, 1.0)))(x)(y);
using h2d = qty::boost::histogram::histogram<double, double>;
auto q2xy =
df.get(query::output<h2d>(linax(10, 0.0, 1.0), linax(10, 0.0, 1.0)))(x, y);
Booking a query#
Booking a query at a particular selection fully instantiates the lazy query:
auto all = df.filter(column::constant(true));
auto q1x_all = q1x.at(all);
A given query can be booked at multiple selections:
auto [q1x_a, q1x_b] = q1x.at(cut_a, cut_b);
Or, multiple different queries can be booked from a selection:
auto [q1x_c, q2xy_c] = cut.book(q1x, q2xy);
Accessing results#
Access the result of any query to trigger the dataset traversal for all.
auto h1x_a = q1x_a.result(); // takes a while
auto h2xy_c = q2xy_c.result(); // instantaneous