Roofit: Create RooDataSet from a chain with a cut without

Is there a way to create a RooDataSet from a tree with a cut, but without adding the variables used in the cut formula to the dataset? I don’t want to copy all these extra cut variables which are not used for fitting to RooDataSet, increasing the construction time and space usage.

I know I can create a RooDataSet from a tree with a RooFormula string or a RooFormulaVar argument in the RooDataSet constructor. But it seems to require the variables used for cut to be in the RooArgSet argument as well, forcing the copying of all these variables to the constructed dataset. Is there a way to avoid this?

A somewhat related note:
When creating a RooDataSet from a tree, the tree is first cloned ( see root.cern.ch/root/html/src/RooTr … html#drUW0 ) . The clone tree will lose the eventlist, so I cannot use SetEventList for cut selection for RooDataSet. And when the tree is a TTree instead of TChain, it will call CloneTree() instead of Clone(), which need a long time for copying the whole tree.

Thanks.

Hi,

At present this is not possible, but I am currently working on a general
overhaul of RooFit data classes, that was already started in ROOT 5.24/RooFit 3.00. Once this is completed (~1 month) the import of TTree data will be improved (specially you’ll be able to cut on variables you do not import).

Wouter

Is there an example of how to do this now? I’d like to use a cut string that is compatible with TTree Draw commands.

I managed to use this:

TChain ch ;//- the chain I have TString str;//- cuts //... TTree *tree = ch.CopyTree(str); RooDataSet ds("ds","ds",roo_x,Import(*tree));
It’s seems to be not the excellent variant, but I don’t know better