Silent TTree Scan

I’d like to find out how many events in my TTree pass a certain cut.

The only way I’ve found to do this is with Scan or Draw.

However, I don’t want windows popping up and I don’t want Scan to print a bunch of crap to my screen. Is there a way to silence Scan or have Draw not create a window?

Try with the “goff” Draw option (the third parameter).

While that may work, more to the spirit of what I wanted to do is to just use ‘GetEntries’ with the cut as a parameter. like

ptree->GetEntries(“Beta > 0.99”)

will return the number of entries which passed the cut.

Thanks for the response though.