From 5ca215acb619e44d9da1c9d91cd39ee6f2ff7f5c Mon Sep 17 00:00:00 2001
From: scott snyder <snyder@bnl.gov>
Date: Tue, 3 Mar 2020 17:01:56 +0100
Subject: [PATCH] DerivationFrameworkMuons: Python 3 fixes

Updates for python 3 compatibility.
---
 .../python/JPsiVertexFitSetup.py              |  7 ++--
 .../python/MuonsCommon.py                     | 14 ++++---
 .../python/StreamConfig.py                    | 27 ++++++++-----
 .../python/TrackIsolationDecorator.py         |  6 ++-
 .../scripts/create_period_container.py        | 32 ++++++++--------
 .../scripts/update_CPContent.py               | 15 +++++---
 .../DerivationFrameworkMuons/share/MUON0.py   |  2 +-
 .../DerivationFrameworkMuons/share/MUON1.py   | 19 +++++-----
 .../DerivationFrameworkMuons/share/MUON2.py   | 38 +++++++++----------
 .../DerivationFrameworkMuons/share/MUON3.py   |  6 +--
 .../DerivationFrameworkMuons/share/MUON4.py   |  6 +--
 .../DerivationFrameworkMuons/share/MUON5.py   |  2 +-
 12 files changed, 96 insertions(+), 78 deletions(-)

diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/JPsiVertexFitSetup.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/JPsiVertexFitSetup.py
index f8ac6a58598..67f079ea85c 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/JPsiVertexFitSetup.py
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/JPsiVertexFitSetup.py
@@ -1,3 +1,4 @@
+from __future__ import print_function
 
 def AddJPsiVertexingAlgs(prefix='',addAlgo=True):
 
@@ -12,7 +13,7 @@ def AddJPsiVertexingAlgs(prefix='',addAlgo=True):
   from TrkVertexFitterUtils.TrkVertexFitterUtilsConf import Trk__KalmanVertexUpdator
   VertexUpdater = Trk__KalmanVertexUpdator(name             = "MuonTP_KalmanVertexUpdator")
   ToolSvc += VertexUpdater
-  print      VertexUpdater
+  print (     VertexUpdater)
 
 
 
@@ -69,7 +70,7 @@ def AddJPsiVertexingAlgs(prefix='',addAlgo=True):
   OutputLevel           = WARNING )
 
   ToolSvc += MuonTP_Reco_mumu
-  print MuonTP_Reco_mumu
+  print (MuonTP_Reco_mumu)
 
 
   from DerivationFrameworkBPhys.DerivationFrameworkBPhysConf import DerivationFramework__Select_onia2mumu
@@ -87,7 +88,7 @@ def AddJPsiVertexingAlgs(prefix='',addAlgo=True):
   OutputLevel           = WARNING)
 
   ToolSvc += MuonTP_Select_Jpsi2mumu
-  print MuonTP_Select_Jpsi2mumu
+  print (MuonTP_Select_Jpsi2mumu)
 
   if addAlgo:
       from DerivationFrameworkMuons.DerivationFrameworkMuonsConf import MuonTPJpsiVertexFittingAlg
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/MuonsCommon.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/MuonsCommon.py
index 0c4c3e39394..fd1b3f07c99 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/MuonsCommon.py
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/MuonsCommon.py
@@ -1,10 +1,12 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 #********************************************************************
 # MuonsCommon.py 
 # Schedules all tools needed for muon object selection and writes
 # results into SG. These may then be accessed along the train   
 #********************************************************************
+from __future__ import print_function
+
 from DerivationFrameworkCore.DerivationFrameworkMaster import *
 from DerivationFrameworkMuons import DFCommonMuonsConfig
 DFCommonMuonsTrtCutOff = DFCommonMuonsConfig.TrtCutOff
@@ -29,7 +31,7 @@ DFCommonMuonsSelector.TurnOffMomCorr = True
 
 if DFCommonMuonsTrtCutOff != None: DFCommonMuonsSelector.TrtCutOff = DFCommonMuonsTrtCutOff
 ToolSvc += DFCommonMuonsSelector
-print DFCommonMuonsSelector
+print (DFCommonMuonsSelector)
 
 DFCommonMuonToolWrapper = DerivationFramework__AsgSelectionToolWrapper( name = "DFCommonMuonToolWrapper",
                                                                         AsgSelectionTool = DFCommonMuonsSelector,
@@ -37,7 +39,7 @@ DFCommonMuonToolWrapper = DerivationFramework__AsgSelectionToolWrapper( name = "
                                                                         StoreGateEntryName = "DFCommonGoodMuon",
                                                                         ContainerName = "Muons")
 ToolSvc += DFCommonMuonToolWrapper
-print DFCommonMuonToolWrapper
+print (DFCommonMuonToolWrapper)
 DFCommonMuonToolWrapperTools.append(DFCommonMuonToolWrapper)
 
 ### Preselection
@@ -49,7 +51,7 @@ DFCommonMuonsSelectorPreselection.TurnOffMomCorr = True
 
 if DFCommonMuonsTrtCutOff != None: DFCommonMuonsSelectorPreselection.TrtCutOff = DFCommonMuonsTrtCutOff
 ToolSvc += DFCommonMuonsSelectorPreselection
-print DFCommonMuonsSelectorPreselection
+print (DFCommonMuonsSelectorPreselection)
 
 DFCommonMuonToolWrapperPreselection = DerivationFramework__AsgSelectionToolWrapper( name = "DFCommonMuonToolWrapperPreselection",
                                                                         AsgSelectionTool = DFCommonMuonsSelectorPreselection,
@@ -57,14 +59,14 @@ DFCommonMuonToolWrapperPreselection = DerivationFramework__AsgSelectionToolWrapp
                                                                         StoreGateEntryName = "DFCommonMuonsPreselection",
                                                                         ContainerName = "Muons")
 ToolSvc += DFCommonMuonToolWrapperPreselection
-print DFCommonMuonToolWrapperPreselection
+print (DFCommonMuonToolWrapperPreselection)
 DFCommonMuonToolWrapperTools.append(DFCommonMuonToolWrapperPreselection)
 
 ### Decoration of the muon objects with the ID track covariances
 #from DerivationFrameworkMuons.DerivationFrameworkMuonsConf import DerivationFramework__MuonIDCovMatrixDecorator
 #DFCommonMuonIDCovMatrixDecorator = DerivationFramework__MuonIDCovMatrixDecorator( name = "DFCommonMuonIDCovMatrixDecorator")
 #ToolSvc += DFCommonMuonIDCovMatrixDecorator
-#print DFCommonMuonIDCovMatrixDecorator
+#print (DFCommonMuonIDCovMatrixDecorator)
 #DFCommonMuonToolWrapperTools.append(DFCommonMuonIDCovMatrixDecorator)
 
 #############
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/StreamConfig.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/StreamConfig.py
index e0aa3e5e86e..988992f6844 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/StreamConfig.py
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/StreamConfig.py
@@ -1,6 +1,9 @@
 #!/usr/bin/env python
 
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+
+from __future__ import print_function
+
 from DerivationFrameworkCore.DerivationFrameworkMaster import DerivationFrameworkIsMonteCarlo
 
 def useSmartSlimmingIfSupported(itemPairs, smAllVarlist, addItemList, ContainerNamesAndTypes):
@@ -8,7 +11,7 @@ def useSmartSlimmingIfSupported(itemPairs, smAllVarlist, addItemList, ContainerN
         cname = i.split('#')[-1]
         if cname in ContainerNamesAndTypes and itemPairs[i].split('#')[-1].rstrip('.') in ContainerNamesAndTypes:
             smAllVarlist.append(cname)
-            print cname, 'added to smartlimming'
+            print (cname, 'added to smartlimming')
         else:
             addItemList.append(i)
             addItemList.append(itemPairs[i])
@@ -114,14 +117,18 @@ class MuonsDxAODStreamConfigurer:
             stream.AddItem(item)
 
     def show(self):
-        print 'Add Items:'
-        for i in self.Items: print i,'=',self.Items[i]
-        print 'Smart slimming:'
-        for i in self.smSlContainer and (not i in self.allVarContainer): print i,'=',self.smSlContainer[i]
-        print 'Keep all varaibles:'
-        for i in self.allVarContainer: print i,'=',self.allVarContainer[i]
-        print 'Keep trigger content:'
-        for i in self.UseTriggerContent: print i,'=',self.UseTriggerContent[i]
+        print ('Add Items:')
+        for i in self.Items:
+            print (i,'=',self.Items[i])
+        print ('Smart slimming:')
+        for i in self.smSlContainer and (not i in self.allVarContainer):
+            print (i,'=',self.smSlContainer[i])
+        print ('Keep all variables:')
+        for i in self.allVarContainer:
+            print (i,'=',self.allVarContainer[i])
+        print ('Keep trigger content:')
+        for i in self.UseTriggerContent:
+            print (i,'=',self.UseTriggerContent[i])
 
 
 if __name__ == '__main__':
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/TrackIsolationDecorator.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/TrackIsolationDecorator.py
index 77fa4230cbf..d2ecc205180 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/TrackIsolationDecorator.py
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/TrackIsolationDecorator.py
@@ -1,7 +1,9 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Add a track isolation updater tool
 
+from __future__ import print_function
+
 from AthenaCommon.AppMgr import ToolSvc
 
 from IsolationTool.IsolationToolConf import xAOD__TrackIsolationTool
@@ -36,7 +38,7 @@ CaloIsoTool.addCaloExtensionDecoration = False
 # if hasattr(CaloIsoTool, 'addCaloExtensionDecoration'): ### somehow does not work
 #     CaloIsoTool.addCaloExtensionDecoration = False
 # CaloIsoTool.OutputLevel = 2
-print CaloIsoTool
+print (CaloIsoTool)
 ToolSvc += CaloIsoTool
 
 
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/scripts/create_period_container.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/scripts/create_period_container.py
index 8d3a8a7fd2d..3f75bda8523 100755
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/scripts/create_period_container.py
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/scripts/create_period_container.py
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 ######################
 ##
 ## Contact: Dongliang Zhang <dongliang.zhang@cern.ch>
@@ -10,6 +10,8 @@
 ##   lsetup pyami
 ######################
 
+from __future__ import print_function
+
 import sys
 import pyAMI.client
 import pyAMI.atlas.api as AtlasAPI
@@ -46,7 +48,7 @@ def makeContainer(c1):
     runs = set([a['run_number'] for a in x0])
 
     if len(runs)==0:
-        print 'no run in period'+c1.period+' is listed in GRL:', c1.grl
+        print ('no run in period'+c1.period+' is listed in GRL:', c1.grl)
         return
 
     ### get AOD datasets
@@ -55,7 +57,7 @@ def makeContainer(c1):
     ### get dataset info
     dic1={}
     for a in x:
-        print a['run_number'], a['ldn']
+        print (a['run_number'], a['ldn'])
         try:
             dic1[a['ldn'].split('_')[-1]].append((a['run_number'],a['ldn']))
         except KeyError:
@@ -64,10 +66,10 @@ def makeContainer(c1):
     ### get the tags, sorted by popularity
     allTags = sorted(dic1.keys(), key=lambda k: len(dic1[k]),reverse=True)
     for tag in allTags:
-        print tag,':',
+        print (tag,':', end='')
         for xx in dic1[tag]:
-            print xx[0],
-        print
+            print (xx[0], end='')
+        print()
 
     ### use the most popular tags if not spicified
     t_acceptTags = c1.acceptTags if c1.acceptTags else allTags
@@ -86,19 +88,19 @@ def makeContainer(c1):
 
     ### Warning when the given tag does not select any dataset
     if len(ds)==0:
-        print 'No dataset in period',c1.period+', exiting...'
+        print ('No dataset in period',c1.period+', exiting...')
         return
 
     #### find any missing runs
     for d in ds:
-        print d[0],d[1]
+        print (d[0],d[1])
         runs.remove(d[0])
-    print runs
+    print (runs)
 
     #### Warn when there are any missing runs
     if len(runs) !=0:
-        print '!'*10
-        print 'MISSING ', ' '.join(runs)
+        print ('!'*10)
+        print ('MISSING ', ' '.join(runs))
 
     ### prepare commands
     dlist=','.join([d[1] for d in ds])
@@ -106,7 +108,7 @@ def makeContainer(c1):
     comments = superTag+','+c1.derivation
 
     cmd='ami cmd COMAPopulateSuperProductionDataset -rucioRegistration="yes" -creationComment="'+comments+'" -selectionType="run_config" -superTag="'+superTag+'" -containedDatasets="'+dlist+'" -separator="," '
-    print 'command:',cmd
+    print ('command:',cmd)
 
     ### write out script if asked
     if c1.outScript:
@@ -139,7 +141,7 @@ def doFirstTry():
     c1.grl = grl15
 
     pds =[p['period'] for p in periods if p['status']=='frozen']
-#     print pds
+#     print (pds)
 #     sys.exit(0)
 
     for p in pds:
@@ -161,7 +163,7 @@ def doData15():
     c1.grl = grl15
 
     pds =[p['period'] for p in periods if p['status']=='frozen']
-#     print pds
+#     print (pds)
 #     sys.exit(0)
 
     for p in pds:
@@ -184,7 +186,7 @@ def do2016LaterPeriods():
     c1.grl = grl16
 
 #     pds =[p['period'] for p in periods if p['status']=='frozen']
-#     print pds
+#     print (pds)
 #     sys.exit(0)
     pds = ['J', 'K', 'L']
 
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/scripts/update_CPContent.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/scripts/update_CPContent.py
index dc98885e138..0a81ae99464 100755
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/scripts/update_CPContent.py
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/scripts/update_CPContent.py
@@ -1,12 +1,15 @@
 #!/usr/bin/env python
 
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+
+from __future__ import print_function
+
 import sys 
 import os
 sys.path.append(os.path.abspath("../python"))
 import MuonsCPContent as mcc
 
-print mcc.MuonsCPContent
+print (mcc.MuonsCPContent)
 
 def makeContent(l):
     ct = 'MuonsCPContent = [\n'
@@ -29,10 +32,10 @@ def mergeList(l1, l2, excludeList=[]):
             found = True
             for m in x[1:]:
                 if m in y[1:]: continue
-                print m, 'is not found for', tag
+                print (m, 'is not found for', tag)
                 l2[ji] += '.'+m
         if (not found) and (not (tag in excludeList)):
-            print tag, 'is not found'
+            print (tag, 'is not found')
             l1a.append(i)
     return l2+l1a
 
@@ -41,8 +44,8 @@ list1 = []
 with open(ifile) as if1:
     for line in if1.readlines():
         list1.append(line.rstrip())
-print makeContent(list1)
-print makeContent(mcc.MuonsCPContent)
+print (makeContent(list1))
+print (makeContent(mcc.MuonsCPContent))
 
 kk = mergeList(list1, mcc.MuonsCPContent, ['EventInfo', 'EventInfoAux']) 
 nc = makeContent(kk)
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/share/MUON0.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/share/MUON0.py
index 872429414cf..17990106e31 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/share/MUON0.py
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/share/MUON0.py
@@ -28,7 +28,7 @@ triggerList = ['HLT_.*mu.*', 'L1_.*MU.*','HLT_noalg_L1.*MU.*']
 from DerivationFrameworkCore.ThinningHelper import ThinningHelper
 MUON0ThinningHelper = ThinningHelper( "MUON0ThinningHelper" )
 MUON0ThinningHelper.TriggerChains = '|'.join(triggerList1)
-print MUON0ThinningHelper.TriggerChains
+printfunc (MUON0ThinningHelper.TriggerChains)
 MUON0ThinningHelper.AppendToStream( MUON0Stream )
 thinningSvc = getattr( svcMgr, "MUON0ThinningSvc" )
 thinningHelperTool = getattr( ToolSvc, "MUON0ThinningHelperSlim" )
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/share/MUON1.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/share/MUON1.py
index 3eb4939005b..19eb7911885 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/share/MUON1.py
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/share/MUON1.py
@@ -37,7 +37,7 @@ triggerList1 = ['HLT_.*mu\d+.*']
 from DerivationFrameworkCore.ThinningHelper import ThinningHelper
 MUON1ThinningHelper = ThinningHelper( "MUON1ThinningHelper" )
 MUON1ThinningHelper.TriggerChains = '|'.join(triggerList1)
-print MUON1ThinningHelper.TriggerChains
+printfunc (MUON1ThinningHelper.TriggerChains)
 MUON1ThinningHelper.AppendToStream( MUON1Stream )
 
 #====================================================================
@@ -76,7 +76,7 @@ ToolSvc += MUON1AugmentTool1a
 MUON1AugmentTools.append(MUON1AugmentTool1a)
 skimmingORs.append(brPrefix1a+'DIMU_pass>0')
 thinningORs.append(brPrefix1a+'DIMU_trkStatus>0')
-print MUON1AugmentTool1a
+printfunc (MUON1AugmentTool1a)
 
 
 ### Jpsi for tag-probe
@@ -111,7 +111,7 @@ ToolSvc += MUON1AugmentTool1b
 MUON1AugmentTools.append(MUON1AugmentTool1b)
 skimmingORs.append(brPrefix1b+'DIMU_pass>0')
 thinningORs.append(brPrefix1b+'DIMU_trkStatus>0')
-print MUON1AugmentTool1b
+printfunc (MUON1AugmentTool1b)
 
 
 ### Jpsi for calibration
@@ -146,7 +146,7 @@ ToolSvc += MUON1AugmentTool1c
 MUON1AugmentTools.append(MUON1AugmentTool1c)
 skimmingORs.append(brPrefix1c+'DIMU_pass>0')
 thinningORs.append(brPrefix1c+'DIMU_trkStatus>0')
-print MUON1AugmentTool1c
+printfunc (MUON1AugmentTool1c)
 
 ### Upsilon tagging
 brPrefix1d = 'MUON1d'
@@ -179,7 +179,7 @@ ToolSvc += MUON1AugmentTool1d
 MUON1AugmentTools.append(MUON1AugmentTool1d)
 skimmingORs.append(brPrefix1d+'DIMU_pass>0')
 thinningORs.append(brPrefix1d+'DIMU_trkStatus>0')
-print MUON1AugmentTool1d
+printfunc (MUON1AugmentTool1d)
 
 ### isolation decorations
 from DerivationFrameworkMuons.TrackIsolationDecorator import MUON1IDTrackDecorator as MUON1AugmentTool2a
@@ -189,12 +189,12 @@ MUON1AugmentTool2a.SelectionFlagValue = 0
 
 ToolSvc += MUON1AugmentTool2a
 MUON1AugmentTools.append(MUON1AugmentTool2a)
-print MUON1AugmentTool2a
+printfunc (MUON1AugmentTool2a)
 
 from DerivationFrameworkMuons.TrackIsolationDecorator import MUON1MSTrackDecorator as MUON1AugmentTool3
 ToolSvc += MUON1AugmentTool3
 MUON1AugmentTools.append(MUON1AugmentTool3)
-print MUON1AugmentTool3
+printfunc (MUON1AugmentTool3)
 
 #====================================================================
 # SKIMMING
@@ -243,7 +243,7 @@ MUON1ThinningTool4 = DerivationFramework__CaloClusterThinning(name
                                                               TopoClCollectionSGKey   = "CaloCalTopoClusters",
                                                               ConeSize                = 0.5)
 ToolSvc += MUON1ThinningTool4
-print MUON1ThinningTool4
+printfunc (MUON1ThinningTool4)
 MUON1ThinningTools.append(MUON1ThinningTool4)
 
 ### also for forward tracks
@@ -278,7 +278,8 @@ if not hasattr(DerivationFrameworkJob,"MUONSequence"):
 
 from DerivationFrameworkMuons import  JPsiVertexFitSetup
 MUON1AugmentTools += JPsiVertexFitSetup.AddJPsiVertexingAlgs('MUON1',False)
-for t in MUON1AugmentTools: print t
+for t in MUON1AugmentTools:
+  printfunc (t)
 
 from DerivationFrameworkBPhys.DerivationFrameworkBPhysConf import DerivationFramework__Thin_vtxTrk
 MUON1Thin_vtxTrk = DerivationFramework__Thin_vtxTrk(
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/share/MUON2.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/share/MUON2.py
index 14aef7826a6..0e725004a56 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/share/MUON2.py
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/share/MUON2.py
@@ -12,7 +12,7 @@ isSimulation = False
 if globalflags.DataSource()=='geant4':
     isSimulation = True
 
-print isSimulation
+printfunc (isSimulation)
 
 #====================================================================
 # SET UP STREAM   
@@ -76,7 +76,7 @@ MUON2JpsiFinder = Analysis__JpsiFinder(name                         = "MUON2Jpsi
                                         VertexPointEstimator        = MUON2_VertexTools.VtxPointEstimator,
                                         useMCPCuts                  = False)
 ToolSvc += MUON2JpsiFinder
-print      MUON2JpsiFinder
+printfunc (     MUON2JpsiFinder)
 
 #--------------------------------------------------------------------
 ## 3/ setup the vertex reconstruction "call" tool(s). They are part of the derivation framework.
@@ -92,7 +92,7 @@ MUON2JpsiSelectAndWrite = DerivationFramework__Reco_mumu(name                 =
                                                        RefPVContainerName     = "SHOULDNOTBEUSED",
                                                        DoVertexType           =1)
 ToolSvc += MUON2JpsiSelectAndWrite
-print MUON2JpsiSelectAndWrite
+printfunc (MUON2JpsiSelectAndWrite)
 
 
 from DerivationFrameworkBPhys.DerivationFrameworkBPhysConf import DerivationFramework__Select_onia2mumu
@@ -110,7 +110,7 @@ MUON2_Select_Jpsi2mumu = DerivationFramework__Select_onia2mumu(
 
   
 ToolSvc += MUON2_Select_Jpsi2mumu
-print      MUON2_Select_Jpsi2mumu
+printfunc (     MUON2_Select_Jpsi2mumu)
 
 
 
@@ -123,7 +123,7 @@ BsKKVertexFit = Trk__TrkVKalVrtFitter(
                                          FirstMeasuredPoint  = True,
                                          MakeExtendedVertex  = True)
 ToolSvc += BsKKVertexFit
-print      BsKKVertexFit
+printfunc (     BsKKVertexFit)
 
 from TrkVKalVrtFitter.TrkVKalVrtFitterConf import Trk__TrkVKalVrtFitter
 BplKplVertexFit = Trk__TrkVKalVrtFitter(
@@ -132,7 +132,7 @@ BplKplVertexFit = Trk__TrkVKalVrtFitter(
                                          FirstMeasuredPoint  = True,
                                          MakeExtendedVertex  = True)
 ToolSvc += BplKplVertexFit
-print      BplKplVertexFit
+printfunc (     BplKplVertexFit)
 
 
 ## 5/ setup the Jpsi+2 track finder
@@ -161,7 +161,7 @@ TrackSelectorTool		    = MUON2_VertexTools.InDetTrackSelectorTool,
 UseMassConstraint		    = True)
 
 ToolSvc += MUON2BsJpsiKK
-print      MUON2BsJpsiKK    
+printfunc (     MUON2BsJpsiKK    )
 
 ## 5a/ setup the Jpsi+1 track finder
 from JpsiUpsilonTools.JpsiUpsilonToolsConf import Analysis__JpsiPlus1Track
@@ -185,7 +185,7 @@ TrackSelectorTool		= MUON2_VertexTools.InDetTrackSelectorTool,
 UseMassConstraint		= True)
         
 ToolSvc += MUON2BplJpsiKpl
-print      MUON2BplJpsiKpl    
+printfunc (     MUON2BplJpsiKpl    )
 
 
 ## 6/ setup the combined augmentation/skimming tool for the Bpm
@@ -198,7 +198,7 @@ MUON2BsKKSelectAndWrite = DerivationFramework__Reco_dimuTrkTrk(name
                                                            RefitPV                  = True,
                                                            MaxPVrefit               = 10000, DoVertexType = 7)
 ToolSvc += MUON2BsKKSelectAndWrite 
-print      MUON2BsKKSelectAndWrite
+printfunc (     MUON2BsKKSelectAndWrite)
 
 from DerivationFrameworkBPhys.DerivationFrameworkBPhysConf import DerivationFramework__Reco_dimuTrk
 MUON2BplKplSelectAndWrite = DerivationFramework__Reco_dimuTrk(name				     	= "MUON2BplKplSelectAndWrite",
@@ -209,7 +209,7 @@ MUON2BplKplSelectAndWrite = DerivationFramework__Reco_dimuTrk(name				     	= "M
                                                               RefitPV                   = True,
                                                               MaxPVrefit                = 10000 )
 ToolSvc += MUON2BplKplSelectAndWrite
-print      MUON2BplKplSelectAndWrite
+printfunc (     MUON2BplKplSelectAndWrite)
 
 
 ## b/ augment and select Bs->JpsiKK candidates
@@ -224,7 +224,7 @@ MUON2_Select_Bs2JpsiKK = DerivationFramework__Select_onia2mumu(
   Chi2Max                    = 200)
 
 ToolSvc += MUON2_Select_Bs2JpsiKK
-print      MUON2_Select_Bs2JpsiKK
+printfunc (     MUON2_Select_Bs2JpsiKK)
 
 MUON2_Select_Bpl2JpsiKpl     = DerivationFramework__Select_onia2mumu(
   name                       = "MUON2_Select_Bpl2JpsiKpl",
@@ -237,7 +237,7 @@ MUON2_Select_Bpl2JpsiKpl     = DerivationFramework__Select_onia2mumu(
   Chi2Max                    = MUON2BplJpsiKpl.Chi2Cut)
 
 ToolSvc += MUON2_Select_Bpl2JpsiKpl
-print      MUON2_Select_Bpl2JpsiKpl
+printfunc (     MUON2_Select_Bpl2JpsiKpl)
 
 MUON2_Select_Bpl2JpsiPi      = DerivationFramework__Select_onia2mumu(
   name                       = "MUON2_Select_Bpl2JpsiPi",
@@ -250,14 +250,14 @@ MUON2_Select_Bpl2JpsiPi      = DerivationFramework__Select_onia2mumu(
   Chi2Max                    = MUON2BplJpsiKpl.Chi2Cut)
 
 ToolSvc += MUON2_Select_Bpl2JpsiPi
-print      MUON2_Select_Bpl2JpsiPi
+printfunc (     MUON2_Select_Bpl2JpsiPi)
 
 #expression = "count(BpmJpsiKpmCandidates.passed_Bplus) > 0"
 #from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__xAODStringSkimmingTool
 #MUON2_SelectEvent = DerivationFramework__xAODStringSkimmingTool(name = "MUON2_SelectEvent",
 #                                                                expression = expression)
 #ToolSvc += MUON2_SelectEvent
-#print MUON2_SelectEvent
+#printfunc (MUON2_SelectEvent)
 
 
 #from DerivationFrameworkBPhys.DerivationFrameworkBPhysConf import DerivationFramework__SelectEvent
@@ -269,17 +269,17 @@ if not isSimulation: #Only Skim Data
      expression = "count(BsJpsiKKCandidates.passed_Bs > 0) > 0")
                                                     
    ToolSvc += MUON2_SelectBsJpsiKKEvent
-   print MUON2_SelectBsJpsiKKEvent
+   printfunc (MUON2_SelectBsJpsiKKEvent)
 
    MUON2_SelectBplJpsiKplEvent = DerivationFramework__xAODStringSkimmingTool(name = "MUON2_SelectBplJpsiKplEvent",
                                                                     expression = "count(BpmJpsiKpmCandidates.passed_Bplus>0) > 0")
    ToolSvc += MUON2_SelectBplJpsiKplEvent
-   print      MUON2_SelectBplJpsiKplEvent
+   printfunc (     MUON2_SelectBplJpsiKplEvent)
 
    MUON2_SelectBplJpsiKplEventBc = DerivationFramework__xAODStringSkimmingTool(name = "MUON2_SelectBplJpsiKplEventBc",
                                                                     expression = "count(BpmJpsiKpmCandidates.passed_Bc>0) > 0")
    ToolSvc += MUON2_SelectBplJpsiKplEventBc
-   print      MUON2_SelectBplJpsiKplEventBc
+   printfunc (     MUON2_SelectBplJpsiKplEventBc)
    
    #====================================================================
    # Make event selection based on an OR of the input skimming tools
@@ -288,7 +288,7 @@ if not isSimulation: #Only Skim Data
    MUON2SkimmingOR = CfgMgr.DerivationFramework__FilterCombinationOR("MUON2SkimmingOR",
                                                                      FilterList = [MUON2_SelectBsJpsiKKEvent, MUON2_SelectBplJpsiKplEvent, MUON2_SelectBplJpsiKplEventBc])
    ToolSvc += MUON2SkimmingOR
-   print      MUON2SkimmingOR
+   printfunc (     MUON2SkimmingOR)
 
 from DerivationFrameworkBPhys.DerivationFrameworkBPhysConf import DerivationFramework__Thin_vtxTrk
 MUON2_thinningTool_Tracks = DerivationFramework__Thin_vtxTrk(
@@ -337,7 +337,7 @@ ToolSvc+=MUON2ElectronTPThinningTool
 #====================================================================
 
 thiningCollection = [] 
-print thiningCollection
+printfunc (thiningCollection)
 
 from DerivationFrameworkJetEtMiss.JetCommon import *
 bphy5Seq = CfgMgr.AthSequencer("MUON2Sequence")
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/share/MUON3.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/share/MUON3.py
index fb576ed8e15..fe72bd8ec4b 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/share/MUON3.py
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/share/MUON3.py
@@ -85,7 +85,7 @@ myAugTools.append(MUON3AugmentTool1)
 skimmingORs.append(brPrefix1+'DIMU_pass>0')
 thinningORs.append(brPrefix1+'DIMU_trkStatus>0')
 # thinningORs.append('('+brPrefix1+'DIMU_pass>0&&'+brPrefix1+'DIMU_trkStatus>0)')
-print MUON3AugmentTool1
+printfunc (MUON3AugmentTool1)
 
 ### Upsilon tagging
 brPrefix2 = 'MUON3b'
@@ -97,7 +97,7 @@ andTriggers2_run1 = addL2StarB(andTriggers2a_run1)
 andTriggers2a_run2 = [] # No trigger in 8TeV data
 
 andTriggers2 = andTriggers2a_run2
-print andTriggers2
+printfunc (andTriggers2)
 
 MUON3AugmentTool2 = DerivationFramework__dimuonTaggingTool(name = "MUON3AugmentTool2",
                                                            OrTrigs = orTriggers2,
@@ -126,7 +126,7 @@ myAugTools.append(MUON3AugmentTool2)
 skimmingORs.append(brPrefix2+'DIMU_pass>0')
 thinningORs.append(brPrefix2+'DIMU_trkStatus>0')
 # thinningORs.append('('+brPrefix2+'DIMU_pass>0&&'+brPrefix2+'DIMU_trkStatus>0)')
-print MUON3AugmentTool2
+printfunc (MUON3AugmentTool2)
 
 #====================================================================
 # SKIMMING
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/share/MUON4.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/share/MUON4.py
index c103e61c372..e35b135ea9c 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/share/MUON4.py
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/share/MUON4.py
@@ -16,7 +16,7 @@ MUON4_aug_tools = []
 from TrkVertexFitterUtils.TrkVertexFitterUtilsConf import Trk__TrackToVertexIPEstimator
 MUON4IPETool = Trk__TrackToVertexIPEstimator(name = "MUON4IPETool")
 ToolSvc += MUON4IPETool
-print MUON4IPETool
+printfunc (MUON4IPETool)
 
 from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackToVertexWrapper
 ## ID tracks
@@ -24,7 +24,7 @@ MUON4TrackToVertexWrapper= DerivationFramework__TrackToVertexWrapper(name = "MUO
                                                                      TrackToVertexIPEstimator = MUON4IPETool,
                                                                      DecorationPrefix = "MUON4",
                                                                      ContainerName = "InDetTrackParticles")
-print MUON4TrackToVertexWrapper
+printfunc (MUON4TrackToVertexWrapper)
 ToolSvc += MUON4TrackToVertexWrapper
 MUON4_aug_tools.append(MUON4TrackToVertexWrapper)
 #====================================================================
@@ -34,7 +34,7 @@ MUON4_skimming_tools = []
 
 expression1 = 'count(Muons.pt>0)>0'
 if DerivationFrameworkIsMonteCarlo: expression1 += '||count(MuonTruthParticles.pt>0)>0'
-print expression1
+printfunc (expression1)
 from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__xAODStringSkimmingTool
 MUON4SkimmingTool1 = DerivationFramework__xAODStringSkimmingTool(name = "MUON4SkimmingTool1",
                                                                  expression = expression1)
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/share/MUON5.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/share/MUON5.py
index bca7843fbb4..9567e241efd 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/share/MUON5.py
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/share/MUON5.py
@@ -110,7 +110,7 @@ if is_MC:
 
     augmentationTools.append(MUON5BkgElectronClassificationTool)
 
-    print "BkgElectronClassificationTool: ", MUON5BkgElectronClassificationTool
+    printfunc ("BkgElectronClassificationTool: ", MUON5BkgElectronClassificationTool)
 
 #====================================================================
 # THINNING TOOLS
-- 
GitLab