In order to facilitate subsequent more complex data processing, I want to perform some preprocessing on the .root file. So, is there any function to delete the data of specific rows in .root file?
_ROOT Version: 6.24/02
In order to facilitate subsequent more complex data processing, I want to perform some preprocessing on the .root file. So, is there any function to delete the data of specific rows in .root file?
_ROOT Version: 6.24/02
Hi @CY_Han ,
there are some facilities, for example you can produce a TEntryList
that contains the “good” rows and then always use that list of entries when reading the tree (e.g. TTreeReader
has built-in support for TEntryList
s).
The simplest thing you can do, however, is to produce a new filtered (“skimmed”) TTree that only contains the entries you want. It’s simple with RDataFrame:
ROOT::RDataFrame(treename, filename)
.Filter("nMuon > 0") // select rows for which column nMuon > 0
.Filter("Abs(Muon_eta) < 2.7")
.Snapshot(newtreename, newfilename); // write a new tree in a new file
If you add a ROOT::EnableImplicitMT()
at the top, this will run the skim in parallel on all your cores.
Cheers,
Enrico
Thanks for your reply, it works.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.