I’ve been trying to figure out what the best way for filling a THnSparse from a TTree is.
As far as I could find, there is only one example using a THnSparse which does the filling manually.
What I was hoping for is a feature like chain.Draw(“var1:var2:var3:var4…>>MyTHn”, “cut_string”) in order to create a THnSparse on the fly.
but when I try this with 4 variables, it creates a TH3F. When I try this with more than 4 variables, I get the following error message:
Too many variables. Use the option “para”, “gl5d” or “candle” to display more than 4 variables.
And none of these options seem to help in creating THnSparse as far as I could try.
Is there any feature available like this which would allow for creating ThnSparse directly from the TTree?
Yes that’s the Python workaround, thanks for digging that up! It’s fairly ugly – if there is enough request we could add a proper method to RDF to fill a THnSparse.
Thanks a lot for the quick responses! Unfortunately, in our current working environment RDFs are not included. I will try it once our environment is updated.
But on the other hand could the Fill THnSparse feature also be implemented with TTree::Draw or are there technical show stoppers?
After seeing this feature request from '08, I was hoping the feature would already be in place.