From c516aa7a452e9fe02f0db82f1796be03fd20647a Mon Sep 17 00:00:00 2001 From: Tomasz Bold <tomasz.bold@gmail.com> Date: Fri, 26 Mar 2021 14:46:11 +0000 Subject: [PATCH] 1st version of the top level reco driver script --- Calorimeter/CaloRec/python/CaloRecoConfig.py | 4 +- .../CaloRec/python/CaloTopoClusterConfig.py | 6 +- .../python/ComponentAccumulator.py | 3 +- InnerDetector/InDetConfig/CMakeLists.txt | 4 + .../InDetConfig/python/InDetConfigFlags.py | 2 +- .../InDetRecCaloSeededROISelectionConfig.py | 31 + .../InDetConfig/python/TrackRecoConfig.py | 186 +++++ .../python/TrackingCommonConfig.py | 2 +- .../python/TrackingSiPatternConfig.py | 781 ++++++++++++++++++ .../src/CaloClusterROI_Selector.cxx | 5 +- .../MuonCombinedReconstructionConfig.py | 5 +- .../RecJobTransforms/CMakeLists.txt | 13 + .../RecJobTransforms/python/RecoSteering.py | 115 +++ .../egammaConfig/python/egammaConfigFlags.py | 2 +- 14 files changed, 1143 insertions(+), 16 deletions(-) create mode 100644 InnerDetector/InDetConfig/python/InDetRecCaloSeededROISelectionConfig.py create mode 100644 InnerDetector/InDetConfig/python/TrackingSiPatternConfig.py create mode 100644 Reconstruction/RecJobTransforms/python/RecoSteering.py diff --git a/Calorimeter/CaloRec/python/CaloRecoConfig.py b/Calorimeter/CaloRec/python/CaloRecoConfig.py index 0d28fec962e6..9a2e0ace3a1a 100644 --- a/Calorimeter/CaloRec/python/CaloRecoConfig.py +++ b/Calorimeter/CaloRec/python/CaloRecoConfig.py @@ -3,7 +3,7 @@ from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory -def CaloRecoCfg(configFlags): +def CaloRecoCfg(configFlags, clustersname="CaloTopoClusters"): result=ComponentAccumulator() if not configFlags.Input.isMC: @@ -33,7 +33,7 @@ def CaloRecoCfg(configFlags): #Configure topo-cluster builder from CaloRec.CaloTopoClusterConfig import CaloTopoClusterCfg - result.merge(CaloTopoClusterCfg(configFlags)) + result.merge(CaloTopoClusterCfg(configFlags, clustersname=clustersname)) return result diff --git a/Calorimeter/CaloRec/python/CaloTopoClusterConfig.py b/Calorimeter/CaloRec/python/CaloTopoClusterConfig.py index 629b8af6d390..a7a9979864d8 100644 --- a/Calorimeter/CaloRec/python/CaloTopoClusterConfig.py +++ b/Calorimeter/CaloRec/python/CaloTopoClusterConfig.py @@ -301,11 +301,9 @@ def CaloTopoClusterSplitterToolCfg(configFlags): # Steering options for trigger # Maybe offline reco options should be extracted from flags elsewhere -def CaloTopoClusterCfg(configFlags,cellsname="AllCalo",clustersname="",doLCCalib=None): +def CaloTopoClusterCfg(configFlags,cellsname="AllCalo",clustersname="CaloTopoClusters",doLCCalib=None): result=ComponentAccumulator() - if not clustersname: - clustersname = "CaloTopoClusters" from LArGeoAlgsNV.LArGMConfig import LArGMCfg from TileGeoModel.TileGMConfig import TileGMCfg @@ -340,7 +338,7 @@ def CaloTopoClusterCfg(configFlags,cellsname="AllCalo",clustersname="",doLCCalib # EnergyCut = 500*MeV, - CaloTopoCluster=CaloClusterMaker(clustersname) + CaloTopoCluster=CaloClusterMaker(clustersname+"Maker") CaloTopoCluster.ClustersOutputName=clustersname CaloTopoCluster.ClusterMakerTools = [TopoMaker, TopoSplitter] diff --git a/Control/AthenaConfiguration/python/ComponentAccumulator.py b/Control/AthenaConfiguration/python/ComponentAccumulator.py index 3a3e3148a87e..0c06a1b02e73 100644 --- a/Control/AthenaConfiguration/python/ComponentAccumulator.py +++ b/Control/AthenaConfiguration/python/ComponentAccumulator.py @@ -147,7 +147,8 @@ class ComponentAccumulator(object): traceback.print_stack() if getattr(self,'_privateTools',None) is not None: log = logging.getLogger("ComponentAccumulator") - log.error("Deleting a ComponentAccumulator with dangling private tool(s)") + log.error("Deleting a ComponentAccumulator with dangling private tool(s): %s", + " ".join([t.name for t in self._privateTools]) if isinstance(self._privateTools, collections.abc.Sequence) else self._privateTools.name) #pass diff --git a/InnerDetector/InDetConfig/CMakeLists.txt b/InnerDetector/InDetConfig/CMakeLists.txt index a08247182733..a6932ba6a4fd 100644 --- a/InnerDetector/InDetConfig/CMakeLists.txt +++ b/InnerDetector/InDetConfig/CMakeLists.txt @@ -22,3 +22,7 @@ atlas_add_test( BackTrackingConfig_test atlas_add_test( TRTSegmentFindingConfig_test SCRIPT python -m InDetConfig.TRTSegmentFindingConfig --norun POST_EXEC_SCRIPT nopost.sh) + +atlas_add_test( TrackRecoConfig_test + SCRIPT python -m InDetConfig.TrackRecoConfig --norun + POST_EXEC_SCRIPT nopost.sh) diff --git a/InnerDetector/InDetConfig/python/InDetConfigFlags.py b/InnerDetector/InDetConfig/python/InDetConfigFlags.py index 9beed0504113..d95f00407942 100644 --- a/InnerDetector/InDetConfig/python/InDetConfigFlags.py +++ b/InnerDetector/InDetConfig/python/InDetConfigFlags.py @@ -29,7 +29,7 @@ def createInDetConfigFlags(): icf.addFlag("InDet.doMinimalReco", False) # Turn running of minimal reconstruction on and off icf.addFlag("InDet.doDVRetracking", False) # Turn running of large-d0 retracking mode on and off. This flag assumes that the processing is done from a (D)ESD file icf.addFlag("InDet.postProcessing", True) # Turn running of post processing on and off - icf.addFlag("InDet.doTruth", True) # Turn running of truth matching on and off + icf.addFlag("InDet.doTruth", lambda f: f.Input.isMC) # Turn running of truth matching on and off (by default on for MC off for data) icf.addFlag("InDet.loadTools", True) # Turn loading of tools on and off icf.addFlag("InDet.doBackTracking", True) # Turn running of backtracking on and off icf.addFlag("InDet.doLowPt",True) # Turn running of doLowPt second pass on and off diff --git a/InnerDetector/InDetConfig/python/InDetRecCaloSeededROISelectionConfig.py b/InnerDetector/InDetConfig/python/InDetRecCaloSeededROISelectionConfig.py new file mode 100644 index 000000000000..4f9da91f4f26 --- /dev/null +++ b/InnerDetector/InDetConfig/python/InDetRecCaloSeededROISelectionConfig.py @@ -0,0 +1,31 @@ +# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator +from AthenaConfiguration.ComponentFactory import CompFactory +from InDetRecExample.InDetKeys import InDetKeys + +def egammaCaloClusterSelectorCfg(ConfigFlags, name="caloClusterRoISelector", **kwargs): + result = ComponentAccumulator() + if "egammaCheckEnergyDepositTool" not in kwargs: + kwargs["egammaCheckEnergyDepositTool"] = CompFactory.egammaCheckEnergyDepositTool() + kwargs.setdefault("EMEtCut", 2250.) + kwargs.setdefault("EMEtSplittingFraction", 0.7) + kwargs.setdefault("EMFCut", 0.7) + kwargs.setdefault("RetaCut", 0.65) + kwargs.setdefault("HadLeakCut", 0.15) + result.setPrivateTools(CompFactory.egammaCaloClusterSelector(name, **kwargs)) + return result + + +def CaloClusterROI_SelectorCfg(ConfigFlags, name="InDetCaloClusterROISelector", **kwargs): + result = ComponentAccumulator() + kwargs.setdefault("InputClusterContainerName", ConfigFlags.Egamma.Keys.Internal.EgammaTopoClusters) #TODO synhronise InDetKeys.CaloClusterContainer()) + kwargs.setdefault("OutputClusterContainerName", InDetKeys.CaloClusterROIContainer()) + if "CaloClusterROIBuilder" not in kwargs: + kwargs["CaloClusterROIBuilder"] = CompFactory.InDet.CaloClusterROI_Builder( + "InDetCaloClusterROIBuilder", + EMEnergyOnly=True, + ) + if "egammaCaloClusterSelector" not in kwargs: + kwargs["egammaCaloClusterSelector"] = result.popToolsAndMerge(egammaCaloClusterSelectorCfg(ConfigFlags)) + result.addEventAlgo(CompFactory.InDet.CaloClusterROI_Selector(name, **kwargs), primary=True) + return result \ No newline at end of file diff --git a/InnerDetector/InDetConfig/python/TrackRecoConfig.py b/InnerDetector/InDetConfig/python/TrackRecoConfig.py index f70962afb055..3fe4ecd42cc6 100644 --- a/InnerDetector/InDetConfig/python/TrackRecoConfig.py +++ b/InnerDetector/InDetConfig/python/TrackRecoConfig.py @@ -136,3 +136,189 @@ def ClusterMakerToolCfg(flags, name="InDetClusterMakerTool", **kwargs) : acc.addPublicTool(InDetClusterMakerTool, primary=True) return acc + +def TrackToVertexCfg(flags, name="TrackToVertex", **kwargs): + result = ComponentAccumulator() + if "Extrapolator" not in kwargs: + from TrkConfig.AtlasExtrapolatorConfig import AtlasExtrapolatorCfg + kwargs["Extrapolator"] = result.popToolsAndMerge(AtlasExtrapolatorCfg(flags)) + from BeamSpotConditions.BeamSpotConditionsConfig import BeamSpotCondAlgCfg + + result.merge(BeamSpotCondAlgCfg(flags)) + result.setPrivateTools(CompFactory.Reco.TrackToVertex(name, **kwargs)) + return result + +def TrackParticleCreatorToolCfg(flags, name="TrackParticleCreatorTool", **kwargs): + result = ComponentAccumulator() + if "TrackToVertex" not in kwargs: + kwargs["TrackToVertex"] = result.popToolsAndMerge(TrackToVertexCfg(flags)) + if "TrackSummaryTool" not in kwargs: + from InDetConfig.TrackingCommonConfig import InDetTrackSummaryToolSharedHitsCfg + kwargs["TrackSummaryTool"] = result.popToolsAndMerge(InDetTrackSummaryToolSharedHitsCfg(flags)) + p_expr = flags.InDet.perigeeExpression + kwargs.setdefault("BadClusterID", flags.InDet.pixelClusterBadClusterID) + kwargs.setdefault("KeepParameters", True) + kwargs.setdefault("KeepFirstParameters", flags.InDet.KeepFirstParameters) + kwargs.setdefault( + "PerigeeExpression", + p_expr if p_expr != "Vertex" else "BeamLine") + result.setPrivateTools(CompFactory.Trk.TrackParticleCreatorTool(name, **kwargs)) + return result + +def TrackCollectionCnvToolCfg(flags, name="TrackCollectionCnvTool", TrackParticleCreator = None): + result = ComponentAccumulator() + if TrackParticleCreator is None: + TrackParticleCreator = result.popToolsAndMerge(TrackParticleCreatorToolCfg(flags)) + result.setPrivateTools(CompFactory.xAODMaker.TrackCollectionCnvTool( + name, + TrackParticleCreator=TrackParticleCreator, + )) + return result + +def TrackParticleCnvAlgCfg(flags, name="TrackParticleCnvAlg", OutputTrackParticleContainer="InDetTrackParticles", **kwargs): + result = ComponentAccumulator() + kwargs.setdefault("ConvertTracks", True) + kwargs.setdefault("ConvertTrackParticles", False) + kwargs.setdefault("xAODContainerName", OutputTrackParticleContainer) + kwargs.setdefault("xAODTrackParticlesFromTracksContainerName", OutputTrackParticleContainer) + if "TrackParticleCreator" not in kwargs: + kwargs["TrackParticleCreator"] = result.popToolsAndMerge(TrackParticleCreatorToolCfg(flags)) + if "TrackCollectionCnvTool" not in kwargs: + kwargs["TrackCollectionCnvTool"] = result.popToolsAndMerge(TrackCollectionCnvToolCfg( + flags, + TrackParticleCreator=kwargs["TrackParticleCreator"], + )) + + if flags.InDet.doTruth: + if not kwargs.get("TrackTruthContainerName", None): + kwargs.setdefault("AddTruthLink", False) + else: + kwargs.setdefault("AddTruthLink", True) + if "MCTruthClassifier" not in kwargs: + from MCTruthClassifier.MCTruthClassifierConfig import MCTruthClassifierCfg + kwargs["MCTruthClassifier"] = result.popToolsAndMerge(MCTruthClassifierCfg(flags)) + else: + kwargs.setdefault("AddTruthLink", False) + result.addEventAlgo(CompFactory.xAODMaker.TrackParticleCnvAlg(name, **kwargs)) + return result + +def TrackRecoCfg(flags): + """Configures complete ID tracking """ + result = ComponentAccumulator() + + from PixelGeoModel.PixelGeoModelConfig import PixelGeometryCfg + result.merge( PixelGeometryCfg(flags)) + + from SCT_GeoModel.SCT_GeoModelConfig import SCT_GeometryCfg + result.merge( SCT_GeometryCfg(flags)) + + from TRT_GeoModel.TRT_GeoModelConfig import TRT_GeometryCfg + result.merge(TRT_GeometryCfg(flags)) + + from BeamPipeGeoModel.BeamPipeGMConfig import BeamPipeGeometryCfg + result.merge(BeamPipeGeometryCfg(flags)) + + #TODO move these to a more appropriate place + + from BeamSpotConditions.BeamSpotConditionsConfig import BeamSpotCondAlgCfg + result.merge(BeamSpotCondAlgCfg(flags)) + + from PixelConditionsAlgorithms.PixelConditionsConfig import (PixelChargeCalibCondAlgCfg, PixelOfflineCalibCondAlgCfg, PixelDistortionAlgCfg) + result.merge(PixelChargeCalibCondAlgCfg(flags)) + result.merge(PixelOfflineCalibCondAlgCfg(flags)) + result.merge(PixelDistortionAlgCfg(flags)) + from InDetConfig.TrackingCommonConfig import PixelClusterNnCondAlgCfg, PixelClusterNnWithTrackCondAlgCfg + result.merge(PixelClusterNnCondAlgCfg(flags)) + result.merge(PixelClusterNnWithTrackCondAlgCfg(flags)) + + from SiLorentzAngleTool.PixelLorentzAngleConfig import PixelLorentzAngleTool, PixelLorentzAngleCfg + result.addPublicTool(PixelLorentzAngleTool(flags)) + result.addPublicTool(result.popToolsAndMerge(PixelLorentzAngleCfg(flags))) + + from SiLorentzAngleTool.SCT_LorentzAngleConfig import SCT_LorentzAngleCfg + result.addPublicTool(result.popToolsAndMerge(SCT_LorentzAngleCfg(flags))) + + from PixelConditionsAlgorithms.PixelConditionsConfig import PixelHitDiscCnfgAlgCfg + result.merge(PixelHitDiscCnfgAlgCfg(flags)) + if flags.Input.Format == "BS": + result.addEventAlgo(CompFactory.PixelRawDataProvider()) + result.addEventAlgo(CompFactory.SCTRawDataProvider()) + + # up to here + # needed for brem/seeding, TODO decided if needed here + from LArBadChannelTool.LArBadChannelConfig import LArBadFebCfg + result.merge(LArBadFebCfg(flags)) + from CaloRec.CaloCellMakerConfig import CaloCellMakerCfg + result.merge(CaloCellMakerCfg(flags)) + from CaloRec.CaloTopoClusterConfig import CaloTopoClusterCfg + result.merge(CaloTopoClusterCfg(flags, doLCCalib=False)) + from egammaAlgs.egammaTopoClusterCopierConfig import egammaTopoClusterCopierCfg + result.merge(egammaTopoClusterCopierCfg(flags)) + from InDetConfig.InDetRecCaloSeededROISelectionConfig import CaloClusterROI_SelectorCfg + result.merge(CaloClusterROI_SelectorCfg(flags, )) + + from InDetConfig.TRTSegmentFindingConfig import TRTActiveCondAlgCfg + from InDetConfig.TrackingCommonConfig import TRT_DetElementsRoadCondAlgCfg, RIO_OnTrackErrorScalingCondAlgCfg + result.merge(TRTActiveCondAlgCfg(flags)) + result.merge(TRT_DetElementsRoadCondAlgCfg()) + result.merge(RIO_OnTrackErrorScalingCondAlgCfg(flags)) + + from InDetConfig.SiliconPreProcessing import InDetRecPreProcessingSiliconCfg + result.merge(InDetRecPreProcessingSiliconCfg(flags)) + from InDetConfig.TrackingSiPatternConfig import TrackingSiPatternCfg + result.merge(TrackingSiPatternCfg(flags, [], "ResolvedTracks", "SiSPSeededTracks")) + result.merge(TrackParticleCnvAlgCfg(flags, TrackContainerName="ResolvedTracks")) + + return result + +if __name__ == "__main__": + from AthenaCommon.Configurable import Configurable + Configurable.configurableRun3Behavior=1 + from AthenaConfiguration.AllConfigFlags import ConfigFlags + + numThreads=1 + ConfigFlags.Concurrency.NumThreads=numThreads + ConfigFlags.Concurrency.NumConcurrentEvents=numThreads + + ConfigFlags.Detector.GeometryPixel = True + ConfigFlags.Detector.GeometrySCT = True + ConfigFlags.InDet.doPixelClusterSplitting = True + ConfigFlags.InDet.doSiSPSeededTrackFinder = True + + ConfigFlags.Detector.RecoIBL = True + ConfigFlags.Detector.RecoPixel = True + ConfigFlags.Detector.RecoTRT = True + ConfigFlags.Detector.RecoSCT = True + # TODO add these flags in future +# ConfigFlags.addFlag('InDet.doAmbiSolving', True) +# ConfigFlags.addFlag('InDet.useHolesFromPattern', False) +# ConfigFlags.addFlag('InDet.holeSearchInGX2Fit', True) + + from AthenaConfiguration.TestDefaults import defaultTestFiles + ConfigFlags.Input.Files = defaultTestFiles.RDO + ConfigFlags.lock() + + from AthenaConfiguration.MainServicesConfig import MainServicesCfg + top_acc = MainServicesCfg(ConfigFlags) + + from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg + top_acc.merge(PoolReadCfg(ConfigFlags)) + + ####################################################################### + #################### Additional Configuration ######################## + if "EventInfo" not in ConfigFlags.Input.Collections: + from xAODEventInfoCnv.xAODEventInfoCnvConfig import EventInfoCnvAlgCfg + top_acc.merge(EventInfoCnvAlgCfg(ConfigFlags)) + + + top_acc.merge(TrackRecoCfg(ConfigFlags)) + from AthenaCommon.Constants import DEBUG + top_acc.foreach_component("AthEventSeq/*").OutputLevel=DEBUG + top_acc.printConfig(withDetails=True, summariseProps=True) + top_acc.store(open("TrackingSiPatternConfig.pkl", "wb")) + import sys + + if "--norun" not in sys.argv: + sc = top_acc.run(5) + if sc.isFailure(): + sys.exit(-1) diff --git a/InnerDetector/InDetConfig/python/TrackingCommonConfig.py b/InnerDetector/InDetConfig/python/TrackingCommonConfig.py index f6f1eaffb70f..5c177e969975 100644 --- a/InnerDetector/InDetConfig/python/TrackingCommonConfig.py +++ b/InnerDetector/InDetConfig/python/TrackingCommonConfig.py @@ -512,7 +512,7 @@ def InDetTRT_ElectronPidToolCfg(flags, name = "InDetTRT_ElectronPidTool", **kwar InDetTRT_dEdxTool = None kwargs.setdefault( "TRT_ToT_dEdx_Tool", InDetTRT_dEdxTool) - kwargs.setdefault( "CalculateNNPid", flags.InDet.doTRTPIDNN) + kwargs.setdefault( "CalculateNNPid", False) #TODO fixme once the flag is there flags.InDet.doTRTPIDNN) InDetTRT_ElectronPidTool = CompFactory.InDet.TRT_ElectronPidToolRun2(name = the_name, **kwargs) return InDetTRT_ElectronPidTool diff --git a/InnerDetector/InDetConfig/python/TrackingSiPatternConfig.py b/InnerDetector/InDetConfig/python/TrackingSiPatternConfig.py new file mode 100644 index 000000000000..ea4a48d7cae0 --- /dev/null +++ b/InnerDetector/InDetConfig/python/TrackingSiPatternConfig.py @@ -0,0 +1,781 @@ +# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator +from AthenaConfiguration.ComponentFactory import CompFactory +import InDetConfig.TrackingCommonConfig as TC +import AthenaCommon.SystemOfUnits as Units + +def SiSpacePointsSeedMakerCfg(flags, name="InDetSpSeedsMaker", InputCollections = None, **kwargs) : + acc = ComponentAccumulator() + # + # --- decide if use the association tool + # + if (len(InputCollections) > 0) and (flags.InDet.Tracking.extension == "LowPt" or flags.InDet.Tracking.extension == "VeryLowPt" or flags.InDet.Tracking.extension == "LargeD0" or flags.InDet.Tracking.extension == "LowPtLargeD0" or flags.InDet.Tracking.extension == "BeamGas" or flags.InDet.Tracking.extension == "ForwardTracks" or flags.InDet.Tracking.extension == "ForwardSLHCTracks" or flags.InDet.Tracking.extension == "Disappearing" or flags.InDet.Tracking.extension == "VeryForwardSLHCTracks" or flags.InDet.Tracking.extension == "SLHCConversionFinding"): + usePrdAssociationTool = True + else: + usePrdAssociationTool = False + # + # --- get list of already associated hits (always do this, even if no other tracking ran before) + # + if usePrdAssociationTool: + prefix = 'InDet' + suffix = flags.InDet.Tracking.extension + # + # --- Space points seeds maker, use different ones for cosmics and collisions + # + if flags.InDet.Tracking.extension == "DBM": + SiSpacePointsSeedMaker = CompFactory.InDet.SiSpacePointsSeedMaker_ATLxk + elif flags.Beam.Type == 'cosmics': + SiSpacePointsSeedMaker = CompFactory.InDet.SiSpacePointsSeedMaker_Cosmic + elif flags.InDet.doHeavyIon: + SiSpacePointsSeedMaker = CompFactory.InDet.SiSpacePointsSeedMaker_HeavyIon + elif flags.InDet.Tracking.extension == "LowPt" or flags.InDet.Tracking.extension == "VeryLowPt" or (flags.InDet.Tracking.extension == "Pixel" and flags.InDet.doMinBias) : + SiSpacePointsSeedMaker = CompFactory.InDet.SiSpacePointsSeedMaker_LowMomentum + elif flags.InDet.Tracking.extension == "BeamGas": + SiSpacePointsSeedMaker = CompFactory.InDet.SiSpacePointsSeedMaker_BeamGas + elif flags.InDet.Tracking.extension == "SLHC" or flags.InDet.Tracking.extension == "ForwardSLHCTracks" or flags.InDet.Tracking.extension == "VeryForwardSLHCTracks" : + SiSpacePointsSeedMaker = CompFactory.InDet.SiSpacePointsSeedMaker_ITK + else: + SiSpacePointsSeedMaker = CompFactory.InDet.SiSpacePointsSeedMaker_ATLxk + + kwargs.setdefault("pTmin", flags.InDet.Tracking.minPT ) + kwargs.setdefault("maxdImpact", flags.InDet.Tracking.maxPrimaryImpact ) + kwargs.setdefault("maxZ", flags.InDet.Tracking.maxZImpact ) + kwargs.setdefault("minZ", -flags.InDet.Tracking.maxZImpact ) + kwargs.setdefault("usePixel", flags.InDet.Tracking.usePixel) + kwargs.setdefault("SpacePointsPixelName", 'PixelSpacePoints') # InDetKeys.PixelSpacePoints() + kwargs.setdefault("useSCT", flags.InDet.Tracking.useSCT and flags.InDet.Tracking.useSCTSeeding ) + kwargs.setdefault("SpacePointsSCTName", 'SCT_SpacePoints') # InDetKeys.SCT_SpacePoints() + kwargs.setdefault("useOverlapSpCollection", flags.InDet.Tracking.useSCT and flags.InDet.Tracking.useSCTSeeding ) + kwargs.setdefault("SpacePointsOverlapName", 'OverlapSpacePoints') # InDetKeys.OverlapSpacePoints() + kwargs.setdefault("radMax", flags.InDet.Tracking.radMax) + kwargs.setdefault("RapidityCut", flags.InDet.Tracking.maxEta ) + + + if flags.InDet.Tracking.extension == "Offline" or flags.InDet.doHeavyIon or flags.InDet.Tracking.extension == "ForwardTracks": + kwargs.setdefault("maxdImpactPPS", flags.InDet.Tracking.maxdImpactPPSSeeds) + kwargs.setdefault("maxdImpactSSS", flags.InDet.Tracking.maxdImpactSSSSeeds) + if not flags.InDet.doHeavyIon: + kwargs.setdefault("maxSeedsForSpacePointStrips", flags.InDet.Tracking.maxSeedsPerSP_Strips) + kwargs.setdefault("maxSeedsForSpacePointPixels", flags.InDet.Tracking.maxSeedsPerSP_Pixels) + kwargs.setdefault("alwaysKeepConfirmedStripSeeds", flags.InDet.Tracking.keepAllConfirmedStripSeeds) + kwargs.setdefault("alwaysKeepConfirmedPixelSeeds", flags.InDet.Tracking.keepAllConfirmedPixelSeeds) + kwargs.setdefault("mindRadius", 10) + kwargs.setdefault("maxSizeSP", 200) + kwargs.setdefault("dImpactCutSlopeUnconfirmedSSS", 1.25) + kwargs.setdefault("dImpactCutSlopeUnconfirmedPPP", 2.0) + + if flags.InDet.Tracking.extension == "R3LargeD0": + kwargs.setdefault("optimisePhiBinning", False) + kwargs.setdefault("usePixel", False) + kwargs.setdefault("etaMax", flags.InDet.Tracking.maxEta) + kwargs.setdefault("maxSeedsForSpacePointStrips", flags.InDet.Tracking.maxSeedsPerSP_Strips) + kwargs.setdefault("alwaysKeepConfirmedStripSeeds", flags.InDet.Tracking.keepAllConfirmedStripSeeds) + kwargs.setdefault("maxdRadius", 150) + kwargs.setdefault("seedScoreBonusConfirmationSeed", -2000) + + if usePrdAssociationTool: + # not all classes have that property !!! + kwargs.setdefault("PRDtoTrackMap", prefix+'PRDtoTrackMap'+ suffix \ + if usePrdAssociationTool else '') + if not flags.Beam.Type == 'cosmics': + kwargs.setdefault("maxRadius1", 0.75*flags.InDet.Tracking.radMax) + kwargs.setdefault("maxRadius2", flags.InDet.Tracking.radMax) + kwargs.setdefault("maxRadius3", flags.InDet.Tracking.radMax) + if flags.InDet.Tracking.extension == "LowPt" or flags.InDet.Tracking.extension == "VeryLowPt" or (flags.InDet.Tracking.extension == "Pixel" and flags.InDet.doMinBias): + kwargs.setdefault("pTmax", flags.InDet.Tracking.maxPT) + kwargs.setdefault("mindRadius", 4.0) + if flags.InDet.Tracking.extension == "SLHC" or flags.InDet.Tracking.extension == "SLHCConversionFinding": + kwargs.setdefault("minRadius1", 0) + kwargs.setdefault("minRadius2", 0) + kwargs.setdefault("minRadius3", 0) + kwargs.setdefault("maxRadius1", 1000.*Units.mm) + kwargs.setdefault("maxRadius2", 1000.*Units.mm) + kwargs.setdefault("maxRadius3", 1000.*Units.mm) + if flags.InDet.Tracking.extension == "ForwardTracks" or flags.InDet.Tracking.extension == "ForwardSLHCTracks" or flags.InDet.Tracking.extension == "VeryForwardSLHCTracks": + kwargs.setdefault("checkEta", True) + kwargs.setdefault("etaMin", flags.InDet.Tracking.minEta) + kwargs.setdefault("etaMax", flags.InDet.Tracking.maxEta) + kwargs.setdefault("RapidityCut", flags.InDet.Tracking.maxEta) + if flags.InDet.Tracking.extension == "DBM": + kwargs.setdefault("etaMin", flags.InDet.Tracking.minEta) + kwargs.setdefault("etaMax", flags.InDet.Tracking.maxEta) + kwargs.setdefault("useDBM", True) + + InDetSiSpacePointsSeedMaker = SiSpacePointsSeedMaker (name = name+flags.InDet.Tracking.extension, **kwargs) + + acc.setPrivateTools(InDetSiSpacePointsSeedMaker) + return acc + +def SiZvertexMaker_xkCfg(flags, name="InDetZvertexMaker", InputCollections = None, **kwargs) : + acc = ComponentAccumulator() + + kwargs.setdefault("Zmax", flags.InDet.Tracking.maxZImpact) + kwargs.setdefault("Zmin", -flags.InDet.Tracking.maxZImpact) + kwargs.setdefault("minRatio", 0.17) + + InDetSiSpacePointsSeedMaker = acc.popToolsAndMerge(SiSpacePointsSeedMakerCfg(flags, + InputCollections = InputCollections )) + acc.addPublicTool(InDetSiSpacePointsSeedMaker) + + kwargs.setdefault("SeedMakerTool", InDetSiSpacePointsSeedMaker) + if flags.InDet.doHeavyIon: + kwargs.setdefault("HistSize", 2000) + kwargs.setdefault("minContent", 30) + + InDetZvertexMaker = CompFactory.InDet.SiZvertexMaker_xk(name = name+flags.InDet.Tracking.extension, **kwargs) + acc.setPrivateTools(InDetZvertexMaker) + return acc + +def SiDetElementsRoadMaker_xkCfg(flags, name="InDetSiRoadMaker", **kwargs) : + acc = ComponentAccumulator() + # + # --- SCT and Pixel detector elements road builder + # + InDetPatternPropagator = TC.InDetPatternPropagatorCfg() + acc.addPublicTool(InDetPatternPropagator) + + kwargs.setdefault("PropagatorTool", InDetPatternPropagator) + kwargs.setdefault("usePixel", flags.InDet.Tracking.usePixel ) + kwargs.setdefault("PixManagerLocation", 'Pixel') + kwargs.setdefault("useSCT", flags.InDet.Tracking.useSCT) + kwargs.setdefault("SCTManagerLocation", 'SCT') + kwargs.setdefault("RoadWidth", flags.InDet.Tracking.roadWidth) + + InDetSiDetElementsRoadMaker = CompFactory.InDet.SiDetElementsRoadMaker_xk(name = name+flags.InDet.Tracking.extension, **kwargs) + acc.setPrivateTools(InDetSiDetElementsRoadMaker) + return acc + +def SiCombinatorialTrackFinder_xkCfg(flags, name="InDetSiComTrackFinder", **kwargs) : + acc = ComponentAccumulator() + # + # --- Local track finding using sdCaloSeededSSSpace point seed + # + # @TODO ensure that PRD association map is used if usePrdAssociationTool is set + is_dbm = flags.InDet.doDBMstandalone or flags.InDet.Tracking.extension == 'DBM' + if not is_dbm: + rot_creator_digital = acc.popToolsAndMerge(TC.InDetRotCreatorDigitalCfg(flags)) + else: + rot_creator_digital = acc.popToolsAndMerge(TC.InDetRotCreatorDBMCfg(flags)) + + acc.addPublicTool(rot_creator_digital) + + InDetPatternPropagator = TC.InDetPatternPropagatorCfg() + acc.addPublicTool(InDetPatternPropagator) + + InDetPatternUpdator = TC.InDetPatternUpdatorCfg() + acc.addPublicTool(InDetPatternUpdator) + + from InDetConfig.InDetRecToolConfig import InDetBoundaryCheckToolCfg + boundary_check_tool = acc.popToolsAndMerge(InDetBoundaryCheckToolCfg(flags)) + acc.addPublicTool(boundary_check_tool) + + kwargs.setdefault("PropagatorTool", InDetPatternPropagator) + kwargs.setdefault("UpdatorTool", InDetPatternUpdator) + kwargs.setdefault("BoundaryCheckTool", boundary_check_tool) + kwargs.setdefault("RIOonTrackTool", rot_creator_digital) + kwargs.setdefault("usePixel", flags.Detector.RecoPixel) + kwargs.setdefault("useSCT", flags.Detector.RecoSCT if not is_dbm else False) + kwargs.setdefault("PixelClusterContainer", 'PixelClusters') # InDetKeys.PixelClusters() + kwargs.setdefault("SCT_ClusterContainer", 'SCT_Clusters') # InDetKeys.SCT_Clusters() + + if flags.InDet.Tracking.extension == "Offline": + kwargs.setdefault("writeHolesFromPattern", True) #TODO fixme flags.InDet.useHolesFromPattern) + + if is_dbm : + kwargs.setdefault("MagneticFieldMode", "NoField") + kwargs.setdefault("TrackQualityCut", 9.3) + + if flags.Detector.RecoSCT: + InDetSCT_ConditionsSummaryTool = CompFactory.SCT_ConditionsSummaryTool(name = 'InDetSCT_ConditionsSummaryTool') + acc.addPublicTool(InDetSCT_ConditionsSummaryTool) + kwargs.setdefault("SctSummaryTool", InDetSCT_ConditionsSummaryTool) + else: + kwargs.setdefault("SctSummaryTool", None) + + track_finder = CompFactory.InDet.SiCombinatorialTrackFinder_xk(name = name+flags.InDet.Tracking.extension, **kwargs) + acc.setPrivateTools(track_finder) + return acc + +def SiTrackMaker_xkCfg(flags, name="InDetSiTrackMaker", InputCollections = None, **kwargs) : + acc = ComponentAccumulator() + useBremMode = flags.InDet.Tracking.extension == "Offline" or flags.InDet.Tracking.extension == "SLHC" or flags.InDet.Tracking.extension == "DBM" + InDetSiDetElementsRoadMaker = acc.popToolsAndMerge(SiDetElementsRoadMaker_xkCfg(flags)) + acc.addPublicTool(InDetSiDetElementsRoadMaker) + + if flags.Detector.RecoPixel: + acc.addCondAlgo( CompFactory.InDet.SiDetElementBoundaryLinksCondAlg_xk( name = "InDetSiDetElementBoundaryLinksPixelCondAlg", + ReadKey = "PixelDetectorElementCollection", + WriteKey = "PixelDetElementBoundaryLinks_xk") ) + if flags.InDet.Tracking.useSCT: + acc.addCondAlgo(CompFactory.InDet.SiDetElementsRoadCondAlg_xk(name = "InDet__SiDetElementsRoadCondAlg_xk")) + + acc.addCondAlgo( CompFactory.InDet.SiDetElementBoundaryLinksCondAlg_xk( name = "InDetSiDetElementBoundaryLinksSCTCondAlg", + ReadKey = "SCT_DetectorElementCollection", + WriteKey = "SCT_DetElementBoundaryLinks_xk") ) + + track_finder = acc.popToolsAndMerge(SiCombinatorialTrackFinder_xkCfg(flags)) + acc.addPublicTool(track_finder) + + # + # --- decide if use the association tool + # + if (len(InputCollections) > 0) and (flags.InDet.Tracking.extension == "LowPt" or flags.InDet.Tracking.extension == "VeryLowPt" or flags.InDet.Tracking.extension == "LargeD0" or flags.InDet.Tracking.extension == "LowPtLargeD0" or flags.InDet.Tracking.extension == "BeamGas" or flags.InDet.Tracking.extension == "ForwardTracks" or flags.InDet.Tracking.extension == "ForwardSLHCTracks" or flags.InDet.Tracking.extension == "Disappearing" or flags.InDet.Tracking.extension == "VeryForwardSLHCTracks" or flags.InDet.Tracking.extension == "SLHCConversionFinding"): + usePrdAssociationTool = True + else: + usePrdAssociationTool = False + + kwargs.setdefault("useSCT", flags.InDet.Tracking.useSCT) #flags.InDet.Tracking.useSCT() + kwargs.setdefault("usePixel", flags.InDet.Tracking.usePixel) #flags.InDet.Tracking.usePixel() + kwargs.setdefault("RoadTool", InDetSiDetElementsRoadMaker) + kwargs.setdefault("CombinatorialTrackFinder", track_finder) + kwargs.setdefault("pTmin", flags.InDet.Tracking.minPT) + kwargs.setdefault("pTminBrem", flags.InDet.Tracking.minPTBrem) + kwargs.setdefault("pTminSSS", flags.InDet.pT_SSScut) + kwargs.setdefault("nClustersMin", flags.InDet.Tracking.minClusters) + kwargs.setdefault("nHolesMax", flags.InDet.Tracking.nHolesMax) + kwargs.setdefault("nHolesGapMax", flags.InDet.Tracking.nHolesGapMax) + kwargs.setdefault("SeedsFilterLevel", flags.InDet.Tracking.seedFilterLevel) + kwargs.setdefault("Xi2max", flags.InDet.Tracking.Xi2max) + kwargs.setdefault("Xi2maxNoAdd", flags.InDet.Tracking.Xi2maxNoAdd) + kwargs.setdefault("nWeightedClustersMin", flags.InDet.Tracking.nWeightedClustersMin) + kwargs.setdefault("CosmicTrack", flags.Beam.Type == 'cosmics') + kwargs.setdefault("Xi2maxMultiTracks", flags.InDet.Tracking.Xi2max) + kwargs.setdefault("useSSSseedsFilter", flags.InDet.doSSSfilter) + kwargs.setdefault("doMultiTracksProd", True) + kwargs.setdefault("useBremModel", flags.InDet.doBremRecovery and useBremMode) # only for NewTracking the brem is debugged !!! + kwargs.setdefault("doCaloSeededBrem", flags.InDet.doCaloSeededBrem) + kwargs.setdefault("doHadCaloSeedSSS", flags.InDet.doHadCaloSeededSSS) + kwargs.setdefault("phiWidth", flags.InDet.Tracking.phiWidthBrem) + kwargs.setdefault("etaWidth", flags.InDet.Tracking.etaWidthBrem) + kwargs.setdefault("InputClusterContainerName", 'InDetCaloClusterROIs') # InDetKeys.CaloClusterROIContainer() + kwargs.setdefault("InputHadClusterContainerName", 'InDetHadCaloClusterROIs') # InDetKeys.HadCaloClusterROIContainer() + kwargs.setdefault("UseAssociationTool", usePrdAssociationTool) + + if flags.InDet.Tracking.extension == "SLHC" or flags.InDet.Tracking.extension == "ForwardSLHCTracks" or flags.InDet.Tracking.extension == "VeryForwardSLHCTracks" : + kwargs.setdefault("ITKGeometry", True) + + if flags.InDet.Tracking.extension == "DBM": + kwargs.setdefault("MagneticFieldMode", "NoField") + kwargs.setdefault("useBremModel", False) + kwargs.setdefault("doMultiTracksProd", False) + kwargs.setdefault("TrackPatternRecoInfo", 'SiSPSeededFinder') + kwargs.setdefault("pTminSSS", -1) + kwargs.setdefault("CosmicTrack", False) + kwargs.setdefault("useSSSseedsFilter", False) + kwargs.setdefault("doCaloSeededBrem", False) + kwargs.setdefault("doHadCaloSeedSSS", False) + + elif flags.Beam.Type == 'cosmics': + kwargs.setdefault("TrackPatternRecoInfo", 'SiSpacePointsSeedMaker_Cosmic') + + elif flags.InDet.doHeavyIon: + kwargs.setdefault("TrackPatternRecoInfo", 'SiSpacePointsSeedMaker_HeavyIon') + + elif flags.InDet.Tracking.extension == "LowPt": + kwargs.setdefault("TrackPatternRecoInfo", 'SiSpacePointsSeedMaker_LowMomentum') + + elif flags.InDet.Tracking.extension == "VeryLowPt" or (flags.InDet.Tracking.extension == "Pixel" and flags.InDet.doMinBias): + kwargs.setdefault("TrackPatternRecoInfo", 'SiSpacePointsSeedMaker_VeryLowMomentum') + + elif flags.InDet.Tracking.extension == "BeamGas": + kwargs.setdefault("TrackPatternRecoInfo", 'SiSpacePointsSeedMaker_BeamGas') + + elif flags.InDet.Tracking.extension == "ForwardTracks": + kwargs.setdefault("TrackPatternRecoInfo", 'SiSpacePointsSeedMaker_ForwardTracks') + + elif flags.InDet.Tracking.extension == "ForwardSLHCTracks": + kwargs.setdefault("TrackPatternRecoInfo", 'SiSpacePointsSeedMaker_ForwardSLHCTracks') + + elif flags.InDet.Tracking.extension == "VeryForwardSLHCTracks": + kwargs.setdefault("TrackPatternRecoInfo", 'SiSpacePointsSeedMaker_VeryForwardSLHCTracks') + + elif flags.InDet.Tracking.extension == "SLHCConversionFinding": + kwargs.setdefault("TrackPatternRecoInfo", 'SiSpacePointsSeedMaker_SLHCConversionTracks') + + elif flags.InDet.Tracking.extension == "LargeD0" or flags.InDet.Tracking.extension == "LowPtLargeD0": + kwargs.setdefault("TrackPatternRecoInfo", 'SiSpacePointsSeedMaker_LargeD0') + + else: + kwargs.setdefault("TrackPatternRecoInfo", 'SiSPSeededFinder') + + if flags.InDet.doStoreTrackSeeds: + InDet_SeedToTrackConversion = CompFactory.InDet.SeedToTrackConversionTool( name = "InDet_SeedToTrackConversion", + OutputName = 'SiSPSeedSegments' + flags.InDet.Tracking.extension) + acc.addPublicTool(InDet_SeedToTrackConversion) + kwargs.setdefault("SeedToTrackConversion", InDet_SeedToTrackConversion) + kwargs.setdefault("SeedSegmentsWrite", True) + + InDetSiTrackMaker = CompFactory.InDet.SiTrackMaker_xk(name = name+flags.InDet.Tracking.extension, **kwargs) + acc.setPrivateTools(InDetSiTrackMaker) + return acc + +def SiSPSeededTrackFinderCfg(flags, name="InDetSiSpTrackFinder", InputCollections = None, SiSPSeededTrackCollectionKey = None, **kwargs) : + acc = ComponentAccumulator() + + # set output track collection name + # + SiTrackCollection = SiSPSeededTrackCollectionKey + # + # --- decide if use the association tool + # + if (len(InputCollections) > 0) and (flags.InDet.Tracking.extension == "LowPt" or flags.InDet.Tracking.extension == "VeryLowPt" or flags.InDet.Tracking.extension == "LargeD0" or flags.InDet.Tracking.extension == "LowPtLargeD0" or flags.InDet.Tracking.extension == "BeamGas" or flags.InDet.Tracking.extension == "ForwardTracks" or flags.InDet.Tracking.extension == "ForwardSLHCTracks" or flags.InDet.Tracking.extension == "Disappearing" or flags.InDet.Tracking.extension == "VeryForwardSLHCTracks" or flags.InDet.Tracking.extension == "SLHCConversionFinding"): + usePrdAssociationTool = True + else: + usePrdAssociationTool = False + # + # --- get list of already associated hits (always do this, even if no other tracking ran before) + # + if usePrdAssociationTool: + prefix = 'InDet' + suffix = flags.InDet.Tracking.extension + + InDetSiTrackMaker = acc.popToolsAndMerge(SiTrackMaker_xkCfg(flags, + InputCollections = InputCollections )) + acc.addPublicTool(InDetSiTrackMaker) + + InDetTrackSummaryToolNoHoleSearch = acc.popToolsAndMerge(TC.InDetTrackSummaryToolNoHoleSearchCfg(flags)) + acc.addPublicTool(InDetTrackSummaryToolNoHoleSearch) + + InDetSiSpacePointsSeedMaker = acc.popToolsAndMerge(SiSpacePointsSeedMakerCfg(flags, + InputCollections = InputCollections )) + acc.addPublicTool(InDetSiSpacePointsSeedMaker) + + # + # --- Z-coordinates primary vertices finder (only for collisions) + # + if flags.InDet.useZvertexTool and flags.InDet.Tracking.extension != "DBM": + InDetZvertexMaker = acc.popToolsAndMerge(SiZvertexMaker_xkCfg(flags, + InputCollections = InputCollections)) + acc.addPublicTool(InDetZvertexMaker) + else: + InDetZvertexMaker = None + + # + # --- Setup Track finder using space points seeds + # + kwargs.setdefault("TrackTool", InDetSiTrackMaker) + kwargs.setdefault("PRDtoTrackMap", prefix+'PRDtoTrackMap'+suffix \ + if usePrdAssociationTool else '') + kwargs.setdefault("TrackSummaryTool", InDetTrackSummaryToolNoHoleSearch) + kwargs.setdefault("TracksLocation", SiTrackCollection) + kwargs.setdefault("SeedsTool", InDetSiSpacePointsSeedMaker) + kwargs.setdefault("ZvertexTool", InDetZvertexMaker) + kwargs.setdefault("useMBTSTimeDiff", flags.InDet.useMBTSTimeDiff) + + if flags.InDet.Tracking.extension == "ForwardSLHCTracks" or flags.InDet.Tracking.extension == "ForwardTracks": + kwargs.setdefault("useZvertexTool", flags.InDet.useZvertexTool) + kwargs.setdefault("useNewStrategy", False) + kwargs.setdefault("useZBoundFinding", False) + else: + kwargs.setdefault("useZvertexTool", flags.InDet.useZvertexTool and flags.InDet.Tracking.extension != "DBM") + kwargs.setdefault("useNewStrategy", flags.InDet.useNewSiSPSeededTF and flags.InDet.Tracking.extension != "DBM") + kwargs.setdefault("useZBoundFinding", flags.InDet.Tracking.doZBoundary and flags.InDet.Tracking.extension != "DBM") + + if flags.InDet.doHeavyIon : + kwargs.setdefault("FreeClustersCut",2) #Heavy Ion optimization from Igor + + if flags.InDet.Tracking.extension == "Offline": + kwargs.setdefault("writeHolesFromPattern", True) # TODO fix it flags.InDet.useHolesFromPattern) + + InDetSiSPSeededTrackFinder = CompFactory.InDet.SiSPSeededTrackFinder(name = name+flags.InDet.Tracking.extension, **kwargs) + acc.addEventAlgo(InDetSiSPSeededTrackFinder) + return acc + +def InDetAmbiTrackSelectionToolCfg(flags, name="InDetAmbiTrackSelectionTool", **kwargs) : + acc = ComponentAccumulator() + + # ------------------------------------------------------------ + # + # ---------- Ambiguity solving + # + # ------------------------------------------------------------ + + # + # --- load InnerDetector TrackSelectionTool + # + prob1 = flags.InDet.pixelClusterSplitProb1 + prob2 = flags.InDet.pixelClusterSplitProb2 + nhitsToAllowSplitting = 9 + + from AtlasGeoModel.CommonGMJobProperties import CommonGeometryFlags + if CommonGeometryFlags.Run() == 1: + prob1 = flags.InDet.pixelClusterSplitProb1_run1 + prob2 = flags.InDet.pixelClusterSplitProb2_run1 + nhitsToAllowSplitting = 8 + + if flags.InDet.doTIDE_Ambi and not (flags.InDet.Tracking.extension == "ForwardSLHCTracks" or flags.InDet.Tracking.extension == "ForwardTracks" or flags.InDet.Tracking.extension == "DBM"): + AmbiTrackSelectionTool = CompFactory.InDet.InDetDenseEnvAmbiTrackSelectionTool + else: + AmbiTrackSelectionTool = CompFactory.InDet.InDetAmbiTrackSelectionTool + + InDetTRTDriftCircleCut = TC.InDetTRTDriftCircleCutForPatternRecoCfg(flags) + acc.addPublicTool(InDetTRTDriftCircleCut) + + InDetPRDtoTrackMapToolGangedPixels = acc.popToolsAndMerge(TC.InDetPRDtoTrackMapToolGangedPixelsCfg(flags)) + acc.addPublicTool(InDetPRDtoTrackMapToolGangedPixels) + + kwargs.setdefault("DriftCircleCutTool", InDetTRTDriftCircleCut) + kwargs.setdefault("AssociationTool" , InDetPRDtoTrackMapToolGangedPixels) + kwargs.setdefault("minHits" , flags.InDet.Tracking.minClusters) + kwargs.setdefault("minNotShared" , flags.InDet.Tracking.minSiNotShared) + kwargs.setdefault("maxShared" , flags.InDet.Tracking.maxShared) + kwargs.setdefault("minTRTHits" , 0) # used for Si only tracking !!! + kwargs.setdefault("sharedProbCut" , 0.10) + kwargs.setdefault("UseParameterization" , False) + kwargs.setdefault("Cosmics" , flags.Beam.Type == 'cosmics') + kwargs.setdefault("doPixelSplitting" , flags.InDet.doPixelClusterSplitting and flags.InDet.Tracking.extension != "DBM") + + if flags.InDet.doTIDE_Ambi and not (flags.InDet.Tracking.extension == "ForwardSLHCTracks" or flags.InDet.Tracking.extension == "ForwardTracks" or flags.InDet.Tracking.extension == "DBM"): + kwargs.setdefault("sharedProbCut" , prob1) + kwargs.setdefault("sharedProbCut2" , prob2) + kwargs.setdefault("minSiHitsToAllowSplitting" , nhitsToAllowSplitting) + kwargs.setdefault("minUniqueSCTHits" , 4) + kwargs.setdefault("minTrackChi2ForSharedHits" , 3) + kwargs.setdefault("InputHadClusterContainerName", "InDetHadCaloClusterROIs" + "Bjet" ) + kwargs.setdefault("doHadCaloSeed" , flags.InDet.doCaloSeededAmbi) #Do special cuts in region of interest + kwargs.setdefault("minPtSplit" , flags.InDet.pixelClusterSplitMinPt) #Only allow split clusters on track withe pt greater than this MeV + kwargs.setdefault("maxSharedModulesInROI" , 3) #Maximum number of shared modules for tracks in ROI + kwargs.setdefault("minNotSharedInROI" , 2) #Minimum number of unique modules for tracks in ROI + kwargs.setdefault("minSiHitsToAllowSplittingInROI" , 7) #Minimum number of Si hits to allow splittings for tracks in ROI + kwargs.setdefault("phiWidth" , 0.1) #Split cluster ROI size + kwargs.setdefault("etaWidth" , 0.1) #Split cluster ROI size + kwargs.setdefault("InputEmClusterContainerName" , 'InDetCaloClusterROIs') + kwargs.setdefault("doEmCaloSeed" , True) #Only split in cluster in region of interest + kwargs.setdefault("minPtConv" , 10000) #Only allow split clusters on track withe pt greater than this MeV + kwargs.setdefault("phiWidthEM" , 0.05) #Split cluster ROI size + kwargs.setdefault("etaWidthEM" , 0.05) #Split cluster ROI size + + if flags.InDet.Tracking.extension == "DBM": + kwargs.setdefault("Cosmics", False) + kwargs.setdefault("UseParameterization" , False) + kwargs.setdefault("doPixelSplitting" , False) + kwargs.setdefault("maxShared" , 1000) + kwargs.setdefault("maxTracksPerSharedPRD" , 2) + kwargs.setdefault("minHits" , 0) + kwargs.setdefault("minNotShared" , 0) + kwargs.setdefault("minScoreShareTracks" , 0.0) + kwargs.setdefault("minTRTHits" , 0) + kwargs.setdefault("sharedProbCut" , 0.1) + + InDetAmbiTrackSelectionTool = AmbiTrackSelectionTool(name = name+flags.InDet.Tracking.extension, **kwargs) + acc.setPrivateTools(InDetAmbiTrackSelectionTool) + return acc + +def DenseEnvironmentsAmbiguityScoreProcessorToolCfg(flags, name = "InDetAmbiguityScoreProcessor", ClusterSplitProbContainer='', **kwargs) : + acc = ComponentAccumulator() + # + # --- set up different Scoring Tool for collisions and cosmics + # + if flags.Beam.Type == 'cosmics' and flags.InDet.Tracking.extension != "DBM": + InDetAmbiScoringTool = acc.popToolsAndMerge(TC.InDetCosmicsScoringToolCfg(flags)) + elif(flags.InDet.Tracking.extension == "R3LargeD0" and flags.InDet.nnCutLargeD0Threshold > 0): + # Set up NN config + InDetAmbiScoringTool = acc.popToolsAndMerge(TC.InDetNNScoringToolCfg(flags)) + else: + InDetAmbiScoringTool = acc.popToolsAndMerge(TC.InDetAmbiScoringToolCfg(flags)) + acc.addPublicTool(InDetAmbiScoringTool) + + + from InDetConfig.SiliconPreProcessing import NnPixelClusterSplitProbToolCfg + NnPixelClusterSplitProbTool = acc.popToolsAndMerge(NnPixelClusterSplitProbToolCfg(flags)) + acc.addPublicTool(NnPixelClusterSplitProbTool) + + InDetPRDtoTrackMapToolGangedPixels = acc.popToolsAndMerge(TC.InDetPRDtoTrackMapToolGangedPixelsCfg(flags)) + acc.addPublicTool(InDetPRDtoTrackMapToolGangedPixels) + + PRDtoTrackMapTool = TC.PRDtoTrackMapToolCfg() + acc.addPublicTool(PRDtoTrackMapTool) + + prob1 = flags.InDet.pixelClusterSplitProb1 + prob2 = flags.InDet.pixelClusterSplitProb2 + + from AtlasGeoModel.CommonGMJobProperties import CommonGeometryFlags + if CommonGeometryFlags.Run() == 1: + prob1 = flags.InDet.pixelClusterSplitProb1_run1 + prob2 = flags.InDet.pixelClusterSplitProb2_run1 + + if flags.InDet.doTIDE_Ambi and not (flags.InDet.Tracking.extension == "ForwardSLHCTracks" or flags.InDet.Tracking.extension == "ForwardTracks" or flags.InDet.Tracking.extension == "DBM") : + kwargs.setdefault("sharedProbCut", prob1) + kwargs.setdefault("sharedProbCut2", prob2) + if flags.InDet.Tracking.extension == "": + kwargs.setdefault("SplitClusterMap_old", "") + elif flags.InDet.Tracking.extension == "Disappearing": + kwargs.setdefault("SplitClusterMap_old", 'SplitClusterAmbiguityMap') + kwargs.setdefault("SplitClusterMap_new", 'SplitClusterAmbiguityMap'+flags.InDet.Tracking.extension) + + kwargs.setdefault("ScoringTool", InDetAmbiScoringTool) + kwargs.setdefault("SplitProbTool", NnPixelClusterSplitProbTool if flags.InDet.doPixelClusterSplitting else None,) + kwargs.setdefault("AssociationTool", InDetPRDtoTrackMapToolGangedPixels) + kwargs.setdefault("AssociationToolNotGanged", PRDtoTrackMapTool) + kwargs.setdefault("AssociationMapName", 'PRDToTrackMap'+flags.InDet.Tracking.extension) + kwargs.setdefault("InputClusterSplitProbabilityName", ClusterSplitProbContainer) + kwargs.setdefault("OutputClusterSplitProbabilityName", 'SplitProb'+flags.InDet.Tracking.extension) + + # DenseEnvironmentsAmbiguityScoreProcessorTool + ScoreProcessorTool = CompFactory.Trk.DenseEnvironmentsAmbiguityScoreProcessorTool + InDetAmbiguityScoreProcessor = ScoreProcessorTool(name=name+flags.InDet.Tracking.extension, **kwargs) + + acc.setPrivateTools(InDetAmbiguityScoreProcessor) + return acc + +def DenseEnvironmentsAmbiguityProcessorToolCfg(flags, name = "InDetAmbiguityProcessor", ClusterSplitProbContainer='', **kwargs) : + acc = ComponentAccumulator() + + useBremMode = flags.InDet.Tracking.extension == "Offline" or flags.InDet.Tracking.extension == "SLHC" or flags.InDet.Tracking.extension == "DBM" + + # + # --- set up different Scoring Tool for collisions and cosmics + # + if flags.Beam.Type == 'cosmics' and flags.InDet.Tracking.extension != "DBM": + InDetAmbiScoringTool = acc.popToolsAndMerge(TC.InDetCosmicsScoringToolCfg(flags)) + elif(flags.InDet.Tracking.extension == "R3LargeD0" and flags.InDet.nnCutLargeD0Threshold > 0): + # Set up NN config + InDetAmbiScoringTool = acc.popToolsAndMerge(TC.InDetNNScoringToolCfg(flags)) + else: + InDetAmbiScoringTool = acc.popToolsAndMerge(TC.InDetAmbiScoringToolCfg(flags)) + acc.addPublicTool(InDetAmbiScoringTool) + + use_low_pt_fitter = True if flags.InDet.Tracking.extension == "LowPt" or flags.InDet.Tracking.extension == "VeryLowPt" or (flags.InDet.Tracking.extension == "Pixel" and flags.InDet.doMinBias) else False + + fitter_args = {} + fitter_args.setdefault("nameSuffix", 'Ambi'+flags.InDet.Tracking.extension) + fitter_args.setdefault("SplitClusterMapExtension", flags.InDet.Tracking.extension) + fitter_args.setdefault("ClusterSplitProbabilityName", 'InDetAmbiguityProcessorSplitProb'+flags.InDet.Tracking.extension) + + if True: #flags.InDet.holeSearchInGX2Fit: + fitter_args.setdefault("DoHoleSearch", True) + from InDetConfig.InDetRecToolConfig import InDetBoundaryCheckToolCfg + InDetBoundaryCheckTool = acc.popToolsAndMerge(InDetBoundaryCheckToolCfg(flags)) + acc.addPublicTool(InDetBoundaryCheckTool) + fitter_args.setdefault("BoundaryCheckTool", InDetBoundaryCheckTool) + + fitter_list=[] + if not use_low_pt_fitter: + InDetTrackFitterAmbi = acc.popToolsAndMerge(TC.InDetTrackFitterCfg(flags, name='InDetTrackFitter'+'Ambi'+flags.InDet.Tracking.extension, **fitter_args)) + acc.addPublicTool(InDetTrackFitterAmbi) + fitter_list.append(InDetTrackFitterAmbi) + else: + InDetTrackFitterLowPt = acc.popToolsAndMerge(TC.InDetTrackFitterLowPt(flags, name='InDetTrackFitterLowPt'+flags.InDet.Tracking.extension, **fitter_args)) + acc.addPublicTool(InDetTrackFitterLowPt) + fitter_list.append(InDetTrackFitterLowPt) + + if flags.InDet.doRefitInvalidCov: + if len(flags.InDet.Tracking.extension) > 0 : + fitter_args = {} + fitter_args.setdefault("SplitClusterMapExtension", flags.InDet.Tracking.extension) + KalmanFitter = acc.popToolsAndMerge(TC.KalmanFitterCfg(flags, name='KalmanFitter'+flags.InDet.Tracking.extension, **fitter_args)) + acc.addPublicTool(KalmanFitter) + fitter_list.append(KalmanFitter) + + ReferenceKalmanFitter = acc.popToolsAndMerge(TC.ReferenceKalmanFitterCfg(flags, name='ReferenceKalmanFitter'+flags.InDet.Tracking.extension, **fitter_args)) + acc.addPublicTool(ReferenceKalmanFitter) + fitter_list.append(ReferenceKalmanFitter) + else: + KalmanFitter = acc.popToolsAndMerge(TC.KalmanFitterCfg(flags)) + acc.addPublicTool(KalmanFitter) + fitter_list.append(KalmanFitter) + + ReferenceKalmanFitter = acc.popToolsAndMerge(TC.ReferenceKalmanFitterCfg(flags)) + acc.addPublicTool(ReferenceKalmanFitter) + fitter_list.append(ReferenceKalmanFitter) + + InDetPRDtoTrackMapToolGangedPixels = acc.popToolsAndMerge(TC.InDetPRDtoTrackMapToolGangedPixelsCfg(flags)) + acc.addPublicTool(InDetPRDtoTrackMapToolGangedPixels) + + ambi_track_summary_tool = acc.popToolsAndMerge(TC.InDetTrackSummaryToolCfg( flags, + namePrefix = 'InDetAmbiguityProcessorSplitProb', + nameSuffix = flags.InDet.Tracking.extension, + ClusterSplitProbabilityName = 'InDetAmbiguityProcessorSplitProb'+flags.InDet.Tracking.extension)) + acc.addPublicTool(ambi_track_summary_tool) + + InDetAmbiTrackSelectionTool = acc.popToolsAndMerge(InDetAmbiTrackSelectionToolCfg(flags)) + acc.addPublicTool(InDetAmbiTrackSelectionTool) + + kwargs.setdefault("Fitter", fitter_list) + kwargs.setdefault("AssociationTool", InDetPRDtoTrackMapToolGangedPixels) + kwargs.setdefault("AssociationMapName", 'PRDToTrackMap'+flags.InDet.Tracking.extension) + kwargs.setdefault("TrackSummaryTool", ambi_track_summary_tool) + kwargs.setdefault("ScoringTool", InDetAmbiScoringTool) + kwargs.setdefault("SelectionTool", InDetAmbiTrackSelectionTool) + kwargs.setdefault("InputClusterSplitProbabilityName", 'SplitProb'+flags.InDet.Tracking.extension) + kwargs.setdefault("OutputClusterSplitProbabilityName", 'InDetAmbiguityProcessorSplitProb'+flags.InDet.Tracking.extension) + kwargs.setdefault("SuppressHoleSearch", False) + kwargs.setdefault("tryBremFit", flags.InDet.doBremRecovery and useBremMode and flags.InDet.Tracking.extension != "DBM") + kwargs.setdefault("caloSeededBrem", flags.InDet.doCaloSeededBrem and flags.InDet.Tracking.extension != "DBM") + kwargs.setdefault("pTminBrem", flags.InDet.Tracking.minPTBrem) + kwargs.setdefault("RefitPrds", True) + kwargs.setdefault("KeepHolesFromBeforeRefit", True)# flags.InDet.useHolesFromPattern) + + # DenseEnvironmentsAmbiguityProcessorTool + ProcessorTool = CompFactory.Trk.DenseEnvironmentsAmbiguityProcessorTool + InDetAmbiguityProcessor = ProcessorTool(name=name+flags.InDet.Tracking.extension, **kwargs) + acc.setPrivateTools(InDetAmbiguityProcessor) + return acc + +def SimpleAmbiguityProcessorToolCfg(flags, name = "InDetAmbiguityProcessor", ClusterSplitProbContainer='', **kwargs) : + acc = ComponentAccumulator() + useBremMode = flags.InDet.Tracking.extension == "Offline" or flags.InDet.Tracking.extension == "SLHC" or flags.InDet.Tracking.extension == "DBM" + + # + # --- set up different Scoring Tool for collisions and cosmics + # + if flags.Beam.Type == 'cosmics' and flags.InDet.Tracking.extension != "DBM": + InDetAmbiScoringTool = acc.popToolsAndMerge(TC.InDetCosmicsScoringToolCfg(flags)) + elif(flags.InDet.Tracking.extension == "R3LargeD0" and flags.InDet.nnCutLargeD0Threshold > 0): + # Set up NN config + InDetAmbiScoringTool = acc.popToolsAndMerge(TC.InDetNNScoringToolCfg(flags)) + else: + InDetAmbiScoringTool = acc.popToolsAndMerge(TC.InDetAmbiScoringToolCfg(flags)) + acc.addPublicTool(InDetAmbiScoringTool) + + InDetTrackFitter = acc.popToolsAndMerge(TC.InDetTrackFitterCfg(flags)) + acc.addPublicTool(InDetTrackFitter) + + InDetPRDtoTrackMapToolGangedPixels = TC.InDetPRDtoTrackMapToolGangedPixelsCfg(flags) + acc.addPublicTool(InDetPRDtoTrackMapToolGangedPixels) + + ambi_track_summary_tool = acc.popToolsAndMerge(TC.InDetTrackSummaryToolCfg( flags, + namePrefix = 'InDetAmbiguityProcessorSplitProb', + nameSuffix = flags.InDet.Tracking.extension, + ClusterSplitProbabilityName = 'InDetAmbiguityProcessorSplitProb'+flags.InDet.Tracking.extension)) + acc.addPublicTool(ambi_track_summary_tool) + + InDetAmbiTrackSelectionTool = acc.popToolsAndMerge(InDetAmbiTrackSelectionToolCfg(flags)) + acc.addPublicTool(InDetAmbiTrackSelectionTool) + + kwargs.setdefault("Fitter", InDetTrackFitter) + kwargs.setdefault("AssociationTool", InDetPRDtoTrackMapToolGangedPixels) + kwargs.setdefault("TrackSummaryTool", ambi_track_summary_tool) + kwargs.setdefault("ScoringTool", InDetAmbiScoringTool) + kwargs.setdefault("SelectionTool", InDetAmbiTrackSelectionTool) + kwargs.setdefault("InputClusterSplitProbabilityName", ClusterSplitProbContainer) + kwargs.setdefault("OutputClusterSplitProbabilityName", 'InDetAmbiguityProcessorSplitProb'+flags.InDet.Tracking.extension) + kwargs.setdefault("SuppressHoleSearch", False) + kwargs.setdefault("tryBremFit", flags.InDet.doBremRecovery and useBremMode and flags.InDet.Tracking.extension != "DBM") + kwargs.setdefault("caloSeededBrem", flags.InDet.doCaloSeededBrem and flags.InDet.Tracking.extension != "DBM") + kwargs.setdefault("pTminBrem", flags.InDet.Tracking.minPTBrem) + kwargs.setdefault("RefitPrds", True) + + if flags.InDet.Tracking.extension == "Pixel" or flags.InDet.Tracking.extension == "DBM": + kwargs.setdefault("SuppressHoleSearch", True) + + ProcessorTool = CompFactory.Trk.SimpleAmbiguityProcessorTool + + if flags.InDet.Tracking.extension == "LowPt" or flags.InDet.Tracking.extension == "VeryLowPt" or (flags.InDet.Tracking.extension == "Pixel" and flags.InDet.doMinBias): + if ProcessorTool.getName().find('Dense') : + pass + else: + InDetTrackFitterLowPt = acc.popToolsAndMerge(TC.InDetTrackFitterLowPt(flags)) + acc.addPublicTool(InDetTrackFitterLowPt) + kwargs.setdefault("Fitter", InDetTrackFitterLowPt) + + if flags.InDet.materialInteractions: + kwargs.setdefault("MatEffects", flags.InDet.materialInteractionsType) + else: + kwargs.setdefault("MatEffects", 0) + + InDetAmbiguityProcessor = ProcessorTool(name=name+flags.InDet.Tracking.extension, **kwargs) + acc.setPrivateTools(InDetAmbiguityProcessor) + return acc + +def TrkAmbiguityScoreCfg(flags, name="InDetAmbiguityScore", SiSPSeededTrackCollectionKey = None, **kwargs) : + acc = ComponentAccumulator() + # + # --- set input and output collection + # + InputTrackCollection = SiSPSeededTrackCollectionKey + + if flags.InDet.doTIDE_Ambi and not (flags.InDet.Tracking.extension == "ForwardSLHCTracks" or flags.InDet.Tracking.extension == "ForwardTracks" or flags.InDet.Tracking.extension == "DBM"): + InDetAmbiguityScoreProcessor = acc.popToolsAndMerge(DenseEnvironmentsAmbiguityScoreProcessorToolCfg(flags)) + acc.addPublicTool(InDetAmbiguityScoreProcessor) + else: + InDetAmbiguityScoreProcessor = None + + # + # --- configure Ambiguity (score) solver + # + kwargs.setdefault("TrackInput" , [ InputTrackCollection ]) + kwargs.setdefault("TrackOutput", 'ScoredMap'+'InDetAmbiguityScore'+ flags.InDet.Tracking.extension) + kwargs.setdefault("AmbiguityScoreProcessor" , InDetAmbiguityScoreProcessor ) ## TODO: check the case when it is None object + + InDetAmbiguityScore = CompFactory.Trk.TrkAmbiguityScore(name = name+flags.InDet.Tracking.extension, **kwargs) + acc.addEventAlgo(InDetAmbiguityScore) + return acc + +def TrkAmbiguitySolverCfg(flags, name="InDetAmbiguitySolver", ResolvedTrackCollectionKey = None, ClusterSplitProbContainer='', **kwargs): + acc = ComponentAccumulator() + SiTrackCollection = ResolvedTrackCollectionKey + + if flags.InDet.doTIDE_Ambi and not (flags.InDet.Tracking.extension == "ForwardSLHCTracks" or flags.InDet.Tracking.extension == "ForwardTracks" or flags.InDet.Tracking.extension == "DBM"): + # DenseEnvironmentsAmbiguityProcessorTool + InDetAmbiguityProcessor = acc.popToolsAndMerge(DenseEnvironmentsAmbiguityProcessorToolCfg( flags, + ClusterSplitProbContainer=ClusterSplitProbContainer)) + acc.addPublicTool(InDetAmbiguityProcessor) + else: + InDetAmbiguityProcessor = acc.popToolsAndMerge(SimpleAmbiguityProcessorToolCfg( flags, + ClusterSplitProbContainer=ClusterSplitProbContainer)) + acc.addPublicTool(InDetAmbiguityProcessor) + + # + # --- configure Ambiguity solver + # + kwargs.setdefault("TrackInput", 'ScoredMap'+'InDetAmbiguityScore'+ flags.InDet.Tracking.extension) + kwargs.setdefault("TrackOutput", SiTrackCollection) + kwargs.setdefault( "AmbiguityProcessor", InDetAmbiguityProcessor) + + InDetAmbiguitySolver = CompFactory.Trk.TrkAmbiguitySolver(name = name+flags.InDet.Tracking.extension, **kwargs) + acc.addEventAlgo(InDetAmbiguitySolver ) + return acc + +# ------------------------------------------------------------ +# +# ----------- Setup Si Pattern for New tracking +# +# ------------------------------------------------------------ +def TrackingSiPatternCfg(flags, InputCollections = None, ResolvedTrackCollectionKey = None, SiSPSeededTrackCollectionKey = None , ClusterSplitProbContainer=''): + acc = ComponentAccumulator() + # + # --- decide if use the association tool + # + if (len(InputCollections) > 0) and (flags.InDet.Tracking.extension == "LowPt" or flags.InDet.Tracking.extension == "VeryLowPt" or flags.InDet.Tracking.extension == "LargeD0" or flags.InDet.Tracking.extension == "LowPtLargeD0" or flags.InDet.Tracking.extension == "BeamGas" or flags.InDet.Tracking.extension == "ForwardTracks" or flags.InDet.Tracking.extension == "ForwardSLHCTracks" or flags.InDet.Tracking.extension == "Disappearing" or flags.InDet.Tracking.extension == "VeryForwardSLHCTracks" or flags.InDet.Tracking.extension == "SLHCConversionFinding"): + usePrdAssociationTool = True + else: + usePrdAssociationTool = False + # + # --- get list of already associated hits (always do this, even if no other tracking ran before) + # + if usePrdAssociationTool: + prefix = 'InDet' + suffix = flags.InDet.Tracking.extension + acc.merge(TC.InDetTrackPRD_AssociationCfg(flags,namePrefix = prefix, + nameSuffix = suffix, + TracksName = list(InputCollections))) + + # ------------------------------------------------------------ + # + # ----------- SiSPSeededTrackFinder + # + # ------------------------------------------------------------ + + if True: #flags.InDet.doSiSPSeededTrackFinder: # TODO fix logic here, this is SiPatternConfig - it should make no sense to call this when SiSPSeededTrackFinder is False??? + acc.merge(SiSPSeededTrackFinderCfg( flags, + InputCollections = InputCollections, + SiSPSeededTrackCollectionKey = SiSPSeededTrackCollectionKey)) + # ------------------------------------------------------------ + # + # ---------- Ambiguity solving + # + # ------------------------------------------------------------ + if True: #flags.InDet.doAmbiSolving: is this flag needed + # + # --- load InnerDetector TrackSelectionTool + # + acc.merge(TrkAmbiguityScoreCfg( flags, + SiSPSeededTrackCollectionKey=SiSPSeededTrackCollectionKey)) + + acc.merge(TrkAmbiguitySolverCfg(flags, + ResolvedTrackCollectionKey=ResolvedTrackCollectionKey)) + + return acc + + diff --git a/InnerDetector/InDetRecAlgs/InDetCaloClusterROISelector/src/CaloClusterROI_Selector.cxx b/InnerDetector/InDetRecAlgs/InDetCaloClusterROISelector/src/CaloClusterROI_Selector.cxx index bfce74b9f0e4..b223d933e856 100755 --- a/InnerDetector/InDetRecAlgs/InDetCaloClusterROISelector/src/CaloClusterROI_Selector.cxx +++ b/InnerDetector/InDetRecAlgs/InDetCaloClusterROISelector/src/CaloClusterROI_Selector.cxx @@ -96,9 +96,8 @@ StatusCode InDet::CaloClusterROI_Selector::execute(const EventContext& ctx) cons // retrieve cluster containers, return `failure' if not existing SG::ReadHandle<xAOD::CaloClusterContainer> inputClusterContainer(m_inputClusterContainerName,ctx); - if (!inputClusterContainer.isValid()) { - return StatusCode::FAILURE; - } + ATH_CHECK(inputClusterContainer.isValid()); + const CaloDetDescrManager* calodetdescrmgr = nullptr; ATH_CHECK( detStore()->retrieve(calodetdescrmgr,"CaloMgr")); // loop over clusters diff --git a/Reconstruction/MuonIdentification/MuonCombinedConfig/python/MuonCombinedReconstructionConfig.py b/Reconstruction/MuonIdentification/MuonCombinedConfig/python/MuonCombinedReconstructionConfig.py index 7d37e901d132..70ba15f34f95 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedConfig/python/MuonCombinedReconstructionConfig.py +++ b/Reconstruction/MuonIdentification/MuonCombinedConfig/python/MuonCombinedReconstructionConfig.py @@ -370,8 +370,7 @@ if __name__=="__main__": #Configure topocluster algorithmsm, and associated conditions from CaloRec.CaloTopoClusterConfig import CaloTopoClusterCfg - cfg.merge(CaloTopoClusterCfg(ConfigFlags,doLCCalib=True)) - + cfg.merge(CaloTopoClusterCfg(ConfigFlags,doLCCalib=True, clustersname="CaloTopoClusters")) acc = MuonCombinedReconstructionCfg(ConfigFlags) cfg.merge(acc) @@ -402,7 +401,7 @@ if __name__=="__main__": # Commented, because it should be added back in very soon. # itemsToRecord = ["xAOD::MuonContainer#Muons", "xAOD::MuonAuxContainer#MuonsAux.-DFCommonMuonsTight.-DFCommonGoodMuon.-DFCommonMuonsMedium.-DFCommonMuonsLoose"] # SetupMuonStandaloneOutput(cfg, ConfigFlags, itemsToRecord) - cfg.printConfig(withDetails = True) + cfg.printConfig(withDetails = True, summariseProps=True) # f=open("MuonCombinedReconstruction.pkl","wb") # cfg.store(f) # f.close() diff --git a/Reconstruction/RecJobTransforms/CMakeLists.txt b/Reconstruction/RecJobTransforms/CMakeLists.txt index ef2583c4b6f1..1873add1e12f 100644 --- a/Reconstruction/RecJobTransforms/CMakeLists.txt +++ b/Reconstruction/RecJobTransforms/CMakeLists.txt @@ -12,3 +12,16 @@ atlas_install_joboptions( share/*.py EXCLUDE share/*RDOtoRDOtrigger*.py ) # Install scripts atlas_install_runtime( scripts/*.py ) +file( MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/unitTestRun_RecoRAW ) +atlas_add_test( RecoRAW + SCRIPT python -m RecJobTransforms.RecoSteering --RAW + POST_EXEC_SCRIPT nopost.sh + PROPERTIES TIMEOUT 300 + PROPERTIES WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/unitTestRun_RecoRAW ) + +# file( MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/unitTestRun_RecoESD ) +# atlas_add_test( RecoESD +# SCRIPT python -m RecJobTransforms.RecoSteering --ESD +# POST_EXEC_SCRIPT nopost.sh +# PROPERTIES TIMEOUT 300 +# PROPERTIES WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/unitTestRun_RecoESD ) \ No newline at end of file diff --git a/Reconstruction/RecJobTransforms/python/RecoSteering.py b/Reconstruction/RecJobTransforms/python/RecoSteering.py new file mode 100644 index 000000000000..f911cfeed1fe --- /dev/null +++ b/Reconstruction/RecJobTransforms/python/RecoSteering.py @@ -0,0 +1,115 @@ +# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration +from AthenaConfiguration.MainServicesConfig import MainServicesCfg +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator +from AthenaCommon.Logging import logging +log = logging.getLogger("RecoSteering.py") + +def RecoSteering(flags): + """ + Generates configuration of the reconstructions + + This driver configures all reconstruction steps unconditionally. + The selftest available below can be used for simple jobs, yet full functionality is achieved with tansforms that set many flags. + """ + acc = ComponentAccumulator() + # setup input + if flags.Input.Format == 'BS': + from ByteStreamCnvSvc.ByteStreamConfig import ByteStreamReadCfg + acc.merge(ByteStreamReadCfg(flags)) + log.info("---------- Configured BS reading") + else: + from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg + acc.merge(PoolReadCfg(flags)) + log.info("---------- Configured POOL reading") + + # calorimeter + from CaloRec.CaloRecoConfig import CaloRecoCfg + acc.merge(CaloRecoCfg(flags)) + log.info("---------- Configured calorimeter reconstruction") + + # ID + from InDetConfig.TrackRecoConfig import TrackRecoCfg + acc.merge(TrackRecoCfg(flags)) + log.info("---------- Configured tracking") + + # muons + from MuonConfig.MuonReconstructionConfig import MuonReconstructionCfg + acc.merge(MuonReconstructionCfg(flags)) + log.info("---------- Configured muon tracking") + + # physics objects + # egamma + # jets + # btagging + # pflow + + #setup output + # TODO - decide how we collect objects that need recording (the old way was a global & external list) + itemsToRecord = ["xAOD::EventInfo#EventInfo"] + from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg + if flags.Output.doWriteESD: + acc.merge(OutputStreamCfg(flags, "ESD", ItemList=itemsToRecord, disableEventTag=True)) + log.info("---------- Configured ESD writing") + + if flags.Output.doWriteAOD: + acc.merge(OutputStreamCfg(flags, "AOD", ItemList=itemsToRecord, disableEventTag=True)) + log.info("---------- Configured AOD writing") + + return acc + +import sys +def _run(input): + import datetime + startStamp = datetime.datetime.now() + from AthenaCommon.Configurable import Configurable + Configurable.configurableRun3Behavior=True + from AthenaConfiguration.AllConfigFlags import ConfigFlags as flags + flags.Exec.MaxEvents = 5 + flags.Concurrency.NumThreads = 1 + flags.Input.Files = [] + #TODO these flags should be defaulted in the divier function above, + #TODO but then we ought to have option to set them from command line should the parser be passed there too? + flags.Detector.RecoIBL=True + flags.Detector.RecoPixel=True + flags.Detector.RecoSCT=True + flags.Detector.RecoTRT=True + flags.Calo.TopoCluster.doTopoClusterLocalCalib=False + parser = flags.getArgumentParser() + args = flags.fillFromArgs(parser=parser) + + # test inputs + if flags.Input.Files == []: + from AthenaConfiguration.TestDefaults import defaultTestFiles + if input == "RAW": + flags.Input.Files = defaultTestFiles.RAW + if input == "ESD": + flags.Input.Files = defaultTestFiles.ESD + + flags.lock() + + acc = MainServicesCfg(flags) + acc.merge(RecoSteering(flags), sequenceName="AthAlgSeq") + confStamp = datetime.datetime.now() + log.info("configured in %d seconds", (confStamp-startStamp).seconds ) + + acc.printConfig(withDetails=True) + if args.configOnly: + with open(args.configOnly, "wb") as confFile: + acc.store(confFile) + log.info("configOnly option specified. Saved in: %s ... exiting now.", args.configOnly ) + + sys.exit(0) + # running + statusCode = acc.run() + endStamp = datetime.datetime.now() + log.info("total time spent in %d seconds (running %s seconds) ", (endStamp-startStamp).seconds, (endStamp-confStamp).seconds ) + + sys.exit(not statusCode.isSuccess()) + +if __name__ == "__main__": + if "--RAW" in sys.argv: + del sys.argv[sys.argv.index("--RAW")] + _run(input="RAW") + if "--ESD" in sys.argv: + del sys.argv[sys.argv.index("--ESD")] + _run(input="ESD") \ No newline at end of file diff --git a/Reconstruction/egamma/egammaConfig/python/egammaConfigFlags.py b/Reconstruction/egamma/egammaConfig/python/egammaConfigFlags.py index 1da6c4c5edfe..70f77a17a15a 100644 --- a/Reconstruction/egamma/egammaConfig/python/egammaConfigFlags.py +++ b/Reconstruction/egamma/egammaConfig/python/egammaConfigFlags.py @@ -50,7 +50,7 @@ def createEgammaConfigFlags(): return "AllCalo" egcf.addFlag("Egamma.Keys.Input.CaloCells", lambda prevFlags: _cellContainer(prevFlags)) - egcf.addFlag("Egamma.Keys.Input.TopoClusters", 'CaloTopoCluster') # input topoclusters + egcf.addFlag("Egamma.Keys.Input.TopoClusters", 'CaloTopoClusters') # input topoclusters egcf.addFlag("Egamma.Keys.Input.TruthParticles", 'TruthParticles') egcf.addFlag("Egamma.Keys.Input.TruthEvents", 'TruthEvents') egcf.addFlag("Egamma.Keys.Input.TrackParticles", 'InDetTrackParticles') # input to GSF -- GitLab