I’m working on creating a significance vs energy plot and need help counting events in specific categories from a dataset. Here’s the workflow I’m aiming for:
Count the number of events that meet specific selection criteria for each column (not just return booleans).
Define:
Signal: electron CC events
Background: muon and electron NC events
Return the total number of events for signal and background, so I can compute a column for significance.
The ultimate goal is to plot a TGraph with significance on the y-axis and energy on the x-axis.
However, I’m struggling to define signal and background without creating separate DataFrames and applying filters for each. Below is a sample of my code for context. Any advice or suggestions would be greatly appreciated!
Please fill also the fields below. Note that root -b -q will tell you this info, and starting from 6.28/06 upwards, you can call .forum bug from the ROOT prompt to pre-populate a topic.
ROOT Version: Not Provided Platform: Not Provided Compiler: Not Provided
I’m trying to define a column that would return the number of electrons etc. in an event e.g. the size of electron_CC. I’m basically trying to write the definition that is effectively the same as Any(
truth_pdg == 12 || truth_pdg == -12) && Any(truth_pdg==11 || truth_pdg==-11)).size(), if that makes sense?
Thanks for reaching out to the forum! Let’s try to clarify a bit the workflow here.
I’m basically trying to write the definition that is effectively the same as Any(
truth_pdg == 12 || truth_pdg == -12) && Any(truth_pdg==11 || truth_pdg==-11)).size(), if that makes sense?
When you write Any(truth_pdg ==12 || truth_pdg == -12) for example, this will return one boolean value (per event), as per the documentation. That means that you cannot call .size() on that since it’s only one boolean. If you want to know exactly how many electrons correspond to your condition, then the correct operation would be Sum over the boolean mask, e.g.
If I infer correctly what your doing from the first post you sent. Let me know if this makes sense and if there’s something missing we can take a look together.