GetEntries() with cuts

Hi everyone,
i need the number of entries in a TTree with a specific flag (say 1 or 0 ) to be returned and assign it to a variable. When i do this from console , I have no problem: I just call tree->Draw() with the speciefied cuts or flags and at the end it returns just the number of entries with the specific cuts. The problem is when i set up a program with an iteration of this operation.
I’m need of something like:

int entries;
entries = tree->GetEntries( “Var1 ==0 && Var2 == 1”);

which of course doesn’t exist…

Any suggestions?
Thanks…

You can do

entries = tree.Draw("0","Var1 ==0 && Var2 == 1","goff"); but you are right a function

Long64_t entries = tree.GetEntries("some condition") would make sense. We will implement it.

Rene

Thank you very much!

Long64_t entries = tree.GetEntries("some condition");has been added to the code in the CVS repository.
Note that entries = tree.Draw("0","Var1 ==0 && Var2 == 1","goff");returns the number entries only if Var1 and Var2 are not part of an array. Without GetEntries(selection), you need to use tree.Draw(">>elist","Var1 ==0 && Var2 == 1","goff"); entris = elist->GetN();to get the proper answer whether Var1 and Var2 are part an array or collection or not.

Cheers,
Philippe