Exemple #1
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)
Exemple #2
0
def precisionPhotonRecoSequence(RoIs):
    """ With this function we will setup the sequence of offline EgammaAlgorithms so to make a photon for TrigEgamma 

    Sequence of algorithms is the following:
      - egammaRecBuilder/TrigEgammaRecPhoton creates egammaObjects out of clusters and tracks. Here, at HLT photons we will only use clusters. 
      - photonSuperClusterBuilder algorithm will create superclusters out of the toposlusters and tracks in egammaRec under the photon hypothesis
          https://gitlab.cern.ch/atlas/athena/blob/master/Reconstruction/egamma/egammaAlgs/python/egammaSuperClusterBuilder.py#L26 
      - TopoEgammBuilder will create photons and electrons out of trakcs and SuperClusters. Here at HLT photons the aim is to ignore electrons and not use tracks at all.
          https://gitlab.cern.ch/atlas/athena/blob/master/Reconstruction/egamma/egammaAlgs/src/topoEgammaBuilder.cxx
    """

    log.debug('precisionPhotonRecoSequence(RoIs = %s)', RoIs)

    # First the data verifiers:
    # Here we define the data dependencies. What input needs to be available for the Fexs (i.e. TopoClusters from precisionCalo) in order to run
    from TriggerMenuMT.HLTMenuConfig.Egamma.PrecisionCaloSequenceSetup import precisionCaloMenuDefs
    import AthenaCommon.CfgMgr as CfgMgr
    ViewVerify = CfgMgr.AthViews__ViewDataVerifier(
        "PrecisionPhotonPhotonViewDataVerifier")
    ViewVerify.DataObjects = [
        ('xAOD::CaloClusterContainer',
         'StoreGateSvc+' + precisionCaloMenuDefs.precisionCaloClusters),
        ('CaloCellContainer', 'StoreGateSvc+CaloCells')
    ]

    # Retrieve the factories now
    from TriggerMenuMT.HLTMenuConfig.Photon.TrigPhotonFactories import TrigEgammaRecPhoton, TrigPhotonSuperClusterBuilder, TrigTopoEgammaPhotons

    log.debug('retrieve(precisionPhotonRecoSequence,None,RoIs = %s)', RoIs)

    # The sequence of these algorithms
    thesequence = parOR(
        "precisionPhotonAlgs"
    )  # This thing creates the sequence with name precisionPhotonAlgs
    thesequence += ViewVerify

    # Add to the sequence the three steps:
    #  - TrigEgammaBuilder, TrigPhotonSuperClusters, TrigTopoEgammaPhotons
    TrigEgammaAlgo = TrigEgammaRecPhoton()
    TrigEgammaAlgo.InputTopoClusterContainerName = precisionCaloMenuDefs.precisionCaloClusters
    thesequence += TrigEgammaAlgo

    trigPhotonAlgo = TrigPhotonSuperClusterBuilder()
    trigPhotonAlgo.InputEgammaRecContainerName = TrigEgammaAlgo.egammaRecContainer
    thesequence += trigPhotonAlgo

    trigTopoEgammaAlgo = TrigTopoEgammaPhotons()
    trigTopoEgammaAlgo.SuperPhotonRecCollectionName = trigPhotonAlgo.SuperPhotonRecCollectionName
    collectionOut = trigTopoEgammaAlgo.PhotonOutputName
    thesequence += trigTopoEgammaAlgo

    return (thesequence, collectionOut)
Exemple #3
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)
Exemple #4
0
def HLTRoITopoRecoSequence(RoIs):
    import AthenaCommon.CfgMgr as CfgMgr
    HLTRoITopoRecoSequenceVDV = CfgMgr.AthViews__ViewDataVerifier(
        "HLTRoITopoRecoSequenceVDV")
    HLTRoITopoRecoSequenceVDV.DataObjects = [
        ('TrigRoiDescriptorCollection', 'StoreGateSvc+PrecisionCaloRoIs'),
        ('CaloBCIDAverage', 'StoreGateSvc+CaloBCIDAverage'),
        ('ILArHVScaleCorr', 'ConditionStore+LArHVScaleCorrRecomputed')
    ]

    cellMaker = HLTCellMaker(RoIs, algSuffix="RoI")
    topoClusterMaker = _algoHLTTopoCluster(inputEDM=cellMaker.CellsName,
                                           algSuffix="RoI")
    RecoSequence = parOR(
        "RoITopoClusterRecoSequence",
        [HLTRoITopoRecoSequenceVDV, cellMaker, topoClusterMaker])
    return (RecoSequence, topoClusterMaker.CaloClusters)
Exemple #5
0
def fastCaloRecoSequence(InViewRoIs,
                         doRinger=False,
                         ClustersName="HLT_FastCaloEMClusters",
                         RingerKey="HLT_FastCaloRinger"):
    fastCaloAlg = _algoL2Egamma(inputEDM=InViewRoIs,
                                doRinger=doRinger,
                                ClustersName=ClustersName,
                                RingerKey=RingerKey)

    import AthenaCommon.CfgMgr as CfgMgr
    fastCaloVDV = CfgMgr.AthViews__ViewDataVerifier("fastCaloVDV")
    fastCaloVDV.DataObjects = [
        ('CaloBCIDAverage', 'StoreGateSvc+CaloBCIDAverage'),
        ('TrigRoiDescriptorCollection', 'StoreGateSvc+EMCaloRoIs')
    ]

    fastCaloInViewSequence = seqAND('fastCaloInViewSequence',
                                    [fastCaloVDV, fastCaloAlg])
    sequenceOut = fastCaloAlg.ClustersName
    return (fastCaloInViewSequence, sequenceOut)
Exemple #6
0
def makeInDetAlgs(whichSignature='',
                  separateTrackParticleCreator='',
                  rois='EMViewRoIs',
                  doFTF=True,
                  viewVerifier='IDViewDataVerifier'):
    #If signature specified add suffix to the algorithms
    signature = whichSignature if whichSignature else ''
    if signature != "" and separateTrackParticleCreator == "":
        separateTrackParticleCreator = signature

    if signature == "":
        raise ValueError('makeInDetAlgs() No signature specified')

    #Global keys/names for Trigger collections
    from .InDetTrigCollectionKeys import TrigPixelKeys, TrigSCTKeys
    from InDetRecExample.InDetKeys import InDetKeys
    from TrigInDetConfig.TrigInDetConfig import InDetCacheNames
    from AthenaCommon.GlobalFlags import globalflags

    viewAlgs = []

    ViewDataVerifier = None
    if viewVerifier:
        import AthenaCommon.CfgMgr as CfgMgr
        ViewDataVerifier = CfgMgr.AthViews__ViewDataVerifier(viewVerifier +
                                                             signature)
        ViewDataVerifier.DataObjects = [
            ('InDet::PixelClusterContainerCache',
             InDetCacheNames.Pixel_ClusterKey),
            ('PixelRDO_Cache', InDetCacheNames.PixRDOCacheKey),
            ('InDet::SCT_ClusterContainerCache',
             InDetCacheNames.SCT_ClusterKey),
            ('SCT_RDO_Cache', InDetCacheNames.SCTRDOCacheKey),
            ('SpacePointCache', InDetCacheNames.SpacePointCachePix),
            ('SpacePointCache', InDetCacheNames.SpacePointCacheSCT),
            ('IDCInDetBSErrContainer_Cache', InDetCacheNames.SCTBSErrCacheKey),
            ('IDCInDetBSErrContainer_Cache',
             InDetCacheNames.SCTFlaggedCondCacheKey),
            ('xAOD::EventInfo', 'StoreGateSvc+EventInfo'),
            ('TagInfo', 'DetectorStore+ProcessingTags')
        ]

        viewAlgs.append(ViewDataVerifier)

        # Load RDOs if we aren't loading bytestream
        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()

        topSequence.SGInputLoader.Load += [('TagInfo',
                                            'DetectorStore+ProcessingTags')]

        if not globalflags.InputFormat.is_bytestream():
            ViewDataVerifier.DataObjects += [
                ('PixelRDO_Container', InDetKeys.PixelRDOs()),
                ('SCT_RDO_Container', InDetKeys.SCT_RDOs()),
                ('IDCInDetBSErrContainer', InDetKeys.SCT_ByteStreamErrs())
            ]
            topSequence.SGInputLoader.Load += [
                ('PixelRDO_Container', InDetKeys.PixelRDOs()),
                ('SCT_RDO_Container', InDetKeys.SCT_RDOs()),
                ('IDCInDetBSErrContainer', InDetKeys.SCT_ByteStreamErrs())
            ]

    from InDetTrigRecExample.InDetTrigFlags import InDetTrigFlags
    from AthenaCommon.AppMgr import ToolSvc

    #Only add raw data decoders if we're running over raw data
    if globalflags.InputFormat.is_bytestream():
        #Pixel

        from PixelRawDataByteStreamCnv.PixelRawDataByteStreamCnvConf import PixelRodDecoder
        InDetPixelRodDecoder = PixelRodDecoder(name="InDetPixelRodDecoder_" +
                                               signature)
        # Disable duplcated pixel check for data15 because duplication mechanism was used.
        from RecExConfig.RecFlags import rec
        if len(rec.projectName()) >= 6 and rec.projectName()[:6] == "data15":
            InDetPixelRodDecoder.CheckDuplicatedPixel = False
        ToolSvc += InDetPixelRodDecoder

        from PixelRawDataByteStreamCnv.PixelRawDataByteStreamCnvConf import PixelRawDataProviderTool
        InDetPixelRawDataProviderTool = PixelRawDataProviderTool(
            name="InDetPixelRawDataProviderTool_" + signature,
            Decoder=InDetPixelRodDecoder,
            checkLVL1ID=False)
        ToolSvc += InDetPixelRawDataProviderTool

        if (InDetTrigFlags.doPrintConfigurables()):
            print(InDetPixelRawDataProviderTool)  # noqa: ATL901

        # load the PixelRawDataProvider
        from PixelRawDataByteStreamCnv.PixelRawDataByteStreamCnvConf import PixelRawDataProvider
        InDetPixelRawDataProvider = PixelRawDataProvider(
            name="InDetPixelRawDataProvider_" + signature,
            RDOKey=InDetKeys.PixelRDOs(),
            ProviderTool=InDetPixelRawDataProviderTool,
        )
        InDetPixelRawDataProvider.isRoI_Seeded = True
        InDetPixelRawDataProvider.RoIs = rois
        InDetPixelRawDataProvider.RDOCacheKey = InDetCacheNames.PixRDOCacheKey

        viewAlgs.append(InDetPixelRawDataProvider)

        if (InDetTrigFlags.doPrintConfigurables()):
            print(InDetPixelRawDataProvider)  # noqa: ATL901

        #SCT
        from SCT_RawDataByteStreamCnv.SCT_RawDataByteStreamCnvConf import SCT_RodDecoder
        InDetSCTRodDecoder = SCT_RodDecoder(name="InDetSCTRodDecoder_" +
                                            signature)
        ToolSvc += InDetSCTRodDecoder

        from SCT_RawDataByteStreamCnv.SCT_RawDataByteStreamCnvConf import SCTRawDataProviderTool
        InDetSCTRawDataProviderTool = SCTRawDataProviderTool(
            name="InDetSCTRawDataProviderTool_" + signature,
            Decoder=InDetSCTRodDecoder)
        ToolSvc += InDetSCTRawDataProviderTool
        if (InDetTrigFlags.doPrintConfigurables()):
            print(InDetSCTRawDataProviderTool)  # noqa: ATL901

        # load the SCTRawDataProvider
        from SCT_RawDataByteStreamCnv.SCT_RawDataByteStreamCnvConf import SCTRawDataProvider
        InDetSCTRawDataProvider = SCTRawDataProvider(
            name="InDetSCTRawDataProvider_" + signature,
            RDOKey=InDetKeys.SCT_RDOs(),
            ProviderTool=InDetSCTRawDataProviderTool)
        InDetSCTRawDataProvider.isRoI_Seeded = True
        InDetSCTRawDataProvider.RoIs = rois
        InDetSCTRawDataProvider.RDOCacheKey = InDetCacheNames.SCTRDOCacheKey
        InDetSCTRawDataProvider.BSErrCacheKey = InDetCacheNames.SCTBSErrCacheKey

        from RegionSelector.RegSelToolConfig import makeRegSelTool_SCT
        InDetSCTRawDataProvider.RegSelTool = makeRegSelTool_SCT()

        viewAlgs.append(InDetSCTRawDataProvider)

        # load the SCTEventFlagWriter
        from SCT_RawDataByteStreamCnv.SCT_RawDataByteStreamCnvConf import SCTEventFlagWriter
        InDetSCTEventFlagWriter = SCTEventFlagWriter(
            name="InDetSCTEventFlagWriter_" + signature)

        viewAlgs.append(InDetSCTEventFlagWriter)

    #Pixel clusterisation
    from InDetTrigRecExample.InDetTrigConfigRecLoadTools import TrigPixelLorentzAngleTool, TrigSCTLorentzAngleTool

    from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelConfigCondAlg
    PixelConfigCondAlg.UseCalibConditions = False

    from SiClusterizationTool.SiClusterizationToolConf import InDet__ClusterMakerTool
    InDetClusterMakerTool = InDet__ClusterMakerTool(
        name="InDetClusterMakerTool_" + signature,
        SCTLorentzAngleTool=TrigSCTLorentzAngleTool,
        PixelLorentzAngleTool=TrigPixelLorentzAngleTool)

    ToolSvc += InDetClusterMakerTool

    from SiClusterizationTool.SiClusterizationToolConf import InDet__MergedPixelsTool
    InDetMergedPixelsTool = InDet__MergedPixelsTool(
        name="InDetMergedPixelsTool_" + signature,
        globalPosAlg=InDetClusterMakerTool,
        MinimalSplitSize=0,
        MaximalSplitSize=49,
        MinimalSplitProbability=0,
        DoIBLSplitting=True,
    )
    # Enable duplcated RDO check for data15 because duplication mechanism was used.
    from RecExConfig.RecFlags import rec
    if len(rec.projectName()) >= 6 and rec.projectName()[:6] == "data15":
        InDetMergedPixelsTool.CheckDuplicatedRDO = True
    ToolSvc += InDetMergedPixelsTool

    from SiClusterizationTool.SiClusterizationToolConf import InDet__PixelGangedAmbiguitiesFinder
    InDetPixelGangedAmbiguitiesFinder = InDet__PixelGangedAmbiguitiesFinder(
        name="InDetPixelGangedAmbiguitiesFinder_" + signature)
    ToolSvc += InDetPixelGangedAmbiguitiesFinder

    from InDetPrepRawDataFormation.InDetPrepRawDataFormationConf import InDet__PixelClusterization
    InDetPixelClusterization = InDet__PixelClusterization(
        name="InDetPixelClusterization_" + signature,
        clusteringTool=InDetMergedPixelsTool,
        gangedAmbiguitiesFinder=InDetPixelGangedAmbiguitiesFinder,
        DataObjectName=InDetKeys.PixelRDOs(),
        AmbiguitiesMap=TrigPixelKeys.PixelClusterAmbiguitiesMap,
        ClustersName=TrigPixelKeys.Clusters)

    InDetPixelClusterization.isRoI_Seeded = True
    InDetPixelClusterization.RoIs = rois
    InDetPixelClusterization.ClusterContainerCacheKey = InDetCacheNames.Pixel_ClusterKey

    viewAlgs.append(InDetPixelClusterization)

    # Create SCT_ConditionsSummaryTool
    from SCT_ConditionsTools.SCT_ConditionsSummaryToolSetup import SCT_ConditionsSummaryToolSetup
    sct_ConditionsSummaryToolSetup = SCT_ConditionsSummaryToolSetup(
        "InDetSCT_ConditionsSummaryTool_" + signature)
    sct_ConditionsSummaryToolSetup.setup()
    InDetSCT_ConditionsSummaryTool = sct_ConditionsSummaryToolSetup.getTool(
    )  # noqa: F841
    sct_ConditionsSummaryToolSetupWithoutFlagged = SCT_ConditionsSummaryToolSetup(
        "InDetSCT_ConditionsSummaryToolWithoutFlagged_" + signature)
    sct_ConditionsSummaryToolSetupWithoutFlagged.setup()
    InDetSCT_ConditionsSummaryToolWithoutFlagged = sct_ConditionsSummaryToolSetupWithoutFlagged.getTool(
    )

    # Add conditions tools to SCT_ConditionsSummaryTool
    from SCT_ConditionsTools.SCT_ConfigurationConditionsToolSetup import SCT_ConfigurationConditionsToolSetup
    sct_ConfigurationConditionsToolSetup = SCT_ConfigurationConditionsToolSetup(
    )
    sct_ConfigurationConditionsToolSetup.setToolName(
        "InDetSCT_ConfigurationConditionsTool_" + signature)
    sct_ConfigurationConditionsToolSetup.setup()
    InDetSCT_ConditionsSummaryToolWithoutFlagged.ConditionsTools.append(
        sct_ConfigurationConditionsToolSetup.getTool().getFullName())

    from SCT_ConditionsTools.SCT_ReadCalibDataToolSetup import SCT_ReadCalibDataToolSetup
    sct_ReadCalibDataToolSetup = SCT_ReadCalibDataToolSetup()
    sct_ReadCalibDataToolSetup.setToolName("InDetSCT_ReadCalibDataTool_" +
                                           signature)
    sct_ReadCalibDataToolSetup.setup()
    InDetSCT_ConditionsSummaryToolWithoutFlagged.ConditionsTools.append(
        sct_ReadCalibDataToolSetup.getTool().getFullName())

    from SCT_ConditionsTools.SCT_ByteStreamErrorsToolSetup import SCT_ByteStreamErrorsToolSetup
    sct_ByteStreamErrorsToolSetup = SCT_ByteStreamErrorsToolSetup()
    sct_ByteStreamErrorsToolSetup.setToolName("InDetSCT_BSErrorTool_" +
                                              signature)
    sct_ByteStreamErrorsToolSetup.setConfigTool(
        sct_ConfigurationConditionsToolSetup.getTool())
    sct_ByteStreamErrorsToolSetup.setup()
    InDetSCT_ConditionsSummaryToolWithoutFlagged.ConditionsTools.append(
        sct_ByteStreamErrorsToolSetup.getTool().getFullName())

    if (InDetTrigFlags.doPrintConfigurables()):
        print(InDetSCT_ConditionsSummaryToolWithoutFlagged)

    #
    # --- SCT_ClusteringTool
    #
    from SiClusterizationTool.SiClusterizationToolConf import InDet__SCT_ClusteringTool
    InDetSCT_ClusteringTool = InDet__SCT_ClusteringTool(
        name="InDetSCT_ClusteringTool_" + signature,
        globalPosAlg=InDetClusterMakerTool,
        conditionsTool=InDetSCT_ConditionsSummaryToolWithoutFlagged)
    if InDetTrigFlags.doSCTIntimeHits():
        if InDetTrigFlags.InDet25nsec():
            InDetSCT_ClusteringTool.timeBins = "01X"
        else:
            InDetSCT_ClusteringTool.timeBins = "X1X"

    #
    # --- SCT_Clusterization algorithm
    #

    from InDetPrepRawDataFormation.InDetPrepRawDataFormationConf import InDet__SCT_Clusterization
    InDetSCT_Clusterization = InDet__SCT_Clusterization(
        name="InDetSCT_Clusterization_" + signature,
        clusteringTool=InDetSCT_ClusteringTool,
        # ChannelStatus         = InDetSCT_ChannelStatusAlg,
        DataObjectName=InDetKeys.SCT_RDOs(),
        ClustersName=TrigSCTKeys.Clusters,
        #Adding the suffix to flagged conditions
        SCT_FlaggedCondData="SCT_FlaggedCondData_TRIG",
        conditionsTool=InDetSCT_ConditionsSummaryToolWithoutFlagged)
    InDetSCT_Clusterization.isRoI_Seeded = True
    InDetSCT_Clusterization.RoIs = rois
    InDetSCT_Clusterization.ClusterContainerCacheKey = InDetCacheNames.SCT_ClusterKey
    InDetSCT_Clusterization.FlaggedCondCacheKey = InDetCacheNames.SCTFlaggedCondCacheKey

    from RegionSelector.RegSelToolConfig import makeRegSelTool_SCT
    InDetSCT_Clusterization.RegSelTool = makeRegSelTool_SCT()

    viewAlgs.append(InDetSCT_Clusterization)

    #Space points and FTF

    from SiSpacePointTool.SiSpacePointToolConf import InDet__SiSpacePointMakerTool
    InDetSiSpacePointMakerTool = InDet__SiSpacePointMakerTool(
        name="InDetSiSpacePointMakerTool_" + signature)

    from AthenaCommon.DetFlags import DetFlags
    from SiSpacePointFormation.SiSpacePointFormationConf import InDet__SiTrackerSpacePointFinder
    from SiSpacePointFormation.InDetOnlineMonitor import InDetMonitoringTool
    InDetSiTrackerSpacePointFinder = InDet__SiTrackerSpacePointFinder(
        name="InDetSiTrackerSpacePointFinder_" + signature,
        SiSpacePointMakerTool=InDetSiSpacePointMakerTool,
        PixelsClustersName=TrigPixelKeys.Clusters,
        SpacePointsPixelName=TrigPixelKeys.SpacePoints,
        SCT_ClustersName=TrigSCTKeys.Clusters,
        SpacePointsSCTName=TrigSCTKeys.SpacePoints,
        SpacePointsOverlapName=InDetKeys.OverlapSpacePoints(),
        ProcessPixels=DetFlags.haveRIO.pixel_on(),
        ProcessSCTs=DetFlags.haveRIO.SCT_on(),
        ProcessOverlaps=DetFlags.haveRIO.SCT_on(),
        SpacePointCacheSCT=InDetCacheNames.SpacePointCacheSCT,
        SpacePointCachePix=InDetCacheNames.SpacePointCachePix,
        monTool=InDetMonitoringTool())

    viewAlgs.append(InDetSiTrackerSpacePointFinder)

    # Condition algorithm for SiTrackerSpacePointFinder
    if InDetSiTrackerSpacePointFinder.ProcessSCTs:
        from AthenaCommon.AlgSequence import AthSequencer
        condSeq = AthSequencer("AthCondSeq")
        if not hasattr(condSeq, "InDetSiElementPropertiesTableCondAlg"):
            # Setup alignment folders and conditions algorithms
            from SiSpacePointFormation.SiSpacePointFormationConf import InDet__SiElementPropertiesTableCondAlg
            condSeq += InDet__SiElementPropertiesTableCondAlg(
                name="InDetSiElementPropertiesTableCondAlg")

    #FIXME have a flag for now set for True( as most cases call FTF) but potentially separate
    if doFTF:
        from TrigFastTrackFinder.TrigFastTrackFinder_Config import TrigFastTrackFinderBase
        theFTF = TrigFastTrackFinderBase(
            "TrigFastTrackFinder_" + whichSignature, whichSignature)
        theFTF.RoIs = rois
        theFTF.TracksName = "TrigFastTrackFinder_Tracks_" + separateTrackParticleCreator

        #the following doCloneRemoval modification should be set up in the InDetTrigSliceSettings once legacy trigger not needed
        if whichSignature == "Electron":
            theFTF.doCloneRemoval = True

        viewAlgs.append(theFTF)

        from TrigInDetConf.TrigInDetPostTools import InDetTrigParticleCreatorToolFTF
        from TrigEDMConfig.TriggerEDMRun3 import recordable
        from InDetTrigParticleCreation.InDetTrigParticleCreationConf import InDet__TrigTrackingxAODCnvMT

        trackCollection = "HLT_IDTrack_" + separateTrackParticleCreator + "_FTF"

        theTrackParticleCreatorAlg = InDet__TrigTrackingxAODCnvMT(
            name="InDetTrigTrackParticleCreatorAlg" + whichSignature,
            TrackName="TrigFastTrackFinder_Tracks_" +
            separateTrackParticleCreator,
            ParticleCreatorTool=InDetTrigParticleCreatorToolFTF)

        if separateTrackParticleCreator == "BeamSpot":
            theTrackParticleCreatorAlg.TrackParticlesName = trackCollection
        else:
            theTrackParticleCreatorAlg.TrackParticlesName = recordable(
                trackCollection)
        viewAlgs.append(theTrackParticleCreatorAlg)

    return viewAlgs, ViewDataVerifier
Exemple #7
0
    def runTest( self ):

        topSequence = AlgSequence()
        evca1 = CfgMgr.EventViewCreatorAlgorithm("evca1")
        evca2 = CfgMgr.EventViewCreatorAlgorithm("evca2")
        vdv1 = CfgMgr.AthViews__ViewDataVerifier("vdv1")
        vdv2 = CfgMgr.AthViews__ViewDataVerifier("vdv2")

        # Test error for empty sequence
        topSequence += seqOR( "makeViewSequence" )
        with self.assertRaisesRegex( RuntimeError, "Please remove makeViewSequence" ):
            findViewAlgs( topSequence.getChildren(), {} )

        # Add an algorithm to the sequence
        topSequence.makeViewSequence += evca1
        #topSequence.makeViewSequence += evca2

        # Return the algorithm assuming it's in a view, or not
        self.assertEqual( findViewAlgs( topSequence.getChildren(), {} ),
                          ( [ "evca1" ], [] ) )
        self.assertEqual( findViewAlgs( topSequence.getChildren(), {"makeViewSequence":False} ),
                          ( [], [ "evca1" ] ) )

        # Add a nested sequence
        topSequence.makeViewSequence += seqOR( "viewSequence" )
        topSequence.makeViewSequence.viewSequence += vdv1

        # Return the algorithms depending on where the view is entered
        self.assertEqual( findViewAlgs( topSequence.getChildren(), {} ),
                          ( [ "evca1", "vdv1" ], [] ) )
        self.assertEqual( findViewAlgs( topSequence.getChildren(), {"makeViewSequence":False} ),
                          ( [], [ "evca1", "vdv1" ] ) )
        self.assertEqual( findViewAlgs( topSequence.getChildren(), {"viewSequence":False} ),
                          ( [ "evca1" ], [ "vdv1" ] ) )

        # Check that the test finds view nodes by name
        viewNodeDict = {"makeViewSequence":False, "aFakeNode":False}
        findViewAlgs( topSequence.getChildren(), viewNodeDict )
        self.assertEqual( viewNodeDict, {"makeViewSequence":True, "aFakeNode":False} )

        # Check misconfigured EVCA
        evca1.ViewNodeName = "aFakeNode"

        with self.assertRaisesRegex( RuntimeError, "no corresponding upstream EventViewCreatorAlgorithm" ):
            checkVDV( topSequence, [topSequence.name()], {} )
        evca1.ViewNodeName = "viewSequence"
        with self.assertRaisesRegex( RuntimeError, "no external data" ):
            checkVDV( topSequence, [topSequence.name()], {} )
        evca1.RequireParentView = True
        checkVDV( topSequence, [topSequence.name()], {} )

        # Check for nested view CF working
        topSequence.makeViewSequence.viewSequence += seqOR( "nestedSequence" )
        topSequence.makeViewSequence.viewSequence.nestedSequence += vdv2
        checkVDV( topSequence, [topSequence.name()], {} )

        # Check duplicate EVCA config
        evca2.ViewNodeName = "aFakeNode"
        topSequence.makeViewSequence += evca2
        checkVDV( topSequence, [topSequence.name()], {} )
        evca2.ViewNodeName = "viewSequence"
        with self.assertRaisesRegex( RuntimeError, "Found duplicate view node name" ):
            checkVDV( topSequence, [topSequence.name()], {} )
Exemple #8
0
def precisionElectronRecoSequence(RoIs):
    """ With this function we will setup the sequence of offline EgammaAlgorithms so to make a electron for TrigEgamma 

    Sequence of algorithms is the following:
      - egammaRecBuilder/TrigEgammaRecElectron creates egammaObjects out of clusters and tracks. 
      - electronSuperClusterBuilder algorithm will create superclusters out of the toposlusters and tracks in egammaRec under the electron hypothesis
          https://gitlab.cern.ch/atlas/athena/blob/master/Reconstruction/egamma/egammaAlgs/python/egammaSuperClusterBuilder.py#L26 
      - TopoEgammBuilder will create photons and electrons out of trakcs and SuperClusters. Here at HLT electrons the aim is to ignore photons.
          https://gitlab.cern.ch/atlas/athena/blob/master/Reconstruction/egamma/egammaAlgs/src/topoEgammaBuilder.cxx
    """

    log.debug('precisionElectronRecoSequence(RoIs = %s)', RoIs)

    # First the data verifiers:
    # Here we define the data dependencies. What input needs to be available for the Fexs (i.e. TopoClusters from precisionCalo) in order to run
    from TriggerMenuMT.HLTMenuConfig.Egamma.PrecisionCaloSequenceSetup import precisionCaloMenuDefs
    import AthenaCommon.CfgMgr as CfgMgr

    ## Taking Fast Track information computed in 2nd step ##
    TrackCollection = "TrigFastTrackFinder_Tracks_Electron"
    ViewVerifyTrk = CfgMgr.AthViews__ViewDataVerifier(
        "FastTrackViewDataVerifier")

    ViewVerifyTrk.DataObjects = [
        ('TrackCollection', 'StoreGateSvc+' + TrackCollection),
        ('xAOD::CaloClusterContainer',
         'StoreGateSvc+' + precisionCaloMenuDefs.precisionCaloClusters),
        ('CaloCellContainer', 'StoreGateSvc+CaloCells'),
        ('SG::AuxElement', 'StoreGateSvc+EventInfo.AveIntPerXDecor'),
        ('IDCInDetBSErrContainer', 'StoreGateSvc+SCT_FlaggedCondData_TRIG'),
        ('TrigRoiDescriptorCollection', 'StoreGateSvc+precisionElectron'),
        ('IDCInDetBSErrContainer', 'StoreGateSvc+SCT_ByteStreamErrs')
    ]  # the load below doesn't always work

    # These objects must be loaded from SGIL if not from CondInputLoader
    from AthenaCommon.AlgSequence import AlgSequence
    topSequence = AlgSequence()
    from IOVDbSvc.CondDB import conddb
    if not conddb.folderRequested("PixelClustering/PixelClusNNCalib"):
        ViewVerifyTrk.DataObjects += [
            ('TTrainedNetworkCollection', 'ConditionStore+PixelClusterNN'),
            ('TTrainedNetworkCollection',
             'ConditionStore+PixelClusterNNWithTrack')
        ]

    if globalflags.InputFormat.is_bytestream():
        ViewVerifyTrk.DataObjects += [
            ('InDetBSErrContainer', 'StoreGateSvc+PixelByteStreamErrs'),
            ('IDCInDetBSErrContainer', 'StoreGateSvc+SCT_ByteStreamErrs')
        ]
    else:
        topSequence.SGInputLoader.Load += [('TRT_RDO_Container',
                                            'StoreGateSvc+TRT_RDOs')]
        ViewVerifyTrk.DataObjects += [('TRT_RDO_Container',
                                       'StoreGateSvc+TRT_RDOs')]
    """ Precision Track Related Setup.... """
    PTAlgs = []
    PTTracks = []
    PTTrackParticles = []

    from TrigInDetConfig.InDetPT import makeInDetPrecisionTracking

    PTTracks, PTTrackParticles, PTAlgs = makeInDetPrecisionTracking(
        "electron", ViewVerifyTrk, inputFTFtracks=TrackCollection, rois=RoIs)
    PTSeq = parOR("precisionTrackingInElectrons", PTAlgs)
    trackParticles = PTTrackParticles[-1]

    electronPrecisionTrack = parOR("electronPrecisionTrack")
    electronPrecisionTrack += ViewVerifyTrk
    electronPrecisionTrack += PTSeq
    """ Retrieve the factories now """
    from TriggerMenuMT.HLTMenuConfig.Electron.TrigElectronFactories import TrigEgammaRecElectron, TrigElectronSuperClusterBuilder, TrigTopoEgammaElectronCfg
    from TriggerMenuMT.HLTMenuConfig.Egamma.TrigEgammaFactories import TrigEMTrackMatchBuilder

    #The sequence of these algorithms
    thesequence = parOR("precisionElectron_" + RoIs)

    # Create the sequence of three steps:
    #  - TrigEgammaRecElectron, TrigElectronSuperClusterBuilder, TrigTopoEgammaElectron
    trackMatchBuilder = TrigEMTrackMatchBuilder()
    trackMatchBuilder.TrackParticlesName = trackParticles
    TrigEgammaAlgo = TrigEgammaRecElectron()

    TrigEgammaAlgo.InputTopoClusterContainerName = precisionCaloMenuDefs.precisionCaloClusters
    TrigEgammaAlgo.TrackMatchBuilderTool = trackMatchBuilder
    thesequence += TrigEgammaAlgo

    trigElectronAlgo = TrigElectronSuperClusterBuilder()

    trigElectronAlgo.InputEgammaRecContainerName = TrigEgammaAlgo.egammaRecContainer
    thesequence += trigElectronAlgo

    trigTopoEgammaAlgo = TrigTopoEgammaElectronCfg()
    trigTopoEgammaAlgo.SuperElectronRecCollectionName = trigElectronAlgo.SuperElectronRecCollectionName
    collectionOut = trigTopoEgammaAlgo.ElectronOutputName
    thesequence += trigTopoEgammaAlgo

    from TriggerMenuMT.HLTMenuConfig.Egamma.TrigEgammaFactories import TrigElectronIsoBuilderCfg
    isoBuilder = TrigElectronIsoBuilderCfg()
    thesequence += isoBuilder

    return (thesequence, electronPrecisionTrack, collectionOut)