How can I extract 70% of things inside a root file out and make it to be a new root file?

Hi experts,
Recently I am struggling with the goal to copy 70% values inside the root file into a new root file. I need to have all the branches but only 70% values. How can I do that? Thank you so much for the help!!!
Best regards,
Zhenxuan

Hello!

What do you mean by “70 % values”? You want to apply some cut and then save the data again? Are we talking about a ROOT file with a TTree here?

If you have a TTree, you can open it with RDataFrame, select you 70 % of entries with Filter(), and save what remains to a new ROOT file with Snapshot().

But that’s just me guessing what you want to do :slight_smile: If you need further help, please be more precise describing your problem.

Cheers,
Jonas

PS: You can also take a look at the RDataFrame tutorials to better understand what I suggested.

Hi Jonas,
I am not familar with ROOT so sorry for the confusion. What I want to do is to save only 70% of a root file tree’s branches’ basket values into a new root file with the same tree and branches but only 70% of the basket values. I don’t know if this is clear or not… again, sorry for the confusion
Best regards,
Zhenxuan

Try:
rooteventselector --help
rootslimtree --help

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.