is there an easy way to check the number of processed events from terminal for a branch taken from already existing ntuple (.root file) ? For example, if I have a branch named “Muon_pt” and I would like to know how many events are there in total.
Dear @couet ,
Do you happen to know why the results I get are different when I count number of events manually (with output in the terminal, with std::cout << " ... " << std::endl;) and when I do as suggested with Events->Project("h", "Muon_pt", "Muon_pt>25") ? I get much less number of events when checking them with “Project”.
Not exactly. An event may have many muons, this depends on the structure of your ntuple. Consider you have just two events: one with 5 muons, another one with 3 muons. This is two events but 5+3=8 entries.
So, what I am doing is something like this: for(int i = 0 ; i<nMuon; i++){ if(Muon_pt[i]>25) { std::cout << " muon pt " << std::endl; hist->Fill(Muon_pt[i]); } }
Now, I expect that the frequency of “muon pt” as an output (let’s say I will have 10 “muon pt” outputs in the terminal from “cout”) should be the same as number of entries. However when I checked with Events->Project("Muon_pt", "Muon_pt>25") as well as with Events->Project("h","Muon_pt","Muon_pt>25") , the number I got was much smaller than 10. And I am trying to understand why.