How to make 2D histogram with variables within a signal range?

Dear experts,

I have a script with variables defined such like

RooRealVar xmass(“xmass”,""xmass, 5.0, 6.0.);
RooRealVar var2(“var2”,“var2”, 1.0, 99.);
RooRealVar var3(“var3”,“var3”, 1.0, 99.);

RooDataSet * dataSetS= (RooDataSet::read(FileName,RooArgSet(xmass, var2, var3), “Q”));

double myXSigma = X_width.getVal();

// within 1.5 sigma

xmass.setRange(“selection2”,5.57-1.5myXSigma, 5.57+1.5myXSigma);
RooAbsReal* pdfBpsignalregion2=pdfBp->createIntegral(RooArgSet(xmass),“selection2”);
RooAbsReal* BkgPolPdfsignalregion2=BkgPolPdf->createIntegral(RooArgSet(xmass),“selection2”);

I’d like to make a 2D histogram of (var2)^2 vs (var3)^2 for those candidates (signal+background) in ±2 sigma region.

Hi again,

actually it is easy to make a histogram with the variables from a pdf, you may just use data->createHistogram(“var1, var2”). But I need (var1var1) vs (var2var2). Any idea how? Thanks.