Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ROOT 6.26 compatibility for 112x branch #776

Merged
merged 6 commits into from Aug 23, 2022

Conversation

guitargeek
Copy link
Contributor

@guitargeek guitargeek commented Jul 29, 2022

This PR does the necessary changes to make the 112x branch compatible with ROOT 6.26.

Backwards compatibility is kept because there are preprocessor macros to get the right code for the right ROOT version.

ROOT 6.26 is added to the CI as suggested by @nsmith- in #772 (comment).

After #772, this contains the second part of the necessary changes that I also gave to @maxgalli to try out in his private branch:
https://github.com/maxgalli/HiggsAnalysis-CombinedLimit/commits/626-py3

@guitargeek guitargeek force-pushed the 112x_root-master branch 4 times, most recently from 60ad240 to 70dad33 Compare July 29, 2022 18:20
@gpetruc
Copy link
Contributor

gpetruc commented Aug 19, 2022

Hi @guitargeek,
When trying to compile this in /cvmfs/sft.cern.ch/lcg/views/LCG_102/x86_64-centos8-gcc11-opt I also had two compilation errors in
gpetruc@fcfbf26 (gcc complains that this is null)
Do you happen to have also some insight about this?

@guitargeek
Copy link
Contributor Author

guitargeek commented Aug 19, 2022

Hi @gpetruc! I made some comments inline in your commit, but the problem is that you are dereferenicing the coef pointer, which is always nullptr because that was the condition to exit the previous loop:
while((coef=(RooAbsReal*)_coefIter->Next()))

Wow I'm amazed the compiler catches this kind of stuff now!

@guitargeek
Copy link
Contributor Author

By the way, @amarini and @nsmith-, can this PR be merged?

@gpetruc
Copy link
Contributor

gpetruc commented Aug 19, 2022

Thanks @guitargeek! I had been assuming that the code had been broken in some strange way by an update in root, but you're right, the code had always been wrong and we had just never found out.
I think the proper fix is then
gpetruc@37c80f5

@amarini
Copy link
Collaborator

amarini commented Aug 19, 2022

Hi,
this seems not compatible with 112x flow (i.e. merging into 112x and running it into 112x):

  File "/builds/cms-hcg/performances/ci/CMSSW_11_2_5/python/HiggsAnalysis/CombinedLimit/ShapeTools.py", line 645, in doCombinedDataset
    self.out._import(self.out.data_obs)
AttributeError: 'RooWorkspace' object has no attribute '_import'

Probably we will need to charge _import -> safe_import also in ShapeTools.py

(I'm also checking it standalone in root626, but iirc that worked).

@guitargeek
Copy link
Contributor Author

Okay, thanks for letting me know, so ._import has to be renamed everywhere. I have updated the PR with that change.

How much do you think this renaming will be a problem? Would this entail that many combine users would have to change their code? It it would be too much trouble, we can also try to find another solution, but that would probably mean patching ROOT...

@hcombbot
Copy link

Pull Request Test.
Summary

Running options:

  • MODE : root626
  • COMBINE_TAG : 112x
  • COMBINE_REPO : cms-analysis
  • COMBINE_MERGE : guitargeek/112x_root-master
  • GITHUB_PR : 776
    Ratio to reference values:

comb_2021_hbb_boosted comb_2021_hgg comb_2021_hinv comb_2021_hmm comb_2021_htt_incl comb_2021_htt_stxs comb_2021_hww comb_2021_hzg comb_2021_hzz comb_2021_tth_hbb comb_2021_tth_multilepton comb_2021_vhbb
1.00 0.89 1.00 0.84 1.25 1.00 1.06 -409.93 1.00 1.00 1.00 0.98
You can find more detail at https://gitlab.cern.ch/cms-hcg/performances/ci/-/pipelines/4385870

@hcombbot
Copy link

Pull Request Test.
Summary

Running options:

  • MODE : cmssw
  • COMBINE_TAG : 112x
  • COMBINE_REPO : cms-analysis
  • COMBINE_MERGE : guitargeek/112x_root-master
  • GITHUB_PR : 776
    Ratio to reference values:

comb_2021_hbb_boosted comb_2021_hgg comb_2021_hinv comb_2021_hmm comb_2021_htt_incl comb_2021_htt_stxs comb_2021_hww comb_2021_hzg comb_2021_hzz comb_2021_tth_hbb comb_2021_tth_multilepton comb_2021_vhbb
1.00 1.00 1.00 1.00 1.00 1.00 1.00 0.94 1.00 1.00 1.00 1.00
You can find more detail at https://gitlab.cern.ch/cms-hcg/performances/ci/-/pipelines/4385869

@hcombbot
Copy link

Pull Request Test.
Summary

Running options:

  • MODE : cmssw
  • COMBINE_TAG : 112x
  • COMBINE_REPO : cms-analysis
  • COMBINE_MERGE : guitargeek/112x_root-master
  • GITHUB_PR : 776
    Ratio to reference values:

comb_2019_hbb_boosted_standalone comb_2019_hgg comb_2019_hmm comb_2019_htt comb_2019_hww comb_2019_tth_hbb comb_2019_tth_hgg comb_2019_tth_multilepton comb_2019_vh_htt comb_2019_vhbb comb_2019_vhbb2017
1.00 0.96 0.99 1.00 1.00 1.00 0.67 1.00 1.01 1.00 1.00
You can find more detail at https://gitlab.cern.ch/cms-hcg/performances/ci/-/pipelines/4385861

@amarini
Copy link
Collaborator

amarini commented Aug 19, 2022

I think that the change

_import -> safe_import

In the models developed privately is a minor change to the code. The important thing is that more or less the datacards continue to work or we understand why they do not.

At the moment in root626:

  • hzz has the error, but it seems to converge to the right value:
[#0] WARNING:Eval -- Evaluating RooAddPdf without a defined normalization set. This can lead to ambiguos coefficients definition and incorrect results. Use RooAddPdf::fixCoefNormalization(nset) to provide a normalization set for defining uniquely RooAddPdf coefficients!
  • while all the datacards with discrete parameters fail the fit. (hgg, hmm, hzg, ...)
  • htt_incl, vhbb, I don't know why it fails.

In 112x seems to be fine.

I think we can merge it, but I would say that we have not fully commissioned root626, yet.

@guitargeek
Copy link
Contributor Author

Okay, thanks! Yes this RooAddPdf warning is a new warning that we print out. But depending on the context it might be harmless, for example if getVal() was only called without the normalization set to print the PDF or something. Still, it's probably something we should look at when commissioning 6.26

Also nameSet2ByIndex with selectFromSet2. This follows the interface
change done in ROOT PR root-project/root#7819.
This is to adapt to the changes that were made for ROOT 6.26, where the
raw pointers in ToyMCSampler were changed to `std::unique_ptr`.

root-project/root#7904
Explicitely set defaultMinimizerAlgo in CascadeMinimizer to `Migrad`.

As of ROOT 6.26, the
`ROOT::Math::MinimizerOptions::DefaultMinimizerAlgo()` returns an empty
string instead of "Migrad", like it did in ROOT 6.24.

This caused errors because RooFit needs to be told what is the minimizer
algo. A simple fix for this problem is to make the default minimizer
algo explicit, which is probably better anyway.
After the following ROOT PR, it is not possible anymore to set the
`_import` attribute of a RooWorkspace instance as of ROOT 6.26:

root-project/root#9896
@guitargeek
Copy link
Contributor Author

I just force-pushed to fix a typo I made in the comments

@hcombbot
Copy link

Pull Request Test.
Summary

Running options:

  • MODE : cmssw
  • COMBINE_TAG : 112x
  • COMBINE_REPO : cms-analysis
  • COMBINE_MERGE : guitargeek/112x_root-master
  • GITHUB_PR : 776
    Ratio to reference values:

comb_2019_hbb_boosted_standalone comb_2019_hgg comb_2019_hmm comb_2019_htt comb_2019_hww comb_2019_tth_hbb comb_2019_tth_hgg comb_2019_tth_multilepton comb_2019_vh_htt comb_2019_vhbb comb_2019_vhbb2017
1.00 0.96 0.99 1.30 1.00 1.00 0.67 1.00 1.01 1.00 1.00
You can find more detail at https://gitlab.cern.ch/cms-hcg/performances/ci/-/pipelines/4389631

@nsmith-
Copy link
Collaborator

nsmith- commented Aug 22, 2022

Do you want to cherry-pick gpetruc@37c80f5 ? I guess the compilation succeeds in the github CI because it is getting gcc v10.4, and LCG102 has gcc v11.2

@guitargeek
Copy link
Contributor Author

Okay, I have done that!

@hcombbot
Copy link

Pull Request Test.
Summary

Running options:

  • MODE : cmssw
  • COMBINE_TAG : 112x
  • COMBINE_REPO : cms-analysis
  • COMBINE_MERGE : guitargeek/112x_root-master
  • GITHUB_PR : 776
    Ratio to reference values:

comb_2019_hbb_boosted_standalone comb_2019_hgg comb_2019_hmm comb_2019_htt comb_2019_hww comb_2019_tth_hbb comb_2019_tth_hgg comb_2019_tth_multilepton comb_2019_vh_htt comb_2019_vhbb comb_2019_vhbb2017
1.00 0.96 0.99 1.30 1.00 1.00 0.67 1.00 1.01 1.00 1.00
You can find more detail at https://gitlab.cern.ch/cms-hcg/performances/ci/-/pipelines/4400168

@hcombbot
Copy link

Pull Request Test.
Summary

Running options:

  • MODE : cmssw
  • COMBINE_TAG : 112x
  • COMBINE_REPO : cms-analysis
  • COMBINE_MERGE : guitargeek/112x_root-master
  • GITHUB_PR : 776
    Ratio to reference values:

comb_2019_hbb_boosted_standalone comb_2019_hgg comb_2019_hmm comb_2019_htt comb_2019_hww comb_2019_tth_hbb comb_2019_tth_hgg comb_2019_tth_multilepton comb_2019_vh_htt comb_2019_vhbb comb_2019_vhbb2017
1.00 1.01 0.70 1.00 1.00 1.00 1.01 1.00 1.00 1.00 1.00
You can find more detail at https://gitlab.cern.ch/cms-hcg/performances/ci/-/pipelines/4400765

@amarini
Copy link
Collaborator

amarini commented Aug 23, 2022

I merge this. We will investigate the discrepancies in ROOT626 in the future. The last run I only changed some minimizer options.

@amarini amarini merged commit f085fb7 into cms-analysis:112x Aug 23, 2022
@guitargeek guitargeek deleted the 112x_root-master branch August 23, 2022 14:36
@guitargeek guitargeek restored the 112x_root-master branch August 23, 2022 14:36
@guitargeek guitargeek deleted the 112x_root-master branch August 23, 2022 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants