Hello. This is my first time asking at the forum, so I may not be skilled at asking questions (especially in English), but I will do my best.
I’m dealing with tree such as below :
Events->Scan("Electron_cutBased:Electron_vidNestedWPBitmap")
***********************************************
* Row * Instance * Electron_ * Electron_ *
***********************************************
* 0 * 0 * 3 * 611469604 *
* 0 * 1 * 4 * 613566756 *
* 1 * 0 * 4 * 613566756 *
* 1 * 1 * 3 * 613566244 *
* 2 * 0 * 4 * 613566756 *
* 2 * 1 * 4 * 613566756 *
* 2 * 2 * 0 * 202375204 *
* 3 * 0 * 0 * 605029412 *
* 4 * 0 * 0 * 613270532 *
* 5 * 0 * 4 * 613566756 *
* 5 * 1 * 0 * 605047076 *
* 5 * 2 * 2 * 613565668 *
* 6 * 0 * 4 * 613566756 *
* 7 * 0 * 0 * 605030436 *
* 7 * 1 * 1 * 613553316 *
* 8 * 0 * 4 * 613566756 *
* 8 * 1 * 4 * 613566756 *
* 9 * 0 * 4 * 613566756 *
* 9 * 1 * 4 * 613566756 *
* 10 * 0 * * *
* 11 * 0 * 2 * 609372324 *
* 12 * 0 * * *
* 13 * 0 * 0 * 546425124 *
Where the ‘Instance’ column is not a real Branch but produced by incidence for a single event (row).
What I want to do is filter all the indices where ‘Electron_cutBased >= 3’ and write a new tree with the filtered data. So after filtering, what I want to write is a tree such as:
Events->Scan("Electron_cutBased:Electron_vidNestedWPBitmap", "Electron_cutBased > = 3")
***********************************************
* Row * Instance * Electron_ * Electron_ *
***********************************************
* 0 * 0 * 3 * 611469604 *
* 0 * 1 * 4 * 613566756 *
* 1 * 0 * 4 * 613566756 *
* 1 * 1 * 3 * 613566244 *
* 2 * 0 * 4 * 613566756 *
* 2 * 1 * 4 * 613566756 *
* 5 * 0 * 4 * 613566756 *
* 6 * 0 * 4 * 613566756 *
* 8 * 0 * 4 * 613566756 *
* 8 * 1 * 4 * 613566756 *
* 9 * 0 * 4 * 613566756 *
* 9 * 1 * 4 * 613566756 *
"But when I used CopyTree(Electron_cutBased >= 3)
or RDataFrame
, they filtered the data at the ‘Entry’ level, not the ‘Instance’ level. As a result, my new tree still contains data with Electron_cutBased < 3. (If there is at least one instance with Electron_cutBased >= 3, CopyTree
includes the entire event, even if other instances have Electron_cutBased < 3).
So I searched for some references, finally I made
total_cutBased.C (1.9 KB)
root [3] Events->Scan("selected_Electron_cutBased:Electron_vidNestedWPBitmap")
***********************************************
* Row * Instance * selected_ * Electron_ *
***********************************************
* 0 * 0 * 3 * 611469604 *
* 0 * 1 * 4 * 613566756 *
* 1 * 0 * 4 * 613566756 *
* 1 * 1 * 3 * 613566244 *
* 2 * 0 * 4 * 613566756 *
* 2 * 1 * 4 * 613566756 *
* 2 * 2 * * 202375204 *
* 3 * 0 * 4 * 613566756 *
* 3 * 1 * * 605047076 *
* 3 * 2 * * 613565668 *
So I Successfully get Electron_cutBased>=3, but there is an empty space where indeed there were data with Electron_cutBased < 3. Is there any way to delete these rows with selected_Electron_cutBased is NULL?
P.S ) I want to attach my root file but because of its file size, I couldn’t attach it. I used a file in NanoAOD dyjetstoll_m-50_ht-100to200_tunecp5_psweights_13tev-madgraphmlm-pythia8. Thank you.
ROOT Version: 6.28/04
Platform: macOS Ventura Version 13.4.1 (c)
Compiler: Apple clang version 14.0.3