Dear expert
When reading the RookeysPdf doxygen I encountered this in the description
If the 'adaptive mode' is enabled, the width of the Gaussian is adaptively calculated from the local density of events, i.e. narrow for regions with high event density to preserve details and wide for regions with low event density to promote smoothness.
This is exactly what I would like to do for a shape to avoid implementing a full Beeston Barlow method in my analysis.
The question I have is , how exactly one enable this adaptive behaviour? Mirror options seems to not being documented on what they do, so one has to try and see but I doubt one of them enable the adaptive mode, while rho sounds to be a customizable flag ( at least it has always been for me)
So the question I have is , how does one enable the adaptive behaviour? And can eventually be fixed in the documentation on what to do to enable it?
We are aware of the flaws in the RooKeysPdf documentation and we are working on improvements (see also issue #8507 on GitHub).
The comment about the āadaptive modeā in the documentation is indeed misleading, because it suggests that the adaptive mode has to be enabled. But in fact, the adaptive mode canāt be switched off! The only control you have over the RooKeysPdf is the \rho parameter as an overall scaling to the kernel width, and the various mirror options.
If you want to toggle the adaptive mode, you need to use the more general RooNDKeysPdf.
The RooNDKeysPdf implementation is however much more complicated in order to generalize to n dimensions. So it might have some additional performance overhead, just as a heads up.
On a related note, if you are using a weighted dataset for the density estimation, you have to use the RooNDKeys pdf because the RooKeysPdf was giving wrong estimates for weighted datasets in all ROOT releases so far. This problem got only fixed last week in ROOT master.
Hope this is informative, let me know if you have further questions!
Jonas
Thanks a lot @jonas , Letās say i would like to try to get this behaviour working in ROOT 6.18/06.
Do you have suggestions on how to backport it?
Unfortunately i cannot switch to root master , so i need to do something diry editing the code probablyā¦
So if i use RooNDKeysPdf out of the box in ROOT 6.18/04 the bug you mentioned about using weighted dataset for the density estimation, i should have to make a fix to backport the latest ROOT master changes?
TBufferFile::WriteObjectAny:0: RuntimeWarning: since RooNDKeysPdf has no public constructor
which can be called without argument, objects of this class
can not be read with the current library. You will need to
add a default constructor before attempting to read it.
When in ROOT 6.18/04 i try to save to a workspace the NDKeysPdf i get this, does it mean in 6.18 i cannot load it back?
Yes, thatās exactly what it means. This got fixed in ROOT 6.20.00 however.
Is there a good reason for you to use such an old ROOT version? I can really encourage you to use a newer one. Especially RooFit has evolved a lot over the last releases with many bugfixes and performance improvements.
The reason is that some of the code is not forward compatible with the changes done in RooFit, and i need to do many changes in my code. Does 6.20.00 should be backward compatible with 6.18.04?
If so i just compile a new class copying the source code and use it.
Thanks
EDIT:
Just copying headers/source and compile them as a new pdf RooKeysNDPdf2 seems to work, ( copy done from 6.20.00)
Does 6.20.00 should be backward compatible with 6.18.04?
If so i just compile a new class copying the source code and use it.
Yes that should definitely work. You can also cherry-pick the relevant commit:
Still, then you are depending on either a patched ROOT version or a custom class. I think this is a much bigger burden than migrating your code to ROOT 6.20, which usually doesnāt require many lines of change (and you can always ask here if you need help with that ).
Hello,
For some reasons I am trying to understand, I enabled the saving and loading from workspace and it works, however the pdf once loaded and after doing the redirectServerHooks on a variable with a different range for the X value It has errors on the normalisation.
I try to debug further , unfortunately I tried to upgrade to 6.20 but I have other code to port which instantiate some class which has been upgraded.