Yes i found the same. The macro is running for me too. Now we are back to you initial question. I will try to replace Draw by Scan and save the output in a file.
thank you the both @couet and @bellenot.
Yes sorry! Yesterday I was trying to add the writing on the txt file…so I did some mistakes during it!
This one caloeff.cpp (49.8 KB) that I was using BEFORE trying to add the writing on a file function! So it works (I just tried it and there are no errors).
Now I would like to add the writing on a file fuction, to write the number of selected events by the time coincidence, that is what I wrote here
in which ROOT writes all selected events (the line of the ntupla and the released energy), but it doesn’t write how many events I selected …it just write it on the terminal
Instead, I don’t neet to write all the selected lines, but I need how many events are selected. I know that I can read it on the terminal and to write it by hand, but if there is a way to automatize this process, it would be great
Hi,
just an idea, with TTree::Draw you could save the selected entries to a TEntryList (search for " Saving the result of Draw to a TEventList, a TEntryList or a TEntryListArray") and then check entryList->GetN() to get the number of selected events.
Alternatively, you can check out RDataFrame. It does not support TTree::Scan’s selection syntax, but you can write arbitrary selections in C++ and then easily count the number of entries that pass them:
There is an example at the link I provided above, you have to search for “Saving the result of Draw to a TEventList, a TEntryList or a TEntryListArray” a bit down the page.