Hi all,
I have a PDF to fit four dimensions and slices defined by three categories. I produce 1d plots using the following code:
cat1->setLabel("foo");
cat2->setLabel("bar");
cat3->setLabel("baz");
RooArgSet* cats = new RooArgSet(*cat1, *cat2, *cat3);
TString cuts = Form("cat1==cat1::%s && cat2==cat2::%s && cat3==cat3::%s", cat1->getLabel(), cat2->getLabel(), cat3->getLabel());
// create a binned projection dataset of the categories to speed up plotting
RooDataSet* catData1 = new RooDataSet("catData1", "catData1", dataset, *cats);
RooDataHist* catData = catData1->binnedClone("catData");
dataset->plotOn(frame, Cut(cuts));
pdf->plotOn(frame, Slice(*cats), ProjWData(*catData));
Now I want to look at 2d subsets. I did
// as before:
cat1->setLabel("foo");
cat2->setLabel("bar");
cat3->setLabel("baz");
TString cuts = Form("cat1==cat1::%s && cat2==cat2::%s && cat3==cat3::%s", cat1->getLabel(), cat2->getLabel(), cat3->getLabel());
TCanvas* c = new TCanvas("c", "Plot", 1240, 480);
c->Divide(2);
c->cd(1);
TH1* dataseth2d = dataset->createHistogram("dataset2d", *var1, Binning(25), YVar(*var2, Binning(25)), Cut(cuts));
dataseth2d->Draw("colz");
c->cd(2);
TH1* pdfh2d = pdf->createHistogram("pdfh2d", *var1, Binning(25), YVar(*var2, Binning(25)));
pdfh2d->Scale(dataseth2d->Integral()/pdfh2d->Integral());
pdfh2d->Draw("colz");
The createHistogram() interface doesn’t support the Slice() modifier. So it came quite as a surprise, that the plots actually look reasonable! Is this the correct way to do it, that is can I trust the plots? Can somebody explain what’s going on?
- Moritz[/code]