From ab99317e7d6c17f880cb5e5fe0d5c7ddec1e7c52 Mon Sep 17 00:00:00 2001
From: Teng Jian Khoo <teng.jian.khoo@cern.ch>
Date: Tue, 24 Jul 2018 12:21:17 +0200
Subject: [PATCH] Update configuration of EventDensityTool to just take input
 PseudoJet label

---
 .../python/EGammaCommon.py                    |  6 ++++--
 .../python/JetCommon.py                       | 11 +++-------
 .../python/EventDensityConfig.py              |  6 +++---
 .../Jet/JetRec/python/JetAlgorithm.py         |  2 +-
 .../IsolationAlgs/python/IsoAODFixGetter.py   |  3 ++-
 .../IsolationAlgs/python/IsoGetter.py         | 21 ++++++++++++-------
 .../python/TrigHLTJetRecConfig.py             |  2 +-
 7 files changed, 28 insertions(+), 23 deletions(-)

diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGammaCommon.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGammaCommon.py
index 31b8cb164db..2c5be1377e2 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGammaCommon.py
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGammaCommon.py
@@ -335,7 +335,8 @@ if  rec.doTruth():
     # Compute the truth-particle-level energy density in the central eta region
     from EventShapeTools.EventDensityConfig import configEventDensityTool, EventDensityAlg
     from JetRec.JetRecStandard import jtm
-    tc=configEventDensityTool("EDTruthCentralTool", jtm.truthget,
+    tc=configEventDensityTool("EDTruthCentralTool",
+                              inputlabel = jtm.truthget.Label,
                               0.5,
                               AbsRapidityMax      = 1.5,
                               OutputContainer     = "TruthIsoCentralEventShape",
@@ -344,7 +345,8 @@ 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",
+                              inputlabel = jtm.truthget.Label,
                               0.5,
                               AbsRapidityMin      = 1.5,
                               AbsRapidityMax      = 3.0,
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/python/JetCommon.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/python/JetCommon.py
index 5a71ea64e44..24236f96619 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/python/JetCommon.py
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/python/JetCommon.py
@@ -33,14 +33,9 @@ def defineEDAlg(R=0.4, inputtype="LCTopo"):
 
     from JetRec.JetRecStandard import jtm
 
-    # map a getter to the input argument
-    inputgetter = { "LCTopo" : jtm.lcget,
-                    "EMTopo" : jtm.emget,
-                    "EMPFlow": jtm.empflowget,
-                    "EMCPFlow": jtm.emcpflowget,
-                    }[inputtype]
-
-    t=configEventDensityTool("EDTool"+str(int(R*10))+inputtype, inputgetter, R)
+    t=configEventDensityTool("EDTool"+str(int(R*10))+inputtype,
+                             inputlabel = inputtype,
+                             radius = R)
     t.OutputLevel = 3
     ToolSvc += t
     return EventDensityAlg( "EventDensityAlg"+t.name(), EventDensityTool = t , OutputLevel=3)
diff --git a/Reconstruction/EventShapes/EventShapeTools/python/EventDensityConfig.py b/Reconstruction/EventShapes/EventShapeTools/python/EventDensityConfig.py
index 5c9acc1948a..a0a10af87f2 100644
--- a/Reconstruction/EventShapes/EventShapeTools/python/EventDensityConfig.py
+++ b/Reconstruction/EventShapes/EventShapeTools/python/EventDensityConfig.py
@@ -4,19 +4,19 @@ from EventShapeTools.EventShapeToolsConf import EventDensityTool, EventShapeCopi
 import logging
 edLogger = logging.getLogger( "EventDensityConfig" )   
 
-def configEventDensityTool( name, pjGetter, radius, **options ):
+def configEventDensityTool( name, inputlabel, radius, **options ):
     """ options can be used to pass any EventDensityTool properties 
     """
     # Set default and passed properties for the EventDensityTool
     toolProperties = dict(
         JetAlgorithm        = "Kt",
         JetRadius           = radius,
-        InputContainer      = pjGetter.OutputContainer,
+        InputContainer      = "PseudoJet"+inputlabel,
         AbsRapidityMin      = 0.0,
         AbsRapidityMax      = 2.0,
         AreaDefinition      = "Voronoi",
         VoronoiRfact        = 0.9,
-        OutputContainer     = "Kt"+str(int(10*radius))+pjGetter.Label + "EventShape",
+        OutputContainer     = "Kt"+str(int(10*radius))+inputlabel + "EventShape",
         UseFourMomArea      = True,
         )
     # Override properties with user-supplied options.
diff --git a/Reconstruction/Jet/JetRec/python/JetAlgorithm.py b/Reconstruction/Jet/JetRec/python/JetAlgorithm.py
index 40bebd7ba85..1c0092a0d33 100644
--- a/Reconstruction/Jet/JetRec/python/JetAlgorithm.py
+++ b/Reconstruction/Jet/JetRec/python/JetAlgorithm.py
@@ -76,7 +76,7 @@ def addJetRecoToAlgSequence(job =None, useTruth =None, eventShapeTools =None,
       else:
         jetlog.info( myname + "Adding event shape " + evskey )
         if not IsInInputFile("xAOD::EventShape",toolname):
-          jtm += configEventDensityTool(toolname, getter, 0.4)
+          jtm += configEventDensityTool(toolname, getter.label, 0.4)
           evstools += [jtm.tools[toolname]]
     else:
       jetlog.info( myname + "Invalid event shape key: " + evskey )
diff --git a/Reconstruction/RecoAlgs/IsolationAlgs/python/IsoAODFixGetter.py b/Reconstruction/RecoAlgs/IsolationAlgs/python/IsoAODFixGetter.py
index 2fbb1563e95..9baab1e9fad 100644
--- a/Reconstruction/RecoAlgs/IsolationAlgs/python/IsoAODFixGetter.py
+++ b/Reconstruction/RecoAlgs/IsolationAlgs/python/IsoAODFixGetter.py
@@ -30,7 +30,8 @@ def configureEDCorrection(tool):
     from JetRec.JetRecStandard import jtm
     topSequence = AlgSequence()
     if not hasattr(topSequence,'EDtpIsoVeryForwardAlg'):
-      tfcc = configEventDensityTool("EDtpIsoVeryForwardTool", jtm.emget,
+      tfcc = configEventDensityTool("EDtpIsoVeryForwardTool",
+                                    inputlabel = jtm.emget.Label,
                                     radius          = 0.5,
                                     AbsRapidityMin  = 2.5,
                                     AbsRapidityMax  = 4.5,
diff --git a/Reconstruction/RecoAlgs/IsolationAlgs/python/IsoGetter.py b/Reconstruction/RecoAlgs/IsolationAlgs/python/IsoGetter.py
index d6c145b0a16..a727ed3af8f 100644
--- a/Reconstruction/RecoAlgs/IsolationAlgs/python/IsoGetter.py
+++ b/Reconstruction/RecoAlgs/IsolationAlgs/python/IsoGetter.py
@@ -74,7 +74,8 @@ def configureEDCorrection(tool):
     from AthenaCommon.AppMgr import ToolSvc
     from EventShapeTools.EventDensityConfig import configEventDensityTool, EventDensityAthAlg
     if not hasattr(topSequence,'EDtpIsoCentralAlg'):
-      tccc = configEventDensityTool("EDtpIsoCentralTool", jtm.emget,
+      tccc = configEventDensityTool("EDtpIsoCentralTool",
+                                    inputlabel = jtm.emget.Label,
                                     radius          = 0.5,
                                     AbsRapidityMin  = 0.0,
                                     AbsRapidityMax  = 1.5,
@@ -85,7 +86,8 @@ def configureEDCorrection(tool):
       topSequence += EventDensityAthAlg("EDtpIsoCentralAlg", EventDensityTool = tccc)
 
     if not hasattr(topSequence,'EDtpIsoForwardAlg'):
-      tfcc = configEventDensityTool("EDtpIsoForwardTool", jtm.emget,
+      tfcc = configEventDensityTool("EDtpIsoForwardTool",
+                                    inputlabel = jtm.emget.Label,
                                     radius          = 0.5,
                                     AbsRapidityMin  = 1.5,
                                     AbsRapidityMax  = 3.0,
@@ -96,7 +98,8 @@ def configureEDCorrection(tool):
       topSequence += EventDensityAthAlg("EDtpIsoForwardAlg", EventDensityTool = tfcc)
 
     if not hasattr(topSequence,'EDtpIsoVeryForwardAlg'):
-      tvfcc = configEventDensityTool("EDtpIsoVeryForwardTool", jtm.emget,
+      tvfcc = configEventDensityTool("EDtpIsoVeryForwardTool",
+                                     inputlabel = jtm.emget.Label,
                                      radius          = 0.5,
                                      AbsRapidityMin  = 2.5,
                                      AbsRapidityMax  = 4.5,
@@ -108,7 +111,8 @@ def configureEDCorrection(tool):
 
     if doPFlow:
       if not hasattr(topSequence,'EDpfIsoCentralAlg'):
-        tcpf = configEventDensityTool("EDpfIsoCentralTool", jtm.empflowget,
+        tcpf = configEventDensityTool("EDpfIsoCentralTool",
+                                      inputlabel = jtm.empflowget.Label,
                                       radius          = 0.5,
                                       AbsRapidityMin  = 0.0,
                                       AbsRapidityMax  = 1.5,
@@ -119,7 +123,8 @@ def configureEDCorrection(tool):
         topSequence += EventDensityAthAlg("EDpfIsoCentralAlg", EventDensityTool = tcpf)
 
       if not hasattr(topSequence,'EDpfIsoForwardAlg'):
-        tfpf = configEventDensityTool("EDpfIsoForwardTool", jtm.empflowget,
+        tfpf = configEventDensityTool("EDpfIsoForwardTool",
+                                      inputlabel = jtm.empflowget.Label,
                                       radius          = 0.5,
                                       AbsRapidityMin  = 1.5,
                                       AbsRapidityMax  = 3.0,
@@ -131,7 +136,8 @@ def configureEDCorrection(tool):
 
       ## Try a neutral density
       if not hasattr(topSequence,'EDnpfIsoCentralAlg'):
-        tcnpf = configEventDensityTool("EDnpfIsoCentralTool", jtm.emnpflowget,
+        tcnpf = configEventDensityTool("EDnpfIsoCentralTool",
+                                       inputlabel = jtm.emnpflowget.Label,
                                        radius          = 0.5,
                                        AbsRapidityMin  = 0.0,
                                        AbsRapidityMax  = 1.5,
@@ -142,7 +148,8 @@ def configureEDCorrection(tool):
         topSequence += EventDensityAthAlg("EDnpfIsoCentralAlg", EventDensityTool = tcnpf)
 
       if not hasattr(topSequence,'EDnpfIsoForwardAlg'):
-        tfnpf = configEventDensityTool("EDnpfIsoForwardTool", jtm.emnpflowget,
+        tfnpf = configEventDensityTool("EDnpfIsoForwardTool",
+                                       inputlabel = jtm.emnpflowget.Label,
                                        radius          = 0.5,
                                        AbsRapidityMin  = 1.5,
                                        AbsRapidityMax  = 3.0,
diff --git a/Trigger/TrigAlgorithms/TrigHLTJetRec/python/TrigHLTJetRecConfig.py b/Trigger/TrigAlgorithms/TrigHLTJetRec/python/TrigHLTJetRecConfig.py
index 251ac4f19e4..c7c6a162316 100644
--- a/Trigger/TrigAlgorithms/TrigHLTJetRec/python/TrigHLTJetRecConfig.py
+++ b/Trigger/TrigAlgorithms/TrigHLTJetRec/python/TrigHLTJetRecConfig.py
@@ -74,7 +74,7 @@ def configHLTEventDensityTool(name,
     toolProperties = dict(
         JetAlgorithm        = JetAlgorithm,
         JetRadius           = radius,
-        JetInput            = pjGetter,
+        TrigPseudoJetGetter = pjGetter,
         AbsRapidityMin      = AbsRapidityMin,
         AbsRapidityMax      = AbsRapidityMax,
         AreaDefinition      = AreaDefinition,
-- 
GitLab