Dear ROOT Community,
I have a simple question: I wish to fill histograms using RDataFrame, whilst setting their binning, title etc. The code below works well:
However I want to set the binning of h_pt_mu. I’ve tried different combinations of arguments, e.g. h_pt_mu = h_tree.Histo1D({"h_mu_pt", "h_mu_pt", 100, 0, 1e3}, "mu_pt")
but none work.
This should be possible I just can’t find the correct syntax.
Any help would be highly appreciated!
Thanks so much! This works. Whilst we’re there, may I ask: is there a way to pass the information from h_tree to a variable and only then save that variable into h_pt_mu (keeping the latter a Histo1D)? This is in order to apply some conditions on that variable and combine it with others, before saving to histograms, whilst maintaining the advantage of RDataFrame and ImplicitMT().
This is in order to apply some conditions on that variable and combine it with others, before saving to histograms, whilst maintaining the advantage of RDataFrame and ImplicitMT().
You mean applying Filter and Define transformations?
Your example would be: df.Define("good_pts", "mu_pt[mu_pt > 50]").Histo1D("good_pts"). Also check ROOT: ROOT::RDataFrame Class Reference (the “Working with collections” section).