Merging Variables in a RooDataSet

Hi Experts,

I have a RooDataSet in which there are variables that describe various properties of positively and negatively charged tracks. e.g. momentum.

I don’t want to distinguish between positive and negatively charged tracks any more and I want a variable that is just “Track Momentum”, with twice the number of datapoints as before, instead of the two separate ones. To increase the statistics of my sample, and efficacy of a subsequent unbinned likelihood fit to the distribution.

To do this I think I need to make a new RooDataSet with twice as many entries as the first one and somehow put all the datapoints from the two variables in the first DataSet into a single one in this new dataset.

I can’t find a way of doing this, short of outputting the initial RooDataSet to two trees, changing the names of the branches, adding the two trees as friends, and then importing the merged tree to a new RooDataSet. And I think there must be an easier way to do this?

Any help would be greatly appreciated!

Thanks in advance,


I have managed to do this now, the following code snippet should work:

[color=#FF0000]//create a reduced dataset from your original with only the properties of +ve tracks[/color]
[color=#4000FF]RooDataSet* rp = data->reduce(SelectVars(RooArgSet(*pRhoPiPlus,*etaRhoPiPlus)),
Name(“RhoPiPlus”), Title(“RhoPiPlus”));[/color]

[color=#FF0000]//change the names to something that doesn’t specify charge[/color]

[color=#FF0000]//create another reduced dataset from your original with only the properties of -ve tracks, and
//change the names to the same as above[/color]
[color=#4000FF] RooDataSet* rpm = data->reduce(SelectVars(RooArgSet(*pRhoPiMinus,*etaRhoPiMinus)),
Name(“RhoPiMinus”), Title(“RhoPiMinus”));

[color=#FF0000]//append one dataset to the other, gets the required output[/color]
[color=#4000FF] rp->append(*rpm);[/color]

[color=#FF0000]//check that it has worked[/color]
[color=#4000FF] for(Int_t i = 0; i<=rp->numEntries() + 1; i++){
std::cout << i << std::endl;