Skip to content
Snippets Groups Projects
Commit f5d856e2 authored by Teng Jian Khoo's avatar Teng Jian Khoo
Browse files

Fix checks for preexisting inputs to jet finding

parent 81511495
No related branches found
No related tags found
No related merge requests found
...@@ -329,10 +329,20 @@ class JetInputDef(object): ...@@ -329,10 +329,20 @@ class JetInputDef(object):
The function must return a tuple : (bool, "reason of failure") The function must return a tuple : (bool, "reason of failure")
- prereqs : a list of prerequisites (str) for this input definition. - 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.name = name
self.basetype = objtype self.basetype = objtype
self.algoBuilder = algoBuilder 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.specs = specs
self.filterfn = filterfn self.filterfn = filterfn
self.prereqs = prereqs self.prereqs = prereqs
......
...@@ -142,11 +142,10 @@ def JetInputCfg(jetOrConstitdef, configFlags, sequenceName='AthAlgSeq'): ...@@ -142,11 +142,10 @@ def JetInputCfg(jetOrConstitdef, configFlags, sequenceName='AthAlgSeq'):
jetdef = jetOrConstitdef jetdef = jetOrConstitdef
jetlog.info("Inspecting input file contents") 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:')] inputdeps = [ inputkey for inputkey in jetdef._prereqOrder if inputkey.startswith('input:')]
for inputfull in inputdeps: for inputfull in inputdeps:
inputInstance = jetdef._prereqDic[inputfull] inputInstance = jetdef._prereqDic[inputfull]
isprimary = False # actually not using it yet. isprimary = False # actually not using it yet.
...@@ -163,13 +162,17 @@ def JetInputCfg(jetOrConstitdef, configFlags, sequenceName='AthAlgSeq'): ...@@ -163,13 +162,17 @@ def JetInputCfg(jetOrConstitdef, configFlags, sequenceName='AthAlgSeq'):
if constitalg: if constitalg:
components.addEventAlgo(constitalg, primary=isprimary) components.addEventAlgo(constitalg, primary=isprimary)
else: # it must be a JetInputDef else: # it must be a JetInputDef
jetlog.debug("Requesting input {} with function {} and specs {}".format(inputInstance.name, inputInstance.algoBuilder, inputInstance.specs) ) cname = inputInstance.containername(jetdef,inputInstance.specs)
# check if it has something to build an Algorithm if cname in filecontents:
if inputInstance.algoBuilder: jetlog.debug("Input container {0} for prereq {1} already in input file.".format(cname, inputInstance.name))
components.addEventAlgo( inputInstance.algoBuilder( jetdef, inputInstance.specs ), primary=isprimary )
else: else:
# for now just hope the input will be present... jetlog.debug("Requesting input {} with function {} and specs {}".format(inputInstance.name, inputInstance.algoBuilder, inputInstance.specs) )
pass # 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 return components
......
...@@ -52,9 +52,11 @@ _stdInputList = [ ...@@ -52,9 +52,11 @@ _stdInputList = [
# ***************************** # *****************************
JetInputDef("EventDensity", "EventShape", algoBuilder = inputcfg.buildEventShapeAlg, 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. 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, 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. prereqs = lambda jetdef : ["input:"+jetdef.inputdef.name], # this will force the input to be build *before* the EventDensity alg.
specs = 'HLT_' specs = 'HLT_'
), ),
......
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