cms-analysis / HiggsAnalysis-CombinedLimit

CMS Higgs Combination toolkit.
https://cms-analysis.github.io/HiggsAnalysis-CombinedLimit/latest
Apache License 2.0
75 stars 381 forks source link

[14x-comb2023] Avoid invalid proxy constructor calls in HMuMuRooPdfs #893

Closed guitargeek closed 5 months ago

guitargeek commented 8 months ago

In the HMuMuRooPdfs, there was a classic dangerous RooFit mistake.

There were constructor calls like:

RooRealProxy m("m", "m", this, 91.2);

However, this is not doing what one would naively expect, which is having proxy to a constant. Instead, it will hit this constructor by converting the double to bool, which is used as the valueServer parameter:

https://root.cern/doc/v626/classRooTemplateProxy.html#a9a550633b5336561b48eb313994a68e8

So it will create a proxy to nothing! In this particular case, this was not a problem because in evaluate(), there is a fallback for empty proxies.

But ROOT 6.30 makes some compile-time checks to prevent these mistakes, so this commit is necessary to compile with newer ROOT versions.

See https://root.cern/doc/v626/classRooTemplateProxy.html.