Accessing TSelector from compiled code

Hi all,
I was wondering if it was possible to access TSelectors from compiled ROOT. In particular, something along the following lines:

//Various includes
#include "MySelector.h"

int main() {
  TFile file = new TFile("my_root.root");
  TTree tree = file.get("CollectionTree");
  MySelector* selector = new MySelector(tree);
  //Some sort of entry selection
  selector->Process(entry);
  delete selector;
}

Thanks in advance for any ideas.

A TSelector is designed to work in interpreted or compiled code. I suggest to do

root > .L MySelector.C+ root > .x myscript.C+
where myscript is a void myscript instead of your main program. Many functions in the Tree management require a TApplication object running.

Rene