Strange things with RooDataSet

Hi, all.

I’m encountering a very odd, perplexing issue.

I have a TFile with a flat ntuple TTree. I’m defining a set of RooRealVar, putting these RooRealVar into a RooArgSet, and then using them to make a RooDataSet from the TTree I grab from the TFile.

But I’m noticing that I get many fewer entries if I include more if the RooRealVars into the RooArgSet, even if I’m not using the variables to reduce the dataset.

Here’s an example of what I’m doing:

[code]TTree* tree = (TTree*)infile->Get(“tofit”);
RooRealVar a(“a”, “a”, -1., 1.);
RooRealVar b(“b”, “b”, -1., 1.);
RooRealVar c(“c”, “c”, -1., 1.);
RooArgSet fitVars();
fitVars.add(a);
fitVars.add(b);
fitVars.add©;

RooDataSet dSet(“dSet”, “dSet”, tree, fitVars);
[/code]

Now, if I, for example, comment out the second two “fitVars.add” lines, I get an entirely different number of entries in my RooDataSet!

Is there a reason why this is happening? I seem to be losing statistics, and I can’t figure out why simply adding more variables to the RooArgSet would change what entries I grab from the tree.

I should also mention that if I simply plot the variables from the TTree to a TH1D, I see even more entries.

I figured out what was happening.

Once of my variables was copied into my final tree incorrectly (an Int_t being copied into a UInt_t) so that was causing a lot of the events to go out of range for that particular variable. So with events with this variable’s value outside the range I specified in the RooRealVar, they weren’t being added to the RooDataSet.

Sorry for my confusion.