Using TSelector pointer in macro

Dear ROOTers,

I’d like to process my ntuples using a TSelector that I included into a library, let’s call them MySelector and libAnalysis.so.

Interactively everything works fine, but when I try to run it into a macro, no events are processed.
Here’s the snippet code I use:

int runMacro(int nev=1e10, const char* fName = "myNtuple.root", const char* options = "") {
  gSystem->Load( "lib/libAnalysis.so" );
  TFile *f = new TFile(fName);
  TTree *t = (TTree*)f->Get("myTree");

  std::cout << "\nProcessing " << fName << std::endl;
  MySelector *sel= new MySelector();
  cout << "\n" << sel <<" "<< t<< endl;
  t->Process(sel,options,nev);
  std::cout << "\nCalled Process\n";
  
  return 0;
}

The output is

root [0] 
Processing runMacro.cc(10,"test.root")

Processing test.root

0x1e734200 0x1e60f0b0

Called Process

As you can see it’s like t->Process() is not called.

Do you have any suggestion?
Thanks,

Maurizio

Dear ROOTers,

I should have made some mistake in my original snippet code.
The one that is shown here actually works.
If I find the error on the original snippet, I’ll post it.
Sorry for the noise.

Maurizio