I have to fill a 2D histogram where one variable is an int and the other a RVec.
For example “Number of tracks” and pT of these tracks. I want the pT vs NTracks 2D HIstogram.
Is there a way to do this in RDataFrame? I guess that I could define a new variable like NTracks but as a RVec to have same datatype in both variables. Is it possible to fill Histo2D with RVec’s ?
Hi @imanol097 ,
you haven’t provided your ROOT version, but until v6.24 there were some limitations in mixing scalars and RVecs when filling histograms (some combinations would work, other wouldn’t). E.g. this should be possible in v6.24:
Since v6.26, all combinations should work, e.g. this (which was not allowed in v6.24, and the workaround would have been to Define an RVec column as "RVec<double>(v.size(), i)"):
Hi,
as mentioned some combinations of scalar/vectors were not allowed in 6.24, you are probably encountering one such case. The constraints are lifted in v6.26.
A workaround for v6.24 is to manually broadcast the scalar to a vector with an expression such as ROOT::RVec<double>(scalar, vector.size).