Skip to content
Snippets Groups Projects
Commit 2c30a7a7 authored by Jean-Baptiste De Vivie De Regie's avatar Jean-Baptiste De Vivie De Regie Committed by Jovan Mitrevski
Browse files

cleaning isoAODFixGetter

Former-commit-id: 0482c440d901f38d0b4b1cf2695ef3570be1c7c5
parent 6c716a77
No related branches found
No related tags found
No related merge requests found
......@@ -49,7 +49,6 @@ class AODFix_r210(AODFix_base):
self.egammaStrips_postSystemRec(topSequence)
pass
###JB
if "elIso" not in oldMetadataList:
self.elIso_postSystemRec(topSequence)
pass
......
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
from AthenaCommon.Constants import INFO
from AthenaCommon.AppMgr import ToolSvc
from AthenaCommon.Logging import logging
from RecExConfig.RecFlags import rec
from egammaRec.Factories import ToolFactory, AlgFactory, getPropertyValue
from egammaRec.Factories import ToolFactory, AlgFactory
#---------------------------------------
......@@ -14,68 +11,24 @@ from ParticlesInConeTools.ParticlesInConeToolsConf import xAOD__CaloClustersInCo
CaloClustersInConeTool = ToolFactory(xAOD__CaloClustersInConeTool,
CaloClusterLocation = "CaloCalTopoClusters")
# configuration for ED computation
def configureEDCorrection(tool):
"""Configure tools and algorithm for energy density correction
(only if doEnergyDensityCorrection = True)"""
# Return if doEnergyDensityCorrection is false
if not getPropertyValue(tool, 'doEnergyDensityCorrection'):
return
if 1:
print 'JB do not need that for my tests'
return
# Set OutputLevel to INFO or higher if tool has it too
OutputLevel = min(getPropertyValue(tool, 'OutputLevel'), INFO)
try:
from AthenaCommon.AppMgr import ToolSvc
from AthenaCommon.AlgSequence import AlgSequence
from EventShapeTools.EventDensityConfig import configEventDensityTool, EventDensityAlg
from JetRec.JetRecStandard import jtm
topSequence = AlgSequence()
if not hasattr(topSequence,'EDtpIsoVeryForwardAlg'):
tfcc = configEventDensityTool("EDtpIsoVeryForwardTool", jtm.emget,
radius = 0.5,
AbsRapidityMin = 2.5,
AbsRapidityMax = 4.5,
OutputContainer = "TopoClusterIsoVeryForwardEventShape",
OutputLevel = OutputLevel
)
ToolSvc += tfcc
topSequence += EventDensityAlg("EDtpIsoVeryForwardAlg", EventDensityTool = tfcc)
except Exception:
print '\nERROR: could not get handle to ED'
raise
# tool for the leakage correction (std calo iso)
from IsolationCorrections.IsolationCorrectionsConf import CP__IsolationCorrectionTool as ict
leakTool = ict(name = "LeakageCorrection",
#CorrFile = "IsolationCorrections/isolation_ptcorrections_rel20_2.root") # in principle the default
) #cannot locate it...
leakTool = ict(name = "LeakageCorrection")
ToolSvc += leakTool
# too to compute the calo iso
from CaloIdentifier import SUBCALO
from IsolationTool.IsolationToolConf import xAOD__CaloIsolationTool, xAOD__TrackIsolationTool
CaloIsolationTool = ToolFactory(xAOD__CaloIsolationTool,name = "CaloIsolationTool",
postInit = [configureEDCorrection],
CaloFillRectangularClusterTool = None,
ClustersInConeTool = CaloClustersInConeTool,
PFlowObjectsInConeTool = None,
#IsoLeakCorrectionTool = None,
IsoLeakCorrectionTool = leakTool,
#saveOnlyRequestedCorrections = True,
saveOnlyRequestedCorrections = False,
EMCaloNums = [],
HadCaloNums = [],
UseEMScale = True,
addCaloExtensionDecoration = False,
OutputLevel = 3)
TrackIsolationTool = ToolFactory(xAOD__TrackIsolationTool, name = 'TrackIsolationTool')
from AthenaCommon import CfgMgr
tit = CfgMgr.xAOD__TrackIsolationTool('TrackIsolationTool')
tit.TrackSelectionTool.maxZ0SinTheta = 3
tit.TrackSelectionTool.minPt = 1000
tit.TrackSelectionTool.CutLevel = "Loose"
addCaloExtensionDecoration = False)
import ROOT, cppyy
# Need to be sure base dict is loaded first.
......@@ -84,54 +37,19 @@ cppyy.loadDictionary('xAODPrimitivesDict')
isoPar = ROOT.xAOD.Iso
# The types to be computed
# a test
IsoTypesEl = [
[ isoPar.topoetcone20,
isoPar.topoetcone30,
isoPar.topoetcone40 ]
]
IsoTypesPh = [
[ isoPar.topoetcone20,
isoPar.topoetcone30,
isoPar.topoetcone40 ]
]
IsoTypesFe = [
[ isoPar.topoetcone20,
isoPar.topoetcone30,
isoPar.topoetcone40 ]
]
IsoTypesMu = [
[ isoPar.topoetcone20,
isoPar.topoetcone30,
isoPar.topoetcone40 ]
]
# And the corrections
IsoCorEg = [
[ isoPar.coreTrackPtr ]
]
IsoCorEl = [
[ isoPar.core57cells, isoPar.ptCorrection, isoPar.pileupCorrection ]
# For this fix, we recompute topoetconeXX for El, Ph, Fwd...
IsoTypesEG = [
[ isoPar.topoetcone20, isoPar.topoetcone30, isoPar.topoetcone40 ]
]
IsoCorPh = [
# ...but the corrections are different for El/Ph vs Fwd
IsoCorEG = [
[ isoPar.core57cells, isoPar.ptCorrection, isoPar.pileupCorrection ]
]
IsoCorFe = [
[ isoPar.coreCone, isoPar.pileupCorrection ]
]
IsoCorMu = [
[ isoPar.coreCone, isoPar.pileupCorrection ]
]
#from IsolationCorrections.IsolationCorrectionsConf import CP__IsolationCorrectionTool as ict
#leakTool = ict(name = "LeakageCorrection",
# #CorrFile = "IsolationCorrections/isolation_ptcorrections_rel20_2.root") # in principle the default
# ) #cannot locate it...
#ToolSvc += leakTool
]
from IsolationAlgs.IsolationAlgsConf import IsolationBuilder
isoAODFixBuilderElectron = AlgFactory(IsolationBuilder,
......@@ -141,21 +59,18 @@ isoAODFixBuilderElectron = AlgFactory(IsolationBuilder,
MuonCollectionContainerName = "",
FwdElectronCollectionContainerName = "",
CaloCellIsolationTool = None,
#CaloTopoIsolationTool = None,
CaloTopoIsolationTool = CaloIsolationTool,
PFlowIsolationTool = None,
TrackIsolationTool = None,
FeIsoTypes = [[]] ,
FeCorTypes = IsoCorFe,
EgIsoTypes = IsoTypesEl,
EgCorTypes = IsoCorEl,
MuIsoTypes = [[]] ,
MuCorTypes = IsoCorMu,
FeCorTypes = [[]],
EgIsoTypes = IsoTypesEG,
EgCorTypes = IsoCorEG,
MuIsoTypes = [[]],
MuCorTypes = [[]],
IsAODFix = True,
#LeakageTool = leakTool,
LeakageTool = None,
IsolateEl = True,
OutputLevel = 3)
IsolateEl = True)
isoAODFixBuilderPhoton = AlgFactory(IsolationBuilder,
name = "IsolationBuilderPhoton",
......@@ -164,45 +79,18 @@ isoAODFixBuilderPhoton = AlgFactory(IsolationBuilder,
MuonCollectionContainerName = "",
FwdElectronCollectionContainerName = "",
CaloCellIsolationTool = None,
#CaloTopoIsolationTool = None,
CaloTopoIsolationTool = CaloIsolationTool,
PFlowIsolationTool = None,
#TrackIsolationTool = TrackIsolationTool,
TrackIsolationTool = None,
FeIsoTypes = [[]] ,
FeCorTypes = IsoCorFe,
EgIsoTypes = IsoTypesPh,
EgCorTypes = IsoCorPh,
MuIsoTypes = [[]] ,
MuCorTypes = IsoCorMu,
FeCorTypes = [[]],
EgIsoTypes = IsoTypesEG,
EgCorTypes = IsoCorEG,
MuIsoTypes = [[]],
MuCorTypes = [[]],
IsAODFix = True,
LeakageTool = leakTool,
IsolateEl = False,
OutputLevel = 3)
isoAODFixBuilderMuon = AlgFactory(IsolationBuilder,
name = "IsolationBuilderMuon",
ElectronCollectionContainerName = "",
PhotonCollectionContainerName = "",
MuonCollectionContainerName = "Muons",
FwdElectronCollectionContainerName = "",
CaloCellIsolationTool = None,
#CaloTopoIsolationTool = CaloIsolationTool,
CaloTopoIsolationTool = None,
PFlowIsolationTool = None,
TrackIsolationTool = None,
FeIsoTypes = [[]] ,
FeCorTypes = IsoCorFe,
EgIsoTypes = [[]],
EgCorTypes = IsoCorEg,
MuIsoTypes = IsoTypesMu,
MuCorTypes = IsoCorMu,
CustomConfigurationNameMu = 'Core0p05',
IsAODFix = True,
LeakageTool = None,
IsolateEl = False,
OutputLevel = 3)
IsolateEl = False)
isoAODFixBuilderFwdElectron = AlgFactory(IsolationBuilder,
name = "IsolationBuilderForwardElectron",
......@@ -215,17 +103,15 @@ isoAODFixBuilderFwdElectron = AlgFactory(IsolationBuilder,
#CaloTopoIsolationTool = None,
PFlowIsolationTool = None,
TrackIsolationTool = None,
FeIsoTypes = IsoTypesFe,
FeIsoTypes = IsoTypesEG,
FeCorTypes = IsoCorFe,
EgIsoTypes = [[]],
EgCorTypes = IsoCorEg,
EgCorTypes = [[]],
MuIsoTypes = [[]],
MuCorTypes = IsoCorMu,
MuCorTypes = [[]],
IsAODFix = True,
LeakageTool = None,
IsolateEl = False,
OutputLevel = 3)
IsolateEl = False)
from RecExConfig.Configured import Configured
class isoAODFixGetter ( Configured ) :
......@@ -245,8 +131,6 @@ class isoAODFixGetter ( Configured ) :
self._isoBuilderHandle = isoAODFixBuilderPhoton()
elif self.type == "ForwardElectrons":
self._isoBuilderHandle = isoAODFixBuilderFwdElectron()
elif self.type == "Muons":
self._isoBuilderHandle = isoAODFixBuilderMuon()
else:
mlog.error("wrong object for IsolationBuilder")
except Exception:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment