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

Make ElectronMVA usable in FWlite again #25337

Merged
merged 14 commits into from Dec 11, 2018
Merged

Make ElectronMVA usable in FWlite again #25337

merged 14 commits into from Dec 11, 2018

Conversation

guitargeek
Copy link
Contributor

@guitargeek guitargeek commented Nov 26, 2018

Hi,

in the discussion about issue #23676 it became evident that the current electron MVA ID does not work in FWlite/Python. Mainly the reason for this was that the MVA classes have to get additional variables not in the objects from edm::ValueMaps and the objects therefore need to be wrapped in something Ref-like (edm::Ptrs in the current implementation).

To get around this, we propose to add another helper class (MVAVariableHelper) to the Egamma MVA framework which calculates the extra variables and passes is to the MVA classes, which in turn don't need any other event or provenance information no more. The same function used by the new MVAVariableHelper to get the extra electron variables can also used in FWLite. An example will be included in the test code. There is also a new Python wrapper class which makes using the most recent Electron MVAs for 2016 and 2017 in Python very easy.

Furthermore, I cleaned up the MVANtuplizers a bit and more importantly changed the interface of the ConversionTools to not require edm::Handles anymore. Which makes their usage a bit more consistent in FWlite/Python with the other code I wrote.

Local matrix tests pass and I checked the output of the new fwlite test and the ElectronMVANtuplizer for numerical agreement of MVA values. Validation plots here [1]. If one wants to reproduce the comparison, the pt threshold in the ElectronMVANtuplizer has to be set to zero [2] and one could make the comparison plots with this script for example.

I hope everyone is fine with these changes and I don't have to touch the MVA code again any time soon.

Cheers,
Jonas

Shout-out to who discussed in the issue-thread @Dr15Jones, @makortel and of course to @cbernet for the nice discussion and help but in particular the FWlite example!

[1] https://rembserj.web.cern.ch/rembserj/plots/CMSSW_PRs/25337/
[2] https://github.com/cms-sw/cmssw/blob/master/RecoEgamma/ElectronIdentification/plugins/ElectronMVANtuplizer.cc#L424
[3] https://gitlab.cern.ch/snippets/636

@cmsbuild
Copy link
Contributor

The code-checks are being triggered in jenkins.

@cmsbuild
Copy link
Contributor

@cmsbuild
Copy link
Contributor

A new Pull Request was created by @guitargeek (Jonas Rembser) for master.

It involves the following packages:

DQMOffline/Lumi
DQMOffline/Trigger
DQMServices/Examples
EgammaAnalysis/ElectronTools
HLTriggerOffline/SUSYBSM
PhysicsTools/NanoAOD
PhysicsTools/PatAlgos
RecoBTag/SoftLepton
RecoEgamma/EgammaTools
RecoEgamma/ElectronIdentification
RecoEgamma/PhotonIdentification
Validation/RecoEgamma

@perrotta, @andrius-k, @kmaeshima, @schneiml, @monttj, @cmsbuild, @jfernan2, @fgolf, @slava77, @peruzzim can you please review it and eventually sign? Thanks.
@TaiSakuma, @gouskos, @jainshilpi, @rappoccio, @HeinerTholen, @varuns23, @seemasharmafnal, @mmarionncern, @JyothsnaKomaragiri, @ahinzmann, @smoortga, @acaudron, @jhgoh, @lgray, @jdolen, @HuguesBrun, @drkovalskyi, @ferencek, @trocino, @rociovilar, @Sam-Harper, @barvic, @jdamgov, @nhanvtran, @gkasieczka, @schoef, @mtosi, @clelange, @battibass, @calderona, @mverzett, @gpetruc, @imarches, @mariadalfonso, @pvmulder, @folguera this is something you requested to watch as well.
@davidlange6, @slava77, @fabiocos you are the release manager for this.

cms-bot commands are listed here

@perrotta
Copy link
Contributor

please test

@cmsbuild
Copy link
Contributor

cmsbuild commented Nov 26, 2018

The tests are being triggered in jenkins.
https://cmssdt.cern.ch/jenkins/job/ib-any-integration/31843/console Started: 2018/11/26 11:40

@Sam-Harper
Copy link
Contributor

@guitargeek , thank you for this, really appreciate it!

@cbernet
Copy link
Contributor

cbernet commented Nov 26, 2018

Hi all, I really appreciate this as well, and I would like to thank again @guitargeek very much for all the work. Just one thing though, there are a couple very small developments missing before we can apply the mva ID in FWLite. I did a PR to @guitargeek for that (https://github.com/guitargeek/cmssw/pull/1) and we will need to add these developments here (or in a later PR) when we're done.

@lucastorterotot @GaelTouquet

@cmsbuild
Copy link
Contributor

Comparison job queued.

@cmsbuild
Copy link
Contributor

Comparison is ready
https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-25337/31843/summary.html

Comparison Summary:

  • No significant changes to the logs found
  • Reco comparison results: 1 differences found in the comparisons
  • DQMHistoTests: Total files compared: 33
  • DQMHistoTests: Total histograms compared: 3131839
  • DQMHistoTests: Total failures: 2
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 3131633
  • DQMHistoTests: Total skipped: 204
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 32 files compared)
  • Checked 137 log files, 14 edm output root files, 33 DQM output files

@cmsbuild
Copy link
Contributor

cmsbuild commented Dec 4, 2018

@cmsbuild
Copy link
Contributor

cmsbuild commented Dec 4, 2018

Comparison job queued.

@cmsbuild
Copy link
Contributor

cmsbuild commented Dec 4, 2018

Comparison is ready
https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-25337/31986/summary.html

Comparison Summary:

  • No significant changes to the logs found
  • Reco comparison results: 0 differences found in the comparisons
  • DQMHistoTests: Total files compared: 33
  • DQMHistoTests: Total histograms compared: 3131939
  • DQMHistoTests: Total failures: 2
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 3131733
  • DQMHistoTests: Total skipped: 204
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 32 files compared)
  • Checked 137 log files, 14 edm output root files, 33 DQM output files

@perrotta
Copy link
Contributor

perrotta commented Dec 4, 2018

I quickly glanced at the timing performance of the new code. With the TTbar PU workflow 25202 I could verify that there is indeed also evidence of some little optimization with this code, although the modules involved were not large CPU consumers even before:

  delta/mean delta/orJob     original                   new       module name
  ---------- ------------     --------                  ----       ------------
     removed      -0.00%         0.04 ms/ev ->         0.00 ms/ev electronMVAVariableHelper
   -0.514217      -0.01%         1.15 ms/ev ->         0.68 ms/ev gedGsfElectrons
   -0.261770      -0.00%         1.44 ms/ev ->         1.11 ms/ev electronMVAValueMapProducer
   -0.218485      -0.00%         1.01 ms/ev ->         0.81 ms/ev gedPhotons
  ---------- ------------     --------                  ----       ------------
Job total:  8.7089 s/ev ==> 8.56415 s/ev

@perrotta
Copy link
Contributor

perrotta commented Dec 4, 2018

+1

  • The updates to the code clean it a bit and fulfil the purpose reported in the PR description of making ElectronMVA usable in FWlite, as demonstrated by the validation plots provided
  • This goes together with an overall optimization of the code itself
  • Jenkins tests pass, and show no differences in the reco output, as it was in the purpose of this PR

@andrius-k
Copy link

+1

@fabiocos
Copy link
Contributor

fabiocos commented Dec 6, 2018

@peruzzim @fgolf this PR is touching also the nanoAOD configuration, please check that it is not interfering with your developments, and sign it in case

@fabiocos
Copy link
Contributor

fabiocos commented Dec 9, 2018

@peruzzim @fgolf do I understand correctly that this is ok for you?

@fabiocos
Copy link
Contributor

+1

the fwlite test provided runs smoothly

@cmsbuild
Copy link
Contributor

Pull request #25337 was updated. @fgolf, @peruzzim can you please check and sign again.

@fabiocos
Copy link
Contributor

merge

@peruzzim @fgolf please note this merge affects you

@cmsbuild cmsbuild merged commit 77915b6 into cms-sw:master Dec 11, 2018
@fabiocos
Copy link
Contributor

@peruzzim @fgolf now that the xpog category has been assigned, please sign it for reference

@peruzzim
Copy link
Contributor

+xpog

for the modification to nano_cff.py, as NANOAOD workflows run and show no difference

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

9 participants