Home | News | Documentation | Download

Cut a TTree to a new TTree


Please read tips for efficient and successful posting and posting code

ROOT Version: 6.22/08
Platform: macOS 11.2
Compiler: Not Provided


Dear experts,

I’m new to data analysis. I wrote a CMSSW macro to get data from CMS data and MC samples. This macro worked well on LXPLUS. I used a TTree to store these data. But this macro is without any cut. I want to write another macro to produce a reduced TTree. But I didn’t know how to cut TTree and save this to a new TTree. I have read the user’s guide, I didn’t find the method which can cut TTree and save it to a new TTree. Could you give me some suggestions? I mainly work on PyROOT, I hope this method can work on PyROOT very well.

I also have another question. The screenshot is a scan from my TTree. As you see, there are some instance is larger than one in some rows. But I only want to keep one instance in the reduced TTree. How can I finish this work?

Thanks!

tutorials/dataframe/df007_snapshot.C should help!

Many thanks!!!