Dear community, i am using RDataFrame with python 3.6 in order to get a weighted histogram.
The thing is that i have to assign a weight depending on the eta of the particle. So I am defining a new column with the weights as a function of the eta with the following syntax that seems not being accepted by the RDF interface.
RDF_TTree.Define( “weight”, “10[Particle Cuts]”)
In this case, 10 is the weight value that i want to assign to the particles which fits the cuts between [ ]. The printed error says that the int 10 does not provide a subscript operator, the cuts. How can I assign an int to a particular set of tracks?
You can try this a a ROOT or Python prompt first. What Where does is that it returns a new vector that contains 10 for the elements where the <cut> condition is true, otherwise it returns the original element of the RVec we pass as third argument (which is simply an RVec of the appropriate size filled with ones).
Can you copy-paste the full error message? It should also say which overloads it tried and why they don’t match. Also note that ROOT::RVec(mcPart_eta.size(), 1) should be ROOT::RVec<float>(mcPart_eta.size(), 1).