Creating a RooDataSet from a tree with cuts

Hello,
I’m wondering if there is a quick and dirty way of creating a RooDataSet from an existing TTree while appyling selection criteria. I tried using CopyTree to create a subset tree applying my selection, however, CopyTree would crash whenever I applied more than 1 cut at a time:

Example: (This would work)
TTree *tree1 = t1->CopyTree(Jpsicut);

However this wouldn’t:
TTree *tree1 = t1->CopyTree(Jpsicut && DeltaEcut);

It would be nice to somehow use TEntryList. Is there a way to cast/store TEntryList as a TTree to be read into a RooDataSet?

Thanks,
Brandon Drummond

Hi Brandon,

You can apply selectio criteria when you create a RooDataSet,e.g.

RooDataSet rds(“rds”,“rds”,RooArgSet(x,y,z,t,…),Import(yourTree),Cut(“x>5&&y<10”)) ;

You can however only cut on variables that are imported.

Your suggestion for a TEntryList specification seems however quite doable. I will try to add this for the next release.

Wouter