ROOT Version: 6.18 Platform: Not Provided Compiler: Not Provided
Hello, I am fairly new to coding in C++ and using root. I was tasked with applying cuts to a set of data and combining it. I have no issues with everything but one cut in specific. The cut takes the form: Njet(pt>30 GeV) = 0. What it translates to as i understand is for every element in one list of the tree (pt) if its energy is above this threshold then the an associated list in the tree (Njet) element must be zero.
How would I actually go about writing this specific cut. I have not had to create cuts that depend on two different lists in a tree and their values. I assume you could iterate through the lists and check but I dont know how to do so, especially while retaining the other values that dont need the cut applied to them.
It is hard to imagine your situation for me. Could you please explain a bit more?
I think that people need your tree structure.
I guessed your situation like this.
Njet and pt are branches saving different trees, and the trees shares the eventids.
That is, i-th entry in the both trees means the same event.
Is this correct?
In this case, you can load the branch variables with two tree->GetEntry(i) in the loop for both trees, then if(<cut condition>) continue is a way.
yes, this is correct. pt and Njet are variables in the trees of the data I am working with. I need to apply this specific cut using both of these variables associated with one another in an event
I could also propose a RDataFrame based solution for skipping the events with at least a jet with pt > 30:
// ... here your DF is initialised...
df.Filter("ROOT::VecOps::Max(pt) < 30") // the event is skipped
if you want to deal only with the jets with pt smaller than 30, e.g. their eta (not sure is relevant since it’s not clear if this is part of your tree