# Normalization of a Mirrored RooKeysPdf

Hi all,
I’m trying to generate some RooKeysPdfs from simulated toyMC distributions, which are obtained from an original distribution (seed distrib) normalized to unity. In creating the RooKeysPdfs I must mirror the distributions in this way:

because there is a non negligible density on the upper bound of myVar.

When I try to plot all these distributions, including seed distrib, they seem to have the same normalization to unity, but if I try to get the normalization explicitly via

```Double_t seed_distrib_norm = (Double_t) seed_distrib->getNorm(RooArgSet(*myVar)); Double_t myRooKey_norm = (Double_t) myRooKey->getNorm(RooArgSet(*myVar));```

I correctly obtain unity for the seed distribution, but approximately 50% for all the RooKeysPdfs (a different number for each). If MirrorRight is not inserted I obtain a normalization near to unity, and this does not sound strange to me because I can imagine that, with RooKeysPdf, there is some probability ‘leaking’ out of the edges, but I don’t understand why the normalization is not correct if I mirror the pdfs. I must also say that if I use MirrorBoth the normalization is reduced to approximately 33%.

Thank you,

Federico

Hi Federico,

RooKeysPdf is always correctly normalized. The issue is mostly on the interpretation of the value returned by getNorm().

In roofit, the correctly normalized expression for a pdf is always

RooArgSet nset(my_observables) ;
pdf.getVal(nset) ;

which amounts to

pdf.getVal() / pdf.getNorm(nset) ;

The reason that it is done this way (which is in this context not so important) is that if you have a pdf with multiple variables the choice of observables is not unique and therefore the normalization procedure isn’t either - this approach allows you to obtain a correctly normalized expression for all cases)

What you see is that RooKeysPdf is constructed in such a way that the expression returned from getVal() is already close to normalized if mirroring is not used. When mirroring is added, this is no longer the case automatically, but the non-unit value pdf.getNorm() will make the pdf again explicitly normalized.

Wouter