CloneTree in TSelector (or CopyTree)

Dear Philippe (or Zachary)

11 years later, I am trying to produce the same type of result.
Things have certainly changed since and it crashes. I am using ROOT 5.34/18.

  • I am surprised that the fChain is NULL is the Begin() method. How can I change that ?

  • Then the CloneTree(0) (performed in Process() then, where it is not NULL crashes.

  • Finally opening/creating a TFile in Begin() leads to failure (see my previous post “Create TFriend in TSelector”). I tried to first save gDirectory and then gDirectory->cd(). No luck.

I can provide a simple non working example (although my TTree is rather complex), but before going there maybe there is another simple procedure I am missing ? Note that I do not want to simple create a smaller tree with conditions, otherwise I can always use something like CopyTree, which BTW works very well here.

Regards
Julien

Edit : found one of the problem (fChain NULL) -> place the code in Init() (as it is explained in the posts above, my bad). The rest still does not work.