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

HLT XGBoost Photon MVA and Diphoton combination filter (backport for 14_0_X) #44500

Merged
merged 2 commits into from
Mar 22, 2024

Conversation

smorovic
Copy link
Contributor

PR description:

This PR uses XGBoost C API to implement calculation of the score of Photons for HLT.
Combination filter is provided with the aim of implementing diphoton paths.
Total of 9 HLT variables are used as input.

For binary model files, NTree Limit parameter must be provided (it is not saved in the model file).

Note: at this time model training files are not provided, until they are finalized.
At that point we will request: cms-data repository for model files, define default parameters (cuts) and add unit test which ensures XGBoost (v1.7.5 currently used in CMSSW) calculates scores correctly with given model files and parameters.

Note: requires external PR:
cms-data/RecoEgamma-PhotonIdentification#14

PR validation:

New unit test added with this PR (requires external PR in cms-data).
This code also passes HLT integration checks (caveat: all events rejected at the combination filter due to low statistics, but no errors, this will be improved and presented to TSG)

Sample HLT snippet used for that test:

process.hltPreDiphotonMVA = cms.EDFilter( "HLTPrescaler",
     offset = cms.uint32( 0 ),
     L1GtReadoutRecordTag = cms.InputTag( "hltGtStage2Digis" )
)

process.hltDiEG14p25EtEta2p55UnseededFilter = cms.EDFilter( "HLT1Photon",
     saveTags = cms.bool( True ),
     inputTag = cms.InputTag( "hltEgammaCandidatesUnseeded" ),
     triggerType = cms.int32( 92 ),
     MinE = cms.double( -1.0 ),
     MinPt = cms.double( 14.25 ),
     MinMass = cms.double( -1.0 ),
     MaxMass = cms.double( -1.0 ),
     MinEta = cms.double( -1.0 ),
     MaxEta = cms.double( 2.55 ),
     MinN = cms.int32( 2 )
)

process.PhotonXGBoostProducer = cms.EDProducer("PhotonXGBoostProducer",
     candTag = cms.InputTag( "hltEgammaCandidatesUnseeded" ),
     inputTagR9 = cms.InputTag("hltEgammaR9IDUnseeded", "r95x5"),
     inputTagHoE = cms.InputTag("hltEgammaHoverEUnseeded"),
     inputTagSigmaiEtaiEta = cms.InputTag("hltEgammaClusterShapeUnseeded", "sigmaIEtaIEta5x5NoiseCleaned"),
     inputTagE2x2 = cms.InputTag("hltEgammaClusterShapeUnseeded", "e2x2"),
     inputTagIso = cms.InputTag("hltEgammaEcalPFClusterIsoUnseeded"),
     mvaFileXgbB = cms.FileInPath("RecoEgamma/PhotonIdentification/data/barrel.bin"), #copy by hand
     mvaFileXgbE = cms.FileInPath("RecoEgamma/PhotonIdentification/data/barrel.bin"), #copy by hand
     mvaNTreeLimitB = cms.uint32(168),
     mvaNTreeLimitE = cms.uint32(158),
     mvaThresholdEt = cms.double(14.25)
)

process.HLTEgammaDoubleXGBoostCombFilter = cms.EDFilter("HLTEgammaDoubleXGBoostCombFilter",
     saveTags = cms.bool( True ),
     candTag = cms.InputTag( "hltEgammaCandidatesUnseeded" ),
     mvaPhotonTag = cms.InputTag( "PhotonXGBoostProducer" ),
     highMassCut = cms.double(95),
     leadCutHighMass1 = cms.vdouble(0.98,0.95),
     subCutHighMass1 = cms.vdouble(0.00,0.04),
     leadCutHighMass2 = cms.vdouble(0.85,0.85),
     subCutHighMass2 = cms.vdouble(0.04,0.08),
     leadCutHighMass3 = cms.vdouble(0.30,0.50),
     subCutHighMass3 = cms.vdouble(0.15,0.20),
     lowMassCut = cms.double(60),
     leadCutLowMass1 = cms.vdouble(0.98,0.90),
     subCutLowMass1 = cms.vdouble(0.04,0.05),
     leadCutLowMass2 = cms.vdouble(0.90,0.80),
     subCutLowMass2 = cms.vdouble(0.10,0.10),
     leadCutLowMass3 = cms.vdouble(0.60,0.60),
     subCutLowMass3 = cms.vdouble(0.30,0.30),

process.HLTDiphotonMvaTestSequence = cms.Sequence( process.HLTDoFullUnpackingEgammaEcalSequence + process.HLTPFClusteringForEgamma + process.hltEgammaCandidates + process.hltEGL1SingleAndDoubleEGOrFilter + process.hltEG30L1SingleAndDoubleEGOrEtFilter + process.HLTPFClusteringForEgammaUnseeded + process.hltEgammaCandidatesUnseeded + process.hltDiEG14p25EtEta2p55UnseededFilter + process.hltEgammaR9IDUnseeded + process.HLTDoLocalHcalSequence + process.HLTFastJetForEgamma + process.hltEgammaHoverEUnseeded + process.hltEgammaClusterShapeUnseeded + process.hltEgammaEcalPFClusterIsoUnseeded )

process.HLT_Diphoton_MVA = cms.Path( process.HLTBeginSequence + process.hltL1sSingleAndDoubleEGor + process.HLTDiphotonMvaTestSequence  + process.PhotonXGBoostProducer + process.HLTEgammaDoubleXGBoostCombFilter + process.HLTEndSequence )

process.schedule.insert( process.schedule.index( process.HLT_Diphoton30_22_R9Id_OR_IsoCaloId_AND_HE_R9Id_Mass95_v20 ) + 1, process.HLT_Diphoton_MVA )

getattr(process.datasets, 'EGamma0').append('HLT_Diphoton_MVA')
getattr(process.datasets, 'EGamma1').append('HLT_Diphoton_MVA')
getattr(process.datasets, 'OnlineMonitor').append('HLT_Diphoton_MVA')

process.hltDatasetEGamma.triggerConditions.append('HLT_Diphoton_MVA')
process.hltDatasetOnlineMonitor.triggerConditions.append('HLT_Diphoton_MVA')

If this PR is a backport please specify the original PR and why you need to backport that PR. If this PR will be backported please specify to which release cycle the backport is meant for:

Backport of #44473
Reason for backport: integration into HLT which will use CMSSW_14_0_X for the initial data-taking in 2024.

smorovic and others added 2 commits March 21, 2024 13:02
* Photon XGBoost MVA estimator and producer.
Implemented using native XGBoost C API for photon MVA score
Currently diphoton score filter is not yet submitted.

Model files will be added to the cms-data

XGBoost Double photon combination filter

fix module name

code-format

fix comments from maintainers

Update HLTrigger/Egamma/plugins/HLTEgammaDoubleXGBoostCombFilter.cc

Co-authored-by: Marco Musich <[email protected]>

Update HLTrigger/Egamma/plugins/HLTEgammaDoubleXGBoostCombFilter.cc

Co-authored-by: Marco Musich <[email protected]>

Update HLTrigger/Egamma/plugins/HLTEgammaDoubleXGBoostCombFilter.cc

Co-authored-by: Marco Musich <[email protected]>

Update HLTrigger/Egamma/plugins/HLTEgammaDoubleXGBoostCombFilter.cc

Co-authored-by: Marco Musich <[email protected]>

Update HLTrigger/Egamma/plugins/HLTEgammaDoubleXGBoostCombFilter.cc

Co-authored-by: Marco Musich <[email protected]>

Update HLTrigger/Egamma/plugins/HLTEgammaDoubleXGBoostCombFilter.cc

Co-authored-by: Marco Musich <[email protected]>

Update RecoEgamma/PhotonIdentification/plugins/PhotonXGBoostProducer.cc

Co-authored-by: Marco Musich <[email protected]>

Update RecoEgamma/PhotonIdentification/plugins/PhotonXGBoostProducer.cc

Co-authored-by: Marco Musich <[email protected]>

Update RecoEgamma/PhotonIdentification/plugins/PhotonXGBoostProducer.cc

Co-authored-by: Marco Musich <[email protected]>

Update RecoEgamma/PhotonIdentification/plugins/PhotonXGBoostProducer.cc

Co-authored-by: Marco Musich <[email protected]>

Update RecoEgamma/PhotonIdentification/plugins/PhotonXGBoostProducer.cc

Co-authored-by: Marco Musich <[email protected]>

tidy up and sort headers

code-format

Update RecoEgamma/PhotonIdentification/plugins/PhotonXGBoostProducer.cc

Co-authored-by: Marco Musich <[email protected]>
XGBoost Photon MVA unit test

Unit test for v1 model files in cms-data
Change of ntree limit parameter
@cmsbuild
Copy link
Contributor

cmsbuild commented Mar 21, 2024

A new Pull Request was created by @smorovic for CMSSW_14_0_X.

It involves the following packages:

  • HLTrigger/Egamma (hlt)
  • RecoEgamma/EgammaHLTProducers (hlt)
  • RecoEgamma/PhotonIdentification (reconstruction)

@jfernan2, @mmusich, @mandrenguyen, @Martin-Grunewald, @cmsbuild can you please review it and eventually sign? Thanks.
@sameasy, @Prasant1993, @lgray, @sobhatta, @ram1123, @Fedespring, @valsdav, @silviodonato, @Martin-Grunewald, @afiqaize, @Sam-Harper, @a-kapoor, @jainshilpi, @missirol, @varuns23, @cericeci, @HuguesBrun this is something you requested to watch as well.
@sextonkennedy, @antoniovilela, @rappoccio you are the release manager for this.

cms-bot commands are listed here

@cmsbuild
Copy link
Contributor

cmsbuild commented Mar 21, 2024

cms-bot internal usage

@mmusich
Copy link
Contributor

mmusich commented Mar 21, 2024

test parameters:

@mmusich
Copy link
Contributor

mmusich commented Mar 21, 2024

@cmsbuild, please test

@mmusich
Copy link
Contributor

mmusich commented Mar 21, 2024

backport of #44473

@mmusich
Copy link
Contributor

mmusich commented Mar 21, 2024

type hlt-int

@cmsbuild
Copy link
Contributor

+1

Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-13911f/38327/summary.html
COMMIT: 46e56ea
CMSSW: CMSSW_14_0_X_2024-03-21-1100/el8_amd64_gcc12
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week1/cms-sw/cmssw/44500/38327/install.sh to create a dev area with all the needed externals and cmssw changes.

Comparison Summary

Summary:

  • You potentially added 20 lines to the logs
  • Reco comparison results: 39 differences found in the comparisons
  • DQMHistoTests: Total files compared: 49
  • DQMHistoTests: Total histograms compared: 3346212
  • DQMHistoTests: Total failures: 3
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 3346187
  • DQMHistoTests: Total skipped: 22
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 48 files compared)
  • Checked 205 log files, 166 edm output root files, 49 DQM output files
  • TriggerResults: no differences found

@mmusich
Copy link
Contributor

mmusich commented Mar 21, 2024

+hlt

@jfernan2
Copy link
Contributor

+1

@cmsbuild
Copy link
Contributor

This pull request is fully signed and it will be integrated in one of the next CMSSW_14_0_X IBs (tests are also fine) and once validation in the development release cycle CMSSW_14_1_X is complete. This pull request will now be reviewed by the release team before it's merged. @sextonkennedy, @antoniovilela, @rappoccio (and backports should be raised in the release meeting by the corresponding L2)
Notice This PR was tested with additional Pull Request(s), please also merge them if necessary: cms-data/RecoEgamma-PhotonIdentification#14

@antoniovilela
Copy link
Contributor

+hlt

To be backported: cms-sw/cmsdist#9089

@mmusich
Copy link
Contributor

mmusich commented Mar 22, 2024

To be backported: cms-sw/cmsdist#9089

I opened cms-sw/cmsdist#9090

@antoniovilela
Copy link
Contributor

+1

@cmsbuild cmsbuild merged commit 7be1156 into cms-sw:CMSSW_14_0_X Mar 22, 2024
11 checks passed
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.

5 participants