diff --git a/Trigger/TrigValidation/TrigUpgradeTest/python/InDetConfig.py b/Trigger/TrigValidation/TrigUpgradeTest/python/InDetConfig.py new file mode 100644 index 0000000000000000000000000000000000000000..16c459f94fd76b6547073cc563746128a9cb22be --- /dev/null +++ b/Trigger/TrigValidation/TrigUpgradeTest/python/InDetConfig.py @@ -0,0 +1,272 @@ +# +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# + +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator + +def TrigInDetConfig( inputFlags, viewSeq ): + acc = ComponentAccumulator() + + from InDetRecExample.InDetKeys import InDetKeys + #Create IdentifiableCaches + from InDetPrepRawDataFormation.InDetPrepRawDataFormationConf import InDet__CacheCreator + InDetCacheCreatorTrigViews = InDet__CacheCreator(name = "InDetCacheCreatorTrigViews", + Pixel_ClusterKey = "PixelTrigClustersCache", + SCT_ClusterKey = "SCT_ClustersCache", + SpacePointCachePix = "PixelSpacePointCache", + SpacePointCacheSCT = "SctSpacePointCache", + SCTRDOCacheKey = "SctRDOCache", + PixRDOCacheKey = "PixRDOCache",) + + acc.addEventAlgo(InDetCacheCreatorTrigViews) + + + #Only add raw data decoders if we're running over raw data + isMC = inputFlags.get("global.isMC") + if not isMC: + #Pixel + + from PixelRawDataByteStreamCnv.PixelRawDataByteStreamCnvConf import PixelRodDecoder + InDetPixelRodDecoder = PixelRodDecoder(name = "InDetPixelRodDecoder") + acc.addPublicTool(InDetPixelRodDecoder) + + from PixelRawDataByteStreamCnv.PixelRawDataByteStreamCnvConf import PixelRawDataProviderTool + InDetPixelRawDataProviderTool = PixelRawDataProviderTool(name = "InDetPixelRawDataProviderTool", + Decoder = InDetPixelRodDecoder) + acc.addPublicTool(InDetPixelRawDataProviderTool) + + + # load the PixelRawDataProvider + from PixelRawDataByteStreamCnv.PixelRawDataByteStreamCnvConf import PixelRawDataProvider + InDetPixelRawDataProvider = PixelRawDataProvider(name = "InDetPixelRawDataProvider", + RDOKey = InDetKeys.PixelRDOs(), + ProviderTool = InDetPixelRawDataProviderTool,) + #OutputLevel = INFO) + InDetPixelRawDataProvider.isRoI_Seeded = True + InDetPixelRawDataProvider.RoIs = "EMViewRoIs" + InDetPixelRawDataProvider.RDOCacheKey = InDetCacheCreatorTrigViews.PixRDOCacheKey + + acc.addEventAlgo(InDetPixelRawDataProvider) + + + + #SCT + from SCT_RawDataByteStreamCnv.SCT_RawDataByteStreamCnvConf import SCT_RodDecoder + InDetSCTRodDecoder = SCT_RodDecoder(name = "InDetSCTRodDecoder", + TriggerMode = False,)# OutputLevel = INFO) + acc.addPublicTool(InDetSCTRodDecoder) + + from SCT_RawDataByteStreamCnv.SCT_RawDataByteStreamCnvConf import SCTRawDataProviderTool + InDetSCTRawDataProviderTool = SCTRawDataProviderTool(name = "InDetSCTRawDataProviderTool", + Decoder = InDetSCTRodDecoder) + acc.addPublicTool(InDetSCTRawDataProviderTool) + + # load the SCTRawDataProvider + from SCT_RawDataByteStreamCnv.SCT_RawDataByteStreamCnvConf import SCTRawDataProvider + InDetSCTRawDataProvider = SCTRawDataProvider(name = "InDetSCTRawDataProvider", + RDOKey = InDetKeys.SCT_RDOs(), + ProviderTool = InDetSCTRawDataProviderTool, ) + #OutputLevel = INFO) + InDetSCTRawDataProvider.isRoI_Seeded = True + InDetSCTRawDataProvider.RoIs = "EMViewRoIs" + InDetSCTRawDataProvider.RDOCacheKey = InDetCacheCreatorTrigViews.SCTRDOCacheKey + + acc.addEventAlgo(InDetSCTRawDataProvider) + + # load the SCTEventFlagWriter + from SCT_RawDataByteStreamCnv.SCT_RawDataByteStreamCnvConf import SCTEventFlagWriter + InDetSCTEventFlagWriter = SCTEventFlagWriter(name = "InDetSCTEventFlagWriter") + + acc.addEventAlgo(InDetSCTEventFlagWriter) + + + #TRT + from TRT_ConditionsServices.TRT_ConditionsServicesConf import TRT_CalDbSvc + InDetTRTCalDbSvc = TRT_CalDbSvc() + acc.addService(InDetTRTCalDbSvc) + + from TRT_ConditionsServices.TRT_ConditionsServicesConf import TRT_StrawStatusSummarySvc + InDetTRTStrawStatusSummarySvc = TRT_StrawStatusSummarySvc(name = "InDetTRTStrawStatusSummarySvc") + acc.addService(InDetTRTStrawStatusSummarySvc) + + from TRT_RawDataByteStreamCnv.TRT_RawDataByteStreamCnvConf import TRT_RodDecoder + InDetTRTRodDecoder = TRT_RodDecoder(name = "InDetTRTRodDecoder", + LoadCompressTableDB = True)#(globalflags.DataSource() != 'geant4')) + acc.addPublicTool(InDetTRTRodDecoder) + + from TRT_RawDataByteStreamCnv.TRT_RawDataByteStreamCnvConf import TRTRawDataProviderTool + InDetTRTRawDataProviderTool = TRTRawDataProviderTool(name = "InDetTRTRawDataProviderTool", + Decoder = InDetTRTRodDecoder) + acc.addPublicTool(InDetTRTRawDataProviderTool) + + + # load the TRTRawDataProvider + from TRT_RawDataByteStreamCnv.TRT_RawDataByteStreamCnvConf import TRTRawDataProvider + InDetTRTRawDataProvider = TRTRawDataProvider(name = "InDetTRTRawDataProvider", + RDOKey = "TRT_RDOs", + ProviderTool = InDetTRTRawDataProviderTool) + InDetTRTRawDataProvider.isRoI_Seeded = True + InDetTRTRawDataProvider.RoIs = "EMViewRoIs" + + acc.addEventAlgo(InDetTRTRawDataProvider) + + + #Pixel clusterisation + + from SiClusterizationTool.SiClusterizationToolConf import InDet__ClusterMakerTool + InDetClusterMakerTool = InDet__ClusterMakerTool(name = "InDetClusterMakerTool", + PixelCalibSvc = None, + PixelOfflineCalibSvc = None, + UsePixelCalibCondDB = False) + + acc.addPublicTool(InDetClusterMakerTool) + + + from SiClusterizationTool.SiClusterizationToolConf import InDet__MergedPixelsTool + InDetMergedPixelsTool = InDet__MergedPixelsTool(name = "InDetMergedPixelsTool", + globalPosAlg = InDetClusterMakerTool, + MinimalSplitSize = 0, + MaximalSplitSize = 49, + MinimalSplitProbability = 0, + DoIBLSplitting = True, + SplitClusterAmbiguityMap= InDetKeys.SplitClusterAmbiguityMap()) + acc.addPublicTool(InDetMergedPixelsTool) + + from SiClusterizationTool.SiClusterizationToolConf import InDet__PixelGangedAmbiguitiesFinder + InDetPixelGangedAmbiguitiesFinder = InDet__PixelGangedAmbiguitiesFinder(name = "InDetPixelGangedAmbiguitiesFinder") + acc.addPublicTool(InDetPixelGangedAmbiguitiesFinder) + + from InDetPrepRawDataFormation.InDetPrepRawDataFormationConf import InDet__PixelClusterization + InDetPixelClusterization = InDet__PixelClusterization(name = "InDetPixelClusterization", + clusteringTool = InDetMergedPixelsTool, + gangedAmbiguitiesFinder = InDetPixelGangedAmbiguitiesFinder, + DetectorManagerName = InDetKeys.PixelManager(), + DataObjectName = InDetKeys.PixelRDOs(), + AmbiguitiesMap = 'TrigPixelClusterAmbiguitiesMap', + ClustersName = "PixelTrigClusters",)# OutputLevel = INFO) + InDetPixelClusterization.isRoI_Seeded = True + InDetPixelClusterization.RoIs = "EMViewRoIs" + InDetPixelClusterization.ClusterContainerCacheKey = InDetCacheCreatorTrigViews.Pixel_ClusterKey + + acc.addEventAlgo(InDetPixelClusterization) + + from SCT_ConditionsTools.SCT_FlaggedConditionToolSetup import SCT_FlaggedConditionToolSetup + sct_FlaggedConditionToolSetup = SCT_FlaggedConditionToolSetup() + sct_FlaggedConditionToolSetup.setup() + InDetSCT_FlaggedConditionTool = sct_FlaggedConditionToolSetup.getTool() + + from SCT_ConditionsTools.SCT_ConditionsSummaryToolSetup import SCT_ConditionsSummaryToolSetup + sct_ConditionsSummaryToolSetup = SCT_ConditionsSummaryToolSetup() + sct_ConditionsSummaryToolSetup.setToolName("InDetSCT_ConditionsSummaryTool") + sct_ConditionsSummaryToolSetup.setup() + InDetSCT_ConditionsSummaryTool = sct_ConditionsSummaryToolSetup.getTool() + condTools = [] + for condToolHandle in InDetSCT_ConditionsSummaryTool.ConditionsTools: + condTool = condToolHandle.typeAndName + if condTool not in condTools: + if condTool != InDetSCT_FlaggedConditionTool.getFullName(): + condTools.append(condTool) + sct_ConditionsSummaryToolSetupWithoutFlagged = SCT_ConditionsSummaryToolSetup() + sct_ConditionsSummaryToolSetupWithoutFlagged.setToolName("InDetSCT_ConditionsSummaryToolWithoutFlagged") + sct_ConditionsSummaryToolSetupWithoutFlagged.setup() + InDetSCT_ConditionsSummaryToolWithoutFlagged = sct_ConditionsSummaryToolSetupWithoutFlagged.getTool() + InDetSCT_ConditionsSummaryToolWithoutFlagged.ConditionsTools = condTools + + # + # --- SCT_ClusteringTool (public) + # + from SiClusterizationTool.SiClusterizationToolConf import InDet__SCT_ClusteringTool + InDetSCT_ClusteringTool = InDet__SCT_ClusteringTool(name = "InDetSCT_ClusteringTool", + globalPosAlg = InDetClusterMakerTool, + conditionsTool = InDetSCT_ConditionsSummaryToolWithoutFlagged) + # + # --- SCT_Clusterization algorithm + # + + from InDetPrepRawDataFormation.InDetPrepRawDataFormationConf import InDet__SCT_Clusterization + InDetSCT_Clusterization = InDet__SCT_Clusterization(name = "InDetSCT_Clusterization", + clusteringTool = InDetSCT_ClusteringTool, + # ChannelStatus = InDetSCT_ChannelStatusAlg, + DetectorManagerName = InDetKeys.SCT_Manager(), + DataObjectName = InDetKeys.SCT_RDOs(), + ClustersName = "SCT_TrigClusters", + conditionsTool = InDetSCT_ConditionsSummaryToolWithoutFlagged) + InDetSCT_Clusterization.isRoI_Seeded = True + InDetSCT_Clusterization.RoIs = "EMViewRoIs" + InDetSCT_Clusterization.ClusterContainerCacheKey = InDetCacheCreatorTrigViews.SCT_ClusterKey + + acc.addEventAlgo(InDetSCT_Clusterization) + + + #Space points and FTF + + from SiSpacePointTool.SiSpacePointToolConf import InDet__SiSpacePointMakerTool + InDetSiSpacePointMakerTool = InDet__SiSpacePointMakerTool(name = "InDetSiSpacePointMakerTool") + acc.addPublicTool(InDetSiSpacePointMakerTool) + + from AthenaCommon.DetFlags import DetFlags + from SiSpacePointFormation.SiSpacePointFormationConf import InDet__SiTrackerSpacePointFinder + InDetSiTrackerSpacePointFinder = InDet__SiTrackerSpacePointFinder(name = "InDetSiTrackerSpacePointFinder", + SiSpacePointMakerTool = InDetSiSpacePointMakerTool, + PixelsClustersName = "PixelTrigClusters", + SCT_ClustersName = "SCT_TrigClusters", + SpacePointsPixelName = "PixelTrigSpacePoints", + SpacePointsSCTName = "SCT_TrigSpacePoints", + SpacePointsOverlapName = InDetKeys.OverlapSpacePoints(), + ProcessPixels = DetFlags.haveRIO.pixel_on(), + ProcessSCTs = DetFlags.haveRIO.SCT_on(), + ProcessOverlaps = DetFlags.haveRIO.SCT_on(), + SpacePointCacheSCT = InDetCacheCreatorTrigViews.SpacePointCacheSCT, + SpacePointCachePix = InDetCacheCreatorTrigViews.SpacePointCachePix,) + #OutputLevel=INFO) + + acc.addEventAlgo(InDetSiTrackerSpacePointFinder) + + + from TrigInDetConf.TrigInDetRecCommonTools import InDetTrigFastTrackSummaryTool + from TrigInDetConf.TrigInDetPostTools import InDetTrigParticleCreatorToolFTF + + from InDetTrigParticleCreation.InDetTrigParticleCreationConf import InDet__TrigTrackingxAODCnvMT + theTrackParticleCreatorAlg = InDet__TrigTrackingxAODCnvMT(name = "InDetTrigTrackParticleCreatorAlg", + doIBLresidual = False, + TrackName = "TrigFastTrackFinder_Tracks", + TrackParticlesName = "xAODTracks", + ParticleCreatorTool = InDetTrigParticleCreatorToolFTF) + theTrackParticleCreatorAlg.roiCollectionName = "EMViewRoIs" + acc.addEventAlgo(theTrackParticleCreatorAlg) + + + return acc + +if __name__ == "__main__": + from AthenaCommon.Constants import INFO,DEBUG + from AthenaConfiguration.AllConfigFlags import ConfigFlags + from AthenaCommon.AlgSequence import AthSequencer + flags = ConfigFlags + flags.set("global.InputFiles", ["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data17_13TeV.00327265.physics_EnhancedBias.merge.RAW._lb0100._SFO-1._0001.1"]) + acc = ComponentAccumulator() + nThreads=1 + + from StoreGate.StoreGateConf import SG__HiveMgrSvc + eventDataSvc = SG__HiveMgrSvc("EventDataSvc") + eventDataSvc.NSlots = nThreads + eventDataSvc.OutputLevel = DEBUG + acc.addService( eventDataSvc ) + + from SGComps.SGCompsConf import SGInputLoader + inputLoader = SGInputLoader(DetStore = 'StoreGateSvc/DetectorStore', + EvtStore = 'StoreGateSvc', + ExtraInputs = [], + ExtraOutputs = [], + FailIfNoProxy = False, + Load = [], + NeededResources = []) + + acc.addEventAlgo( inputLoader, sequence='AthAlgSeq' ) + + viewSeq = AthSequencer("AthViewSeq", Sequential=True, ModeOR=False, StopOverride=False) + acc.addSequence(viewSeq) + + acc = TrigInDetConfig( flags , viewSeq) + acc.store( file( "test.pkl", "w" ) ) + print "All OK"