I am trying to make a roodataset with cuts on a variable as follows:
[code] TFile* dataFile = new TFile( fileNameData.Data() );
assert(dataFile);
TTree* dataTree;
dataTree = (TTree*) dataFile->FindObjectAny(“Events”);
RooRealVar eta1(“eta1”,“eta1”,-10,10);
RooDataSet* dataDS = new RooDataSet(“dataDS”,"",RooArgSet(eta1),Import(*dataTree),Cut(“eta1>1”));
cout << "dataDS->numEntries() = " << dataDS->numEntries() << endl;
TH1D* hData = new TH1D(“hData”,"",100,-10.,10.);
dataTree->Draw(“eta1>>hData”,“eta1>1”);
cout << "hData->GetEntries() = " << hData->GetEntries() << endl;
[/code]
The output of the program is this:
[quote]
dataDS->numEntries() = 0
Info in TCanvas::MakeDefCanvas: created default TCanvas with name c1
hData->GetEntries() = 408[/quote]
Does anyone have any idea why the cut eta1 > 1 is not effective with the roodataset?
By playing around with the cut in the roodataset constructor, I have found that it thinks that eta1 = 0 for every entry in the tree. This is definitely not true, as I have verified by looking at tree and as you can see from the “hData->GetEntries() = 408”.