예제 #1
0
    def runTest(self):
        destinationCA = ComponentAccumulator()
        destinationCA.addSequence(seqAND("dest"))

        sourceCA = ComponentAccumulator()
        sourceCA.addEventAlgo(TestAlgo("alg1"))
        sourceCA.addEventAlgo(TestAlgo("alg2"))
        sourceCA.addSequence(seqAND("innerSeq"))
        sourceCA.addEventAlgo(TestAlgo("alg3"), sequenceName="innerSeq")

        destinationCA.merge(sourceCA, sequenceName="dest")

        #destinationCA.merge( sourceCA )
        self.assertIsNotNone(
            findAlgorithm(destinationCA.getSequence("dest"), "alg1"),
            "Algorithm not placed in sub-sequence")
        self.assertIsNotNone(
            findSubSequence(destinationCA.getSequence(), "innerSeq"),
            "The sequence is not added")
        self.assertIsNotNone(
            findAlgorithm(destinationCA.getSequence("dest"), "alg3"),
            "Algorithm deep in thesource CA not placed in sub-sequence of destiantion CA"
        )
        destinationCA.wasMerged()
        sourceCA.wasMerged()
예제 #2
0
 def test_algorithmsAreAdded(self):
     self.assertEqual(
         findAlgorithm(self.acc.getSequence(), "Algo1", 1).name, "Algo1",
         "Algorithm not added to a top sequence")
     self.assertEqual(
         findAlgorithm(self.acc.getSequence(), "Algo2", 1).name, "Algo2",
         "Algorithm not added to a top sequence")
     self.assertEqual(
         findAlgorithm(self.acc.getSequence(), "Algo3", 1).name, "Algo3",
         "Algorithm not added to a top sequence")
예제 #3
0
 def test_algorithmsInNestedSequences(self):
     self.assertIsNotNone(
         findAlgorithm(self.acc.getSequence(), "NestedAlgo1"),
         "Algorithm added to nested sequence")
     self.assertIsNotNone(
         findAlgorithm(self.acc.getSequence(), "NestedAlgo1", 1) is None,
         "Algorithm mistakenly in top sequence")
     self.assertIsNotNone(
         findAlgorithm(
             findSubSequence(self.acc.getSequence(), "sub2Sequence1"),
             "NestedAlgo1", 1), "Algorithm not in right sequence")
예제 #4
0
    def runTest(self):
        # test if an algorithm (or sequence) can be controlled by more than one sequence

        accTop = ComponentAccumulator()

        recoSeq = seqAND("seqReco")
        recoAlg = TestAlgo("recoAlg")
        recoSeq.Members.append(recoAlg)

        acc1 = ComponentAccumulator()
        acc1.addSequence(seqAND("seq1"))
        acc1.addSequence(recoSeq, parentName="seq1")

        acc2 = ComponentAccumulator()
        acc2.addSequence(seqAND("seq2"))
        acc2.addSequence(recoSeq, parentName="seq2")

        accTop.merge(acc1)
        accTop.merge(acc2)

        accTop.printConfig()

        self.assertIsNotNone(
            findAlgorithm(accTop.getSequence("seq1"), "recoAlg"),
            "Algorithm missing in the first sequence")
        self.assertIsNotNone(
            findAlgorithm(accTop.getSequence("seq2"), "recoAlg"),
            "Algorithm missing in the second sequence")
        s = accTop.getSequence("seqReco")
        self.assertEqual(
            len(s.Members), 1,
            "Wrong number of algorithms in reco seq: %d " % len(s.Members))
        self.assertIs(findAlgorithm(accTop.getSequence("seq1"), "recoAlg"),
                      findAlgorithm(accTop.getSequence("seq2"), "recoAlg"),
                      "Algorithms are cloned")
        self.assertIs(findAlgorithm(accTop.getSequence("seq1"), "recoAlg"),
                      recoAlg, "Clone of the original inserted in sequence")

        fout = open("dummy.pkl", "wb")
        accTop.store(fout)
        fout.close()
예제 #5
0
def makeHLTTree(newJO=False, triggerConfigHLT=None):
    """ creates the full HLT tree"""

    # Check if triggerConfigHLT exits, if yes, derive information from this
    # this will be in use once TrigUpgrade test has migrated to TriggerMenuMT completely

    # get topSequnece
    from AthenaCommon.AlgSequence import AlgSequence
    topSequence = AlgSequence()

    # find main HLT top sequence (already set up in runHLT_standalone)
    from AthenaCommon.CFElements import findSubSequence, findAlgorithm
    l1decoder = findAlgorithm(topSequence, "L1Decoder")

    # add the HLT steps Node
    steps = seqAND("HLTAllSteps")
    hltTop = findSubSequence(topSequence, "HLTTop")
    hltTop += steps

    hltEndSeq = parOR("HLTEndSeq")
    hltTop += hltEndSeq

    hltFinalizeSeq = seqAND("HLTFinalizeSeq")

    # make DF and CF tree from chains
    finalDecisions = decisionTreeFromChains(steps,
                                            triggerConfigHLT.configsList(),
                                            triggerConfigHLT.dictsList(),
                                            newJO)

    flatDecisions = []
    for step in finalDecisions:
        flatDecisions.extend(step)

    summary = makeSummary("Final", flatDecisions)
    hltEndSeq += summary

    # TODO - check we are not running things twice. Once here and once in TriggerConfig.py

    from TriggerJobOpts.TriggerConfig import collectHypos, collectFilters, collectViewMakers, collectDecisionObjects,\
        triggerMonitoringCfg, triggerSummaryCfg, triggerMergeViewsAndAddMissingEDMCfg, collectHypoDecisionObjects
    from AthenaConfiguration.AllConfigFlags import ConfigFlags

    from AthenaConfiguration.ComponentAccumulator import conf2toConfigurable, appendCAtoAthena

    # Collections required to configure the algs below
    hypos = collectHypos(steps)
    filters = collectFilters(steps)
    viewMakers = collectViewMakers(steps)

    Configurable.configurableRun3Behavior = 1
    summaryAcc, summaryAlg = triggerSummaryCfg(ConfigFlags, hypos)
    Configurable.configurableRun3Behavior = 0
    # A) First we check if any chain accepted the event
    hltFinalizeSeq += conf2toConfigurable(summaryAlg)
    appendCAtoAthena(summaryAcc)

    # B) Then (if true), we run the accepted event algorithms.
    # Add any required algs to hltFinalizeSeq here

    # More collections required to configure the algs below
    decObj = collectDecisionObjects(hypos, filters, l1decoder, summaryAlg)
    decObjHypoOut = collectHypoDecisionObjects(hypos,
                                               inputs=False,
                                               outputs=True)

    Configurable.configurableRun3Behavior = 1
    monAcc, monAlg = triggerMonitoringCfg(ConfigFlags, hypos, filters,
                                          l1decoder)
    Configurable.configurableRun3Behavior = 0
    hltEndSeq += conf2toConfigurable(monAlg)
    appendCAtoAthena(monAcc)

    Configurable.configurableRun3Behavior = 1
    edmAlg = triggerMergeViewsAndAddMissingEDMCfg(['AOD', 'ESD'], hypos,
                                                  viewMakers, decObj,
                                                  decObjHypoOut)
    Configurable.configurableRun3Behavior = 0
    # C) Finally, we create the EDM output
    hltFinalizeSeq += conf2toConfigurable(edmAlg)

    hltEndSeq += hltFinalizeSeq

    # Test the configuration
    from TriggerMenuMT.HLTMenuConfig.Menu.CFValidation import testHLTTree
    testHLTTree(hltTop)
예제 #6
0
doWriteBS = False
include("TriggerJobOpts/runHLT_standalone.py")

from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()

doHLTCaloTopo=True
doL2Egamma=True

# ----------------------------------------------------------------
# Setup Views
# ----------------------------------------------------------------
from AthenaCommon.CFElements import stepSeq,seqOR,findAlgorithm
from DecisionHandling.DecisionHandlingConf import RoRSeqFilter

topSequence.remove( findAlgorithm(topSequence, "L1Decoder") )
from L1Decoder.L1DecoderConf import L1TestDecoder
topSequence += L1TestDecoder("L1TestDecoder", OutputLevel=DEBUG)

steps = seqOR("HLTTop")
topSequence += steps

if TriggerFlags.doCalo:
  if ( doHLTCaloTopo ) :
    from TrigT2CaloCommon.CaloDef import HLTFSTopoRecoSequence
    recosequence, caloclusters = HLTFSTopoRecoSequence("HLT_TestFSRoI")
    steps += recosequence

  if ( doL2Egamma ) :
     from TrigT2CaloCommon.CaloDef import createFastCaloSequence
     filterL1RoIsAlg = RoRSeqFilter( "filterL1RoIsAlg")
예제 #7
0
    condSeq += JetTagCalibCfg(ConfigFlags,
                              scheme="Trig",
                              TaggerList=ConfigFlags.BTagging.Run2TrigTaggers +
                              ConfigFlags.BTagging.Run3NewTrigTaggers,
                              NewChannel=alias)

#-------------------------------------------------------------
# Output configuration
#-------------------------------------------------------------
if opt.doWriteBS or opt.doWriteRDOTrigger:
    from TriggerJobOpts.TriggerConfig import collectHypos, collectFilters, collectDecisionObjects, collectHypoDecisionObjects, triggerOutputCfg
    from AthenaCommon.CFElements import findAlgorithm, findSubSequence
    hypos = collectHypos(findSubSequence(topSequence, "HLTAllSteps"))
    filters = collectFilters(findSubSequence(topSequence, "HLTAllSteps"))

    summaryMakerAlg = findAlgorithm(topSequence, "DecisionSummaryMakerAlg")
    l1decoder = findAlgorithm(topSequence, "L1Decoder")

    if l1decoder and summaryMakerAlg:
        decObj = collectDecisionObjects(hypos, filters, l1decoder,
                                        summaryMakerAlg)
        decObjHypoOut = collectHypoDecisionObjects(hypos,
                                                   inputs=False,
                                                   outputs=True)
        log.debug(
            "Decision Objects to write to output [hack method - should be replaced with triggerRunCfg()]"
        )
        log.debug(decObj)
    else:
        log.error(
            "Failed to find L1Decoder or DecisionSummaryMakerAlg, cannot determine Decision names for output configuration"
예제 #8
0
doWriteBS = False

include("TriggerJobOpts/runHLT_standalone.py")

from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()

# ----------------------------------------------------------------
# Setup Views
# ----------------------------------------------------------------
from AthenaCommon.CFElements import stepSeq, seqOR, findAlgorithm
from DecisionHandling.DecisionHandlingConf import RoRSeqFilter
from AthenaCommon.Constants import DEBUG
from TriggerJobOpts.TriggerFlags import TriggerFlags

topSequence.remove(findAlgorithm(topSequence, "L1Decoder"))
from L1Decoder.L1DecoderConf import L1TestDecoder
topSequence += L1TestDecoder("L1TestDecoder", OutputLevel=DEBUG)

steps = seqOR("HLTTop")
topSequence += steps
#steps += topSequence.L1Decoder

if TriggerFlags.doCalo:

    if (doHLTCaloTopo):
        from TrigT2CaloCommon.CaloDef import HLTFSTopoRecoSequence

        recosequence, caloclusters = HLTFSTopoRecoSequence("HLT_TestFSRoI")
        steps += recosequence