diff --git a/Trigger/TrigSteer/DecisionHandling/DecisionHandling/HypoBase.h b/Trigger/TrigSteer/DecisionHandling/DecisionHandling/HypoBase.h index ef851056428c73bbedbc77b0f459fd9cfaf7f1a2..f1d72e698fb64aa3fee2b7037be8a9dc5210f84d 100644 --- a/Trigger/TrigSteer/DecisionHandling/DecisionHandling/HypoBase.h +++ b/Trigger/TrigSteer/DecisionHandling/DecisionHandling/HypoBase.h @@ -32,10 +32,12 @@ This is a base class for HLT Hypos to reduce boilerplate and enforce the common const SG::ReadHandleKey<TrigCompositeUtils::DecisionContainer>& decisionInput() const; const SG::WriteHandleKey<TrigCompositeUtils::DecisionContainer>& decisionOutput() const; private: + /// input decisions, will be implicit (renounced). - SG::ReadHandleKey<TrigCompositeUtils::DecisionContainer> m_input { this, "previousDecisions", "InputDecision", "Input Decision (implicit)" }; + SG::ReadHandleKey<TrigCompositeUtils::DecisionContainer> m_input { this, "HypoInputDecisions", "HypoInputDecision", "Input Decision (implicit)" }; /// output decisions - SG::WriteHandleKey<TrigCompositeUtils::DecisionContainer> m_output { this, "Output", "OutputDecision", "Ouput Decision" }; + SG::WriteHandleKey<TrigCompositeUtils::DecisionContainer> m_output { this, "HypoOutputDecisions", "HypoOutputDecision", "Ouput Decision" }; + // for future implementation: ToolHandleArray<ITestHypoTool> m_tools { this, "HypoTools", {}, "Hypo tools" }; }; diff --git a/Trigger/TrigSteer/DecisionHandling/DecisionHandling/InputMakerBase.h b/Trigger/TrigSteer/DecisionHandling/DecisionHandling/InputMakerBase.h index 2384a3e6ed47514bd0ce49ef22fc1235536da3fc..fcf0e49ba3c92e751874b71072ea5a7a3ca0920d 100644 --- a/Trigger/TrigSteer/DecisionHandling/DecisionHandling/InputMakerBase.h +++ b/Trigger/TrigSteer/DecisionHandling/DecisionHandling/InputMakerBase.h @@ -33,9 +33,9 @@ This is a base class for HLT InputMakers to reduce boilerplate and enforce the c const SG::WriteHandleKeyArray<TrigCompositeUtils::DecisionContainer>& decisionOutputs() const; private: /// input decisions, will be implicit (renounced). - SG::ReadHandleKeyArray<TrigCompositeUtils::DecisionContainer> m_inputs { this, "InputDecisions", {}, "Input Decisions (implicit)" }; + SG::ReadHandleKeyArray<TrigCompositeUtils::DecisionContainer> m_inputs { this, "InputMakerInputDecisions", {}, "Input Decisions (implicit)" }; /// output decisions - SG::WriteHandleKeyArray<TrigCompositeUtils::DecisionContainer> m_outputs { this, "OutputDecisions", {}, "Ouput Decisions" }; + SG::WriteHandleKeyArray<TrigCompositeUtils::DecisionContainer> m_outputs { this, "InputMakerOutputDecisions", {}, "Ouput Decisions" }; }; diff --git a/Trigger/TrigValidation/TrigUpgradeTest/python/HLTCFConfig.py b/Trigger/TrigValidation/TrigUpgradeTest/python/HLTCFConfig.py index 5e1ab10752752c30ee8a162636693d1836021539..45dcb59b7ab9a050001087cf52d068bf168f945f 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/python/HLTCFConfig.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/python/HLTCFConfig.py @@ -69,7 +69,7 @@ def create_CFSequence(CFseq): filterAlg=CFseq.filter.Alg subs=[] - for seq in CFseq.menuSeq.nodeSeqList: + for seq in CFseq.menuSeq.recoSeqList: ath_sequence=seq.sequence.Alg subs.append(ath_sequence) @@ -131,7 +131,7 @@ def decisionTree_From_Chains(HLTNode, chains): cfseq_name= sequence.name if DH_DEBUG: print "Going through sequence %s with threshold %s"%(sequence.name, hypotool) - seeds= [nodeSeq.seed for nodeSeq in sequence.nodeSeqList] + seeds= [recoSeq.seed for recoSeq in sequence.recoSeqList] if DH_DEBUG: print "Found these seeds form the sequence: %s"%(seeds) #define sequence input if count_steps == 0: # L1 seeding @@ -186,26 +186,26 @@ def decisionTree_From_Chains(HLTNode, chains): if DH_DEBUG: print "Filter Done: %s"%(sfilter.name) # Connect the InputMaker - #loop over NodeSequences of this sequence to add inputs to InputMaker and send decisions to HypoAlg - for nodeSeq in sequence.nodeSeqList: - seed=nodeSeq.seed + #loop over RecoSequences of this sequence to add inputs to InputMaker and send decisions to HypoAlg + for recoSeq in sequence.recoSeqList: + seed=recoSeq.seed input_maker_input=[sfilter.getOutputList()[i] for i,fseed in enumerate (sfilter.seeds) if fseed in seed ] - if DH_DEBUG: print "Adding %d inputs to sequence::%s from Filter::%s (from seed %s)"%(len(input_maker_input), nodeSeq.name, sfilter.algname, seed) + if DH_DEBUG: print "Adding %d inputs to sequence::%s from Filter::%s (from seed %s)"%(len(input_maker_input), recoSeq.name, sfilter.algname, seed) for i in input_maker_input: print i if len(input_maker_input) == 0: sys.exit("ERROR, no inputs to sequence are set!") - for i in input_maker_input: nodeSeq.addInput(i) - input_maker_output=["%s_from_%s_output"%(nodeSeq.maker.algname,i) for i in input_maker_input ] + for i in input_maker_input: recoSeq.addInput(i) + input_maker_output=["%s_from_%s_output"%(recoSeq.maker.algname,i) for i in input_maker_input ] if len(input_maker_output) == 0: sys.exit("ERROR, no outputs to sequence are set!") if DH_DEBUG: print "connecting InputMaker to HypoAlg" - print "Adding %d output to InputMaker::%s and sending to HypoAlg::%s"%(len(input_maker_output), nodeSeq.maker.algname, sequence.hypo.algname) + print "Adding %d output to InputMaker::%s and sending to HypoAlg::%s"%(len(input_maker_output), recoSeq.maker.algname, sequence.hypo.algname) for i in input_maker_output: print i for out in input_maker_output: - nodeSeq.addOutputDecision(out) + recoSeq.addOutputDecision(out) sequence.hypo.setPreviousDecision(out) #needed for the summary diff --git a/Trigger/TrigValidation/TrigUpgradeTest/python/HLTCFDot.py b/Trigger/TrigValidation/TrigUpgradeTest/python/HLTCFDot.py index 9916bf2d64e07ac64c022b3cd45ed096aa092502..7f8346b7603bf24d2ee64277f0213d2a99082ef3 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/python/HLTCFDot.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/python/HLTCFDot.py @@ -1,26 +1,28 @@ - - -###### Here some graphical methods - - +###### Here some graphical methods to produce dot files from Decision Handling + # to visualize: dot -T pdf Step1.dot > Step1.pdf + from ViewAlgsTest.connectAlgorithmsIO import connectAlgorithmsIO, graph_generator from AthenaCommon.AlgSequence import AthSequencer +from TrigUpgradeTest.MenuComponents import isHypoBase, isInputMakerBase, isFilterAlg def algColor(alg): - if "Hypo" in alg: return "darkorchid1" - if "Filter" in alg: return "chartreuse3" - if "InputMaker" in alg: return "cyan3" + """ Set given color to Alg type""" + if isHypoBase(alg): return "darkorchid1" + if 'Combo' in alg.name(): return "darkorchid1" #TMP for combo hypo + if isInputMakerBase(alg): return "cyan3" + if isFilterAlg(alg): return "chartreuse3" + return "cadetblue1" - + def stepCF_ControlFlow_to_dot(stepCF): def _dump (seq, indent): o = list() - for c in seq.getChildren(): + for c in seq.getChildren(): if isinstance(c, AthSequencer): o.append( ("%s[color=%s, shape=circle, width=.5, fixedsize=true ,style=filled]\n"%(c.name(),_seqColor(c)), indent) ) else: - o.append( ("%s[fillcolor=%s,style=filled]\n"%(c.name(),algColor(c.name())), indent) ) + o.append( ("%s[fillcolor=%s,style=filled]\n"%(c.name(),algColor(c)), indent) ) o.append( ("%s -> %s\n"%(seq.name(), c.name()), indent)) o.extend( _dump (c, indent+1) ) return o @@ -46,8 +48,6 @@ def stepCF_ControlFlow_to_dot(stepCF): - # to visualize: dot -T pdf Step1.dot > Step1.pdf - with open('%s.CF.dot'%stepCF.name(), mode="wt") as file: #strict file.write( 'digraph step {\n'\ @@ -86,7 +86,7 @@ def all_DataFlow_to_dot(name, step_list): last_step_hypoNodes =[] for cfseq in cfseq_list: print cfseq.name - file.write(" %s[fillcolor=%s style=filled]\n"%(cfseq.filter.algname,algColor(cfseq.filter.algname))) + file.write(" %s[fillcolor=%s style=filled]\n"%(cfseq.filter.algname,algColor(cfseq.filter.Alg))) step_connections.append(cfseq.filter) file.write( '\n subgraph cluster_%s {\n'%(cfseq.name)\ +' node [color=white style=filled]\n'\ @@ -98,19 +98,19 @@ def all_DataFlow_to_dot(name, step_list): cfseq_algs = [] cfseq_algs.append(cfseq.filter) - for seq in cfseq.menuSeq.nodeSeqList: + for seq in cfseq.menuSeq.recoSeqList: seq.reuse=False - for seq in cfseq.menuSeq.nodeSeqList: + for seq in cfseq.menuSeq.recoSeqList: cfseq_algs.append(seq.maker) cfseq_algs.append(seq.sequence ) if seq.reuse==False: - file.write(" %s[fillcolor=%s]\n"%(seq.maker.algname, algColor(seq.maker.algname))) - file.write(" %s[fillcolor=%s]\n"%(seq.sequence.algname, algColor(seq.sequence.algname))) + file.write(" %s[fillcolor=%s]\n"%(seq.maker.algname, algColor(seq.maker.Alg))) + file.write(" %s[fillcolor=%s]\n"%(seq.sequence.algname, algColor(seq.sequence.Alg))) seq.reuse=True - cfseq_algs.append(seq.hypo) - last_step_hypoNodes.append(seq.hypo) - file.write(" %s[color=%s]\n"%(seq.hypo.algname, algColor(seq.hypo.algname))) + cfseq_algs.append(cfseq.menuSeq.hypo) + last_step_hypoNodes.append(cfseq.menuSeq.hypo) + file.write(" %s[color=%s]\n"%(cfseq.menuSeq.hypo.algname, algColor(cfseq.menuSeq.hypo.Alg))) file.write(' }\n') file.write(findConnections(cfseq_algs)) file.write('\n') @@ -123,7 +123,6 @@ def all_DataFlow_to_dot(name, step_list): def stepCF_DataFlow_to_dot(name, cfseq_list): - # to visualize: dot -T pdf Step1.dot > Step1.pdf with open( '%s.DF.dot'%name, mode="wt" ) as file: #strict file.write( 'digraph step {\n'\ @@ -135,7 +134,7 @@ def stepCF_DataFlow_to_dot(name, cfseq_list): for cfseq in cfseq_list: print cfseq.name - file.write(" %s[fillcolor=%s style=filled]\n"%(cfseq.filter.algname,algColor(cfseq.filter.algname))) + file.write(" %s[fillcolor=%s style=filled]\n"%(cfseq.filter.algname,algColor(cfseq.filter.Alg))) for inp in cfseq.filter.getInputList(): file.write(addConnection(name, cfseq.filter.algname, inp)) @@ -149,16 +148,15 @@ def stepCF_DataFlow_to_dot(name, cfseq_list): cfseq_algs = [] cfseq_algs.append(cfseq.filter) - for seq in cfseq.menuSeq.nodeSeqList: + for seq in cfseq.menuSeq.recoSeqList: cfseq_algs.append(seq.maker) cfseq_algs.append(seq.sequence ) if seq.reuse==False: - file.write(" %s[fillcolor=%s]\n"%(seq.maker.algname, algColor(seq.maker.algname))) - file.write(" %s[fillcolor=%s]\n"%(seq.sequence.algname, algColor(seq.sequence.algname))) + file.write(" %s[fillcolor=%s]\n"%(seq.maker.algname, algColor(seq.maker.Alg))) + file.write(" %s[fillcolor=%s]\n"%(seq.sequence.algname, algColor(seq.sequence.Alg))) seq.reuse=True - cfseq_algs.append(seq.hypo) - - file.write(" %s[color=%s]\n"%(seq.hypo.algname, algColor(seq.hypo.algname))) + cfseq_algs.append(cfseq.menuSeq.hypo) + file.write(" %s[color=%s]\n"%(cfseq.menuSeq.hypo.algname, algColor(cfseq.menuSeq.hypo.Alg))) file.write(' }\n') file.write(findConnections(cfseq_algs)) file.write('\n') @@ -169,19 +167,15 @@ def stepCF_DataFlow_to_dot(name, cfseq_list): def findConnections(alg_list): lineconnect='' - for nodeA in alg_list: - for nodeB in alg_list: - if nodeA is nodeB: - continue - dataIntersection = list(set(nodeA.getOutputList()) & set(nodeB.getInputList())) - if len(dataIntersection) > 0: - for line in dataIntersection: - lineconnect+=addConnection(nodeA.algname,nodeB.algname, line) - print 'Data connections between %s and %s: %s'%(nodeA.algname, nodeB.algname, line) - + import itertools + for nodeA, nodeB in itertools.combinations(alg_list, 2): + line=addConnection(nodeA, nodeB) + lineconnect+=line + print 'Data connections between %s and %s: %s'%(nodeA.algname, nodeB.algname, line) return lineconnect + -def findConnections_wihtin_sequence(alg_list): +def findConnections_within_sequence(alg_list): lineconnect='' import itertools for nodeA, nodeB in itertools.combinations(alg_list, 2): @@ -206,11 +200,10 @@ def getValuesProperties(node): Excluded = ["StoreGateSvc/DetectorStore", "StoreGateSvc"] values = [] algs = [] - if "AthSequencer" in node.Alg.getFullName(): + if isinstance(node.Alg, AthSequencer): seq=node.Alg algs = seq.getChildren() - algs.pop(0) - #.pop(0) # remove inputmaker + algs.pop(0) # remove InputMaker else: algs.append(node.Alg) @@ -231,7 +224,7 @@ def getValuesProperties(node): return set(values) -def addConnection(nodeA, nodeB, label): +def addConnection(nodeA, nodeB, label=''): line = " %s -> %s \n"%(nodeA,nodeB) #line = " %s -> %s [label=%s]\n"%(nodeA,nodeB,label) # print line diff --git a/Trigger/TrigValidation/TrigUpgradeTest/python/HLTSignatureConfig.py b/Trigger/TrigValidation/TrigUpgradeTest/python/HLTSignatureConfig.py index 4ddbac2fbd3d4e406cd25ea429d28474595cd473..7ae8c2d975c85586ef6f9508c919956f6e30f3b4 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/python/HLTSignatureConfig.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/python/HLTSignatureConfig.py @@ -15,7 +15,7 @@ def InputMakerAlg(name): # - declare all the RecoAlg and the HypoAlg -> create the Sequence # - creates the InputMaker, without the inputs -from TrigUpgradeTest.MenuComponents import NodeSequence, MenuSequence +from TrigUpgradeTest.MenuComponents import HLTRecoSequence, MenuSequence from AthenaCommon.CFElements import parOR, seqAND, stepSeq @@ -50,7 +50,8 @@ def MuStep2HypoTool(): muIM= InputMakerAlg(name="Step1MuInputMaker") muIM.Output='muIM_out' - +print "CACCA" +print muIM muAlg = muMSRecAlg(name="muMSRecAlg", FileName="msmu.dat") muAlg.Output='muAlg_out' @@ -59,10 +60,10 @@ muAlg.Input = muIM.Output muHypo.Input = muAlg.Output mustep1_sequence = seqAND("muSeqStep1", [muIM, muAlg]) -nodeSequence_mu = NodeSequence("muNodeSeq1", Maker=muIM, Sequence=mustep1_sequence, Seed="L1MU", ) +recoSequence_mu = HLTRecoSequence("muNodeSeq1", Maker=muIM, Sequence=mustep1_sequence, Seed="L1MU", ) def muStep1Sequence(): - return MenuSequence("muStep1", nodeSeqList=[nodeSequence_mu], Hypo=muHypo,HypoToolClassName=MuStep1HypoTool()) + return MenuSequence("muStep1", recoSeqList=[recoSequence_mu], Hypo=muHypo,HypoToolClassName=MuStep1HypoTool()) # mu step2 muIM2= InputMakerAlg(name="Step2MuInputMaker") @@ -76,10 +77,10 @@ muAlg2.Input = muIM2.Output muHypo2.Input = muAlg2.Output mustep2_sequence = seqAND("muSeqStep2", [muIM2, muAlg2]) -nodeSequence2_mu = NodeSequence("muNodeSeq2", Sequence=mustep2_sequence, Maker=muIM2, Seed="L1MU") +recoSequence2_mu = HLTRecoSequence("muNodeSeq2", Sequence=mustep2_sequence, Maker=muIM2, Seed="L1MU") def muStep2Sequence(): - return MenuSequence("muStep2", nodeSeqList=[nodeSequence2_mu], Hypo=muHypo2, HypoToolClassName=MuStep2HypoTool()) + return MenuSequence("muStep2", recoSeqList=[recoSequence2_mu], Hypo=muHypo2, HypoToolClassName=MuStep2HypoTool()) ## ##### electron signatures @@ -116,10 +117,10 @@ elAlg.Input = elIM.Output elHypo.Input = elAlg.Output elstep1_sequence = seqAND("elSeqStep1", [elIM, elAlg]) -nodeSequence_el = NodeSequence("elNodeSeq1", Maker=elIM, Sequence=elstep1_sequence, Seed="L1EM") +recoSequence_el = HLTRecoSequence("elNodeSeq1", Maker=elIM, Sequence=elstep1_sequence, Seed="L1EM") def elStep1Sequence(): - return MenuSequence("elStep1", nodeSeqList=[nodeSequence_el], Hypo=elHypo, HypoToolClassName=ElStep1HypoTool()) + return MenuSequence("elStep1", recoSeqList=[recoSequence_el], Hypo=elHypo, HypoToolClassName=ElStep1HypoTool()) #step2 elIM2= InputMakerAlg(name="Step2ElInputMaker") @@ -133,10 +134,10 @@ elAlg2.Input = elIM2.Output elHypo2.Input = elAlg2.Output elstep2_sequence = seqAND("elSeqStep2", [elIM2, elAlg2]) -nodeSequence2_el = NodeSequence("elNodeSeq2", Maker=elIM2, Sequence=elstep2_sequence, Seed="L1EM") +recoSequence2_el = HLTRecoSequence("elNodeSeq2", Maker=elIM2, Sequence=elstep2_sequence, Seed="L1EM") def elStep2Sequence(): - return MenuSequence("elStep2", nodeSeqList=[nodeSequence2_el], Hypo=elHypo2, HypoToolClassName=ElStep2HypoTool()) + return MenuSequence("elStep2", recoSeqList=[recoSequence2_el], Hypo=elHypo2, HypoToolClassName=ElStep2HypoTool()) # combined Hypo # @@ -160,12 +161,12 @@ comboAlg = ComboMuEHypo("Step1ComboMuElHypo") comboAlg.Input1=muAlg.Output comboAlg.Input2=elAlg.Output -nodeSequence_muComb = NodeSequence("Combo1NodeSeq1", Maker=muIM, Sequence=mustep1_sequence, Seed="L1MU") -nodeSequence_elComb = NodeSequence("Combo2NodeSeq1", Maker=elIM, Sequence=elstep1_sequence, Seed="L1EM") +recoSequence_muComb = HLTRecoSequence("Combo1NodeSeq1", Maker=muIM, Sequence=mustep1_sequence, Seed="L1MU") +recoSequence_elComb = HLTRecoSequence("Combo2NodeSeq1", Maker=elIM, Sequence=elstep1_sequence, Seed="L1EM") def combStep1Sequence(): - return MenuSequence("ComboStep1", nodeSeqList=[nodeSequence_muComb,nodeSequence_elComb], Hypo=comboAlg, HypoToolClassName=ComboStep1HypoTool()) + return MenuSequence("ComboStep1", recoSeqList=[recoSequence_muComb,recoSequence_elComb], Hypo=comboAlg, HypoToolClassName=ComboStep1HypoTool()) # step2 @@ -173,8 +174,8 @@ comboAlg2 = ComboMuEHypo("Step2ComboMuElHypo") comboAlg2.Input1=muAlg2.Output comboAlg2.Input2=elAlg2.Output -nodeSequence2_muComb = NodeSequence("Combo1NodeSeq2", Maker=muIM2, Sequence=mustep2_sequence, Seed="L1MU") -nodeSequence2_elComb = NodeSequence("Combo2NodeSeq2", Maker=elIM2, Sequence=elstep2_sequence, Seed="L1EM") +recoSequence2_muComb = HLTRecoSequence("Combo1NodeSeq2", Maker=muIM2, Sequence=mustep2_sequence, Seed="L1MU") +recoSequence2_elComb = HLTRecoSequence("Combo2NodeSeq2", Maker=elIM2, Sequence=elstep2_sequence, Seed="L1EM") def combStep2Sequence(): - return MenuSequence("ComboStep2", nodeSeqList=[nodeSequence2_muComb,nodeSequence2_elComb], Hypo=comboAlg2,HypoToolClassName=ComboStep2HypoTool()) + return MenuSequence("ComboStep2", recoSeqList=[recoSequence2_muComb,recoSequence2_elComb], Hypo=comboAlg2,HypoToolClassName=ComboStep2HypoTool()) diff --git a/Trigger/TrigValidation/TrigUpgradeTest/python/MenuComponents.py b/Trigger/TrigValidation/TrigUpgradeTest/python/MenuComponents.py index 277d9db9650b0f6dfe06a81915f8cb09dd625978..b73a371690a2079367f06c85029079a4b35fb0cd 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/python/MenuComponents.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/python/MenuComponents.py @@ -21,7 +21,6 @@ class Node(): self.inputProp=name def addInput(self, name): - # not sure is needed self.inputProp=name def getInput(self): @@ -38,9 +37,8 @@ class Node(): class AlgNode(Node): - def __init__(self, Alg, inputProp, outputProp, ViewNodeName=''): + def __init__(self, Alg, inputProp, outputProp): Node.__init__(self, Alg, inputProp, outputProp) - self.viewNodeName=ViewNodeName def addDefaultOutput(self): if self.outputProp is not '': @@ -77,6 +75,11 @@ class AlgNode(Node): if self.outputProp is not '': return self.setPar(self.outputProp,name) + def addOutput(self, name): + if self.outputProp is not '': + return self.setParArray(self.outputProp,name) + + def getOutput(self): if self.outputProp is not '': return self.getPar(self.outputProp) @@ -118,36 +121,35 @@ class AlgNode(Node): return inputs def __str__(self): - return "Alg::%s.%s [%s] -> [%s]"%(self.algname,self.viewNodeName, ' '.join(map(str, self.getInputList())), ' '.join(map(str, self.getOutputList()))) + return "Alg::%s [%s] -> [%s]"%(self.algname, ' '.join(map(str, self.getInputList())), ' '.join(map(str, self.getOutputList()))) class HypoAlgNode(AlgNode): - def __init__(self, Alg, inputProp, outputProp): - AlgNode.__init__(self, Alg, inputProp, outputProp) + def __init__(self, Alg): + assert isHypoBase(Alg), "Error in creating HypoAlgNode from Alg " + Alg.name() + AlgNode.__init__(self, Alg, 'HypoInputDecisions', 'HypoOutputDecisions') self.addDefaultOutput() self.tools = [] self.previous=[] def addHypoTool(self, hypoToolName, hypoToolClassName): from TrigUpgradeTest.MenuHypoTools import createHypoTool - self.tools.append(hypoToolName) + tools = self.Alg.HypoTools ## HypoTools are private, so need to be created when added to the Alg - self.Alg.HypoTools = tools+[createHypoTool(hypoToolClassName, hypoToolName)] - # here add a check of good creation of the new tools - status = 0 - return status + try: + self.Alg.HypoTools = tools+[createHypoTool(hypoToolClassName, hypoToolName)] + except: + print "Error in creating HypoTool " + hypoToolName + " of type " + hypoToolClassName - def addPreviousDecision(self,prev): - self.previous.append(prev) - status= self.setParArray('previousDecisions',prev) - return status + self.tools.append(hypoToolName) + return True + def setPreviousDecision(self,prev): self.previous.append(prev) - return self.setPar('previousDecisions',prev) - + return self.setInput(prev) def __str__(self): return "HypoAlg::%s [%s] -> [%s], previous = [%s], HypoTools=[%s]"%(self.Alg.name(),' '.join(map(str, self.getInputList())), @@ -157,10 +159,12 @@ class HypoAlgNode(AlgNode): -class ComboHypoAlgNode(HypoAlgNode): +class ComboHypoAlgNode(AlgNode): # TMP class for curent Combo alg - def __init__(self, Alg, inputProp, outputProp): - HypoAlgNode.__init__(self, Alg, inputProp, outputProp) + def __init__(self, Alg): + AlgNode.__init__(self, Alg, inputProp='', outputProp='') + self.tools = [] + self.previous=[] self.addDefaultOutput() def addDefaultOutput(self): @@ -246,25 +250,45 @@ from DecisionHandling.DecisionHandlingConf import RoRSeqFilter, DumpDecisions class RoRSequenceFilterNode(SequenceFilterNode): def __init__(self, name): Alg= RoRSeqFilter(name, OutputLevel = 2) - inputProp='Input' - outputProp='Output' - SequenceFilterNode.__init__(self, Alg, inputProp, outputProp) + SequenceFilterNode.__init__(self, Alg, 'Input', 'Output') - +class InputMakerNode(AlgNode): + def __init__(self, Alg): + assert isInputMakerBase(Alg), "Error in creating InputMakerNode from Alg " + Alg.name() + AlgNode.__init__(self, Alg, 'InputMakerInputDecisions', 'InputMakerOutputDecisions') + + + +######################################################### +# USEFULL TOOLS +######################################################### + +def isHypoBase(alg): + return ('HypoInputDecisions' in alg.__class__.__dict__) + +def isInputMakerBase(alg): + return ('InputMakerInputDecisions' in alg.__class__.__dict__) + +def isFilterAlg(alg): + return isinstance(alg, RoRSeqFilter) + ########################################################## # NOW sequences and chains ########################################################## -class NodeSequence(): + + +class HLTRecoSequence(): def __init__(self, name, Sequence, Maker, Seed): - print "Making NEW sequence %s"%(name) + print "Making sequence %s"%(name) self.name = name self.seed = Seed self.sequence = Node( Alg=Sequence, inputProp='%s_in'%(Sequence.name()), outputProp='%s_out'%(Sequence.name())) - self.maker = AlgNode( Alg=Maker, inputProp='InputDecisions', outputProp='OutputDecisions') + self.maker = InputMakerNode( Alg=Maker) + #self.maker = AlgNode( Alg=Maker, inputProp='InputMakerInputDecisions', outputProp='InputMakerOutputDecisions') self.reuse = False def getOutputList(self): @@ -279,41 +303,41 @@ class NodeSequence(): def addOutputDecision(self,theinput): print "adding output decisions (%s) to sequence %s (output of alg %s)"%(theinput, self.name, self.maker.algname ) - self.maker.setPar("OutputDecisions", theinput) + self.maker.addOutput(theinput) def __str__(self): - return "NodeSequence::%s with \n Seed::%s \n Maker::%s \n Sequence::%s"%(self.name, self.seed, self.maker, self.sequence) + return "HLTRecoSequence::%s with \n Seed::%s \n Maker::%s \n Sequence::%s"%(self.name, self.seed, self.maker, self.sequence) class MenuSequence(): - def __init__(self, name, nodeSeqList, Hypo, HypoToolClassName): + def __init__(self, name, recoSeqList, Hypo, HypoToolClassName): from AthenaCommon.AlgSequence import AthSequencer self.name = name - self.nodeSeqList=nodeSeqList + self.recoSeqList=recoSeqList self.hypoToolClassName = HypoToolClassName - self.seeds=[seq.seed for seq in nodeSeqList] + self.seeds=[seq.seed for seq in recoSeqList] self.outputs=[] - if "Combo" in name: - self.hypo = ComboHypoAlgNode( Alg=Hypo, inputProp='', outputProp='') + if "Combo" in name: #TMP for combo + self.hypo = ComboHypoAlgNode( Alg=Hypo ) new_outputs = [] outputs=self.hypo.getOutputList() iseq=0 - for seq in self.nodeSeqList: + for seq in self.recoSeqList: new_outputs.append("%s_%s"%(seq.seed, outputs[iseq])) self.hypo.setOutputs(new_outputs) self.outputs=new_outputs - elif len(self.nodeSeqList) == 1: - self.hypo = HypoAlgNode( Alg=Hypo, inputProp='previousDecisions', outputProp='Output') - new_output = "%s_%s"%(self.nodeSeqList[0].seed, self.hypo.getOutput()) + elif len(self.recoSeqList) == 1: + self.hypo = HypoAlgNode( Alg=Hypo) + new_output = "%s_%s"%(self.recoSeqList[0].seed, self.hypo.getOutput()) self.hypo.setOutput(new_output) self.outputs.append(new_output) def __str__(self): - return "MenuSequence::%s \n Hypo::%s \n %s"%(self.name, self.hypo, ',\n '.join(map(str, self.nodeSeqList))) + return "MenuSequence::%s \n Hypo::%s \n %s"%(self.name, self.hypo, ',\n '.join(map(str, self.recoSeqList))) class CFSequence(): diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/EmuStepProcessingTest.py b/Trigger/TrigValidation/TrigUpgradeTest/share/EmuStepProcessingTest.py index 95fa405015a9eabc80da541eb8780a99028a400c..a2984306cb176bfc650cc825bfbe78e3f4fd138e 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/EmuStepProcessingTest.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/share/EmuStepProcessingTest.py @@ -111,8 +111,8 @@ for unpack in l1Decoder.roiUnpackers: # signatures from TrigUpgradeTest.HLTCFConfig import decisionTree_From_Chains -from TrigUpgradeTest.MenuComponents import NodeSequence, MenuSequence, Chain, ChainStep -#from TrigUpgradeTest.HLTSignatureConfig import * +from TrigUpgradeTest.MenuComponents import MenuSequence, Chain, ChainStep + doMuon=True doElectron=True diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/HLTCF.py b/Trigger/TrigValidation/TrigUpgradeTest/share/HLTCF.py index 3ba5acfda5e38f96b51331066bd2825dccdf1dce..b4830f123486e4f69d47327648f502694b1833a9 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/HLTCF.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/share/HLTCF.py @@ -48,7 +48,7 @@ def TestRecoAlg(name, Output, FileName="noreco.dat", Input=""): from TrigUpgradeTest.TrigUpgradeTestConf import HLTTest__TestHypoAlg def TestHypoAlg(name, Input, Output): fname = "H_"+name - h = HLTTest__TestHypoAlg(fname, OutputLevel = DEBUG, Input=Input, Output=Output) + h = HLTTest__TestHypoAlg(fname, OutputLevel = DEBUG, HypoInputDecisions=Input, HypoOutputDecisions=Output) allAlgs[name] = h return h @@ -56,7 +56,7 @@ def TestHypoAlg(name, Input, Output): def merger(name, Inputs, Output ): from TrigUpgradeTest.TrigUpgradeTestConf import HLTTest__TestInputMaker outdec=["%s_decision"%i for i in Output] - return remember(name, HLTTest__TestInputMaker( "M_"+name, OutputLevel=DEBUG, InputDecisions=Inputs, Output=Output, OutputDecisions=outdec, LinkName="initialRoI" ) ) + return remember(name, HLTTest__TestInputMaker( "M_"+name, OutputLevel=DEBUG, InputMakerInputDecisions=Inputs, Output=Output, InputMakerOutputDecisions=outdec, LinkName="initialRoI" ) ) def addSteps(s): diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/egamma.menu.py b/Trigger/TrigValidation/TrigUpgradeTest/share/egamma.menu.py index 872117bdd2e799d5562bd9933d1606f5d5ba9431..273676948c09633f1062f171a8e5e9eeff5979f3 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/egamma.menu.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/share/egamma.menu.py @@ -38,7 +38,7 @@ if globalflags.InputFormat.is_bytestream(): # menu components from TrigUpgradeTest.HLTCFConfig import decisionTree_From_Chains -from TrigUpgradeTest.MenuComponents import NodeSequence, MenuSequence, Chain, ChainStep +from TrigUpgradeTest.MenuComponents import HLTRecoSequence, MenuSequence, Chain, ChainStep # =============================================================================================== # L2 Calo @@ -58,9 +58,6 @@ trigL2CaloRingerFexMT.OutputLevel = DEBUG from AthenaCommon.CFElements import parOR, seqOR, seqAND, stepSeq - -#from DecisionHandling.DecisionHandlingConf import RoRSeqFilter, DumpDecisions - from ViewAlgs.ViewAlgsConf import TestEventViewCreatorAlgorithm fastCaloInViewAlgs = seqAND("fastCaloInViewAlgs", [theFastCaloAlgo, trigL2CaloRingerFexMT]) @@ -88,13 +85,13 @@ theFastCaloHypo.CaloClusters = theFastCaloAlgo.ClustersName fastCaloSequence = seqAND("fastCaloSequence",[fastCaloViewsMaker, fastCaloInViewAlgs ]) -fastCalo_NodeSequence = NodeSequence("fastCalo_NodeSequence", +fastCalo_HLTSequence = HLTRecoSequence("fastCalo_HLTSequence", Sequence=fastCaloSequence, Maker=fastCaloViewsMaker, Seed="L1EM") fastCaloSequence = MenuSequence("egammaCaloStep", - nodeSeqList=[fastCalo_NodeSequence], + recoSeqList=[fastCalo_HLTSequence], Hypo=theFastCaloHypo, HypoToolClassName="TrigL2CaloHypoToolConf",) @@ -164,23 +161,21 @@ theElectronHypo.OutputLevel = VERBOSE #electronDecisionsDumper = DumpDecisions("electronDecisionsDumper", OutputLevel=DEBUG, Decisions = theElectronHypo.Output ) electronSequence = seqAND("electronSequence", eventAlgs + [l2ElectronViewsMaker, electronInViewAlgs ] ) -#electronSequence = seqAND("electronSequence", [electronViewSequence] ) -electron_NodeSequence = NodeSequence("electron_NodeSequence", +electron_HLTSequence = HLTRecoSequence("electron_HLTSequence", Maker=l2ElectronViewsMaker, Sequence=electronSequence, Seed="L1EM") electronSequence = MenuSequence("electronStep", - nodeSeqList=[electron_NodeSequence], + recoSeqList=[electron_HLTSequence], Hypo=theElectronHypo, HypoToolClassName="TrigL2ElectronHypoToolConf") ########################################## # menu ########################################## -#testChains = ["HLT_e3_etcut", "HLT_e5_etcut", "HLT_e7_etcut", "HLT_2e3_etcut", "HLT_e3e5_etcut"] # map L1 decisions for menu for unpack in topSequence.L1DecoderTest.roiUnpackers: @@ -200,14 +195,13 @@ for unpack in topSequence.L1DecoderTest.rerunRoiUnpackers: if unpack.name() is "MURerunRoIsUnpackingTool": unpack.SourceDecisions="L1MU" + +# menu + testChains = [ Chain(name='HLT_e3_etcut', Seed="L1_EM3", \ ChainSteps=[ ChainStep("Step1_e3_etcut", [fastCaloSequence]), ChainStep("Step2_e3_etcut", [electronSequence])] ), - - ## Chain(name='HLT_e3_etcut', Seed="L1_EM3", \ - ## ChainSteps=[ ChainStep("Step1_e3_etcut", [SequenceHypoTool(fastCaloSequence,step1_e3_etcut() )])] ), - Chain(name='HLT_e5_etcut', Seed="L1_EM3", \ ChainSteps=[ChainStep("Step1_e5_etcut", [fastCaloSequence])]), Chain(name='HLT_e7_etcut', Seed="L1_EM3", \ diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/egamma.withViews.py b/Trigger/TrigValidation/TrigUpgradeTest/share/egamma.withViews.py index 266459f1b67622b4d5efe703b1751002ceaf50c7..fca140d3605e85dc0291eb200065c6161f51d9ac 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/egamma.withViews.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/share/egamma.withViews.py @@ -82,23 +82,23 @@ def createFastCaloSequence(rerun=False): fastCaloViewsMaker = TestEventViewCreatorAlgorithm( __prefix+"fastCaloViewsMaker", OutputLevel=DEBUG) fastCaloViewsMaker.ViewFallThrough = True - fastCaloViewsMaker.InputDecisions = [ __forViewDecsions ] + fastCaloViewsMaker.InputMakerInputDecisions = [ __forViewDecsions ] fastCaloViewsMaker.RoIsLink = "initialRoI" # -||- fastCaloViewsMaker.InViewRoIs = "EMCaloRoIs" # contract with the fastCalo fastCaloViewsMaker.Views = __prefix+"EMCaloViews" fastCaloViewsMaker.ViewNodeName = __prefix+"fastCaloInViewAlgs" - fastCaloViewsMaker.OutputDecisions = [ "L2CaloLinks"] + fastCaloViewsMaker.InputMakerOutputDecisions = [ "L2CaloLinks"] clusterMaker.RoIs = fastCaloViewsMaker.InViewRoIs from TrigEgammaHypo.TrigEgammaHypoConf import TrigL2CaloHypoAlgMT from TrigEgammaHypo.TrigL2CaloHypoTool import TrigL2CaloHypoToolFromName fastCaloHypo = TrigL2CaloHypoAlgMT( __prefix+"L2CaloHypo" ) fastCaloHypo.OutputLevel = DEBUG - fastCaloHypo.previousDecisions = fastCaloViewsMaker.OutputDecisions[0] # __l1RoIDecisions + fastCaloHypo.HypoInputDecisions = fastCaloViewsMaker.InputMakerOutputDecisions[0] # __l1RoIDecisions # fastCaloHypo.Views = fastCaloViewsMaker.Views fastCaloHypo.CaloClusters = clusterMaker.ClustersName # fastCaloHypo.RoIs = fastCaloViewsMaker.InViewRoIs - fastCaloHypo.Output = __prefix+"EgammaCaloDecisions" + fastCaloHypo.HypoOutputDecisions = __prefix+"EgammaCaloDecisions" fastCaloHypo.HypoTools = [ TrigL2CaloHypoToolFromName( c ) for c in testChains ] for t in fastCaloHypo.HypoTools: @@ -145,7 +145,7 @@ theElectronFex.OutputLevel=VERBOSE filterCaloRoIsAlg = RoRSeqFilter("filterCaloRoIsAlg") -caloHypoDecisions = findAlgorithm(egammaCaloStep, "L2CaloHypo").Output +caloHypoDecisions = findAlgorithm(egammaCaloStep, "L2CaloHypo").HypoOutputDecisions print "kkkk ", caloHypoDecisions filterCaloRoIsAlg.Input = [caloHypoDecisions] filterCaloRoIsAlg.Output = ["Filtered" + caloHypoDecisions]