Hi,
I started from the example above and reformulated it in terms of TDataFrame in order to show this new functionality of ROOT 6.10.
I attach the macro which I used to generate some fake input, also created with TDataFrame createInput.C.
The analysis code looks like:
// analyse.C
void analyse() {
ROOT::Experimental::TDataFrame d("mytree","myfile.root");
using floats = std::vector<float>;
using ints = std::vector<int>;
auto printM = [](floats& x, floats& y, floats& z, floats& t, ints& c){
std::vector<TLorentzVector> tmp = {{x[0], y[0], z[0], t[0]},
{x[1], y[1], z[1], t[1]},
{x[2], y[2], z[2], t[2]}};
if (c[0]*c[1] < 0) printf("z1_mass = %g\n", (tmp[1] + tmp[2]).M());
if (c[1]*c[2] < 0) printf("z2_mass = %g\n", (tmp[2] + tmp[3]).M());
if (c[0]*c[2] < 0) printf("z3_mass = %g\n", (tmp[1] + tmp[3]).M());
};
d.Foreach(printM, {"VetoMu_px","VetoMu_py","VetoMu_pz","VetoMu_en","VetoMu_charge"});
}
Cheers,
D