Hi !
I would like to use a function using TLorentzVector parameters called, as following:
GetXbjorken(const TLorentzVector&, const TLorentzVector&)
in order to draw a more complex variable.

I see this is working while calling functions with simple variables. But this is not working with more complex objects. Is it a limitation from TTreeFormula and I should then loop manually ?

// Create dataframe of dataset tree in ROOT file data.root
ROOT::RDataFrame df("tree", "data.root");
// Compute invariant mass of the dimuon system
auto compute_mass = [](const RVec<float> &pt, const RVec<float> &eta, const RVec<float> &phi, const RVec<float> &mass) {
// Compose four-vectors of both muons
TLorentzVector p1, p2;
p1.SetPtEtaPhiM(pt[0], eta[0], phi[0], mass[0]);
p2.SetPtEtaPhiM(pt[1], eta[1], phi[1], mass[1]);
// Add four-vectors to build dimuon system and return the invariant mass
return (p1 + p2).M();
};
auto df_mass = df.Define("Dimuon_mass", compute_mass, {"Muon_pt", "Muon_eta", "Muon_phi", "Muon_mass"});
// Plot the invariant mass
auto h = df_mass.Histo1D("Dimuon_mass");
h->Draw();