diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGammaCommon.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGammaCommon.py index 2004520c3426141c22d18b7547c261786c75f72a..71a06406aed07db9a12818940a8d4b5c45bc5799 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGammaCommon.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGammaCommon.py @@ -87,15 +87,24 @@ ToolSvc += ElectronLHSelectorLooseBL #==================================================================== # ELECTRON CHARGE SELECTION #==================================================================== +# +# Disabled as is missing in R22 +# +''' from ElectronPhotonSelectorTools.ElectronPhotonSelectorToolsConf import AsgElectronChargeIDSelectorTool ElectronChargeIDSelector = AsgElectronChargeIDSelectorTool("ElectronChargeIDSelectorLoose") ElectronChargeIDSelector.primaryVertexContainer = "PrimaryVertices" ElectronChargeIDSelector.TrainingFile = "ElectronPhotonSelectorTools/ChargeID/ECIDS_20180731rel21Summer2018.root" ToolSvc += ElectronChargeIDSelector +''' #==================================================================== # FWD ELECTRON LH SELECTORS #==================================================================== +# +# Disabled as is missing in R22 +# +''' from ElectronPhotonSelectorTools.ElectronPhotonSelectorToolsConf import AsgForwardElectronLikelihoodTool ForwardElectronLHSelectorLoose = AsgForwardElectronLikelihoodTool("ForwardElectronLHSelectorLoose", WorkingPoint="LooseLHForwardElectron") @@ -106,7 +115,7 @@ ToolSvc += ForwardElectronLHSelectorMedium ForwardElectronLHSelectorTight = AsgForwardElectronLikelihoodTool("ForwardElectronLHSelectorTight", WorkingPoint="TightLHForwardElectron") ToolSvc += ForwardElectronLHSelectorTight - +''' #==================================================================== # PHOTON SELECTION (loose and tight cut-based) @@ -222,14 +231,17 @@ ElectronPassLHTight = DerivationFramework__EGSelectionToolWrapper( name = "Elect ToolSvc += ElectronPassLHTight print(ElectronPassLHTight) +# +# Disabled as is missing in R22 +# +''' # decorate electrons with the output of ECIDS ---------------------------------------------------------------------- ElectronPassECIDS = DerivationFramework__EGElectronLikelihoodToolWrapper( name = "ElectronPassECIDS", EGammaElectronLikelihoodTool = ElectronChargeIDSelector, EGammaFudgeMCTool = "", CutType = "", StoreGateEntryName = "DFCommonElectronsECIDS", - - ContainerName = "Electrons", + ContainerName = "Electrons", StoreTResult = True) ToolSvc += ElectronPassECIDS print (ElectronPassECIDS) @@ -263,7 +275,7 @@ ForwardElectronPassLHTight = DerivationFramework__EGSelectionToolWrapper( name = ContainerName = "ForwardElectrons") ToolSvc += ForwardElectronPassLHTight print (ForwardElectronPassLHTight) - +''' # decorate photons with the output of IsEM loose # on MC, fudge the shower shapes before computing the ID (but the original shower shapes are not overridden) @@ -347,11 +359,14 @@ ElectronAmbiguity = DF_EGEAT(name = "ElectronAdditionnalAmbiguity" isMC = (globalflags.DataSource()!='data')) ToolSvc += ElectronAmbiguity +# +# Commented ForwardElectronPassLHLoose, ForwardElectronPassLHMedium, ForwardElectronPassLHTight, ElectronPassECIDS tools due to they are not available in R22 +# # list of all the decorators so far EGAugmentationTools = [DFCommonPhotonsDirection, ElectronPassLHVeryLoose, ElectronPassLHLoose, ElectronPassLHLooseBL, ElectronPassLHMedium, ElectronPassLHTight, - ForwardElectronPassLHLoose, ForwardElectronPassLHMedium, ForwardElectronPassLHTight, - ElectronPassECIDS, + #ForwardElectronPassLHLoose, ForwardElectronPassLHMedium, ForwardElectronPassLHTight, + #ElectronPassECIDS, PhotonPassIsEMLoose, PhotonPassIsEMTight, PhotonPassIsEMTightPtIncl, PhotonPassCleaning, @@ -406,7 +421,7 @@ if rec.doTruth(): # Compute the truth-particle-level energy density in the central eta region from EventShapeTools.EventDensityConfig import configEventDensityTool, EventDensityAthAlg from JetRec.JetRecStandard import jtm - tc=configEventDensityTool("EDTruthCentralTool", jtm.truthget, + tc=configEventDensityTool("EDTruthCentralTool", jtm.truthget.Label, 0.5, AbsRapidityMax = 1.5, OutputContainer = "TruthIsoCentralEventShape", @@ -415,7 +430,7 @@ if rec.doTruth(): ToolSvc += tc # Compute the truth-particle-level energy density in the forward eta region - tf=configEventDensityTool("EDTruthForwardTool", jtm.truthget, + tf=configEventDensityTool("EDTruthForwardTool", jtm.truthget.Label, 0.5, AbsRapidityMin = 1.5, AbsRapidityMax = 3.0, @@ -444,8 +459,11 @@ DerivationFrameworkJob += CfgMgr.DerivationFramework__CommonAugmentation("EGamma # ADD TOOLS #======================================= -import IsolationAlgs.IsoUpdatedTrackCones as isoCones -if not hasattr(DerivationFrameworkJob,"IsolationBuilderTight1000"): - DerivationFrameworkJob += isoCones.GetUpdatedIsoTrackCones() +# +# Disabling this tool due to it's missing in R22 +# +# import IsolationAlgs.IsoUpdatedTrackCones as isoCones +# if not hasattr(DerivationFrameworkJob,"IsolationBuilderTight1000"): +# DerivationFrameworkJob += isoCones.GetUpdatedIsoTrackCones() diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/Root/EGSelectorConfigurationMapping.h b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/Root/EGSelectorConfigurationMapping.h index 20ce54c4d637f48faa620c2d6a97ffac2b7217fe..a9008e4da71d4fcde40c97e755c679cec1324849 100644 --- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/Root/EGSelectorConfigurationMapping.h +++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/Root/EGSelectorConfigurationMapping.h @@ -31,9 +31,11 @@ namespace EgammaSelectors { {"TightLHElectron_Rel20p7","ElectronPhotonSelectorTools/offline/mc15_20160512/ElectronLikelihoodTightOfflineConfig2016_Smooth.conf"}, }; const std::map<std::string,std::string> PhotonCutPointToConfFile={ + // These should be the current best-supported ID menus. Typically picked up by analyzers using the "WorkingPoint" option. + // Note: keep this conf file up to date with the PhotonIsEMTightSelectorConfig function in python/PhotonIsEMTightSelectorCutDefs.py {"LoosePhoton","ElectronPhotonSelectorTools/offline/mc15_20150712/PhotonIsEMLooseSelectorCutDefs.conf"}, {"MediumPhoton","ElectronPhotonSelectorTools/offline/mc15_20160512/PhotonIsEMMediumSelectorCutDefs.conf"}, - {"TightPhoton","ElectronPhotonSelectorTools/offline/mc15_20150712/PhotonIsEMTightSelectorCutDefs.conf"}, + {"TightPhoton","ElectronPhotonSelectorTools/offline/20180825/PhotonIsEMTightSelectorCutDefs.conf"}, }; const std::map<std::string,std::string> ForwardElectronCutPointToConfFile={ {"LooseForwardElectron","ElectronPhotonSelectorTools/offline/mc15_20150812/ForwardElectronIsEMLooseSelectorCutDefs.conf"}, diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ConfiguredAsgPhotonIsEMSelectors.py b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ConfiguredAsgPhotonIsEMSelectors.py index aca1c0b090e28586813d932fd044b4329625cba4..d2e0b619d7d4b4e2ec1a04aea5c76a2400c14fd7 100644 --- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ConfiguredAsgPhotonIsEMSelectors.py +++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ConfiguredAsgPhotonIsEMSelectors.py @@ -21,7 +21,7 @@ from ElectronPhotonSelectorTools.PhotonIsEMSelectorMapping import ( def ConfiguredAsgPhotonIsEMSelector( - name, quality, menu=photonPIDmenu.menuDC14, **kw): + name, quality, menu=photonPIDmenu.menuCurrentCuts, **kw): """ Configure the AsgPhotonIsEMSelector with the quality cuts and allow for (re-)setting of all provided cuts. diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMLooseSelectorCutDefs.py b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMLooseSelectorCutDefs.py index e3a4c93cb878ee37a274c494c4f2c3bdb0a5250b..ba9d946a6c427d52afb0943ca146d7a8c76083b9 100755 --- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMLooseSelectorCutDefs.py +++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMLooseSelectorCutDefs.py @@ -10,7 +10,7 @@ from PATCore.HelperUtils import * # Define GeV GeV = 1000.0 -def PhotonIsEMLooseSelectorConfigDC14(theTool) : +def PhotonIsEMLooseSelectorConfig(theTool) : ''' These are the photon isEM definitions *DC14* Loose ''' diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMMediumSelectorCutDefs.py b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMMediumSelectorCutDefs.py index 40ee83253fc7bb1ceb252578993c26d54b9bdf91..1b519e4913aa085756f9f76e5284f6aa54340dd8 100755 --- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMMediumSelectorCutDefs.py +++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMMediumSelectorCutDefs.py @@ -8,7 +8,7 @@ from PATCore.HelperUtils import * -def PhotonIsEMMediumSelectorConfigDC14(theTool) : +def PhotonIsEMMediumSelectorConfig(theTool) : ''' These are the photon isEM definitions from *DC14* ''' diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMSelectorMapping.py b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMSelectorMapping.py index d0267f7c89cc477b2a8e4eaf9aa0f744aba4bc34..1f1cc29b2b5481bf7aea24eac4ab69635c2f9962 100644 --- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMSelectorMapping.py +++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMSelectorMapping.py @@ -17,12 +17,22 @@ except : from ROOT import egammaPID +# +# The "photonPIDmenu" used to store every menu in existence... now we will simply update the +# location of the conf file to the new path. +# Therefore, the CURRENT MENU is: menuCurrentCuts (corresponding to the PhotonIsEMMapCurrent dict) +# and the other menu that exists is the "menuPtInclJan2018" (the PhotonIsEMMapPtInclJan2018 dict) +# (because it will be used concurrently in the same tag of athena). +# Should remove menuPtInclJan2018 when it is no longer supported. +# class photonPIDmenu: - menu2011 = 0 - menu2012 = 1 - origMenu2012 = 2 # this is the original menu not meant for anyone to use - menuDC14 = 3 - menuTrigDC14 = 4 + # menu2011 = 0 + # menu2012 = 1 + # origMenu2012 = 2 # this is the original menu not meant for anyone to use + # menuDC14 = 3 + # menuTrigDC14 = 4 + menuCurrentCuts = 5 + menuPtInclJan2018 = 6 import ElectronPhotonSelectorTools.PhotonIsEMSelectorCutDefs as PhotonIsEMSelectorCutDefs import ElectronPhotonSelectorTools.PhotonIsEMLooseSelectorCutDefs as PhotonIsEMLooseSelectorCutDefs @@ -33,70 +43,28 @@ import ElectronPhotonSelectorTools.TrigPhotonIsEMCaloCutsOnlySelectorCutDefs as # format - key: (mask, function) -TrigPhotonIsEMMapDC14 = { - egammaPID.PhotonIDLooseEF: ( egammaPID.PhotonLooseEF, PhotonIsEMLooseSelectorCutDefs.PhotonIsEMLooseSelectorConfigDC14 ), - egammaPID.PhotonIDMediumEF: ( egammaPID.PhotonMediumEF, PhotonIsEMMediumSelectorCutDefs.PhotonIsEMMediumSelectorConfigDC14 ), - egammaPID.PhotonIDTight: ( egammaPID.PhotonTight, PhotonIsEMTightSelectorCutDefs.PhotonIsEMTightSelectorConfigDC14 ), - } - - -PhotonIsEMMapDC14 = { - egammaPID.PhotonIDLoose: ( egammaPID.PhotonLoose, PhotonIsEMLooseSelectorCutDefs.PhotonIsEMLooseSelectorConfigDC14 ), - egammaPID.PhotonIDMedium: ( egammaPID.PhotonMedium, PhotonIsEMMediumSelectorCutDefs.PhotonIsEMMediumSelectorConfigDC14 ), - egammaPID.PhotonIDTight: ( egammaPID.PhotonTight, PhotonIsEMTightSelectorCutDefs.PhotonIsEMTightSelectorConfigDC14 ), - - egammaPID.PhotonIDLooseAR: ( egammaPID.PhotonLooseAR, PhotonIsEMLooseSelectorCutDefs.PhotonIsEMLooseSelectorConfigDC14 ), - egammaPID.PhotonIDMediumAR: ( egammaPID.PhotonMediumAR, PhotonIsEMMediumSelectorCutDefs.PhotonIsEMMediumSelectorConfigDC14 ), - egammaPID.PhotonIDTightAR: ( egammaPID.PhotonTightAR, PhotonIsEMTightSelectorCutDefs.PhotonIsEMTightSelectorConfigDC14 ), - - egammaPID.NoIDCut: ( 0, PhotonIsEMLooseSelectorCutDefs.PhotonIsEMLooseSelectorConfigDC14 ) - } - -PhotonIsEMMap2011 = { - egammaPID.PhotonIDLoose: ( egammaPID.PhotonLoose, PhotonIsEMSelectorCutDefs.PhotonIsEMSelectorConfig2011 ), - egammaPID.PhotonIDTight: ( egammaPID.PhotonTight, PhotonIsEMSelectorCutDefs.PhotonIsEMSelectorConfig2011 ), +PhotonIsEMMapCurrent = { + egammaPID.PhotonIDLoose: ( egammaPID.PhotonLoose, PhotonIsEMLooseSelectorCutDefs.PhotonIsEMLooseSelectorConfig ), + egammaPID.PhotonIDMedium: ( egammaPID.PhotonMedium, PhotonIsEMMediumSelectorCutDefs.PhotonIsEMMediumSelectorConfig ), + egammaPID.PhotonIDTight: ( egammaPID.PhotonTight, PhotonIsEMTightSelectorCutDefs.PhotonIsEMTightSelectorConfig ), - egammaPID.PhotonIDLooseAR: ( egammaPID.PhotonLooseAR, PhotonIsEMSelectorCutDefs.PhotonIsEMSelectorConfig2011 ), - egammaPID.PhotonIDTightAR: ( egammaPID.PhotonTightAR, PhotonIsEMSelectorCutDefs.PhotonIsEMSelectorConfig2011 ), + egammaPID.PhotonIDLooseAR: ( egammaPID.PhotonLooseAR, PhotonIsEMLooseSelectorCutDefs.PhotonIsEMLooseSelectorConfig ), + egammaPID.PhotonIDMediumAR: ( egammaPID.PhotonMediumAR, PhotonIsEMMediumSelectorCutDefs.PhotonIsEMMediumSelectorConfig ), + egammaPID.PhotonIDTightAR: ( egammaPID.PhotonTightAR, PhotonIsEMTightSelectorCutDefs.PhotonIsEMTightSelectorConfig ), - egammaPID.NoIDCut: ( 0, PhotonIsEMSelectorCutDefs.PhotonIsEMSelectorConfig2012 ) + egammaPID.NoIDCut: ( 0, PhotonIsEMLooseSelectorCutDefs.PhotonIsEMLooseSelectorConfig ) } -PhotonIsEMMap2012 = { - egammaPID.PhotonIDLoose: ( egammaPID.PhotonLoose, PhotonIsEMSelectorCutDefs.PhotonIsEMSelectorConfig2012 ), - egammaPID.PhotonIDMedium: ( egammaPID.PhotonMedium, PhotonIsEMMediumSelectorCutDefs.PhotonIsEMMediumSelectorConfig2012 ), - egammaPID.PhotonIDTight: ( egammaPID.PhotonTight, PhotonIsEMSelectorCutDefs.PhotonIsEMSelectorConfig2012 ), - - egammaPID.PhotonIDLooseAR: ( egammaPID.PhotonLooseAR, PhotonIsEMSelectorCutDefs.PhotonIsEMSelectorConfig2012 ), - egammaPID.PhotonIDMediumAR: ( egammaPID.PhotonMediumAR, PhotonIsEMMediumSelectorCutDefs.PhotonIsEMMediumSelectorConfig2012 ), - egammaPID.PhotonIDTightAR: ( egammaPID.PhotonTightAR, PhotonIsEMSelectorCutDefs.PhotonIsEMSelectorConfig2012 ), - - egammaPID.NoIDCut: ( 0, PhotonIsEMSelectorCutDefs.PhotonIsEMSelectorConfig2012 ) - } - -PhotonIsEMMap2012OLD = { - egammaPID.PhotonIDLoose: ( egammaPID.PhotonLoose, PhotonIsEMSelectorCutDefs.PhotonIsEMSelectorConfig2012OLD ), - egammaPID.PhotonIDMedium: ( egammaPID.PhotonMedium, PhotonIsEMMediumSelectorCutDefs.PhotonIsEMMediumSelectorConfig2012 ), # unchanged - egammaPID.PhotonIDTight: ( egammaPID.PhotonTight, PhotonIsEMSelectorCutDefs.PhotonIsEMSelectorConfig2012OLD ), - - egammaPID.PhotonIDLooseAR: ( egammaPID.PhotonLooseAR, PhotonIsEMSelectorCutDefs.PhotonIsEMSelectorConfig2012OLD ), - egammaPID.PhotonIDMediumAR: ( egammaPID.PhotonMediumAR, PhotonIsEMMediumSelectorCutDefs.PhotonIsEMMediumSelectorConfig2012 ), - egammaPID.PhotonIDTightAR: ( egammaPID.PhotonTightAR, PhotonIsEMSelectorCutDefs.PhotonIsEMSelectorConfig2012OLD ), - - egammaPID.NoIDCut: ( 0, PhotonIsEMSelectorCutDefs.PhotonIsEMSelectorConfig2012OLD ) +PhotonIsEMMapPtInclJan2018 = { + egammaPID.PhotonIDTight: ( egammaPID.PhotonTight , PhotonIsEMTightSelectorCutDefs.PhotonIsEMTightSelectorConfigPtInclJan2018 ), } def PhotonIsEMMap(quality, menu): - if menu == photonPIDmenu.menu2011: - return PhotonIsEMMap2011[quality] - elif menu == photonPIDmenu.menu2012: - return PhotonIsEMMap2012[quality] - elif menu == photonPIDmenu.origMenu2012: - return PhotonIsEMMap2012OLD[quality] - elif menu == photonPIDmenu.menuDC14: - return PhotonIsEMMapDC14[quality] - elif menu == photonPIDmenu.menuTrigDC14: - return TrigPhotonIsEMMapDC14[quality] + # These are the "current menus" (non-legacy) + if menu == photonPIDmenu.menuCurrentCuts and quality in PhotonIsEMMapCurrent.keys() : + return PhotonIsEMMapCurrent[quality] + elif menu == photonPIDmenu.menuPtInclJan2018 and quality in PhotonIsEMMapPtInclJan2018.keys() : + return PhotonIsEMMapPtInclJan2018[quality] else: raise ValueError("Requested menu is undefined: %d" % menu) diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMTightSelectorCutDefs.py b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMTightSelectorCutDefs.py index 3aa5adf995f20ed5b444751e615a11ce454d5c60..c34fbe4f771b88671ccaf024b629902935a63c0b 100755 --- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMTightSelectorCutDefs.py +++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMTightSelectorCutDefs.py @@ -9,7 +9,12 @@ from PATCore.HelperUtils import * # Define GeV GeV = 1000.0 -def PhotonIsEMTightSelectorConfigDC14(theTool) : +# +# Current cut-based tight menu. When updating tight, simply change the config-file below +# (and please add a meaningful description of the conf file) +# Note: keep this conf file up to date with the PhotonCutPointToConfFile map in Root/EGSelectorConfigurationMapping.h +# +def PhotonIsEMTightSelectorConfig(theTool) : ''' These are the photon isEM definitions for Tight menu ''' @@ -17,7 +22,24 @@ def PhotonIsEMTightSelectorConfigDC14(theTool) : theTool = GetTool(theTool) # - # PHOTON tight cuts, with updated using *DC14* + # Pt-dependent tight cuts, derived in August 2018 ("v11") # - theTool.ConfigFile = "ElectronPhotonSelectorTools/offline/mc15_20150712/PhotonIsEMTightSelectorCutDefs.conf" + theTool.ConfigFile = "ElectronPhotonSelectorTools/offline/20180825/PhotonIsEMTightSelectorCutDefs.conf" + +# +# Pt-inclusive tight ID menu, derived in January 2018. +# Needs to be kept around until the new menu is fully supported, but can be removed +# when it becomes obsolete. +# +def PhotonIsEMTightSelectorConfigPtInclJan2018(theTool) : + ''' + These are the photon isEM definitions for Tight menu + ''' + + theTool = GetTool(theTool) + + # + # PHOTON tight cuts, now with January 2018 re-optimization + # + theTool.ConfigFile = "ElectronPhotonSelectorTools/offline/20180116/PhotonIsEMTightSelectorCutDefs.conf"