Example #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()
Example #2
0
def createCFTree(CFseq):
    """ Creates AthSequencer nodes with sequences attached """

    log.debug(" *** Create CF Tree for CFSequence %s", CFseq.step.name)
    filterAlg = CFseq.filter.Alg

    #empty step:
    if len(CFseq.step.sequences) == 0:
        seqAndWithFilter = seqAND(CFseq.step.name, [filterAlg])
        return seqAndWithFilter

    stepReco = parOR(
        CFseq.step.name + CFNaming.RECO_POSTFIX
    )  # all reco algoritms from al lthe sequences in a parallel sequence
    seqAndView = seqAND(
        CFseq.step.name + CFNaming.VIEW_POSTFIX,
        [stepReco])  # include in seq:And to run in views: add here the Hypo
    seqAndWithFilter = seqAND(
        CFseq.step.name,
        [filterAlg, seqAndView])  # add to the main step+filter

    recoSeq_list = set()
    hypo_list = set()
    for menuseq in CFseq.step.sequences:
        menuseq.addToSequencer(recoSeq_list, hypo_list)

    stepReco += [recoseq for recoseq in recoSeq_list]
    seqAndView += [hypo for hypo in hypo_list]

    if CFseq.step.isCombo:
        seqAndView += CFseq.step.combo.Alg

    return seqAndWithFilter
Example #3
0
 def selfSequence():
     from AthenaCommon.CFElements import seqAND
     accTop = ComponentAccumulator()
     accTop.wasMerged()
     seq1 = seqAND("seq1")
     seq1_again = seqAND("seq1")
     accTop.addSequence(seq1)
     accTop.addSequence(seq1_again, parentName="seq1")
Example #4
0
def fastElectronSequence(ConfigFlags):
    """ second step:  tracking....."""

    from TrigInDetConfig.InDetSetup import makeInDetAlgs
    RoIs = "EMIDRoIs"  # contract with the fastCalo
    viewAlgs, viewVerify = makeInDetAlgs(
        whichSignature="Electron",
        separateTrackParticleCreator="Electron",
        rois=RoIs)

    # A simple algorithm to confirm that data has been inherited from parent view
    # Required to satisfy data dependencies
    from TriggerMenuMT.HLTMenuConfig.CommonSequences.CaloSequenceSetup import CaloMenuDefs
    viewVerify.DataObjects += [('xAOD::TrigEMClusterContainer',
                                'StoreGateSvc+' + CaloMenuDefs.L2CaloClusters),
                               ('TrigRoiDescriptorCollection',
                                'StoreGateSvc+' + RoIs)]

    from IOVDbSvc.CondDB import conddb
    if not conddb.folderRequested("/PIXEL/DCS/FSMSTATUS"):
        viewVerify.DataObjects += [('CondAttrListCollection',
                                    'ConditionStore+/PIXEL/DCS/FSMSTATUS')]
    if not conddb.folderRequested("/PIXEL/DCS/FSMSTATE"):
        viewVerify.DataObjects += [('CondAttrListCollection',
                                    'ConditionStore+/PIXEL/DCS/FSMSTATE')]

    TrackParticlesName = ""
    for viewAlg in viewAlgs:
        if "InDetTrigTrackParticleCreatorAlg" in viewAlg.name():
            TrackParticlesName = viewAlg.TrackParticlesName

    from TrigEgammaHypo.TrigEgammaFastElectronFexMTConfig import EgammaFastElectronFex_1
    theElectronFex = EgammaFastElectronFex_1()
    theElectronFex.TrigEMClusterName = CaloMenuDefs.L2CaloClusters
    theElectronFex.TrackParticlesName = TrackParticlesName
    theElectronFex.ElectronsName = recordable("HLT_FastElectrons")

    # EVCreator:
    l2ElectronViewsMaker = EventViewCreatorAlgorithm("IMl2Electron")
    l2ElectronViewsMaker.RoIsLink = "initialRoI"
    l2ElectronViewsMaker.RoITool = ViewCreatorInitialROITool()
    l2ElectronViewsMaker.InViewRoIs = RoIs
    l2ElectronViewsMaker.Views = "EMElectronViews"
    l2ElectronViewsMaker.ViewFallThrough = True
    l2ElectronViewsMaker.RequireParentView = True

    theElectronFex.RoIs = l2ElectronViewsMaker.InViewRoIs
    # ATR-20453
    # Until such time as FS and RoI collections do not interfere, a hacky fix
    #electronInViewAlgs = parOR("electronInViewAlgs", viewAlgs + [ theElectronFex ])
    electronInViewAlgs = seqAND("electronInViewAlgs",
                                viewAlgs + [theElectronFex])
    l2ElectronViewsMaker.ViewNodeName = "electronInViewAlgs"

    electronAthSequence = seqAND("electronAthSequence",
                                 [l2ElectronViewsMaker, electronInViewAlgs])
    return (electronAthSequence, l2ElectronViewsMaker,
            theElectronFex.ElectronsName)
Example #5
0
    def setUp(self):

        # trivial case without any nested sequences

        log.setLevel(DEBUG)

        dummyCfgFlags = AthConfigFlags()
        dummyCfgFlags.lock()

        def AlgsConf1(flags):
            acc = ComponentAccumulator()
            a1 = TestAlgo("Algo1")
            a2 = TestAlgo("Algo2")
            return acc, [a1, a2]

        def AlgsConf2(flags):
            acc = ComponentAccumulator()
            result, algs = AlgsConf1(flags)
            acc.merge(result)
            a = TestAlgo("Algo3")
            print("algo3 when created %s" % id(a))
            algs.append(a)
            return acc, algs

        acc = ComponentAccumulator()

        # top level algs
        acc1, algs = AlgsConf2(dummyCfgFlags)
        acc.merge(acc1)
        acc.addEventAlgo(algs)

        def AlgsConf3(flags):
            acc = ComponentAccumulator()
            na1 = TestAlgo("NestedAlgo1")
            return acc, na1

        def AlgsConf4(flags):
            acc, na1 = AlgsConf3(flags)
            NestedAlgo2 = TestAlgo("NestedAlgo2")
            NestedAlgo2.OutputLevel = 7
            return acc, na1, NestedAlgo2

        acc.addSequence(seqAND("Nest"))
        acc.addSequence(seqAND("subSequence1"), parentName="Nest")
        acc.addSequence(parOR("subSequence2"), parentName="Nest")

        acc.addSequence(seqAND("sub2Sequence1"), parentName="subSequence1")
        acc.addSequence(seqAND("sub3Sequence1"), parentName="subSequence1")
        acc.addSequence(seqAND("sub4Sequence1"), parentName="subSequence1")

        accNA1 = AlgsConf4(dummyCfgFlags)
        acc.merge(accNA1[0])
        acc.addEventAlgo(accNA1[1:], "sub2Sequence1")
        outf = open("testFile.pkl", "wb")
        acc.store(outf)
        outf.close()
        self.acc = acc
Example #6
0
def muEFCBAlgSequence(ConfigFlags):

    #By default the EFCB sequence will run both outside-in and
    #(if zero muons are found) inside-out reconstruction
    from TrigMuonEF.TrigMuonEFConf import MuonFilterAlg, MergeEFMuonsAlg
    from TriggerMenuMT.HLTMenuConfig.Muon.MuonSetup import muEFCBRecoSequence, muEFInsideOutRecoSequence

    efcbViewsMaker = EventViewCreatorAlgorithm("IMefcbtotal")
    #
    efcbViewsMaker.RoIsLink = "roi"  # Merge based on L2SA muon
    efcbViewsMaker.RoITool = ViewCreatorPreviousROITool(
    )  # Spawn EventViews on L2SA muon ROI
    #
    efcbViewsMaker.Views = "MUEFCBViewRoIs"
    efcbViewsMaker.InViewRoIs = "MUEFCBRoIs"
    #
    efcbViewsMaker.RequireParentView = True
    efcbViewsMaker.ViewFallThrough = True
    efcbViewsMaker.mergeUsingFeature = True

    #outside-in reco sequence
    muEFCBRecoSequence, sequenceOutCB = muEFCBRecoSequence(
        efcbViewsMaker.InViewRoIs, "RoI")

    #Algorithm to filter events with no muons
    muonFilter = MuonFilterAlg("FilterZeroMuons")
    muonFilter.MuonContainerLocation = sequenceOutCB

    #inside-out reco sequence - runs only if filter is passed
    muonEFInsideOutRecoSequence, sequenceOutInsideOut = muEFInsideOutRecoSequence(
        efcbViewsMaker.InViewRoIs, "RoI")
    muonInsideOutSequence = seqAND("muonEFInsideOutSequence",
                                   [muonFilter, muonEFInsideOutRecoSequence])

    #combine outside-in and inside-out sequences
    muonRecoSequence = parOR("muonEFCBandInsideOutRecoSequence",
                             [muEFCBRecoSequence, muonInsideOutSequence])

    #Merge muon containers from outside-in and inside-out reco
    muonMerger = MergeEFMuonsAlg("MergeEFMuons")
    muonMerger.MuonCBContainerLocation = sequenceOutCB
    muonMerger.MuonInsideOutContainerLocation = sequenceOutInsideOut
    muonMerger.MuonOutputLocation = muNames.EFCBName
    sequenceOut = muonMerger.MuonOutputLocation

    #Add merging alg in sequence with reco sequences
    mergeSequence = seqOR("muonCBInsideOutMergingSequence",
                          [muonRecoSequence, muonMerger])

    #Final sequence running in view
    efcbViewsMaker.ViewNodeName = mergeSequence.name()
    muonSequence = seqAND("muonEFCBandInsideOutSequence",
                          [efcbViewsMaker, mergeSequence])

    return (muonSequence, efcbViewsMaker, sequenceOut)
Example #7
0
        def selfMergedGrandParentSequence():
            from AthenaCommon.CFElements import seqAND
            acc1 = ComponentAccumulator()
            acc1.wasMerged()
            acc1.addSequence(seqAND("seq1"))

            acc2 = ComponentAccumulator()
            acc2.wasMerged()
            acc2.addSequence(seqAND("seq2"))
            acc2.addSequence(seqAND("seq1"), parentName="seq2")
            acc1.merge(acc2, sequenceName="seq1")
Example #8
0
    def configure(self):
        log = logging.getLogger("ByteStreamUnpackGetter")

        log.info("TriggerFlags.dataTakingConditions: %s",
                 TriggerFlags.dataTakingConditions())
        hasHLT = TriggerFlags.dataTakingConditions(
        ) == 'HltOnly' or TriggerFlags.dataTakingConditions() == 'FullTrigger'
        if not hasHLT:
            log.info(
                "Will not configure HLT BS unpacking because dataTakingConditions flag indicates HLT was disabled"
            )
            return True

        # Define the decoding sequence
        from TrigHLTResultByteStream.TrigHLTResultByteStreamConf import HLTResultMTByteStreamDecoderAlg
        from TrigOutputHandling.TrigOutputHandlingConf import TriggerEDMDeserialiserAlg
        from AthenaCommon.CFElements import seqAND
        decoder = HLTResultMTByteStreamDecoderAlg()
        deserialiser = TriggerEDMDeserialiserAlg("TrigDeserialiser")
        decodingSeq = seqAND("HLTDecodingSeq")
        decodingSeq += decoder  # BS -> HLTResultMT
        decodingSeq += deserialiser  # HLTResultMT -> xAOD

        # Append the decoding sequence to topSequence
        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()
        topSequence += decodingSeq

        log.debug("Configured HLT result BS decoding sequence")
        return True
Example #9
0
def minbiasSpacePointAthSequence(ConfigFlags):
    InputMakerAlg = clusterFSInputMaker()
    (recoSequence, sequenceOut) = MinBiasRecoSequences()

    minbiasSpacePointAthSequence = seqAND("minbiasSpacePointAthSequence",
                                          [InputMakerAlg, recoSequence])
    return (minbiasSpacePointAthSequence, InputMakerAlg, sequenceOut)
Example #10
0
def efLateMuAlgSequence(ConfigFlags):

    from TriggerMenuMT.HLTMenuConfig.Muon.MuonSetup import muEFInsideOutRecoSequence, makeMuonPrepDataAlgs, muonIDFastTrackingSequence
    eflateViewsMaker = EventViewCreatorAlgorithm("IMeflatemu")
    roiTool = ViewCreatorNamedROITool(
    )  # Use an existing ROI which is linked to the navigation with a custom name.
    roiTool.ROILinkName = "feature"  # The ROI is actually linked as Step 1's feature. So the custom name is "feature".
    #
    eflateViewsMaker.mergeUsingFeature = True  # Expect to have efLateMuRoIAlgSequence produce one Decision Object per lateROI, keep these distinct in the merging
    eflateViewsMaker.RoITool = roiTool
    #
    eflateViewsMaker.Views = "MUEFLATEViewRoIs"
    eflateViewsMaker.InViewRoIs = "MUEFLATERoIs"
    #
    eflateViewsMaker.ViewFallThrough = True

    #decode data in these RoIs
    viewAlgs_MuonPRD = makeMuonPrepDataAlgs(RoIs=eflateViewsMaker.InViewRoIs)
    #ID fast tracking
    muFastIDRecoSequence = muonIDFastTrackingSequence(
        eflateViewsMaker.InViewRoIs, "Late")
    #inside-out reco sequence
    muonEFInsideOutRecoSequence, sequenceOut = muEFInsideOutRecoSequence(
        eflateViewsMaker.InViewRoIs, "LateMu")

    lateMuRecoSequence = parOR(
        "lateMuonRecoSequence",
        [viewAlgs_MuonPRD, muFastIDRecoSequence, muonEFInsideOutRecoSequence])

    #Final sequence running in view
    eflateViewsMaker.ViewNodeName = lateMuRecoSequence.name()
    muonSequence = seqAND("lateMuonOutSequence",
                          [eflateViewsMaker, lateMuRecoSequence])

    return (muonSequence, eflateViewsMaker, sequenceOut)
Example #11
0
def muIsoAlgSequence(ConfigFlags):

    l2muIsoViewsMaker = EventViewCreatorAlgorithm("IMl2muIso")
    #
    l2muIsoViewsMaker.RoIsLink = "roi"  # Merge based on L2SA muon
    l2muIsoViewsMaker.RoITool = ViewCreatorPreviousROITool(
    )  # Spawn EventViews on L2SA muon ROI
    #
    l2muIsoViewsMaker.Views = "MUIsoViewRoIs"
    l2muIsoViewsMaker.InViewRoIs = "MUIsoRoIs"
    #
    l2muIsoViewsMaker.RequireParentView = True
    l2muIsoViewsMaker.ViewFallThrough = True

    ### get EF reco sequence ###
    from TriggerMenuMT.HLTMenuConfig.Muon.MuonSetup import l2muisoRecoSequence
    l2muisoRecoSequence, sequenceOut = l2muisoRecoSequence(
        l2muIsoViewsMaker.InViewRoIs)

    l2muIsoViewsMaker.ViewNodeName = l2muisoRecoSequence.name()

    ### Define a Sequence to run for muIso ###
    l2muIsoSequence = seqAND("l2muIsoSequence",
                             [l2muIsoViewsMaker, l2muisoRecoSequence])

    return (l2muIsoSequence, l2muIsoViewsMaker, sequenceOut)
Example #12
0
def muFastAlgSequence(ConfigFlags):

    ### set the EVCreator ###
    l2MuViewsMaker = EventViewCreatorAlgorithm("IMl2Mu")
    #
    l2MuViewsMaker.RoIsLink = "initialRoI"  # ROI is from L1
    l2MuViewsMaker.RoITool = ViewCreatorInitialROITool()  # ROI is from L1
    #
    l2MuViewsMaker.Views = "MUViewRoIs"
    l2MuViewsMaker.InViewRoIs = "MURoIs"
    #
    l2MuViewsMaker.ViewFallThrough = True

    ### get muFast reco sequence ###
    from TriggerMenuMT.HLTMenuConfig.Muon.MuonSetup import muFastRecoSequence, makeMuonPrepDataAlgs
    viewAlgs_MuonPRD = makeMuonPrepDataAlgs(RoIs=l2MuViewsMaker.InViewRoIs)
    muFastRecoSequence, sequenceOut = muFastRecoSequence(
        l2MuViewsMaker.InViewRoIs, doFullScanID=False)
    muFastSequence = parOR("muFastRecoSequence",
                           [viewAlgs_MuonPRD, muFastRecoSequence])
    l2MuViewsMaker.ViewNodeName = muFastSequence.name()

    l2muFastSequence = seqAND("l2muFastSequence",
                              [l2MuViewsMaker, muFastSequence])
    return (l2muFastSequence, l2MuViewsMaker, sequenceOut)
Example #13
0
def muEFCBFSAlgSequence(ConfigFlags):
    efcbfsInputMaker = EventViewCreatorAlgorithm("IMEFCBFS")
    newRoITool = ViewCreatorCentredOnIParticleROITool()
    newRoITool.RoisWriteHandleKey = "MuonCandidates_FS_ROIs"
    #
    efcbfsInputMaker.mergeUsingFeature = True
    efcbfsInputMaker.RoITool = newRoITool
    #
    efcbfsInputMaker.Views = "MUCBFSViews"
    efcbfsInputMaker.InViewRoIs = "MUCBFSRoIs"
    #
    efcbfsInputMaker.RequireParentView = True
    efcbfsInputMaker.ViewFallThrough = True
    # Muon specific
    efcbfsInputMaker.PlaceMuonInView = True
    efcbfsInputMaker.InViewMuons = "InViewMuons"
    efcbfsInputMaker.InViewMuonCandidates = "MuonCandidates_FS"

    from TriggerMenuMT.HLTMenuConfig.Muon.MuonSetup import muEFCBRecoSequence
    muEFCBFSRecoSequence, sequenceOut = muEFCBRecoSequence(
        efcbfsInputMaker.InViewRoIs, "FS")

    efcbfsInputMaker.ViewNodeName = muEFCBFSRecoSequence.name()

    muonEFCBFSSequence = seqAND("muonEFFSCBSequence",
                                [efcbfsInputMaker, muEFCBFSRecoSequence])

    return (muonEFCBFSSequence, efcbfsInputMaker, sequenceOut)
Example #14
0
def tauEFSequence(ConfigFlags):

    RecoSequenceName = "tauEFInViewSequence"

    newRoITool = ViewCreatorFetchFromViewROITool()
    newRoITool.RoisWriteHandleKey = recordable(
        "HLT_Roi_TauID")  #RoI collection recorded to EDM
    newRoITool.InViewRoIs = "UpdatedTrackRoI"  #input RoIs from calo only step

    efViewsMaker = EventViewCreatorAlgorithm("IMTauEF")
    efViewsMaker.RoIsLink = "roi"
    efViewsMaker.RoITool = newRoITool
    efViewsMaker.InViewRoIs = "RoiForTauCore"
    efViewsMaker.Views = "TAUEFViews"
    efViewsMaker.ViewFallThrough = True
    efViewsMaker.RequireParentView = True
    efViewsMaker.ViewNodeName = RecoSequenceName

    (tauEFInViewSequence,
     sequenceOut) = tauIdTrackSequence(efViewsMaker.InViewRoIs,
                                       RecoSequenceName)

    tauEFSequence = seqAND("tauEFSequence",
                           [efViewsMaker, tauEFInViewSequence])
    return (tauEFSequence, efViewsMaker, sequenceOut)
Example #15
0
def muEFSAAlgSequence(ConfigFlags):

    efsaViewsMaker = EventViewCreatorAlgorithm("IMefsa")
    #
    efsaViewsMaker.RoIsLink = "initialRoI"  # Merge based on initial RoI

    newRoITool = ViewCreatorFetchFromViewROITool()
    newRoITool.RoisWriteHandleKey = recordable(
        "HLT_Roi_L2SAMuonForEF")  #RoI collection recorded to EDM
    newRoITool.InViewRoIs = "forMS"  #input RoIs from L2 SA views
    newRoITool.ViewToFetchFrom = "MUViewRoIs"
    efsaViewsMaker.RoITool = newRoITool  # Create a new ROI centred on the L2 SA muon from Step 1
    #
    efsaViewsMaker.Views = "MUEFSAViewRoIs"
    efsaViewsMaker.InViewRoIs = "MUEFSARoIs"
    #
    efsaViewsMaker.RequireParentView = True
    efsaViewsMaker.ViewFallThrough = True

    ### get EF reco sequence ###
    from TriggerMenuMT.HLTMenuConfig.Muon.MuonSetup import muEFSARecoSequence
    muEFSARecoSequence, sequenceOut = muEFSARecoSequence(
        efsaViewsMaker.InViewRoIs, 'RoI')

    efsaViewsMaker.ViewNodeName = muEFSARecoSequence.name()

    muonEFSAonlySequence = seqAND("muonEFSAonlySequence",
                                  [efsaViewsMaker, muEFSARecoSequence])

    return (muonEFSAonlySequence, efsaViewsMaker, sequenceOut)
Example #16
0
def precisionPhotonSequence(ConfigFlags):
    """ This function creates the PrecisionPhoton sequence"""

    # Prepare first the EventView
    InViewRoIs = "PrecisionPhotonRoIs"
    precisionPhotonViewsMaker = EventViewCreatorAlgorithm("IMprecisionPhoton")
    precisionPhotonViewsMaker.ViewFallThrough = True
    precisionPhotonViewsMaker.RequireParentView = True
    precisionPhotonViewsMaker.RoIsLink = "initialRoI"  # ROI link used to merge inputs
    precisionPhotonViewsMaker.RoITool = ViewCreatorInitialROITool(
    )  # Tool used to supply ROIs for EventViews
    precisionPhotonViewsMaker.InViewRoIs = InViewRoIs  # names to use for the collection of which the RoIs are picked up
    precisionPhotonViewsMaker.Views = "precisionPhotonViews"  # Output container which has the view objects

    # Configure the reconstruction algorithm sequence
    from TriggerMenuMT.HLTMenuConfig.Photon.PhotonRecoSequences import precisionPhotonRecoSequence
    (precisionPhotonInViewSequence,
     sequenceOut) = precisionPhotonRecoSequence(InViewRoIs)

    precisionPhotonViewsMaker.ViewNodeName = precisionPhotonInViewSequence.name(
    )

    theSequence = seqAND(
        "precisionPhotonSequence",
        [precisionPhotonViewsMaker, precisionPhotonInViewSequence])
    return (theSequence, precisionPhotonViewsMaker, sequenceOut)
Example #17
0
def tauFTFCoreSequence(ConfigFlags):

    RecoSequenceName = "tauFTFCoreInViewSequence"

    newRoITool = ViewCreatorFetchFromViewROITool()
    newRoITool.RoisWriteHandleKey = recordable(
        "HLT_Roi_TauCore")  #RoI collection recorded to EDM
    newRoITool.InViewRoIs = "UpdatedCaloRoI"  #input RoIs from calo only step

    ftfCoreViewsMaker = EventViewCreatorAlgorithm("IMFTFCore")
    ftfCoreViewsMaker.RoIsLink = "roi"
    ftfCoreViewsMaker.RoITool = newRoITool
    ftfCoreViewsMaker.InViewRoIs = "RoiForTauCore"
    ftfCoreViewsMaker.Views = "TAUFTFCoreViews"
    ftfCoreViewsMaker.ViewFallThrough = True
    ftfCoreViewsMaker.RequireParentView = True
    ftfCoreViewsMaker.ViewNodeName = RecoSequenceName

    (tauFTFCoreInViewSequence,
     sequenceOut) = tauCoreTrackSequence(ftfCoreViewsMaker.InViewRoIs,
                                         RecoSequenceName)

    tauFastTrackCoreSequence = seqAND(
        "tauFastTrackCoreSequence",
        [ftfCoreViewsMaker, tauFTFCoreInViewSequence])
    return (tauFastTrackCoreSequence, ftfCoreViewsMaker, sequenceOut)
Example #18
0
def tauCaloMVASequence(ConfigFlags):
    """ Creates L2 Fast Calo sequence for Taus"""
    # EV creator
    InViewRoIs = "TAUCaloRoIs"
    RecoSequenceName = "tauCaloMVAInViewSequence"

    tauCaloMVAViewsMaker = EventViewCreatorAlgorithm("IMtauCaloMVA")
    tauCaloMVAViewsMaker.ViewFallThrough = True
    tauCaloMVAViewsMaker.RoIsLink = "initialRoI"
    tauCaloMVAViewsMaker.RoITool = ViewCreatorInitialROITool()
    tauCaloMVAViewsMaker.InViewRoIs = InViewRoIs
    tauCaloMVAViewsMaker.Views = "TAUCaloMVAViews"
    tauCaloMVAViewsMaker.ViewNodeName = RecoSequenceName
    (tauCaloMVAInViewSequence,
     sequenceOut) = tauCaloMVARecoSequence(InViewRoIs, RecoSequenceName)

    tauCaloMVARecoVDV = CfgMgr.AthViews__ViewDataVerifier("tauCaloMVARecoVDV")
    tauCaloMVARecoVDV.DataObjects = [
        ('TrigRoiDescriptorCollection', 'StoreGateSvc+TAUCaloRoIs'),
        ('CaloBCIDAverage', 'StoreGateSvc+CaloBCIDAverage'),
        ('ILArHVScaleCorr', 'ConditionStore+LArHVScaleCorrRecomputed'),
        ('xAOD::EventInfo', 'StoreGateSvc+EventInfo'),
        ('SG::AuxElement', 'StoreGateSvc+EventInfo.ActIntPerXDecor'),
        ('SG::AuxElement', 'StoreGateSvc+EventInfo.AveIntPerXDecor')
    ]
    tauCaloMVAInViewSequence += tauCaloMVARecoVDV

    tauCaloMVASequence = seqAND(
        "tauCaloMVASequence", [tauCaloMVAViewsMaker, tauCaloMVAInViewSequence])
    return (tauCaloMVASequence, tauCaloMVAViewsMaker, sequenceOut)
Example #19
0
def precisionElectronSequence(ConfigFlags):
    """ fourth step:  precision electron....."""
    InViewRoIs = "precisionElectron"
    # EVCreator:
    precisionElectronViewsMaker = EventViewCreatorAlgorithm(
        "IMprecisionElectron")
    precisionElectronViewsMaker.RoIsLink = "initialRoI"
    precisionElectronViewsMaker.RoITool = ViewCreatorInitialROITool()
    precisionElectronViewsMaker.InViewRoIs = InViewRoIs
    precisionElectronViewsMaker.Views = "precisionElectronViews"  #precisionElectronViews
    precisionElectronViewsMaker.ViewFallThrough = True
    precisionElectronViewsMaker.RequireParentView = True

    # Configure the reconstruction algorithm sequence
    from TriggerMenuMT.HLTMenuConfig.Electron.PrecisionElectronRecoSequences import precisionElectronRecoSequence
    (electronPrecisionRec, electronPrecisionTrack,
     sequenceOut) = precisionElectronRecoSequence(InViewRoIs)

    electronPrecisionInViewAlgs = parOR(
        "electronPrecisionInViewAlgs",
        [electronPrecisionTrack, electronPrecisionRec])
    precisionElectronViewsMaker.ViewNodeName = "electronPrecisionInViewAlgs"

    electronPrecisionAthSequence = seqAND(
        "electronPrecisionAthSequence",
        [precisionElectronViewsMaker, electronPrecisionInViewAlgs])
    return (electronPrecisionAthSequence, precisionElectronViewsMaker,
            sequenceOut)
Example #20
0
def muEFIsoAlgSequence(ConfigFlags):
    efmuIsoViewsMaker = EventViewCreatorAlgorithm("IMefmuIso")
    newRoITool = ViewCreatorCentredOnIParticleROITool()
    newRoITool.RoIEtaWidth = 0.15
    newRoITool.RoIPhiWidth = 0.15
    newRoITool.RoisWriteHandleKey = recordable("HLT_Roi_MuonIso")
    #
    efmuIsoViewsMaker.mergeUsingFeature = True
    efmuIsoViewsMaker.RoITool = newRoITool
    #
    efmuIsoViewsMaker.Views = "MUEFIsoViewRoIs"
    efmuIsoViewsMaker.InViewRoIs = "MUEFIsoRoIs"
    #
    efmuIsoViewsMaker.ViewFallThrough = True
    # Muon specific
    # TODO - this should be deprecated here and removed in the future, now that we mergeUsingFeature, each parent View should only have one muon.
    # therefore the xAOD::Muon should be got via ViewFallThrough, rather than being copied in here as "IsoViewMuons"
    efmuIsoViewsMaker.PlaceMuonInView = True
    efmuIsoViewsMaker.InViewMuonCandidates = "IsoMuonCandidates"
    efmuIsoViewsMaker.InViewMuons = "IsoViewMuons"

    ### get EF reco sequence ###
    from TriggerMenuMT.HLTMenuConfig.Muon.MuonSetup import efmuisoRecoSequence
    efmuisoRecoSequence, sequenceOut = efmuisoRecoSequence(
        efmuIsoViewsMaker.InViewRoIs, efmuIsoViewsMaker.InViewMuons)

    efmuIsoViewsMaker.ViewNodeName = efmuisoRecoSequence.name()

    ### Define a Sequence to run for muIso ###
    efmuIsoSequence = seqAND("efmuIsoSequence",
                             [efmuIsoViewsMaker, efmuisoRecoSequence])

    return (efmuIsoSequence, efmuIsoViewsMaker, sequenceOut)
Example #21
0
def muEFSAFSAlgSequence(ConfigFlags):

    efsafsInputMaker = EventViewCreatorAlgorithm("IMMuonFS")
    fsRoiTool = ViewCreatorFSROITool()
    fsRoiTool.RoisWriteHandleKey = "MuonFS_RoIs"
    #
    efsafsInputMaker.RoIsLink = "initialRoI"  # Only expect to get in one FS RI
    efsafsInputMaker.RoITool = fsRoiTool  # Use new FS roi (note: the ViewCreatorInitialROITool should work excactly the same here)
    #
    efsafsInputMaker.Views = "MUFSViewRoI"
    efsafsInputMaker.InViewRoIs = "MUFSRoIs"
    #
    efsafsInputMaker.ViewFallThrough = True

    ### get EF reco sequence ###
    from TriggerMenuMT.HLTMenuConfig.Muon.MuonSetup import muEFSARecoSequence, makeMuonPrepDataAlgs
    viewAlgs_MuonPRD = makeMuonPrepDataAlgs(RoIs=efsafsInputMaker.InViewRoIs,
                                            forFullScan=True)
    muEFSAFSRecoSequence, sequenceOut = muEFSARecoSequence(
        efsafsInputMaker.InViewRoIs, 'FS')

    muEFFSRecoSequence = parOR("muEFSAFSRecoSequence",
                               [viewAlgs_MuonPRD, muEFSAFSRecoSequence])
    efsafsInputMaker.ViewNodeName = muEFFSRecoSequence.name()

    muonEFSAFSSequence = seqAND("muonEFSAFSSequence",
                                [efsafsInputMaker, muEFFSRecoSequence])

    return (muonEFSAFSSequence, efsafsInputMaker, sequenceOut)
Example #22
0
    def runTest(self):
        # replicate HLT issue, it occured because the sequnces were recorded in the order of storing in the dict and thus the
        # some of them (in this case hltSteps) did not have properties recorded

        acc = ComponentAccumulator()
        acc.addSequence(seqOR("hltTop"))
        algos2 = TestAlgo("RecoAlgInTop")
        acc.addEventAlgo(algos2, sequenceName="hltTop")  # some algo
        acc.addSequence(seqAND("hltSteps"), parentName="hltTop")
        acc.addSequence(parOR("hltStep_1"), parentName="hltSteps")
        acc.addSequence(seqAND("L2CaloEgammaSeq"), "hltStep_1")
        acc.addSequence(parOR("hltStep_2"), parentName="hltSteps")
        acc.moveSequence("L2CaloEgammaSeq", "hltStep_2")

        fout = open("testFile2.pkl", "wb")
        acc.store(fout)
        fout.close()
Example #23
0
 def getSingleMenuSeq( stepNumber, stepName ):
     """
     """
     name = "Menu{}{}".format(stepNumber, stepName)
     seq = seqAND( name )
     allRecoSeqName = getRecosStepSeq( stepNumber ).name
     acc.addSequence(seq, parentName = allRecoSeqName )
     return seq
Example #24
0
 def athSequence(self):
     """ Create the 'ath' sequence
     
     The return value is cached so only one instance is ever created
     """
     if hasattr(self, "_athSequence"):
         return self._athSequence
     self._athSequence = seqAND("METAthSeq_{}".format(self._suffix),
                                [self.inputMaker, self.recoSequence])
     return self._athSequence
Example #25
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()
Example #26
0
def allTE_trkfast( signature="FS" ):
        inputMakerAlg = EventViewCreatorAlgorithm("IM_beamspot_"+signature)
        inputMakerAlg.ViewFallThrough = True
        inputMakerAlg.RoIsLink = "initialRoI"
        inputMakerAlg.RoITool = ViewCreatorInitialROITool()
        inputMakerAlg.InViewRoIs = "beamspotViewRoI_"+signature
        inputMakerAlg.Views      = "beamspotViewRoI_"+signature

        from TrigInDetConfig.InDetSetup import makeInDetAlgs
        from TrigT2BeamSpot.T2VertexBeamSpotConfig import T2VertexBeamSpot_activeAllTE

        viewAlgs, viewVerify  = makeInDetAlgs( whichSignature=signature, rois=inputMakerAlg.InViewRoIs )

        vertexAlg = T2VertexBeamSpot_activeAllTE( "vertex_"+signature )
        vertexAlg.TrackCollection = "TrigFastTrackFinder_Tracks_"+signature

        viewVerify.DataObjects += [( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+beamspotViewRoI_'+signature ),
                                   ( 'xAOD::EventInfo' , 'StoreGateSvc+EventInfo' ),
                                   ( 'TagInfo' , 'DetectorStore+ProcessingTags' )]

        # Make sure this is still available at whole-event level
        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()
        topSequence.SGInputLoader.Load += [( 'TagInfo' , 'DetectorStore+ProcessingTags' )]

        beamspotSequence = seqAND( "beamspotSequence_"+signature, viewAlgs+[vertexAlg] )
        inputMakerAlg.ViewNodeName = beamspotSequence.name()
        beamspotViewsSequence = seqAND( "beamspotViewsSequence"+signature, [ inputMakerAlg, beamspotSequence ])


        #hypo
        beamspotHypoAlg = TrigStreamerHypoAlgMT("BeamspotHypoAlg_"+signature)
        beamspotHypoAlg.RuntimeValidation = False #Needed to avoid the ERROR ! Decision has no 'feature' ElementLink
        beamspotHypoToolGen= StreamerHypoToolMTgenerator


        return  MenuSequence( Sequence    = beamspotViewsSequence,
                              Maker       = inputMakerAlg,
                              Hypo        = beamspotHypoAlg,
                              HypoToolGen = beamspotHypoToolGen )
Example #27
0
def getSecondStageBjetTracking(inputRoI, dataObjects):
    algSequence = []

    # Second stage of Fast tracking (for precision tracking preparation)
    from TrigInDetConfig.InDetSetup import makeInDetAlgs

    viewAlgs, viewVerify = makeInDetAlgs(whichSignature='Jet',
                                         separateTrackParticleCreator="Bjet",
                                         rois=inputRoI)

    viewVerify.DataObjects += dataObjects

    # Make sure the required objects are still available at whole-event level
    from IOVDbSvc.CondDB import conddb
    from AthenaCommon.AlgSequence import AlgSequence
    topSequence = AlgSequence()
    if not conddb.folderRequested("PixelClustering/PixelClusNNCalib"):
        viewVerify.DataObjects += [('TTrainedNetworkCollection',
                                    'ConditionStore+PixelClusterNN'),
                                   ('TTrainedNetworkCollection',
                                    'ConditionStore+PixelClusterNNWithTrack')]

    from AthenaCommon.GlobalFlags import globalflags
    if not globalflags.InputFormat.is_bytestream():
        viewVerify.DataObjects += [('TRT_RDO_Container',
                                    'StoreGateSvc+TRT_RDOs')]
        topSequence.SGInputLoader.Load += [('TRT_RDO_Container',
                                            'StoreGateSvc+TRT_RDOs')]

    algSequence.append(seqAND("SecondStageFastTrackingSequence", viewAlgs))

    # Precision Tracking
    from TrigInDetConfig.InDetPT import makeInDetPrecisionTracking
    PTTracks, PTTrackParticles, PTAlgs = makeInDetPrecisionTracking(
        "bjet",
        rois=inputRoI,
        inputFTFtracks="TrigFastTrackFinder_Tracks_Bjet")
    algSequence.append(seqAND("PrecisionTrackingSequence", PTAlgs))

    return [algSequence, PTTrackParticles]
Example #28
0
def fastCaloSequence(doRinger):
    """ Creates Fast Calo sequence"""
    # EV creator
    from TrigT2CaloCommon.CaloDef import fastCaloEVCreator
    (fastCaloViewsMaker, InViewRoIs) = fastCaloEVCreator()

    # reco sequence always build the rings
    from TrigT2CaloCommon.CaloDef import fastCaloRecoSequence
    (fastCaloInViewSequence, sequenceOut) = fastCaloRecoSequence(InViewRoIs, doRinger=doRinger)

     # connect EVC and reco
    fastCaloSequence = seqAND("fastCaloSequence", [fastCaloViewsMaker, fastCaloInViewSequence ])
    return (fastCaloSequence, fastCaloViewsMaker, sequenceOut)
Example #29
0
def makeSequence(ConfigFlags, name,step, signature):
    IM= InputMakerForFeatureAlg(name="IM"+signature+name+"Step"+step)
    IM.Output=name+signature+"IM"+step+"_out"
    if "el" in signature:
        Alg = CaloClustering(name="CaloClustering"+name+"Step"+step, FileName="emclusters.dat")
    elif "mu" in signature:
        Alg = muMSRecAlg(name="muMSRecAlg"+name+"Step"+step, FileName="msmu.dat")
    else:
        sys.exit("ERROR, in configuration of sequence "+name+step+signature)

    Alg.Output = name+signature+"Alg"+step+"_out"
    Alg.Input  = IM.Output
    Sequence   = seqAND(name+signature+"SeqStep"+step, [IM, Alg])

    return (Sequence, IM, Alg.Output)
Example #30
0
def fastPhotonMenuSequence():
    """Creates secpond step photon sequence"""

    from TriggerMenuMT.HLTMenuConfig.CommonSequences.CaloSequenceSetup import CaloMenuDefs
    ViewVerify = CfgMgr.AthViews__ViewDataVerifier(
        "FastPhotonViewDataVerifier")
    ViewVerify.DataObjects = [('xAOD::TrigEMClusterContainer',
                               'StoreGateSvc+' + CaloMenuDefs.L2CaloClusters),
                              ('TrigRoiDescriptorCollection',
                               'StoreGateSvc+EMIDRoIs')]

    from TrigEgammaHypo.TrigEgammaFastPhotonFexMTConfig import EgammaFastPhotonFex_1
    thePhotonFex = EgammaFastPhotonFex_1()
    thePhotonFex.TrigEMClusterName = CaloMenuDefs.L2CaloClusters
    thePhotonFex.PhotonsName = recordable("HLT_FastPhotons")
    #thePhotonFex.RoIs="EMIDRoIs"

    l2PhotonViewsMaker = EventViewCreatorAlgorithm("IMl2Photon")
    l2PhotonViewsMaker.RoIsLink = "initialRoI"
    l2PhotonViewsMaker.InViewRoIs = "EMIDRoIs"
    #l2PhotonViewsMaker.InViewRoIs = "EMCaloRoIs"
    l2PhotonViewsMaker.RoITool = ViewCreatorInitialROITool()
    l2PhotonViewsMaker.Views = "EMPhotonViews"
    l2PhotonViewsMaker.ViewFallThrough = True
    l2PhotonViewsMaker.RequireParentView = True

    thePhotonFex.RoIs = l2PhotonViewsMaker.InViewRoIs

    photonInViewAlgs = parOR("photonInViewAlgs", [ViewVerify, thePhotonFex])

    l2PhotonViewsMaker.ViewNodeName = "photonInViewAlgs"

    from TrigEgammaHypo.TrigEgammaHypoConf import TrigEgammaFastPhotonHypoAlgMT
    thePhotonHypo = TrigEgammaFastPhotonHypoAlgMT()
    thePhotonHypo.Photons = thePhotonFex.PhotonsName
    thePhotonHypo.RunInView = True

    # this needs to be added:
    #electronDecisionsDumper = DumpDecisions("electronDecisionsDumper", Decisions = theElectronHypo.Output )

    photonAthSequence = seqAND("photonAthSequence",
                               [l2PhotonViewsMaker, photonInViewAlgs])
    from TrigEgammaHypo.TrigEgammaFastPhotonHypoTool import TrigEgammaFastPhotonHypoToolFromDict

    return MenuSequence(Maker=l2PhotonViewsMaker,
                        Sequence=photonAthSequence,
                        Hypo=thePhotonHypo,
                        HypoToolGen=TrigEgammaFastPhotonHypoToolFromDict)