Hi Aras,
Sorry for the late reply. I was on vacation.
Datasets can only contain fundamentals (i.e variables), not observables.
If you want to make a plot of a distribution of a derived observable,
you can do that easily, but it requires an intermediate step: you add a column
to the dataset with the calculated values of your transformation function on
the data points already contained in the dataset. Here is a modified version
of your example:
using namespace RooFitShortHand;
RooRealVar sigma(“sigma”,“sigma”,0.0,0.2);
RooLandau sigma_dist(“sigma_dist”,“sigma_dist”,sigma, C(0.05),C(0.01));
RooDataSet *datasigma = sigma_dist.generate(RooArgSet(sigma),5000);
RooFormulaVar d1_func(“d1”,“sqrt(@0)”,RooArgSet(sigma));
RooRealVar* d1 = (RooRealVar*) datasigma->addColumn(d1_func) ; // <–
RooDataHist h1(“h1”,“h1”,*d1,*datasigma);
RooHistPdf (“h1pdf”,“h1pdf”,*d1,h1);
The magic line is the one marked with the arrow, which adds a column to your
dataset with the output of the transformation that you give it.
I’ll answer your other posting on conditional p.d.f.s tomorrow.
Wouter