Skip to content
Snippets Groups Projects
Commit 7e9b994c authored by Frank Winklmeier's avatar Frank Winklmeier
Browse files

Merge branch 'py3.DerivationFrameworkCore-20200303' into 'master'

DerivationFrameworkCore: Python 3 fixes

See merge request atlas/athena!30834
parents 0b183604 9545ce55
No related branches found
No related tags found
No related merge requests found
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
# ------------------------------------------------------------ # ------------------------------------------------------------
# DerivationFrameworkMaster.py # DerivationFrameworkMaster.py
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
# Contains all basic includes for running the derivation framework # Contains all basic includes for running the derivation framework
#------------------------------------------------------------- #-------------------------------------------------------------
from __future__ import print_function
from AthenaCommon.AppMgr import ToolSvc from AthenaCommon.AppMgr import ToolSvc
from AthenaCommon.AppMgr import theApp from AthenaCommon.AppMgr import theApp
# Derivation names and locations of job options # Derivation names and locations of job options
...@@ -81,13 +83,13 @@ jetFlags.useTracks = True ...@@ -81,13 +83,13 @@ jetFlags.useTracks = True
DerivationFrameworkIsMonteCarlo=False DerivationFrameworkIsMonteCarlo=False
DerivationFrameworkSimBarcodeOffset = int(200e3) DerivationFrameworkSimBarcodeOffset = int(200e3)
if globalflags.DataSource()=='geant4': if globalflags.DataSource()=='geant4':
print "Switching on jetFlags.useTruth" print ("Switching on jetFlags.useTruth")
jetFlags.useTruth = True jetFlags.useTruth = True
DerivationFrameworkIsMonteCarlo = True DerivationFrameworkIsMonteCarlo = True
try: try:
DerivationFrameworkSimBarcodeOffset = int(inputFileSummary['metadata']['/Simulation/Parameters']['SimBarcodeOffset']) DerivationFrameworkSimBarcodeOffset = int(inputFileSummary['metadata']['/Simulation/Parameters']['SimBarcodeOffset'])
except: except:
print 'Could not retrieve SimBarcodeOffset from /Simulation/Parameters, leaving at 200k' print ('Could not retrieve SimBarcodeOffset from /Simulation/Parameters, leaving at 200k')
def buildFileName(derivationStream): def buildFileName(derivationStream):
return derivationStream.FileName return derivationStream.FileName
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
#################################################################### ####################################################################
# SlimmingHelper.py # SlimmingHelper.py
...@@ -34,6 +34,8 @@ ...@@ -34,6 +34,8 @@
# may be unreadable. # may be unreadable.
#################################################################### ####################################################################
from __future__ import print_function
from DerivationFrameworkCore.CompulsoryContent import * from DerivationFrameworkCore.CompulsoryContent import *
from DerivationFrameworkCore.ContentHandler import * from DerivationFrameworkCore.ContentHandler import *
from AthenaCommon.BeamFlags import jobproperties from AthenaCommon.BeamFlags import jobproperties
...@@ -210,7 +212,7 @@ class SlimmingHelper: ...@@ -210,7 +212,7 @@ class SlimmingHelper:
["TruthTaus","xAOD::TruthParticleContainer"], ["TruthTaus","xAOD::TruthParticleContainer"],
["TruthTausAux","xAOD::TruthParticleAuxContainer"] ["TruthTausAux","xAOD::TruthParticleAuxContainer"]
]: ]:
if not self.AppendToDictionary.has_key(_cont): if _cont not in self.AppendToDictionary:
self.AppendToDictionary[_cont]=_type self.AppendToDictionary[_cont]=_type
# Process the master list... # Process the master list...
...@@ -294,14 +296,14 @@ class SlimmingHelper: ...@@ -294,14 +296,14 @@ class SlimmingHelper:
badItemsXAOD.append(item) badItemsXAOD.append(item)
if (len(badItemsWildcards)>0): if (len(badItemsWildcards)>0):
msg.error("These static items contain wildcards: not permitted") msg.error("These static items contain wildcards: not permitted")
print badItemsWildcards print (badItemsWildcards)
raise RuntimeError("Static content list contains wildcards") raise RuntimeError("Static content list contains wildcards")
if (len(badItemsXAOD)>0): if (len(badItemsXAOD)>0):
msg.error("These static items are xAOD collections: not permitted") msg.error("These static items are xAOD collections: not permitted")
print badItemsXAOD print (badItemsXAOD)
raise RuntimeError("Static content list contains xAOD collections") raise RuntimeError("Static content list contains xAOD collections")
#Prevent any more modifications As they will be completely ignored, and hard to debug #Prevent any more modifications As they will be completely ignored, and hard to debug
print self.ExtraVariables,dir(self.ExtraVariables) print (self.ExtraVariables,dir(self.ExtraVariables))
self.StaticContent.lock() self.StaticContent.lock()
self.ExtraVariables.lock() self.ExtraVariables.lock()
...@@ -361,10 +363,10 @@ class SlimmingHelper: ...@@ -361,10 +363,10 @@ class SlimmingHelper:
elif collectionName=="AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets": elif collectionName=="AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets":
from DerivationFrameworkJetEtMiss.AntiKt10LCTopoTrimmedPtFrac5SmallR20JetsCPContent import AntiKt10LCTopoTrimmedPtFrac5SmallR20JetsCPContent from DerivationFrameworkJetEtMiss.AntiKt10LCTopoTrimmedPtFrac5SmallR20JetsCPContent import AntiKt10LCTopoTrimmedPtFrac5SmallR20JetsCPContent
#from DerivationFrameworkCore.AntiKt10LCTopoTrimmedPtFrac5SmallR20JetsCPContent import AntiKt10LCTopoTrimmedPtFrac5SmallR20JetsCPContent #from DerivationFrameworkCore.AntiKt10LCTopoTrimmedPtFrac5SmallR20JetsCPContent import AntiKt10LCTopoTrimmedPtFrac5SmallR20JetsCPContent
if not self.AppendToDictionary.has_key("AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets"): if "AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets" not in self:
self.AppendToDictionary["AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets"]='xAOD::JetContainer' self.AppendToDictionary["AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets"]='xAOD::JetContainer'
self.AppendToDictionary["AntiKt10LCTopoTrimmedPtFrac5SmallR20JetsAux"]='xAOD::JetAuxContainer' self.AppendToDictionary["AntiKt10LCTopoTrimmedPtFrac5SmallR20JetsAux"]='xAOD::JetAuxContainer'
if not self.AppendToDictionary.has_key("AntiKt10TruthTrimmedPtFrac5SmallR20Jets"): if "AntiKt10TruthTrimmedPtFrac5SmallR20Jets" not in self:
self.AppendToDictionary["AntiKt10TruthTrimmedPtFrac5SmallR20Jets"]="xAOD::JetContainer" self.AppendToDictionary["AntiKt10TruthTrimmedPtFrac5SmallR20Jets"]="xAOD::JetContainer"
self.AppendToDictionary["AntiKt10TruthTrimmedPtFrac5SmallR20JetsAux"]='xAOD::JetAuxContainer' self.AppendToDictionary["AntiKt10TruthTrimmedPtFrac5SmallR20JetsAux"]='xAOD::JetAuxContainer'
items.extend(AntiKt10LCTopoTrimmedPtFrac5SmallR20JetsCPContent) items.extend(AntiKt10LCTopoTrimmedPtFrac5SmallR20JetsCPContent)
......
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