I’m creating a shape template using RooKeysPDF from MC, which takes very long time (RooDateset used has 100k entries, so this is pretty normal I guess). Is there some alternative (faster) PDF generation method available inside RooFit (most probably smoothing is not needed due to huge number of entries). Alternatively - is there a way inside RooFit to limit the size of the dataset to given number of events (e.g. take first 5k)?
ok, found the solution. Fill TH1 histogram using the dataset, apply smoothing, convert to RooDataHist and then to RooHistPdf…
Anyway, it would be nice to understand if there is a possibility to limit given RooDataset to given number of events (e.g. select first 5000 events from dataset)
If you still want to use kernel estimation, you could also use the TKDE class in ROOT, which does kernel estimation as the RooKeyPDF, but it has the option to perform some internal binning which reduces by a large factor the computation time. You can then sample the TKDE and get a RooFit PDF
See root.cern.ch/root/htmldoc/TKDE.html
There is not a direct interface from TKDE to RooDataSet, but you can easily fill an array of values from a RooDataSet and passed then to the TKDE class
I’m having some trouble with the TKDE function looking right.
First I plotted my RooDataHist on a frame and then tried to build function which I could bind to a PDF. RooPlot *frame = ptfrac->frame(); hist->plotOn(frame); TKDE *key = TKDE(frame->getHist()->GetN(), frame->getHist()->GetX(), 0, 1.1,"", 1.0); RooAbsPdf *rfa1 = bindPdf(key->GetFunction(),ptfrac);
ptfrac is a variable declared earlier for the RooDataHist that goes from 0 to 1.1 and hist is the RooDataHist created from my data. The resulting PDF does not match the data, so when I fit it to the data it doesn’t give a reasonable result.
Is there a step I’m missing?
Now I’m trying to morph between these PDFs I’ve imported multiple datasets with TKDE and I’ve checked that they’re all slightly different, but when I apply RooMorphMoment the morphing parameter is flat.