Acessing TTree data

I am using root 5.06/00 on winxp. I have a TTree *pt and a char *selection that could be an argument to, e.g. pt->Draw(“a:b”,selection,…). I am wondering if it is possible to access pt’s data as in:for(int i=0;i<pt->GetEntries();i++) { pt->GetEntry(i); if ( pt->IsSelected(selection) ) { // do something with this entry that satisfies selection } } Of course, there is no TTree::IsSelected() method. IS there some way I could do this without having to parse selection myself? Thanks!

You can use a TTreeFormula object. See the implementation of TTreePlayer::Scan for an example of us.