Commit 0c34b62e authored by Frank Winklmeier's avatar Frank Winklmeier
Browse files

Merge branch 'fix_csc_configuration' into 'master'

MuonRecExample - Harmonize configuration to swtich off the small wheels

See merge request !44285
parents 237d7b0d 692afe89
......@@ -183,7 +183,7 @@ namespace Muon {
/// Properties to explicitly switch off the CSC / Micromega/ sTGC reconstruction
Gaudi::Property<bool> m_runCSC{this, "RunCSC", true, "Specify whether the CSC reconstruction shall be run"};
Gaudi::Property<bool> m_runSTgc{this, "RunTgc", true, "Specify whether the sTGC reconstruction shall be run"};
Gaudi::Property<bool> m_runSTgc{this, "RunsTgc", true, "Specify whether the sTGC reconstruction shall be run"};
Gaudi::Property<bool> m_runMM{this, "RunMM", true, "Specify whether the Micromega reconstruction shall be tun"};
const ServiceHandle<StoreGateSvc> m_detStore;
......
......@@ -44,9 +44,8 @@ namespace Muon {
}
if (m_hasSTgc) {
if (m_detStore->retrieve(m_stgcIdHelper).isFailure()) {
ATH_MSG_WARNING(
" Cannot retrieve sTgcIdHelper, please consider setting HasSTgc property to false in the future when running a layout "
"without sTGC chambers");
ATH_MSG_WARNING(" Cannot retrieve sTgcIdHelper, please consider setting HasSTgc property to false "<<
" in the future when running a layout without sTGC chambers");
m_hasSTgc = false;
m_stgcIdHelper = nullptr;
m_runSTgc = false;
......@@ -179,6 +178,8 @@ namespace Muon {
msg(MSG::DEBUG) << MuonStationIndex::chName(data.chIndex) << " " << MuonStationIndex::stName(data.stIndex) << endmsg;
}
}
ATH_MSG_DEBUG("Configured the service with the following flags --- hasCSC: "<<hasCSC()
<<" recoCSC: "<<recoCSC()<<" hasSTGC: "<<hasSTgc()<<" recoSTGC: "<<recosTgc()<<" hasMicroMegas: "<<hasMM()<<" recoMM: "<<recoMM());
return StatusCode::SUCCESS;
}
......
......@@ -24,7 +24,6 @@ from AthenaCommon.ConfiguredFactory import getProperty
from IOVDbSvc.CondDB import conddb
from MuonCnvExample.MuonCnvUtils import mdtCalibWindowNumber
from .MuonRecTools import MuonExtrapolator, MuonChi2TrackFitter
from .MuonRecUtils import ConfiguredBase,ExtraFlags
......@@ -32,6 +31,7 @@ from .MuonRecUtils import ConfiguredBase,ExtraFlags
from .MuonRecFlags import muonRecFlags
from .MuonStandaloneFlags import muonStandaloneFlags
from AtlasGeoModel.MuonGMJobProperties import MuonGeometryFlags
from TriggerJobOpts.TriggerFlags import TriggerFlags
from InDetRecExample import TrackingCommon
......@@ -101,7 +101,7 @@ class MooSegmentCombinationFinder(CfgMgr.Muon__MooSegmentCombinationFinder,Confi
__slots__ = ()
def __init__(self,name="MooSegmentFinder",**kwargs):
reco_cscs = MuonGeometryFlags.hasCSC() and muonRecFlags.doCSCs()
kwargs.setdefault( "SegmentCombiner", "MuonCurvedSegmentCombiner" )
kwargs.setdefault( "SegmentCombinationCleaner", "MuonSegmentCombinationCleanerTool" )
if( muonStandaloneFlags.reconstructionMode() == 'collisions'):
......@@ -112,9 +112,9 @@ class MooSegmentCombinationFinder(CfgMgr.Muon__MooSegmentCombinationFinder,Confi
kwargs.setdefault( "MdtSegmentMaker", "MuonPatternSegmentMaker" )
kwargs.setdefault( "DoSegmentCombinations", False )
kwargs.setdefault( "DoSegmentCombinationCleaning", False )
kwargs.setdefault( "DoCscSegments", muonRecFlags.doCSCs() )
kwargs.setdefault( "DoCscSegments", reco_cscs )
kwargs.setdefault( "DoMdtSegments", muonRecFlags.doMDTs() )
if muonRecFlags.doCSCs():
if reco_cscs:
kwargs.setdefault( "Csc2dSegmentMaker","Csc2dSegmentMaker" )
kwargs.setdefault( "Csc4dSegmentMaker", "Csc4dSegmentMaker" )
else:
......@@ -315,13 +315,14 @@ def MCTBSLFitter(name="MCTBSLFitter", **kwargs):
def MCTBSLFitterMaterialFromTrack(name="MCTBSLFitterMaterialFromTrack", **kwargs):
kwargs["GetMaterialFromTrack"]=True
kwargs.setdefault("ExtrapolationTool", "Trk::Extrapolator/MuonStraightLineExtrapolator")
#kwargs.setdefault("PropagatorTool", "Trk::STEP_Propagator/MuonStraightLinePropagator") #will switch to this once it's ready
kwargs.setdefault("ExtrapolationTool", getPublicTool("MuonStraightLineExtrapolator"))
kwargs["PropagatorTool"]=getPublicTool("MuonRK_Propagator")
return MCTBSLFitter(name, **kwargs)
def MuonSeededSegmentFinder(name="MuonSeededSegmentFinder",**kwargs):
def MuonSeededSegmentFinder(name="MuonSeededSegmentFinder",**kwargs):
reco_cscs = MuonGeometryFlags.hasCSC() and muonRecFlags.doCSCs()
reco_stgcs = muonRecFlags.dosTGCs() and MuonGeometryFlags.hasSTGC()
reco_mm = muonRecFlags.doMicromegas() and MuonGeometryFlags.hasMM()
if "SegmentMaker" not in kwargs or "SegmentMakerNoHoles" not in kwargs:
if beamFlags.beamType() == 'collisions':
......@@ -336,9 +337,9 @@ def MuonSeededSegmentFinder(name="MuonSeededSegmentFinder",**kwargs):
kwargs.setdefault("SegmentMaker", segMaker)
kwargs.setdefault("SegmentMakerNoHoles", segMaker)
if not MuonGeometryFlags.hasCSC(): kwargs.setdefault("CscPrepDataContainer","")
if not MuonGeometryFlags.hasSTGC(): kwargs.setdefault("sTgcPrepDataContainer","")
if not MuonGeometryFlags.hasMM(): kwargs.setdefault("MMPrepDataContainer","")
if not reco_cscs: kwargs.setdefault("CscPrepDataContainer","")
if not reco_stgcs: kwargs.setdefault("sTgcPrepDataContainer","")
if not reco_mm: kwargs.setdefault("MMPrepDataContainer","")
return CfgMgr.Muon__MuonSeededSegmentFinder(name,**kwargs)
......@@ -403,8 +404,11 @@ def MuonChamberHoleRecoveryTool(name="MuonChamberHoleRecoveryTool",extraFlags=No
if doSegmentT0Fit:
kwargs.setdefault("AddMeasurements", False)
if muonRecFlags.doCSCs():
reco_cscs = MuonGeometryFlags.hasCSC() and muonRecFlags.doCSCs()
reco_stgcs = muonRecFlags.dosTGCs() and MuonGeometryFlags.hasSTGC()
reco_mm = muonRecFlags.doMicromegas() and MuonGeometryFlags.hasMM()
if reco_cscs:
if muonRecFlags.enableErrorTuning() or globalflags.DataSource() == 'data':
kwargs.setdefault("CscRotCreator","CscBroadClusterOnTrackCreator")
else:
......@@ -417,8 +421,8 @@ def MuonChamberHoleRecoveryTool(name="MuonChamberHoleRecoveryTool",extraFlags=No
# add in missing C++ dependency. TODO: fix in C++
getPublicTool("ResidualPullCalculator")
if not MuonGeometryFlags.hasSTGC(): kwargs.setdefault("sTgcPrepDataContainer","")
if not MuonGeometryFlags.hasMM(): kwargs.setdefault("MMPrepDataContainer","")
if not reco_stgcs: kwargs.setdefault("sTgcPrepDataContainer","")
if not reco_mm: kwargs.setdefault("MMPrepDataContainer","")
#MDT conditions information not available online
if(athenaCommonFlags.isOnline):
......@@ -444,17 +448,21 @@ class MuonSegmentRegionRecoveryTool(CfgMgr.Muon__MuonSegmentRegionRecoveryTool,C
kwargs.setdefault("MDTRegionSelector", makeRegSelTool_MDT())
kwargs.setdefault("RPCRegionSelector", makeRegSelTool_RPC())
kwargs.setdefault("TGCRegionSelector", makeRegSelTool_TGC())
if MuonGeometryFlags.hasCSC():
reco_cscs = MuonGeometryFlags.hasCSC() and muonRecFlags.doCSCs()
reco_stgcs = muonRecFlags.dosTGCs() and MuonGeometryFlags.hasSTGC()
reco_mm = muonRecFlags.doMicromegas() and MuonGeometryFlags.hasMM()
if reco_cscs:
from RegionSelector.RegSelToolConfig import makeRegSelTool_CSC
kwargs.setdefault("CSCRegionSelector", makeRegSelTool_CSC())
else:
kwargs.setdefault("CSCRegionSelector", "")
if MuonGeometryFlags.hasSTGC():
if reco_stgcs:
from RegionSelector.RegSelToolConfig import makeRegSelTool_sTGC
kwargs.setdefault("STGCRegionSelector", makeRegSelTool_sTGC())
else:
kwargs.setdefault("STGCRegionSelector", "")
if MuonGeometryFlags.hasMM():
if reco_mm:
from RegionSelector.RegSelToolConfig import makeRegSelTool_MM
kwargs.setdefault("MMRegionSelector", makeRegSelTool_MM())
else:
......@@ -543,7 +551,8 @@ getPublicTool("MCTBSLFitter")
getPublicTool("MCTBFitterMaterialFromTrack")
getPublicTool("MuonSeededSegmentFinder")
mCHRT = getPublicTool("MuonChamberHoleRecoveryTool")
if not MuonGeometryFlags.hasCSC():
reco_cscs = MuonGeometryFlags.hasCSC() and muonRecFlags.doCSCs()
if not reco_cscs:
mCHRT.CscRotCreator = ""
mCHRT.CscPrepDataContainer = ""
getPublicTool("MuonTrackSelectorTool")
......
......@@ -29,7 +29,8 @@ class MuPatCandidateTool(CfgMgr.Muon__MuPatCandidateTool,ConfiguredBase):
def __init__(self,name='MuPatCandidateTool',**kwargs):
self.applyUserDefaults(kwargs,name)
if not MuonGeometryFlags.hasCSC():
reco_cscs = MuonGeometryFlags.hasCSC() and muonRecFlags.doCSCs()
if not reco_cscs:
kwargs["CscRotCreator"] = ""
super(MuPatCandidateTool,self).__init__(name,**kwargs)
......@@ -38,8 +39,10 @@ class MuPatHitTool(CfgMgr.Muon__MuPatHitTool,ConfiguredBase):
__slots__ = ()
def __init__(self,name="MuPatHitTool",**kwargs):
reco_cscs = MuonGeometryFlags.hasCSC() and muonRecFlags.doCSCs()
self.applyUserDefaults(kwargs,name)
if not muonRecFlags.doCSCs():
if not reco_cscs:
# overwrite whatever is set
kwargs["CscRotCreator"] = ""
super(MuPatHitTool,self).__init__(name,**kwargs)
......@@ -47,7 +50,7 @@ class MuPatHitTool(CfgMgr.Muon__MuPatHitTool,ConfiguredBase):
MuPatHitTool.setDefaultProperties(
CscRotCreator = ("FixedErrorMuonClusterOnTrackCreator" if MuonGeometryFlags.hasCSC() else ""),
CscRotCreator = ("FixedErrorMuonClusterOnTrackCreator" if MuonGeometryFlags.hasCSC() and muonRecFlags.doCSCs() else ""),
MdtRotCreator = "MdtDriftCircleOnTrackCreatorPreFit" )
# end of class MuPatHitTool
# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
from AthenaCommon.CfgGetter import addTool, addToolClone, addService, addAlgorithm, addNamesToSkipIfNotAvailable, addTypesOnlyToSkip
from AtlasGeoModel.CommonGMJobProperties import CommonGeometryFlags
from AtlasGeoModel.CommonGMJobProperties import CommonGeometryFlags # noqa: F401
from AtlasGeoModel.MuonGMJobProperties import MuonGeometryFlags
from MuonRecExample.MuonRecFlags import muonRecFlags
addNamesToSkipIfNotAvailable( "MuonIsolationTool" )
addTypesOnlyToSkip( "ICaloNoiseTool" )
setup_cscs = muonRecFlags.doCSCs() and MuonGeometryFlags.hasCSC()
setup_stgcs = MuonGeometryFlags.hasSTGC() and muonRecFlags.dosTGCs()
setup_mm = MuonGeometryFlags.hasMM() and muonRecFlags.doMicromegas()
################################################################################
# Tools from other packages
################################################################################
......@@ -56,7 +61,12 @@ addTool("MuonRecExample.MuonRecTools.MuonStraightLineExtrapolator", "MuonStraigh
addTool("Trk::KalmanUpdator", "MuonMeasUpdator")
addService("Muon::MuonIdHelperSvc", "MuonIdHelperSvc", HasCSC=MuonGeometryFlags.hasCSC(), HasSTgc=MuonGeometryFlags.hasSTGC(), HasMM=MuonGeometryFlags.hasMM())
addService("Muon::MuonIdHelperSvc", "MuonIdHelperSvc", HasCSC=MuonGeometryFlags.hasCSC(),
HasSTgc=MuonGeometryFlags.hasSTGC(),
HasMM=MuonGeometryFlags.hasMM(),
RunCSC=setup_cscs,
RunsTgc=setup_stgcs,
RunMM = setup_mm)
addTool("Muon::MuonTrackTruthTool", "MuonTrackTruthTool")
......@@ -113,11 +123,12 @@ addTool("Trk::ResidualPullCalculator","ResidualPullCalculator",
addTool( "MuonRecExample.MuonPrdProviderToolsConfig.RpcPrepDataProviderTool", "RpcPrepDataProviderTool" )
addTool( "MuonRecExample.MuonPrdProviderToolsConfig.MdtPrepDataProviderTool", "MdtPrepDataProviderTool" )
addTool( "MuonRecExample.MuonPrdProviderToolsConfig.TgcPrepDataProviderTool", "TgcPrepDataProviderTool" )
if MuonGeometryFlags.hasCSC():
if setup_cscs:
addTool( "MuonRecExample.MuonPrdProviderToolsConfig.CscPrepDataProviderTool", "CscPrepDataProviderTool" )
addAlgorithm("MuonRecExample.MuonPrdProviderToolsConfig.CscRdoToCscPrepData", "CscRdoToCscPrepData")
if (CommonGeometryFlags.Run() in ["RUN3", "RUN4"]):
if setup_mm:
addTool( "MuonRecExample.MuonPrdProviderToolsConfig.MM_PrepDataProviderTool", "MM_PrepDataProviderTool" )
if setup_stgcs:
addTool( "MuonRecExample.MuonPrdProviderToolsConfig.STGC_PrepDataProviderTool", "STGC_PrepDataProviderTool" )
################################################################################
......@@ -155,11 +166,14 @@ addTool( "MuonRecExample.MooreTools.MuonTrackCleaner", "MuonTrackCleaner" )
addToolClone( "MuonClusterOnTrackCreator", "FixedErrorMuonClusterOnTrackCreator",
DoFixedErrorCscEta = True, FixedErrorCscEta = .5 )
if MuonGeometryFlags.hasCSC():
if setup_cscs:
addTool( "MuonRecExample.MuonRecTools.CscClusterOnTrackCreator", "CscClusterOnTrackCreator" )
addTool( "MuonRecExample.MuonRecTools.CscBroadClusterOnTrackCreator", "CscBroadClusterOnTrackCreator" )
addTool( "MuonRecExample.MooreTools.MuonChamberHoleRecoveryTool", "MuonChamberHoleRecoveryTool", CscRotCreator=("Muon::CscClusterOnTrackCreator/CscClusterOnTrackCreator" if MuonGeometryFlags.hasCSC() else ""), CscPrepDataContainer=("CSC_Clusters" if MuonGeometryFlags.hasCSC() else ""))
addTool( "MuonRecExample.MooreTools.MuonChamberHoleRecoveryTool",
"MuonChamberHoleRecoveryTool",
CscRotCreator=("Muon::CscClusterOnTrackCreator/CscClusterOnTrackCreator" if setup_cscs else ""),
CscPrepDataContainer=("CSC_Clusters" if setup_cscs else ""))
addTool( "MuonRecExample.MooreTools.MuonSegmentRegionRecoveryTool", "MuonSegmentRegionRecoveryTool" )
......@@ -200,7 +214,7 @@ addTool( "MuonRecExample.MooreTools.MooTrackFitter", "MooSLTrackFitter",
addTool( "MuonRecExample.MooreTools.MooTrackBuilder", "MooTrackBuilderTemplate")
if MuonGeometryFlags.hasCSC():
if setup_cscs:
addTool("MuonRecExample.CscTools.CscAlignmentTool","CscAlignmentTool")
addTool("MuonRecExample.CscTools.CscClusterUtilTool","CscClusterUtilTool")
addTool("MuonRecExample.CscTools.QratCscClusterFitter","QratCscClusterFitter")
......@@ -219,24 +233,28 @@ if MuonGeometryFlags.hasCSC():
################################################################################
# Tools from MuonRecExample.NSWTools (NSW - MicroMegas and STgc reconstruction tools)
################################################################################
addTool("MuonRecExample.NSWTools.SimpleMMClusterBuilderTool","SimpleMMClusterBuilderTool")
addTool("MuonRecExample.NSWTools.UTPCMMClusterBuilderTool","UTPCMMClusterBuilderTool")
addTool("MuonRecExample.NSWTools.ProjectionMMClusterBuilderTool","ProjectionMMClusterBuilderTool")
addTool("MuonRecExample.NSWTools.ConstraintAngleMMClusterBuilderTool","ConstraintAngleMMClusterBuilderTool")
addTool("MuonRecExample.NSWTools.ClusterTimeProjectionMMClusterBuilderTool","ClusterTimeProjectionMMClusterBuilderTool")
addTool("MuonRecExample.NSWTools.SimpleSTgcClusterBuilderTool","SimpleSTgcClusterBuilderTool")
addTool("NSWCalibTools.NSWCalibToolsConfig.MMCalibSmearingTool","MMCalibSmearingTool")
addTool("NSWCalibTools.NSWCalibToolsConfig.STgcCalibSmearingTool","STgcCalibSmearingTool")
addTool("NSWCalibTools.NSWCalibToolsConfig.NSWCalibTool","NSWCalibTool")
if setup_mm:
addTool("MuonRecExample.NSWTools.SimpleMMClusterBuilderTool","SimpleMMClusterBuilderTool")
addTool("MuonRecExample.NSWTools.UTPCMMClusterBuilderTool","UTPCMMClusterBuilderTool")
addTool("MuonRecExample.NSWTools.ProjectionMMClusterBuilderTool","ProjectionMMClusterBuilderTool")
addTool("MuonRecExample.NSWTools.ConstraintAngleMMClusterBuilderTool","ConstraintAngleMMClusterBuilderTool")
addTool("MuonRecExample.NSWTools.ClusterTimeProjectionMMClusterBuilderTool","ClusterTimeProjectionMMClusterBuilderTool")
addTool("NSWCalibTools.NSWCalibToolsConfig.MMCalibSmearingTool","MMCalibSmearingTool")
if setup_stgcs:
addTool("MuonRecExample.NSWTools.SimpleSTgcClusterBuilderTool","SimpleSTgcClusterBuilderTool")
addTool("NSWCalibTools.NSWCalibToolsConfig.STgcCalibSmearingTool","STgcCalibSmearingTool")
if setup_stgcs or setup_mm:
addTool("NSWCalibTools.NSWCalibToolsConfig.NSWCalibTool","NSWCalibTool")
################################################################################
# Tools from MuonRecExample.MuPatTools
################################################################################
addTool( "MuonRecExample.MuPatTools.MuPatCandidateTool","MuPatCandidateTool", CscRotCreator=("Muon::CscClusterOnTrackCreator/CscClusterOnTrackCreator" if MuonGeometryFlags.hasCSC() else ""))
addTool( "MuonRecExample.MuPatTools.MuPatCandidateTool","MuPatCandidateTool",
CscRotCreator=("Muon::CscClusterOnTrackCreator/CscClusterOnTrackCreator" if setup_cscs else ""))
addTool( "MuonRecExample.MuPatTools.MuPatHitTool", "MuPatHitTool", CscRotCreator=("Muon::CscClusterOnTrackCreator/CscClusterOnTrackCreator" if MuonGeometryFlags.hasCSC() else ""))
addTool( "MuonRecExample.MuPatTools.MuPatHitTool", "MuPatHitTool",
CscRotCreator=("Muon::CscClusterOnTrackCreator/CscClusterOnTrackCreator" if setup_cscs else ""))
################################################################################
......
......@@ -481,7 +481,7 @@ if DetFlags.detdescr.Muon_on() and rec.doMuon():
getPublicTool("MuonEDMPrinterTool")
getPublicTool("MuonSegmentMomentum")
getPublicTool("MuonClusterOnTrackCreator")
if MuonGeometryFlags.hasCSC():
if muonRecFlags.doCSCs():
getPrivateTool("CscClusterOnTrackCreator")
getPrivateTool("CscBroadClusterOnTrackCreator")
getPublicTool("MdtDriftCircleOnTrackCreator")
......@@ -493,8 +493,8 @@ else: # not (DetFlags.Muon_on() and rec.doMuon())
logMuon.warning("Muon reconstruction tools only loaded on-demand because Muons")
def MuonLayerSegmentFinderTool(name='MuonLayerSegmentFinderTool',extraFlags=None,**kwargs):
kwargs.setdefault("Csc2DSegmentMaker", getPublicTool("Csc2dSegmentMaker") if MuonGeometryFlags.hasCSC() else "")
kwargs.setdefault("Csc4DSegmentMaker", getPublicTool("Csc4dSegmentMaker") if MuonGeometryFlags.hasCSC() else "")
kwargs.setdefault("Csc2DSegmentMaker", getPublicTool("Csc2dSegmentMaker") if muonRecFlags.doCSCs() else "")
kwargs.setdefault("Csc4DSegmentMaker", getPublicTool("Csc4dSegmentMaker") if muonRecFlags.doCSCs() else "")
kwargs.setdefault("MuonClusterSegmentFinder",getPublicTool("MuonClusterSegmentFinder"))
if muonStandaloneFlags.reconstructionMode() != 'collisions':
kwargs.setdefault("Key_MuonLayerHoughToolHoughDataPerSectorVec", "")
......
......@@ -19,7 +19,6 @@ from AthenaCommon.CfgGetter import getPublicTool,getPublicToolClone
from RecExConfig.ObjKeyStore import cfgKeyStore
from AtlasGeoModel.MuonGMJobProperties import MuonGeometryFlags
from TriggerJobOpts.TriggerFlags import TriggerFlags
#==============================================================
......@@ -50,13 +49,14 @@ def MuonTrackSteering(name="MuonTrackSteering", extraFlags=None, **kwargs):
kwargs.setdefault("DoSummary", extraFlags.printSummary)
kwargs.setdefault("OutputSingleStationTracks", True)
kwargs.setdefault("HoleRecoveryTool", "MuonEORecoveryTool")
kwargs.setdefault("HoleRecoveryTool",getPublicTool("MuonEORecoveryTool"))
if "TrackBuilderTool" not in kwargs:
extraFlags.setFlagDefault('UseTrackingHistory',True)
kwargs["TrackBuilderTool"] = getPublicToolClone("MooMuonTrackBuilder", "MooTrackBuilderTemplate",
extraFlags=extraFlags)
if "TrackRefinementTool" not in kwargs:
kwargs["TrackRefinementTool"] = getPublicTool("MooTrackBuilderTemplate")
kwargs.setdefault("SegSeedQCut", 2)
kwargs.setdefault("Seg2ndQCut", 1)
return CfgMgr.Muon__MuonTrackSteering(name,**kwargs)
......@@ -84,19 +84,20 @@ def MooSegmentFinderAlg( name="MuonSegmentMaker",**kwargs ):
return CfgMgr.MooSegmentFinderAlg(name,**kwargs)
def MooSegmentFinderNCBAlg( name="MuonSegmentMaker_NCB",**kwargs ):
reco_cscs = muonRecFlags.doCSCs() and MuonGeometryFlags.hasCSC()
kwargs.setdefault("SegmentFinder",getPublicToolClone("MooSegmentFinder_NCB","MuonSegmentFinder",
DoSummary=False,
Csc2dSegmentMaker = (getPublicToolClone("Csc2dSegmentMaker_NCB","Csc2dSegmentMaker",
segmentTool = getPublicToolClone("CscSegmentUtilTool_NCB",
"CscSegmentUtilTool",
TightenChi2 = False,
IPconstraint=False)) if MuonGeometryFlags.hasCSC() else ""),
IPconstraint=False)) if reco_cscs else ""),
Csc4dSegmentMaker = (getPublicToolClone("Csc4dSegmentMaker_NCB","Csc4dSegmentMaker",
segmentTool = getPublicTool("CscSegmentUtilTool_NCB")) if MuonGeometryFlags.hasCSC() else ""),
segmentTool = getPublicTool("CscSegmentUtilTool_NCB")) if reco_cscs else ""),
DoMdtSegments=False,DoSegmentCombinations=False,DoSegmentCombinationCleaning=False))
kwargs.setdefault("MuonPatternCombinationLocation", "NCB_MuonHoughPatternCombinations")
kwargs.setdefault("MuonSegmentOutputLocation", "NCB_TrackMuonSegments")
kwargs.setdefault("UseCSC", muonRecFlags.doCSCs())
kwargs.setdefault("UseCSC", reco_cscs)
kwargs.setdefault("UseMDT", False)
kwargs.setdefault("UseRPC", False)
kwargs.setdefault("UseTGC", False)
......@@ -126,7 +127,7 @@ def MuonSegmentFinderAlg( name="MuonSegmentMaker", **kwargs):
MuonPatternSegmentMaker = getPublicTool("MuonPatternSegmentMaker"),
PrintSummary = muonStandaloneFlags.printSummary() )
# we check whether the layout contains any CSC chamber and if yes, we check that the user also wants to use the CSCs in reconstruction
if MuonGeometryFlags.hasCSC() and muonRecFlags.doCSCs():
if muonRecFlags.doCSCs():
getPublicTool("CscSegmentUtilTool")
getPublicTool("Csc2dSegmentMaker")
getPublicTool("Csc4dSegmentMaker")
......@@ -176,13 +177,16 @@ class MuonStandalone(ConfiguredMuonRec):
if not self.isEnabled(): return
# do the following in case of (at least one) NSW
if (MuonGeometryFlags.hasSTGC() and MuonGeometryFlags.hasMM()):
reco_stgc = muonRecFlags.dosTGCs() and MuonGeometryFlags.hasSTGC()
reco_mircomegas = muonRecFlags.doMicromegas() and MuonGeometryFlags.hasMM()
reco_cscs = muonRecFlags.doCSCs() and MuonGeometryFlags.hasCSC()
if reco_stgc or reco_mircomegas:
getPublicTool("MuonLayerHoughTool")
self.addAlg( CfgMgr.MuonLayerHoughAlg( "MuonLayerHoughAlg",
PrintSummary = muonStandaloneFlags.printSummary(),
CscPrepDataContainer = ("CSC_Clusters" if MuonGeometryFlags.hasCSC() else ""),
sTgcPrepDataContainer = ("STGC_Measurements" if MuonGeometryFlags.hasSTGC() else ""),
MMPrepDataContainer = ("MM_Measurements" if MuonGeometryFlags.hasMM() else "") ) )
CscPrepDataContainer = ("CSC_Clusters" if reco_cscs else ""),
sTgcPrepDataContainer = ("STGC_Measurements" if reco_stgc else ""),
MMPrepDataContainer = ("MM_Measurements" if reco_mircomegas else "") ) )
if not muonStandaloneFlags.patternsOnly():
self.addAlg( MuonSegmentFinderAlg("MuonSegmentMaker" ))
else:
......@@ -204,7 +208,10 @@ class MuonStandalone(ConfiguredMuonRec):
#
# add the algorithm (which uses the MuonTrackSteering)
#
TrackBuilder = CfgMgr.MuPatTrackBuilder("MuPatTrackBuilder", TrackSteering=getPublicTool("MuonTrackSteering"), SpectrometerTrackOutputLocation="MuonSpectrometerTracks", MuonSegmentCollection="TrackMuonSegments")
TrackBuilder = CfgMgr.MuPatTrackBuilder("MuPatTrackBuilder",
TrackSteering=getPublicTool("MuonTrackSteering"),
SpectrometerTrackOutputLocation="MuonSpectrometerTracks",
MuonSegmentCollection="TrackMuonSegments")
self.addAlg( TrackBuilder )
if muonStandaloneFlags.createTrackParticles():
......
......@@ -61,7 +61,7 @@ if (rec.readRDO() or rec.readESD()) and muonRecFlags.prdToxAOD():
topSequence += CfgMgr.MDT_PrepDataToxAOD()
topSequence += CfgMgr.RPC_PrepDataToxAOD()
topSequence += CfgMgr.TGC_PrepDataToxAOD()
if MuonGeometryFlags.hasCSC(): topSequence += CfgMgr.CSC_PrepDataToxAOD()
if muonRecFlags.doCSCs(): topSequence += CfgMgr.CSC_PrepDataToxAOD()
if muonRecFlags.doCreateClusters():
topSequence += CfgMgr.RPC_PrepDataToxAOD("RPC_ClusterToxAOD",InputContainerName="RPC_Clusters")
......@@ -83,10 +83,8 @@ if rec.readESD() and DetFlags.readRIOPool.TGC_on():
if muonRecFlags.doFastDigitization():
if (MuonGeometryFlags.hasSTGC() and MuonGeometryFlags.hasMM()):
#if DetFlags.Micromegas_on() and DetFlags.digitize.Micromegas_on():
from MuonFastDigitization.MuonFastDigitizationConf import MM_FastDigitizer
topSequence += MM_FastDigitizer("MM_FastDigitizer")
#if DetFlags.sTGC_on() and DetFlags.digitize.sTGC_on():
from MuonFastDigitization.MuonFastDigitizationConf import sTgcFastDigitizer
topSequence += sTgcFastDigitizer("sTgcFastDigitizer")
......@@ -121,7 +119,7 @@ if rec.doTruth() and DetFlags.makeRIO.Muon_on():
if (MuonGeometryFlags.hasSTGC() and MuonGeometryFlags.hasMM()):
topSequence.MuonTruthDecorationAlg.SDOs+=["MM_SDO","sTGC_SDO"]
PRD_TruthMaps += ["MM_TruthMap", "STGC_TruthMap"]
if not MuonGeometryFlags.hasCSC(): topSequence.MuonTruthDecorationAlg.CSCSDOs = ""
if not muonRecFlags.doCSCs(): topSequence.MuonTruthDecorationAlg.CSCSDOs = ""
else: PRD_TruthMaps += ["CSC_TruthMap"]
topSequence.MuonTruthDecorationAlg.PRD_TruthMaps = PRD_TruthMaps
......
......@@ -54,10 +54,10 @@ namespace Muon {
ATH_CHECK(m_mdtRotCreator.retrieve());
if (!m_cscRotCreator.empty()) {
if (!m_idHelperSvc->hasCSC())
if (!m_idHelperSvc->recoCSC())
ATH_MSG_WARNING(
"The current layout does not have any CSC chamber but you gave a CscRotCreator, ignoring it, but double-check "
"configuration");
"The current layout does not have any CSC chamber but you gave a CscRotCreator, ignoring it,"<<
" but double-check configuration");
else
ATH_CHECK(m_cscRotCreator.retrieve());
} else {
......@@ -70,11 +70,14 @@ namespace Muon {
ATH_CHECK(m_intersectSvc.retrieve());
ATH_CHECK(m_key_mdt.initialize());
ATH_CHECK(m_key_csc.initialize(!m_key_csc.empty())); // check for layouts without CSCs
/// Check that the layout has CSCs and that the key is actually set
if (!m_key_csc.empty() && m_idHelperSvc->recoCSC()){ ATH_CHECK(m_key_csc.initialize());}
ATH_CHECK(m_key_tgc.initialize());
ATH_CHECK(m_key_rpc.initialize());
ATH_CHECK(m_key_stgc.initialize(!m_key_stgc.empty())); // check for layouts without STGCs
ATH_CHECK(m_key_mm.initialize(!m_key_mm.empty())); // check for layouts without MicroMegas
/// Check that the layout has stgcs and that the key is set
if (!m_key_stgc.empty() && m_idHelperSvc->recosTgc()) {ATH_CHECK(m_key_stgc.initialize());}
/// Check that the layout has micromegas and that the key is set
if (!m_key_mm.empty() && m_idHelperSvc->recoMM()){ATH_CHECK(m_key_mm.initialize());}
ATH_CHECK(m_condKey.initialize(!m_condKey.empty()));
return StatusCode::SUCCESS;
......@@ -83,7 +86,7 @@ namespace Muon {
std::set<MuonStationIndex::ChIndex> chamberLayersOnTrack;
// loop over track and calculate residuals
const DataVector<const Trk::TrackStateOnSurface>* trkstates = track.trackStateOnSurfaces();
const Trk::TrackStates* trkstates = track.trackStateOnSurfaces();
if (!trkstates) {
ATH_MSG_DEBUG(" track without states, discarding track ");
return nullptr;
......@@ -172,7 +175,7 @@ namespace Muon {
ATH_MSG_DEBUG(" track has stations: " << stations.size() << " original states " << states.size() << " new states "
<< newStates.size());
// states were added, create a new track
auto trackStateOnSurfaces = std::make_unique<DataVector<const Trk::TrackStateOnSurface>>();
auto trackStateOnSurfaces = std::make_unique<Trk::TrackStates>();
trackStateOnSurfaces->reserve(newStates.size());
for (std::unique_ptr<const Trk::TrackStateOnSurface>& nit : newStates) { trackStateOnSurfaces->push_back(nit.release()); }
......
......@@ -75,14 +75,22 @@ namespace Muon {
}
ATH_CHECK(m_idHelperSvc.retrieve());
ATH_CHECK(m_hitSummaryTool.retrieve());
/// Old chamber technologies
ATH_CHECK(m_regsel_mdt.retrieve());
if (!m_regsel_csc.empty()) ATH_CHECK(m_regsel_csc.retrieve());
ATH_CHECK(m_regsel_rpc.retrieve());
ATH_CHECK(m_regsel_tgc.retrieve());
if (!m_regsel_stgc.empty()) ATH_CHECK(m_regsel_stgc.retrieve());
if (!m_regsel_mm.empty()) ATH_CHECK(m_regsel_mm.retrieve());
ATH_CHECK(m_trackSummaryTool.retrieve());
if (m_idHelperSvc->recoCSC()){
ATH_CHECK(m_regsel_csc.retrieve());
} else m_regsel_csc.disable();
if (m_idHelperSvc->recosTgc()){
ATH_CHECK(m_regsel_stgc.retrieve());
} else m_regsel_stgc.disable();
if (m_idHelperSvc->recoMM()){
ATH_CHECK(m_regsel_mm.retrieve());
} else {
m_regsel_mm.disable();
}
if (!m_condKey.empty()) ATH_CHECK(m_condKey.initialize());
return StatusCode::SUCCESS;
......@@ -222,7 +230,7 @@ namespace Muon {
MuonSegmentRegionRecoveryTool::MuonData& data) const {
ATH_MSG_VERBOSE(" Collecting all crossed chambers");
const DataVector<const Trk::TrackStateOnSurface>* states = track.trackStateOnSurfaces();
const Trk::TrackStates* states = track.trackStateOnSurfaces();
if (!states) {
ATH_MSG_WARNING(" track without states, cannot perform cleaning ");
return;
......@@ -231,8 +239,8 @@ namespace Muon {
std::set<MuonStationIndex::StIndex> stations;
double etamin{1e9}, etamax{-1e9}, phimin{1e9}, phimax{-1e9};
// loop over TSOSs
DataVector<const Trk::TrackStateOnSurface>::const_iterator tsit = states->begin();
DataVector<const Trk::TrackStateOnSurface>::const_iterator tsit_end = states->end();
Trk::TrackStates::const_iterator tsit = states->begin();
Trk::TrackStates::const_iterator tsit_end = states->end();
for (; tsit != tsit_end; ++tsit) {
const Trk::TrackParameters* pars = (*tsit)->trackParameters();
......@@ -290,9 +298,9 @@ namespace Muon {
if (m_idHelperSvc->hasMDT() && (m_idHelperSvc->mdtIdHelper().isInitialized())) addHashes(MDT, roi, data.mdt, data.mdtTrack);
if (m_idHelperSvc->hasRPC() && (m_idHelperSvc->rpcIdHelper().isInitialized())) addHashes(RPC, roi, data.rpc, data.rpcTrack);
if (m_idHelperSvc->hasTGC() && (m_idHelperSvc->tgcIdHelper().isInitialized())) addHashes(TGC, roi, data.tgc, data.tgcTrack);
if (m_idHelperSvc->hasCSC() && (m_idHelperSvc->cscIdHelper().isInitialized())) addHashes(CSC, roi, data.csc, data.cscTrack);
if (m_idHelperSvc->hasSTgc() && (m_idHelperSvc->stgcIdHelper().isInitialized())) addHashes(STGC, roi, data.stgc, data.stgcTrack);
if (m_idHelperSvc->hasMM() && (m_idHelperSvc->mmIdHelper().isInitialized())) addHashes(MM, roi, data.mm, data.mmTrack);
if (m_idHelperSvc->recoCSC()) addHashes(CSC, roi, data.csc, data.cscTrack);
if (m_idHelperSvc->recosTgc()) addHashes(STGC, roi, data.stgc, data.stgcTrack);
if (m_idHelperSvc->recoMM()) addHashes(MM, roi, data.mm, data.mmTrack);
std::set<IdentifierHash>::iterator hsit = data.mdt.begin();
std::set<IdentifierHash>::iterator hsit_end = data.mdt.end();
......@@ -320,7 +328,7 @@ namespace Muon {
ATH_MSG_VERBOSE(" making set of already-on-track chambers");
// Collect track PRD's
const DataVector<const Trk::TrackStateOnSurface>* states = track.trackStateOnSurfaces();