diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Electron/generateElectron.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Electron/generateElectron.py index a41d65b0169842feb6ed7ad0f00fe6b9487fce6c..6f7df7c0f1b06dd9e5cd18558ad808d1527bf02c 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Electron/generateElectron.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Electron/generateElectron.py @@ -10,105 +10,94 @@ from AthenaConfiguration.ComponentFactory import CompFactory from TriggerMenuMT.HLTMenuConfig.Menu.DictFromChainName import getChainMultFromDict +def _fastCalo(flags, chainDict): + selAcc=SelectionCA('FastCaloElectron') + selAcc.mergeReco(l2CaloRecoCfg(flags)) + + # this alg needs EventInfo decorated with the pileup info + from LumiBlockComps.LumiBlockMuWriterConfig import LumiBlockMuWriterCfg + selAcc.merge(LumiBlockMuWriterCfg(flags)) + + l2CaloHypo = l2CaloHypoCfg(flags, + name='L2ElectronCaloHypo', + CaloClusters=recordable('HLT_FastCaloEMClusters')) + + selAcc.addHypoAlgo(l2CaloHypo) + + fastCaloSequence = MenuSequenceCA(selAcc, + HypoToolGen=TrigEgammaFastCaloHypoToolFromDict) + + # this cannot work for asymmetric combined chains....FP + return ChainStep(name=selAcc.name, Sequences=[fastCaloSequence], chainDicts=[chainDict], multiplicity=getChainMultFromDict(chainDict)) + +def _ftf(flags, chainDict): + selAcc=SelectionCA('ElectronFTF') + # # # fast ID (need to be customised because require secialised configuration of the views maker - i.e. parent has to be linked) + name = "IMFastElectron" + evtViewMaker = CompFactory.EventViewCreatorAlgorithm(name, + ViewFallThrough = True, + RoIsLink = 'initialRoI', + RoITool = CompFactory.ViewCreatorInitialROITool(), + InViewRoIs = name+'RoIs', + Views = name+'Views', + ViewNodeName = 'FastElectronInView', + RequireParentView = True) + del name + from TrigInDetConfig.TrigInDetConfig import trigInDetFastTrackingCfg + idTracking = trigInDetFastTrackingCfg(flags, roisKey=evtViewMaker.InViewRoIs, signatureName="Electron") + fastInDetReco = InViewRecoCA('FastElectron', viewMaker=evtViewMaker) + fastInDetReco.mergeReco(idTracking) + fastInDetReco.addRecoAlgo(CompFactory.AthViews.ViewDataVerifier(name='VDVElectronFastCalo', + DataObjects=[('xAOD::TrigEMClusterContainer', 'StoreGateSvc+HLT_FastCaloEMClusters')]) ) + from TrigEgammaHypo.TrigEgammaFastElectronFexMTConfig import fastElectronFexAlgCfg + fastInDetReco.mergeReco(fastElectronFexAlgCfg(flags, rois=evtViewMaker.InViewRoIs)) + selAcc.mergeReco(fastInDetReco) + fastElectronHypoAlg = CompFactory.TrigEgammaFastElectronHypoAlgMT() + fastElectronHypoAlg.Electrons = 'HLT_FastElectrons' + fastElectronHypoAlg.RunInView = True + selAcc.addHypoAlgo(fastElectronHypoAlg) + from TrigEgammaHypo.TrigEgammaFastElectronHypoTool import TrigEgammaFastElectronHypoToolFromDict + fastInDetSequence = MenuSequenceCA(selAcc, + HypoToolGen=TrigEgammaFastElectronHypoToolFromDict) + return ChainStep( name=selAcc.name, Sequences=[fastInDetSequence], chainDicts=[chainDict], multiplicity=getChainMultFromDict(chainDict)) + +def _precisonCalo(flags, chainDict): + recoAcc = InViewRecoCA('ElectronRoITopoClusterReco') + recoAcc.addRecoAlgo(CompFactory.AthViews.ViewDataVerifier(name='VDV'+recoAcc.name, + DataObjects=[('TrigRoiDescriptorCollection', recoAcc.inputMaker().InViewRoIs), + ('CaloBCIDAverage', 'StoreGateSvc+CaloBCIDAverage')])) + + from TrigCaloRec.TrigCaloRecConfig import hltCaloTopoClusteringCfg + recoAcc.mergeReco(hltCaloTopoClusteringCfg(flags, + namePrefix="Electron", + roisKey=recoAcc.inputMaker().InViewRoIs)) # RoI + + copier = CompFactory.egammaTopoClusterCopier('TrigEgammaTopoClusterCopierPrecisionCaloRoIs', + InputTopoCollection='HLT_TopoCaloClustersRoI', + OutputTopoCollection='HLT_CaloEMClusters', + OutputTopoCollectionShallow='tmp_HLT_CaloEMClusters') + recoAcc.addRecoAlgo(copier) + + selAcc = SelectionCA('PrecisionCalo') + selAcc.mergeReco(recoAcc) + hypoAlg = CompFactory.TrigEgammaPrecisionCaloHypoAlgMT(name='ElectronPrecisionCaloHypo', + CaloClusters=recordable('HLT_CaloEMClusters')) + selAcc.addHypoAlgo(hypoAlg) + from TrigEgammaHypo.TrigEgammaPrecisionCaloHypoTool import TrigEgammaPrecisionCaloHypoToolFromDict + menuSequence = MenuSequenceCA(selAcc, + HypoToolGen=TrigEgammaPrecisionCaloHypoToolFromDict) + return ChainStep(name=selAcc.name, Sequences=[menuSequence], chainDicts=[chainDict], multiplicity=getChainMultFromDict(chainDict)) -def generateChains(flags, chainDict): - - def __fastCalo(): - selAcc=SelectionCA('FastCaloElectron') - selAcc.mergeReco(l2CaloRecoCfg(flags)) - - # this alg needs EventInfo decorated with the pileup info - from LumiBlockComps.LumiBlockMuWriterConfig import LumiBlockMuWriterCfg - selAcc.merge(LumiBlockMuWriterCfg(flags)) - - l2CaloHypo = l2CaloHypoCfg(flags, - name='L2ElectronCaloHypo', - CaloClusters=recordable('HLT_FastCaloEMClusters')) - - selAcc.addHypoAlgo(l2CaloHypo) - - fastCaloSequence = MenuSequenceCA(selAcc, - HypoToolGen=TrigEgammaFastCaloHypoToolFromDict) - - # this cannot work for asymmetric combined chains....FP - return ChainStep(name=selAcc.name, Sequences=[fastCaloSequence], chainDicts=[chainDict], multiplicity=getChainMultFromDict(chainDict)) - - def __ftf(): - selAcc=SelectionCA('ElectronFTF') - - # # # fast ID (need to be customised because require secialised configuration of the views maker - i.e. parent has to be linked) - name = "IMFastElectron" - evtViewMaker = CompFactory.EventViewCreatorAlgorithm(name, - ViewFallThrough = True, - RoIsLink = 'initialRoI', - RoITool = CompFactory.ViewCreatorInitialROITool(), - InViewRoIs = name+'RoIs', - Views = name+'Views', - ViewNodeName = 'FastElectronInView', - RequireParentView = True) - del name - from TrigInDetConfig.TrigInDetConfig import trigInDetFastTrackingCfg - idTracking = trigInDetFastTrackingCfg(flags, roisKey=evtViewMaker.InViewRoIs, signatureName="Electron") - - fastInDetReco = InViewRecoCA('FastElectron', viewMaker=evtViewMaker) - fastInDetReco.mergeReco(idTracking) - fastInDetReco.addRecoAlgo(CompFactory.AthViews.ViewDataVerifier(name='VDVElectronFastCalo', - DataObjects=[('xAOD::TrigEMClusterContainer', 'StoreGateSvc+HLT_FastCaloEMClusters')]) ) - - from TrigEgammaHypo.TrigEgammaFastElectronFexMTConfig import fastElectronFexAlgCfg - fastInDetReco.mergeReco(fastElectronFexAlgCfg(flags, rois=evtViewMaker.InViewRoIs)) - selAcc.mergeReco(fastInDetReco) - - fastElectronHypoAlg = CompFactory.TrigEgammaFastElectronHypoAlgMT() - fastElectronHypoAlg.Electrons = 'HLT_FastElectrons' - fastElectronHypoAlg.RunInView = True - selAcc.addHypoAlgo(fastElectronHypoAlg) - - from TrigEgammaHypo.TrigEgammaFastElectronHypoTool import TrigEgammaFastElectronHypoToolFromDict - fastInDetSequence = MenuSequenceCA(selAcc, - HypoToolGen=TrigEgammaFastElectronHypoToolFromDict) - - return ChainStep( name=selAcc.name, Sequences=[fastInDetSequence], chainDicts=[chainDict], multiplicity=getChainMultFromDict(chainDict)) +def generateChains(flags, chainDict): l1Thresholds=[] for part in chainDict['chainParts']: l1Thresholds.append(part['L1threshold']) - # # # Precision calo - def __precisonCalo(): - recoAcc = InViewRecoCA('ElectronRoITopoClusterReco') - recoAcc.addRecoAlgo(CompFactory.AthViews.ViewDataVerifier(name='VDV'+recoAcc.name, - DataObjects=[('TrigRoiDescriptorCollection', recoAcc.inputMaker().InViewRoIs), - ('CaloBCIDAverage', 'StoreGateSvc+CaloBCIDAverage')])) - - from TrigCaloRec.TrigCaloRecConfig import hltCaloTopoClusteringCfg - recoAcc.mergeReco(hltCaloTopoClusteringCfg(flags, - namePrefix="Electron", - roisKey=recoAcc.inputMaker().InViewRoIs)) # RoI - - copier = CompFactory.egammaTopoClusterCopier('TrigEgammaTopoClusterCopierPrecisionCaloRoIs', - InputTopoCollection='HLT_TopoCaloClustersRoI', - OutputTopoCollection='HLT_CaloEMClusters', - OutputTopoCollectionShallow='tmp_HLT_CaloEMClusters') - recoAcc.addRecoAlgo(copier) - - selAcc = SelectionCA('PrecisionCalo') - selAcc.mergeReco(recoAcc) - hypoAlg = CompFactory.TrigEgammaPrecisionCaloHypoAlgMT(name='ElectronPrecisionCaloHypo', - CaloClusters=recordable('HLT_CaloEMClusters')) - selAcc.addHypoAlgo(hypoAlg) - from TrigEgammaHypo.TrigEgammaPrecisionCaloHypoTool import TrigEgammaPrecisionCaloHypoToolFromDict - menuSequence = MenuSequenceCA(selAcc, - HypoToolGen=TrigEgammaPrecisionCaloHypoToolFromDict) - return ChainStep(name=selAcc.name, Sequences=[menuSequence], chainDicts=[chainDict], multiplicity=getChainMultFromDict(chainDict)) - - # # # Precison tracking - - # # # offline egamma chain = Chain(chainDict['chainName'], L1Thresholds=l1Thresholds, - ChainSteps=[__fastCalo(), __ftf(), __precisonCalo()]) + ChainSteps=[_fastCalo(flags, chainDict), _ftf(flags, chainDict), _precisonCalo(flags, chainDict)]) return chain diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Photon/generatePhoton.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Photon/generatePhoton.py index 9bf2dd2229bbc1e0606eb623fa0eb72359be3cdd..78e8d3d6bca5ed5819007e4856858c79cb6a7c7d 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Photon/generatePhoton.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Photon/generatePhoton.py @@ -2,10 +2,9 @@ from TriggerMenuMT.HLTMenuConfig.Electron.ElectronRecoSequences import l2CaloRecoCfg, l2CaloHypoCfg from TriggerMenuMT.HLTMenuConfig.Photon.PhotonRecoSequences import l2PhotonRecoCfg, l2PhotonHypoCfg -from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import MenuSequenceCA, \ - ChainStep, Chain, createStepView -from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator - +from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import MenuSequenceCA, SelectionCA, ChainStep, Chain +from TriggerMenuMT.HLTMenuConfig.Menu.DictFromChainName import getChainMultFromDict +from TrigEDMConfig.TriggerEDMRun3 import recordable from TrigEgammaHypo.TrigEgammaFastCaloHypoTool import TrigEgammaFastCaloHypoToolFromDict from TrigEgammaHypo.TrigEgammaFastPhotonHypoTool import TrigEgammaFastPhotonHypoToolFromDict @@ -13,59 +12,49 @@ import pprint from AthenaCommon.Logging import logging log = logging.getLogger( 'TriggerMenuMT.HLTMenuConfig.Photon.generatePhoton' ) -def generateChains(flags, chainDict): - firstStepName = 'FastCaloPhoton' - stepReco, stepView = createStepView(firstStepName) - - accCalo = ComponentAccumulator() - accCalo.addSequence(stepView) +# TODO reuse electron calo setup (these two could share all algorithms) +def _fastCalo(flags, chainDict): + selAcc=SelectionCA('FastCaloPhoton') + selAcc.mergeReco(l2CaloRecoCfg(flags)) - l2CaloReco = l2CaloRecoCfg(flags) - accCalo.merge(l2CaloReco, sequenceName=stepReco.getName()) - - # this alg needs EventInfo decorated with the pileup info + # this alg needs EventInfo decorated with the pileup info from LumiBlockComps.LumiBlockMuWriterConfig import LumiBlockMuWriterCfg - accCalo.merge( LumiBlockMuWriterCfg(flags) ) - - l2CaloHypo = l2CaloHypoCfg( flags, - name = 'L2PhotonCaloHypo', - CaloClusters = 'HLT_FastCaloEMClusters' ) + selAcc.merge(LumiBlockMuWriterCfg(flags)) - accCalo.addEventAlgo(l2CaloHypo, sequenceName=stepView.getName()) + l2CaloHypo = l2CaloHypoCfg(flags, + name='L2PhotonCaloHypo', + CaloClusters=recordable('HLT_FastCaloEMClusters')) - fastCaloSequence = MenuSequenceCA(accCalo, - HypoToolGen = TrigEgammaFastCaloHypoToolFromDict) + selAcc.addHypoAlgo(l2CaloHypo) - fastCaloStep = ChainStep(firstStepName, [fastCaloSequence], multiplicity=[1],chainDicts=[chainDict] ) + fastCaloSequence = MenuSequenceCA(selAcc, + HypoToolGen=TrigEgammaFastCaloHypoToolFromDict) + return ChainStep(name=selAcc.name, Sequences=[fastCaloSequence], chainDicts=[chainDict], multiplicity=getChainMultFromDict(chainDict)) - secondStepName = 'FastPhoton' - stepReco, stepView = createStepView(secondStepName) - accPhoton = ComponentAccumulator() - accPhoton.addSequence(stepView) - - l2PhotonReco = l2PhotonRecoCfg(flags) - accPhoton.merge(l2PhotonReco, sequenceName=stepReco.getName()) +def _fastPhoton(flags, chainDict): + selAcc=SelectionCA('FastPhoton') + selAcc.mergeReco(l2PhotonRecoCfg(flags)) l2PhotonHypo = l2PhotonHypoCfg( flags, Photons = 'HLT_FastPhotons', RunInView = True ) + selAcc.addHypoAlgo(l2PhotonHypo) - accPhoton.addEventAlgo(l2PhotonHypo, sequenceName=stepView.getName()) - - l2PhotonSequence = MenuSequenceCA(accPhoton, + l2PhotonSequence = MenuSequenceCA(selAcc, HypoToolGen = TrigEgammaFastPhotonHypoToolFromDict) - l2PhotonStep = ChainStep(secondStepName, [l2PhotonSequence], multiplicity=[1],chainDicts=[chainDict] ) + return ChainStep(selAcc.name, Sequences=[l2PhotonSequence], chainDicts=[chainDict], multiplicity=getChainMultFromDict(chainDict) ) +def generateChains(flags, chainDict): + l1Thresholds=[] for part in chainDict['chainParts']: l1Thresholds.append(part['L1threshold']) log.debug('dictionary is: %s\n', pprint.pformat(chainDict)) - - chain = Chain(chainDict['chainName'], L1Thresholds=l1Thresholds, ChainSteps=[fastCaloStep, l2PhotonStep]) + chain = Chain(chainDict['chainName'], L1Thresholds=l1Thresholds, ChainSteps=[_fastCalo(flags, chainDict), _fastPhoton(flags, chainDict)]) return chain