Skimming a TTree

Dear all,
I am having trouble with a seemingly simple task.

I am trying to skim a file with a TTree, selecting only some events. When reading the tree in a macro, I use the class generated with MakeClass (ReadSelectedTree). Below is the skeleton of the relevant parts of the code.

  TTree *oldtree = (TTree*)ch;    
  ReadSelectedTree *tree = new ReadSelectedTree(oldtree);

  TFile *newfile = new TFile(Form("%s", OutputBase.c_str()), "recreate");  
  TTree *newtree = oldtree->CloneTree(0); 


  for (Long64_t iEntry=0; iEntry<20000; iEntry++)
    { // Main loop
      tree->GetEntry(iEntry); // get ith entry
      if(tree->mPair>50 && tree->mPair<100)

  delete ch;
  delete newfile;

this code compiles fine and runs fine. The resulting tree is not fully cloned however. The branches of the original tree that are simple Float etc are copied ok, but those where TBranch is a “MyClass” are copied empty. When compiling the excitable I fully linked the dictionaries, so it seems that class, but still the tree is not fully copied.

Could somebody point me to what may be going wrong here?

Thank you,