Plotting 2 out of 4 dimesions in a 4D PDF


I am working with a 4D PDF and was cross checking some of the 2D Projections of the PDF. The 4 dimensions are r,z,S1,log10S2. In the attachment, top left and right pad are S1 vs log10S2 and r vs z. These look normal.

When I try to make a projection in r vs S1 (bottom left) the PDF looks WRONG on the bottom left pad. This is using the RooAbsPdf->generate->createHistogram() function with the following codes.

RooArgSet rS1(r,S1);
TH2* h_comptonRestPop_rS1 = (TH2*)comptonRestPop.generate(rS1,10000)->createHistogram(“r,S1”,NRBIN,NS1BIN);

I remade the r vs S1 (bottom right) using a projection command first using the following codes,

    RooArgSet NotrS1(z,log10S2);
RooAbsPdf * comptonRestPop_rS1 = comptonRestPop.createProjection(NotrS1);
TH2* hProj_comptonRestPop_rS1 = (TH2*)comptonRestPop_rS1->generate(rS1,10000)->createHistogram("r,S1",NRBIN,NS1BIN);

I am just curious what’s actually the right way to look at the PDF and what does Roofit actually use? I hope that I am just wrong in generating a 2D projection straight out of a 4D histogram.


I think the problem you observed could be caused by problem generating the 4-D PDF. I would not be surprised if some regions are missed when generating. You could try to increase the foam samples,
see A bug ?, extract a 2-D histogram based on Roofit

createProjection() computes instead the numerical integral first, so I would think it should work better