Count of data points greater than a threshold

I have a .root file where I have written the energy deposited in an ntuple but i need to know how many data points are greater than a specific value. How can I determine this?

I apologize if this question seem very basic. I tried various methods but didn’t find a solution with ROOT. Perhaps the only way is to use g4csv method to output a csv file instead of a root file?

Maybe something like this (assuming “Energy” is the leaf that keeps the “energy deposited”):

Double_t thr = 100.; // set to whatever value you need
Long64_t n = YourTTree->GetEntries(TString::Format("Energy > %.17g", thr));

or simply:

Long64_t n = YourTTree->GetEntries("Energy > 100."); // any value you need
1 Like

Thank you so much! This worked easily!!