ROOT Version: 6.24/08
Platform: lxplus
Dear all,
I am selecting dimuon events using rDataFrame. Such muons have to fulfil some quality requirements; thus, in order to study their pts, I wrote a function to return a RVec containig the pts of the two custom muons.
Pseudo-code:
using rvec_f = ROOT::RVec<float>;
rvec_f tightMuonPt (arg1, arg2, ..., argN) {
TLorentzVector mu1;
TLorentzVector mu2;
std::vector<float> pts{};
//here perform muon selection based on args
if (pass selection) {
pts.push_back(mu1.Pt());
pts.push_back(mu2.Pt());
}
rvec_f out(pts.data(), pts.size());
return out;
}
I have explicitly checked (by printing) that out
is correctly filled, i.e., it is filled with non-zero values.
But, if I try to define a custom column in my dataframe storing such pts, and I try to plot the values, I get all zeros.
Pseudo-code:
f = f.Define("tightMuon_pt", tightMuonPt, {"arg1", "arg2", ..., "argN"});
f = f.Define("tightMuon1_pt", "tightMuon_pt.at(0)");
auto h_tightMuon1_pt = f.Histo1D({"tightMuon1_pt", "tightMuon1_pt", 200u, 0., 500.}, "tightMuon1_pt");
I checked the histogram h_tightMuon1_pt
and it filled by all-zeros.
Do you have any idea what I am doing wrong?
I am available to provide a working piece of code, if needed.
Thanks a lot for your time, my best regards,
Fabio.