I am using RDataFrame, and I have RVecs containing various jet variables. I need to work with the 4 highest pT jets, so I need to sort these by the jet pT. How can I do this easily (preferably without having to define a new column containing vectors of structs)?
It’s not that sorting is inefficient, it’s that I have to rearrange the other vectors according to the order the pT vector got sorted.
I haven’t found anything in either the standard library or range-v3 that would easily help. The best solution I have now is to use range-v3’s zipWith to turn it into a vector of structs, then sort that.
It’s not that sorting is inefficient, it’s that I have to rearrange the other vectors according to the order the pT vector got sorted.
In that case you can use std::sort with a custom function to get the indices in the order you want, then you can just apply the sorting to the other vectors.