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
Egamma Fall17 V2 Photon IDs #25293
Merged
Merged
Egamma Fall17 V2 Photon IDs #25293
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
d631865
Cutbased photonID Fall17 V2
swagata87 92de492
update phoID v2 cutbased
swagata87 739083f
Fall17_94X_v2 MVA Photon ID
guitargeek 431982a
fix worst charged iso variable
guitargeek 8ec3c83
Renamed cut based ID and put in MiniAOD
guitargeek File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
...onIdentification/data/Fall17/effAreaPhotons_cone03_pfChargedHadrons_90percentBased_V2.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# The constants are based on 90% contours of isolation. | ||
# |eta| min |eta| max effective area | ||
0.0000 1.0000 0.0112 | ||
1.0000 1.4790 0.0108 | ||
1.4790 2.0000 0.0106 | ||
2.0000 2.2000 0.01002 | ||
2.2000 2.3000 0.0098 | ||
2.3000 2.4000 0.0089 | ||
2.4000 5.0000 0.0087 |
9 changes: 9 additions & 0 deletions
9
...onIdentification/data/Fall17/effAreaPhotons_cone03_pfNeutralHadrons_90percentBased_V2.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# The constants are based on 90% contours of isolation. | ||
# |eta| min |eta| max effective area | ||
0.0000 1.0000 0.0668 | ||
1.0000 1.4790 0.1054 | ||
1.4790 2.0000 0.0786 | ||
2.0000 2.2000 0.0233 | ||
2.2000 2.3000 0.0078 | ||
2.3000 2.4000 0.0028 | ||
2.4000 5.0000 0.0137 |
9 changes: 9 additions & 0 deletions
9
...ma/PhotonIdentification/data/Fall17/effAreaPhotons_cone03_pfPhotons_90percentBased_V2.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# The constants are based on 90% contours of isolation. | ||
# |eta| min |eta| max effective area | ||
0.0000 1.0000 0.1113 | ||
1.0000 1.4790 0.0953 | ||
1.4790 2.0000 0.0619 | ||
2.0000 2.2000 0.0837 | ||
2.2000 2.3000 0.1070 | ||
2.3000 2.4000 0.1212 | ||
2.4000 5.0000 0.1466 |
154 changes: 154 additions & 0 deletions
154
RecoEgamma/PhotonIdentification/python/Identification/cutBasedPhotonID_Fall17_94X_V2_cff.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
from PhysicsTools.SelectorUtils.centralIDRegistry import central_id_registry | ||
|
||
import FWCore.ParameterSet.Config as cms | ||
|
||
# Common functions and classes for ID definition are imported here: | ||
from RecoEgamma.PhotonIdentification.Identification.cutBasedPhotonID_tools \ | ||
import ( WorkingPoint_V2, | ||
IsolationCutInputs, | ||
configureVIDCutBasedPhoID_V5 ) | ||
|
||
# The cut values are taken from the twiki: | ||
# https://twiki.cern.ch/twiki/bin/viewauth/CMS/CutBasedPhotonIdentificationRun2 | ||
# (where they may not stay, if a newer version of cuts becomes available for these | ||
# conditions) | ||
|
||
# See also the presentation explaining these working points (this will not change): | ||
# https://indico.cern.ch/event/732974/contributions/3072291/attachments/1685029/2709189/PhotonIDStudy.pdf | ||
|
||
|
||
# | ||
# First, define cut values | ||
# | ||
|
||
# Loose working point Barrel and Endcap | ||
idName = "cutBasedPhotonID-Fall17-94X-V2-loose" | ||
WP_Loose_EB = WorkingPoint_V2( | ||
idName , # idName | ||
0.04596 , # hOverECut | ||
0.0106 , # full5x5_SigmaIEtaIEtaCut | ||
# Isolation cuts are generally absIso < C1 + pt*C2, except for NeuHad is < C1 + pt*C2 + pt*pt*C3 | ||
1.694 , # absPFChaHadIsoWithEACut_C1 | ||
0 , # absPFChaHadIsoWithEACut_C2 | ||
24.032 , # absPFNeuHadIsoWithEACut_C1 | ||
0.01512 , # absPFNeuHadIsoWithEACut_C2 | ||
0.00002259 , # absPFNeuHadIsoWithEACut_C3 | ||
2.876 , # absPFPhoIsoWithEACut_C1 | ||
0.004017 # absPFPhoIsoWithEACut_C2 | ||
) | ||
WP_Loose_EE = WorkingPoint_V2( | ||
idName , #idName | ||
0.0590 , # hOverECut | ||
0.0272 , # full5x5_SigmaIEtaIEtaCut | ||
# Isolation cuts are generally absIso < C1 + pt*C2, except for NeuHad is < C1 + pt*C2 + pt*pt*C3 | ||
2.089 , # absPFChaHadIsoWithEACut_C1 | ||
0.00 , # absPFChaHadIsoWithEACut_C2 | ||
19.722 , # absPFNeuHadIsoWithEACut_C1 | ||
0.0117 , # absPFNeuHadIsoWithEACut_C2 | ||
0.000023 , # absPFNeuHadIsoWithEACut_C3 | ||
4.162 , # absPFPhoIsoWithEACut_C1 | ||
0.0037 # absPFPhoIsoWithEACut_C2 | ||
) | ||
|
||
# Medium working point Barrel and Endcap | ||
idName = "cutBasedPhotonID-Fall17-94X-V2-medium" | ||
WP_Medium_EB = WorkingPoint_V2( | ||
idName , # idName | ||
0.02197 , # hOverECut | ||
0.01015 , # full5x5_SigmaIEtaIEtaCut | ||
# Isolation cuts are generally absIso < C1 + pt*C2, except for NeuHad is < C1 + pt*C2 + pt*pt*C3 | ||
1.141 , # absPFChaHadIsoWithEACut_C1 | ||
0.00 , # absPFChaHadIsoWithEACut_C2 | ||
1.189 , # absPFNeuHadIsoWithEACut_C1 | ||
0.01512 , # absPFNeuHadIsoWithEACut_C2 | ||
0.00002259 , # absPFNeuHadIsowithEACut_C3 | ||
2.08 , # absPFPhoIsoWithEACut_C1 | ||
0.004017 # absPFPhoIsoWithEACut_C2 | ||
) | ||
|
||
WP_Medium_EE = WorkingPoint_V2( | ||
idName , #idName | ||
0.0326 , # hOverECut | ||
0.0272 , # full5x5_SigmaIEtaIEtaCut | ||
# Isolation cuts are generally absIso < C1 + pt*C2, except for NeuHad is < C1 + pt*C2 + pt*pt*C3 | ||
1.051 , # absPFChaHadIsoWithEACut_C1 | ||
0.00 , # absPFChaHadIsoWithEACut_C2 | ||
2.718 , # absPFNeuHadIsoWithEACut_C1 | ||
0.0117 , # absPFNeuHadIsoWithEACut_C2 | ||
0.000023 , # absPFNeuHadIsowithEACut_C3 | ||
3.867 , # absPFPhoIsoWithEACut_C1 | ||
0.0037 # absPFPhoIsoWithEACut_C2 | ||
) | ||
|
||
# Tight working point Barrel and Endcap | ||
idName = "cutBasedPhotonID-Fall17-94X-V2-tight" | ||
WP_Tight_EB = WorkingPoint_V2( | ||
idName , # idName | ||
0.02148 , # hOverECut | ||
0.00996 , # full5x5_SigmaIEtaIEtaCut | ||
# Isolation cuts are generally absIso < C1 + pt*C2, except for NeuHad is < C1 + pt*C2 + pt*pt*C3 | ||
0.65 , # absPFChaHadIsoWithEACut_C1 | ||
0.00 , # absPFChaHadIsoWithEACut_C2 | ||
0.317 , # absPFNeuHadIsoWithEACut_C1 | ||
0.01512 , # absPFNeuHadIsoWithEACut_C2 | ||
0.00002259 , # absPFNeuHadIsowithEACut_C3 | ||
2.044 , # absPFPhoIsoWithEACut_C1 | ||
0.004017 # absPFPhoIsoWithEACut_C2 | ||
) | ||
|
||
WP_Tight_EE = WorkingPoint_V2( | ||
idName , #idName | ||
0.0321 , # hOverECut | ||
0.0271 , # full5x5_SigmaIEtaIEtaCut | ||
# Isolation cuts are generally absIso < C1 + pt*C2, except for NeuHad is < C1 + pt*C2 + pt*pt*C3 | ||
0.517 , # absPFChaHadIsoWithEACut_C1 | ||
0.00 , # absPFChaHadIsoWithEACut_C2 | ||
2.716 , # absPFNeuHadIsoWithEACut_C1 | ||
0.0117 , # absPFNeuHadIsoWithEACut_C2 | ||
0.000023 , # absPFNeuHadIsowithEACut_C3 | ||
3.032 , # absPFPhoIsoWithEACut_C1 | ||
0.0037 # absPFPhoIsoWithEACut_C2 | ||
) | ||
|
||
|
||
# Second, define where to find the precomputed isolations and what effective | ||
# areas to use for pile-up correction | ||
isoInputs = IsolationCutInputs( | ||
# chHadIsolationMapName | ||
'photonIDValueMapProducer:phoChargedIsolation' , | ||
# chHadIsolationEffAreas | ||
"RecoEgamma/PhotonIdentification/data/Fall17/effAreaPhotons_cone03_pfChargedHadrons_90percentBased_V2.txt", | ||
# neuHadIsolationMapName | ||
'photonIDValueMapProducer:phoNeutralHadronIsolation' , | ||
# neuHadIsolationEffAreas | ||
"RecoEgamma/PhotonIdentification/data/Fall17/effAreaPhotons_cone03_pfNeutralHadrons_90percentBased_V2.txt" , | ||
# phoIsolationMapName | ||
"photonIDValueMapProducer:phoPhotonIsolation" , | ||
# phoIsolationEffAreas | ||
"RecoEgamma/PhotonIdentification/data/Fall17/effAreaPhotons_cone03_pfPhotons_90percentBased_V2.txt" | ||
) | ||
|
||
# | ||
# Finally, set up VID configuration for all cuts | ||
# | ||
cutBasedPhotonID_Fall17_94X_V2_loose = configureVIDCutBasedPhoID_V5 ( WP_Loose_EB, WP_Loose_EE, isoInputs) | ||
cutBasedPhotonID_Fall17_94X_V2_medium = configureVIDCutBasedPhoID_V5 ( WP_Medium_EB, WP_Medium_EE, isoInputs) | ||
cutBasedPhotonID_Fall17_94X_V2_tight = configureVIDCutBasedPhoID_V5 ( WP_Tight_EB, WP_Tight_EE, isoInputs) | ||
|
||
## The MD5 sum numbers below reflect the exact set of cut variables | ||
# and values above. If anything changes, one has to | ||
# 1) comment out the lines below about the registry, | ||
# 2) run "calculateMD5 <this file name> <one of the VID config names just above> | ||
# 3) update the MD5 sum strings below and uncomment the lines again. | ||
# | ||
|
||
central_id_registry.register(cutBasedPhotonID_Fall17_94X_V2_loose.idName, | ||
'4578dfcceb0bfd1ba5ac28973c843fd0') | ||
central_id_registry.register(cutBasedPhotonID_Fall17_94X_V2_medium.idName, | ||
'28b186c301061395f394a81266c8d7de') | ||
central_id_registry.register(cutBasedPhotonID_Fall17_94X_V2_tight.idName, | ||
'6f4f0ed6a8bf2de8dcf0bc3349b0546d') | ||
|
||
cutBasedPhotonID_Fall17_94X_V2_loose.isPOGApproved = cms.untracked.bool(True) | ||
cutBasedPhotonID_Fall17_94X_V2_medium.isPOGApproved = cms.untracked.bool(True) | ||
cutBasedPhotonID_Fall17_94X_V2_tight.isPOGApproved = cms.untracked.bool(True) |
55 changes: 55 additions & 0 deletions
55
RecoEgamma/PhotonIdentification/python/Identification/mvaPhotonID_Fall17_94X_V2_cff.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
from RecoEgamma.PhotonIdentification.Identification.mvaPhotonID_tools import * | ||
# | ||
# In this file we define the locations of the MVA weights, cuts on the MVA values | ||
# for specific working points, and configure those cuts in VID | ||
# | ||
# | ||
# The following MVA is derived for Fall17 samples for photons. | ||
# See more documentation in these presentations: | ||
# https://indico.cern.ch/event/697079/contributions/2968123/attachments/1632966/2604131/PhotonID_EGM_13.04.2018.pdf | ||
# | ||
mvaTag = "RunIIFall17v2" | ||
mvaVariablesFile = "RecoEgamma/PhotonIdentification/data/PhotonMVAEstimatorRun2VariablesFall17V1p1.txt" | ||
mvaWeightFiles = [ | ||
path.join(weightFileBaseDir, "Fall17/EB_V2.weights.xml.gz"), | ||
path.join(weightFileBaseDir, "Fall17/EE_V2.weights.xml.gz"), | ||
] | ||
# Set up the VID working point parameters | ||
wpConfig = [ | ||
# The working point for this MVA that is expected to have about 90% signal | ||
# efficiency in each category for photons with pt>30 GeV (somewhat lower | ||
# for lower pt photons). | ||
{"idName" : "mvaPhoID-RunIIFall17-v2-wp90", | ||
"cuts" : { "EB" : -0.02, | ||
"EE" : -0.26 }}, | ||
# The working point for this MVA that is expected to have about 90% signal | ||
# efficiency in each category for photons with pt>30 GeV (somewhat lower | ||
# for lower pt photons). | ||
{"idName" : "mvaPhoID-RunIIFall17-v2-wp80", | ||
"cuts" : { "EB" : 0.42, | ||
"EE" : 0.14 }}, | ||
] | ||
# Create the PSet that will be fed to the MVA value map producer and the | ||
# VPset's for VID cuts | ||
configs = configureFullVIDMVAPhoID(mvaTag=mvaTag, | ||
variablesFile=mvaVariablesFile, | ||
weightFiles=mvaWeightFiles, | ||
wpConfig=wpConfig, | ||
# Category parameters | ||
nCategories = cms.int32(2), | ||
categoryCuts = category_cuts) | ||
mvaPhoID_RunIIFall17_v2_producer_config = configs["producer_config"] | ||
mvaPhoID_RunIIFall17_v2_wp90 = configs["VID_config"]["mvaPhoID-RunIIFall17-v2-wp90"] | ||
mvaPhoID_RunIIFall17_v2_wp80 = configs["VID_config"]["mvaPhoID-RunIIFall17-v2-wp80"] | ||
# The MD5 sum numbers below reflect the exact set of cut variables | ||
# and values above. If anything changes, one has to | ||
# 1) comment out the lines below about the registry, | ||
# 2) run "calculateIdMD5 <this file name> <one of the VID config names just above> | ||
# 3) update the MD5 sum strings below and uncomment the lines again. | ||
# | ||
central_id_registry.register( mvaPhoID_RunIIFall17_v2_wp90.idName, | ||
'5c06832759b1faf7dd6fc45ed1aef3a2') | ||
central_id_registry.register( mvaPhoID_RunIIFall17_v2_wp80.idName, | ||
'3013ddce7a3ad8b54827c29f5d92282e') | ||
mvaPhoID_RunIIFall17_v2_wp90.isPOGApproved = cms.bool(True) | ||
mvaPhoID_RunIIFall17_v2_wp80.isPOGApproved = cms.bool(True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that the import of
os.path
and the definition ofweightFileBaseDir
are missing hereThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same with
category_cuts
later in the same fileThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yes, that's absolutely right! And I noticed I messed up with this PR (I forgot #24131 was merged in 10_3_X), so I have to adapt the config files a bit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...actually we are talking about the backport #25313. Nothing is missing here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@peruzzim for what I can see, they are all included within mvaPhotonID_tools, and indeed the unit tests using this fragment looks to work properly