diff --git a/Reconstruction/Jet/JetRecConfig/python/JetDefinition.py b/Reconstruction/Jet/JetRecConfig/python/JetDefinition.py index 9142d30d879a3f8f712952fbd6779548a38cb3c1..51d695fa1619661287c81a3139e6b4e542a43582 100644 --- a/Reconstruction/Jet/JetRecConfig/python/JetDefinition.py +++ b/Reconstruction/Jet/JetRecConfig/python/JetDefinition.py @@ -329,10 +329,20 @@ class JetInputDef(object): The function must return a tuple : (bool, "reason of failure") - prereqs : a list of prerequisites (str) for this input definition. """ - def __init__(self, name, objtype, algoBuilder=None, specs=None, filterfn= _condAlwaysPass, prereqs=[]): + def __init__(self, name, objtype, algoBuilder=None, specs=None, containername=None, filterfn= _condAlwaysPass, prereqs=[]): self.name = name self.basetype = objtype self.algoBuilder = algoBuilder + + # In certain cases (EventShape) we need to configure the concrete + # output container name based on the jetdef and specs, so can + # pass in a (lambda) function to define this. + if containername: + self.containername = containername + else: + # Ordinarily we just return the name + self.containername = lambda dummyjetdef,dummyspecs : self.name + self.specs = specs self.filterfn = filterfn self.prereqs = prereqs diff --git a/Reconstruction/Jet/JetRecConfig/python/JetRecConfig.py b/Reconstruction/Jet/JetRecConfig/python/JetRecConfig.py index 80ffcc3bda1ff23b7090353e1841288beefe168e..29dc80eced2ed8e188ea207134ee96bae0ebc839 100644 --- a/Reconstruction/Jet/JetRecConfig/python/JetRecConfig.py +++ b/Reconstruction/Jet/JetRecConfig/python/JetRecConfig.py @@ -142,11 +142,10 @@ def JetInputCfg(jetOrConstitdef, configFlags, sequenceName='AthAlgSeq'): jetdef = jetOrConstitdef jetlog.info("Inspecting input file contents") - filecontents = configFlags.Input.Collections + filecontents = [coll for coll in configFlags.Input.Collections] inputdeps = [ inputkey for inputkey in jetdef._prereqOrder if inputkey.startswith('input:')] - for inputfull in inputdeps: inputInstance = jetdef._prereqDic[inputfull] isprimary = False # actually not using it yet. @@ -163,13 +162,17 @@ def JetInputCfg(jetOrConstitdef, configFlags, sequenceName='AthAlgSeq'): if constitalg: components.addEventAlgo(constitalg, primary=isprimary) else: # it must be a JetInputDef - jetlog.debug("Requesting input {} with function {} and specs {}".format(inputInstance.name, inputInstance.algoBuilder, inputInstance.specs) ) - # check if it has something to build an Algorithm - if inputInstance.algoBuilder: - components.addEventAlgo( inputInstance.algoBuilder( jetdef, inputInstance.specs ), primary=isprimary ) + cname = inputInstance.containername(jetdef,inputInstance.specs) + if cname in filecontents: + jetlog.debug("Input container {0} for prereq {1} already in input file.".format(cname, inputInstance.name)) else: - # for now just hope the input will be present... - pass + jetlog.debug("Requesting input {} with function {} and specs {}".format(inputInstance.name, inputInstance.algoBuilder, inputInstance.specs) ) + # check if it has something to build an Algorithm + if inputInstance.algoBuilder: + components.addEventAlgo( inputInstance.algoBuilder( jetdef, inputInstance.specs ), primary=isprimary ) + else: + # for now just hope the input will be present... + pass return components diff --git a/Reconstruction/Jet/JetRecConfig/python/StandardJetConstits.py b/Reconstruction/Jet/JetRecConfig/python/StandardJetConstits.py index ae888b49029499dbeeeabc954b50fef50645ab7e..262c0775592f81e613e8da12bfe14089e7feb72d 100644 --- a/Reconstruction/Jet/JetRecConfig/python/StandardJetConstits.py +++ b/Reconstruction/Jet/JetRecConfig/python/StandardJetConstits.py @@ -52,9 +52,11 @@ _stdInputList = [ # ***************************** JetInputDef("EventDensity", "EventShape", algoBuilder = inputcfg.buildEventShapeAlg, + containername = lambda jetdef, specs : (specs or "")+"Kt4"+jetdef.inputdef.label+"EventShape", prereqs = lambda jetdef : ["input:"+jetdef.inputdef.name] # this will force the input to be build *before* the EventDensity alg. ), JetInputDef("HLT_EventDensity", "EventShape", algoBuilder = inputcfg.buildEventShapeAlg, + containername = lambda jetdef, specs : (specs or "")+"Kt4"+jetdef.inputdef.label+"EventShape", prereqs = lambda jetdef : ["input:"+jetdef.inputdef.name], # this will force the input to be build *before* the EventDensity alg. specs = 'HLT_' ),