hello experts
I have a root file with different trees showed in picture:
i want to read from tree Events to get variable genWeight and read from tree Runs to get variable genEventSumw, then save genWeight/genEventSumw as another variable, i did this: import ROOT fileName = "6F3B4758-2BFA-5441-8D5A-E2BB3FA2C876.root" treeName = "Events" treeName2 = "Runs" d = ROOT.RDataFrame(treeName, fileName) df=d.Redefine("genWeight", "genWeight*0.045096*16.9")
yes sorry i used the wrong word, they should be tree, not branches, how to save the two variables from two different trees into one use RDataFrame? thank you
conceptually you need to “join” the two datasets (Runs and Events) before processing the joined dataset with RDataFrame. You typically use friend trees (or indexed friend trees) for that, see also ROOT: ROOT::RDataFrame Class Reference .
Do Runs and Events have the same number of entries? If not, what’s the correspondence between entries in one tree and entries in the other?