def generateMuonSensitiveDetectorList(): SensitiveDetectorList = [] from AthenaCommon.DetFlags import DetFlags if DetFlags.simulate.Muon_on(): from AthenaCommon.BeamFlags import jobproperties if jobproperties.Beam.beamType() == 'cosmics': if DetFlags.simulate.MDT_on(): SensitiveDetectorList += ['MDTSensitiveDetectorCosmics'] if DetFlags.simulate.RPC_on(): SensitiveDetectorList += ['RPCSensitiveDetectorCosmics'] if DetFlags.simulate.TGC_on(): SensitiveDetectorList += ['TGCSensitiveDetectorCosmics'] if MuonGeometryFlags.hasCSC() and DetFlags.simulate.CSC_on(): SensitiveDetectorList += ['CSCSensitiveDetectorCosmics'] else: if DetFlags.simulate.MDT_on(): SensitiveDetectorList += ['MDTSensitiveDetector'] if DetFlags.simulate.RPC_on(): SensitiveDetectorList += ['RPCSensitiveDetector'] if DetFlags.simulate.TGC_on(): SensitiveDetectorList += ['TGCSensitiveDetector'] if MuonGeometryFlags.hasCSC() and DetFlags.simulate.CSC_on(): SensitiveDetectorList += ['CSCSensitiveDetector'] if MuonGeometryFlags.hasSTGC() and DetFlags.simulate.sTGC_on(): SensitiveDetectorList += ['sTGCSensitiveDetector'] if MuonGeometryFlags.hasMM() and DetFlags.simulate.Micromegas_on(): SensitiveDetectorList += ['MicromegasSensitiveDetector'] return SensitiveDetectorList
def __init__(self, name="MuonSegmentRegionRecoveryTool", **kwargs): #MDT conditions information not available online if (athenaCommonFlags.isOnline): kwargs.setdefault("MdtCondKey", "") from RegionSelector.RegSelToolConfig import makeRegSelTool_MDT, makeRegSelTool_RPC, makeRegSelTool_TGC kwargs.setdefault("MDTRegionSelector", makeRegSelTool_MDT()) kwargs.setdefault("RPCRegionSelector", makeRegSelTool_RPC()) kwargs.setdefault("TGCRegionSelector", makeRegSelTool_TGC()) if MuonGeometryFlags.hasCSC(): from RegionSelector.RegSelToolConfig import makeRegSelTool_CSC kwargs.setdefault("CSCRegionSelector", makeRegSelTool_CSC()) else: kwargs.setdefault("CSCRegionSelector", "") if MuonGeometryFlags.hasSTGC(): from RegionSelector.RegSelToolConfig import makeRegSelTool_sTGC kwargs.setdefault("STGCRegionSelector", makeRegSelTool_sTGC()) else: kwargs.setdefault("STGCRegionSelector", "") if MuonGeometryFlags.hasMM(): from RegionSelector.RegSelToolConfig import makeRegSelTool_MM kwargs.setdefault("MMRegionSelector", makeRegSelTool_MM()) else: kwargs.setdefault("MMRegionSelector", "") self.applyUserDefaults(kwargs, name) super(MuonSegmentRegionRecoveryTool, self).__init__(name, **kwargs)
def MuonPrdCacheCfg(): # Use MuonGeometryFlags to identify which configuration is being used from AtlasGeoModel.MuonGMJobProperties import MuonGeometryFlags acc = ComponentAccumulator() MuonPRDCacheCreator = CompFactory.MuonPRDCacheCreator cacheCreator = MuonPRDCacheCreator( CscStripCacheKey=(MuonPrdCacheNames.CscStripCache if MuonGeometryFlags.hasCSC() else ""), MdtCacheKey=MuonPrdCacheNames.MdtCache, CscCacheKey=(MuonPrdCacheNames.CscCache if MuonGeometryFlags.hasCSC() else ""), RpcCacheKey=MuonPrdCacheNames.RpcCache, TgcCacheKey=MuonPrdCacheNames.TgcCache, sTgcCacheKey=(MuonPrdCacheNames.sTgcCache if MuonGeometryFlags.hasSTGC() else ""), MmCacheKey=(MuonPrdCacheNames.MmCache if MuonGeometryFlags.hasMM() else ""), TgcCoinCacheKey=MuonPrdCacheNames.TgcCoinCache, RpcCoinCacheKey=MuonPrdCacheNames.RpcCoinCache, ) acc.addEventAlgo(cacheCreator, primary=True) return acc
def MuonSeededSegmentFinder(name="MuonSeededSegmentFinder", **kwargs): if "SegmentMaker" not in kwargs or "SegmentMakerNoHoles" not in kwargs: if beamFlags.beamType() == 'collisions': segMaker = getPublicToolClone( "MCTBDCMathSegmentMaker", "DCMathSegmentMaker", MdtSegmentFinder="MCTBMdtMathSegmentFinder", SinAngleCut=0.04, DoGeometry=True) else: # cosmics or singlebeam segMaker = getPublicToolClone( "MCTBDCMathSegmentMaker", "DCMathSegmentMaker", MdtSegmentFinder="MCTBMdtMathSegmentFinder", SinAngleCut=0.1, DoGeometry=False, AddUnassociatedPhiHits=True) 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", "") return CfgMgr.Muon__MuonSeededSegmentFinder(name, **kwargs)
def MuidSegmentRegionRecoveryTool( name ='MuidSegmentRegionRecoveryTool', **kwargs ): kwargs.setdefault("Builder", getPublicTool("CombinedMuonTrackBuilderFit") ) import MuonCombinedRecExample.CombinedMuonTrackSummary from AthenaCommon.AppMgr import ToolSvc kwargs.setdefault("TrackSummaryTool", ToolSvc.CombinedMuonTrackSummary) from RegionSelector.RegSelToolConfig import makeRegSelTool_MDT, makeRegSelTool_RPC, makeRegSelTool_TGC kwargs.setdefault("MDTRegionSelector", makeRegSelTool_MDT()) kwargs.setdefault("RPCRegionSelector", makeRegSelTool_RPC()) kwargs.setdefault("TGCRegionSelector", makeRegSelTool_TGC()) if MuonGeometryFlags.hasCSC(): from RegionSelector.RegSelToolConfig import makeRegSelTool_CSC kwargs.setdefault("CSCRegionSelector", makeRegSelTool_CSC()) else: kwargs.setdefault("CSCRegionSelector", "") if MuonGeometryFlags.hasSTGC(): from RegionSelector.RegSelToolConfig import makeRegSelTool_sTGC kwargs.setdefault("STGCRegionSelector", makeRegSelTool_sTGC()) else: kwargs.setdefault("STGCRegionSelector", "") if MuonGeometryFlags.hasMM(): from RegionSelector.RegSelToolConfig import makeRegSelTool_MM kwargs.setdefault("MMRegionSelector", makeRegSelTool_MM()) else: kwargs.setdefault("MMRegionSelector", "") return CfgMgr.Muon__MuonSegmentRegionRecoveryTool(name,**kwargs)
def MuonChamberHoleRecoveryTool(name="MuonChamberHoleRecoveryTool", extraFlags=None, **kwargs): doSegmentT0Fit = getattr(extraFlags, "doSegmentT0Fit", muonRecFlags.doSegmentT0Fit()) kwargs.setdefault("Extrapolator", "MuonExtrapolator") if doSegmentT0Fit: kwargs.setdefault("AddMeasurements", False) if muonRecFlags.doCSCs(): if muonRecFlags.enableErrorTuning() or globalflags.DataSource( ) == 'data': kwargs.setdefault("CscRotCreator", "CscBroadClusterOnTrackCreator") else: kwargs.setdefault("CscRotCreator", "CscClusterOnTrackCreator") else: # no CSCs # switch off whatever is set kwargs["CscRotCreator"] = "" kwargs["CscPrepDataContainer"] = "" # 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", "") #MDT conditions information not available online if (athenaCommonFlags.isOnline): kwargs.setdefault("MdtCondKey", "") return CfgMgr.Muon__MuonChamberHoleRecoveryTool(name, **kwargs)
def makeRegSelTool_MM(): from AtlasGeoModel.MuonGMJobProperties import MuonGeometryFlags from AthenaCommon.DetFlags import DetFlags enabled = False if MuonGeometryFlags.hasMM(): enabled = DetFlags.detdescr.Micromegas_on() from MuonRegionSelector.MuonRegionSelectorConf import MM_RegSelCondAlg return _makeRegSelTool("MM", enabled, MM_RegSelCondAlg)
def MuonStauSeededSegmentFinder( name="MuonStauSeededSegmentFinder", **kwargs ): kwargs.setdefault("MdtRotCreator", getPublicTool("MdtDriftCircleOnTrackCreatorStau") ) kwargs.setdefault("SegmentMaker", getPublicTool("DCMathStauSegmentMaker") ) kwargs.setdefault("SegmentMakerNoHoles", getPublicTool("DCMathStauSegmentMaker") ) if not MuonGeometryFlags.hasCSC(): kwargs.setdefault("CscPrepDataContainer","") if not MuonGeometryFlags.hasSTGC(): kwargs.setdefault("sTgcPrepDataContainer","") if not MuonGeometryFlags.hasMM(): kwargs.setdefault("MMPrepDataContainer","") return MuonSeededSegmentFinder(name,**kwargs)
def MuGirlStauAlg(name="MuGirlStauAlg", **kwargs): tools = [getPublicTool("MuonStauRecoTool")] kwargs.setdefault("MuonCombinedInDetExtensionTools", tools) kwargs.setdefault("TagMap", "stauTagMap") kwargs.setdefault("HasCSC", MuonGeometryFlags.hasCSC()) kwargs.setdefault("HasSTgc", MuonGeometryFlags.hasSTGC()) kwargs.setdefault("HasMM", MuonGeometryFlags.hasMM()) kwargs.setdefault("CombinedTrackCollection", "MuGirlStauCombinedTracks") kwargs.setdefault("METrackCollection", "") kwargs.setdefault("SegmentCollection", "MuGirlStauSegments") return CfgMgr.MuonCombinedInDetExtensionAlg(name, **kwargs)
def MuonCombinedInDetExtensionAlg(name="MuonCombinedInDetExtensionAlg", **kwargs): tools = [] if muonCombinedRecFlags.doCaloTrkMuId(): tools.append(getTool("MuonCaloTagTool")) kwargs.setdefault("TagMap", "caloTagMap") kwargs.setdefault("MuonCombinedInDetExtensionTools", tools) kwargs.setdefault("HasCSC", MuonGeometryFlags.hasCSC()) kwargs.setdefault("HasSTgc", MuonGeometryFlags.hasSTGC()) kwargs.setdefault("HasMM", MuonGeometryFlags.hasMM()) return CfgMgr.MuonCombinedInDetExtensionAlg(name, **kwargs)
def TMEF_MuonLayerSegmentFinderTool(name="TMEF_MuonLayerSegmentFinderTool", **kwargs): kwargs.setdefault('MuonRecoValidationTool', '') kwargs.setdefault('MuonPRDSelectionTool', 'TMEF_MuonPRDSelectionTool') kwargs.setdefault('MuonClusterSegmentFinder', 'TMEF_MuonClusterSegmentFinder') if not MuonGeometryFlags.hasCSC(): kwargs.setdefault('Csc2DSegmentMaker', '') kwargs.setdefault('Csc4DSegmentMaker', '') if (MuonGeometryFlags.hasSTGC() and MuonGeometryFlags.hasMM()): kwargs.setdefault('NSWMuonClusterSegmentFinderTool', 'TMEF_MuonClusterSegmentFinderTool') return CfgMgr.Muon__MuonLayerSegmentFinderTool(name, **kwargs)
def MuonInsideOutRecoAlg(name="MuonInsideOutRecoAlg", **kwargs): tools = [getPublicTool("MuonInsideOutRecoTool")] from MuonLayerSegmentMakerTools.MuonLayerSegmentMakerToolsConf import Muon__MuonLayerSegmentFinderTool from AthenaCommon.AppMgr import ToolSvc MuonLayerSegmentFinderTool = Muon__MuonLayerSegmentFinderTool( "MuonLayerSegmentFinderTool", Csc2DSegmentMaker=(getPublicTool("Csc2dSegmentMaker") if MuonGeometryFlags.hasCSC() else ""), Csc4DSegmentMaker=(getPublicTool("Csc4dSegmentMaker") if MuonGeometryFlags.hasCSC() else "")) ToolSvc += MuonLayerSegmentFinderTool tools[0].MuonLayerSegmentFinderTool = MuonLayerSegmentFinderTool kwargs.setdefault("MuonCombinedInDetExtensionTools", tools) kwargs.setdefault("usePRDs", True) kwargs.setdefault("HasCSC", MuonGeometryFlags.hasCSC()) kwargs.setdefault("HasSTgc", MuonGeometryFlags.hasSTGC()) kwargs.setdefault("HasMM", MuonGeometryFlags.hasMM()) kwargs.setdefault("TagMap", "muGirlTagMap") return CfgMgr.MuonCombinedInDetExtensionAlg(name, **kwargs)
include.block("MuonByteStreamCnvTest/jobOptions_MuonRDOToDigit.py") from AthenaCommon.CfgGetter import getPublicTool from AtlasGeoModel.MuonGMJobProperties import MuonGeometryFlags ## configure the tool from MuonByteStreamCnvTest.MuonByteStreamCnvTestConf import MuonRdoToMuonDigitTool MuonRdoToMuonDigitTool = MuonRdoToMuonDigitTool( DecodeMdtRDO=True, DecodeRpcRDO=True, DecodeTgcRDO=True, DecodeCscRDO=MuonGeometryFlags.hasCSC(), DecodeSTGC_RDO=MuonGeometryFlags.hasSTGC(), DecodeMM_RDO=MuonGeometryFlags.hasMM(), cscRdoDecoderTool=("Muon::CscRDO_Decoder" if MuonGeometryFlags.hasCSC() else ""), stgcRdoDecoderTool=("Muon::STGC_RDO_Decoder" if MuonGeometryFlags.hasSTGC() else ""), mmRdoDecoderTool=("Muon::MM_RDO_Decoder" if MuonGeometryFlags.hasMM() else "")) if MuonGeometryFlags.hasCSC(): MuonRdoToMuonDigitTool.cscCalibTool = getPublicTool("CscCalibTool") ToolSvc += MuonRdoToMuonDigitTool ## configure the algorithm from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence()
##job.G4TestAlg.SimTestTools += [CfgGetter.getPrivateTool("TileDeadMaterialCaloCalibHitsTestTool", checkType=True)] if DetFlags.Muon_on(): job.G4TestAlg.SimTestTools += [ CfgGetter.getPrivateTool("MDTHitsTestTool", checkType=True) ] job.G4TestAlg.SimTestTools += [ CfgGetter.getPrivateTool("RPCHitsTestTool", checkType=True) ] job.G4TestAlg.SimTestTools += [ CfgGetter.getPrivateTool("TGCHitsTestTool", checkType=True) ] if MuonGeometryFlags.hasCSC(): job.G4TestAlg.SimTestTools += [ CfgGetter.getPrivateTool("CSCHitsTestTool", checkType=True) ] if MuonGeometryFlags.hasMM(): job.G4TestAlg.SimTestTools += [ CfgGetter.getPrivateTool("MMHitsTestTool", checkType=True) ] if MuonGeometryFlags.hasSTGC(): job.G4TestAlg.SimTestTools += [ CfgGetter.getPrivateTool("sTGCHitsTestTool", checkType=True) ] if DetFlags.Truth_on(): job.G4TestAlg.SimTestTools += [ CfgGetter.getPrivateTool("MuonEntryLayerTestTool", checkType=True) ] job.G4TestAlg.SimTestTools += [ CfgGetter.getPrivateTool("MuonExitLayerTestTool", checkType=True) ] if DetFlags.Lucid_on():
def _do_jobproperties(self): """ Place to handle JobProperties. """ ## Import extra flags if it hasn't already been done from G4AtlasApps.SimFlags import simFlags if "atlas_flags" not in simFlags.extra_flags: simFlags.load_atlas_flags() if jobproperties.Beam.beamType( ) == "cosmics" and "cosmics_flags" not in simFlags.extra_flags: simFlags.load_cosmics_flags() AtlasG4Eng.G4Eng.log.verbose( 'AtlasSimSkeleton._do_jobproperties :: starting') ## Tidy up DBM DetFlags: temporary measure DetFlags.DBM_setOff() from AtlasGeoModel.MuonGMJobProperties import MuonGeometryFlags if not MuonGeometryFlags.hasCSC(): DetFlags.CSC_setOff() if not MuonGeometryFlags.hasSTGC(): DetFlags.sTGC_setOff() if not MuonGeometryFlags.hasMM(): DetFlags.Micromegas_setOff() ## Switch off tasks DetFlags.pileup.all_setOff() DetFlags.simulateLVL1.all_setOff() DetFlags.digitize.all_setOff() if not simFlags.IsEventOverlayInputSim(): DetFlags.overlay.all_setOff() DetFlags.readRDOPool.all_setOff() DetFlags.makeRIO.all_setOff() DetFlags.writeBS.all_setOff() DetFlags.readRDOBS.all_setOff() DetFlags.readRIOBS.all_setOff() DetFlags.readRIOPool.all_setOff() DetFlags.writeRIOPool.all_setOff() DetFlags.writeRDOPool.all_setOff() ## Global flags needed by externals from AthenaCommon.GlobalFlags import globalflags globalflags.DataSource = 'geant4' if jobproperties.Beam.beamType() == 'cosmics': globalflags.DetGeo = 'commis' else: globalflags.DetGeo = 'atlas' ## At this point we can set the global job properties flag globalflags.DetDescrVersion = simFlags.SimLayout.get_Value() # Switch off GeoModel Release in the case of parameterization if simFlags.LArParameterization.get_Value( ) > 0 and simFlags.ReleaseGeoModel(): AtlasG4Eng.G4Eng.log.info( 'AtlasSimSkeleton._do_jobproperties :: Running parameterization - switching off GeoModel release!' ) simFlags.ReleaseGeoModel = False ## Translate conditions tag into IOVDbSvc global tag: must be done before job properties are locked!!! from AthenaCommon.AppMgr import ServiceMgr from IOVDbSvc.IOVDbSvcConf import IOVDbSvc ServiceMgr += IOVDbSvc() if not hasattr( globalflags, "ConditionsTag") or not globalflags.ConditionsTag.get_Value(): msg = "AtlasSimSkeleton._do_jobproperties :: conditions tag has not been set and is no longer guessed by SimAtlasKernel. " msg += "You must set the globaltags.ConditionsTag flag in your job options." AtlasG4Eng.G4Eng.log.error(msg) raise SystemExit( "AtlasSimSkeleton._do_jobproperties :: Global ConditionsTag not set" ) if not hasattr(ServiceMgr.IOVDbSvc, 'GlobalTag') or not ServiceMgr.IOVDbSvc.GlobalTag: ServiceMgr.IOVDbSvc.GlobalTag = globalflags.ConditionsTag.get_Value( ) ## Enable floating point exception handling ## FIXME! This seems to cause the jobs to crash in the FpeControlSvc, so commenting this out for now... #from AthenaCommon.AthenaCommonFlags import athenaCommonFlags #athenaCommonFlags.RuntimeStrictness = 'abort' #AtlasG4Eng.G4Eng.log.debug('AtlasSimSkeleton._do_jobproperties :: Enabled floating point exceptions') if not simFlags.ISFRun: from G4AtlasApps.G4Atlas_Metadata import checkForSpecialConfigurationMetadata checkForSpecialConfigurationMetadata() ## Print flags if AtlasG4Eng.G4Eng.log.getEffectiveLevel() < 40: AtlasG4Eng.G4Eng.log.info( 'AtlasSimSkeleton._do_jobproperties :: printing detector flags DetFlags' ) DetFlags.Print() AtlasG4Eng.G4Eng.log.info( 'AtlasSimSkeleton._do_jobproperties :: printing simulation flags simFlags' ) jobproperties.print_JobProperties('tree&value') # Lock the job properties if not running ISF. if not simFlags.ISFRun: jobproperties.lock_JobProperties() AtlasG4Eng.G4Eng.log.verbose( 'AtlasSimSkeleton._do_jobproperties :: done')
def _do_external(self): """Place to handle the external services: GeoModel, IOVDb, frozen showers, etc """ AtlasG4Eng.G4Eng.log.verbose( 'AtlasSimSkeleton._do_external :: starting') from AthenaCommon.AppMgr import ToolSvc, ServiceMgr from Geo2G4.Geo2G4Conf import Geo2G4Svc geo2G4Svc = Geo2G4Svc() theApp.CreateSvc += ["Geo2G4Svc"] ServiceMgr += geo2G4Svc ## Enable top transforms for the ATLAS geometry geo2G4Svc.GetTopTransform = True ## Configure access to the BeamCondSvc if necessary. Assuming ## it should be on always as BeamEffectTransformation is ## currently always switched on, else something like this will ## be required here. from G4AtlasApps.SimFlags import simFlags include("InDetBeamSpotService/BeamCondSvc.py") ## GeoModel stuff ## TODO: Tidy imports etc. from GeoModelSvc.GeoModelSvcConf import GeoModelSvc from AthenaCommon.GlobalFlags import jobproperties from AtlasGeoModel import SetGeometryVersion ## Forward Region Twiss files - needed before geometry setup! if simFlags.ForwardDetectors.statusOn: if DetFlags.geometry.FwdRegion_on(): from AthenaCommon.CfgGetter import getPublicTool from AthenaCommon.AppMgr import ToolSvc ToolSvc += getPublicTool("ForwardRegionProperties") from AtlasGeoModel import GeoModelInit from AtlasGeoModel import SimEnvelopes from GeoModelSvc.GeoModelSvcConf import GeoModelSvc gms = GeoModelSvc() ## Cosmics GeoModel tweaks if jobproperties.Beam.beamType() == 'cosmics' or \ (simFlags.CavernBG.statusOn and not 'Signal' in simFlags.CavernBG.get_Value() ): from CavernInfraGeoModel.CavernInfraGeoModelConf import CavernInfraDetectorTool gms.DetectorTools += [CavernInfraDetectorTool()] ## Protects GeoModelSvc in the simulation from the AlignCallbacks gms.AlignCallbacks = False ## Muon GeoModel tweaks if DetFlags.Muon_on(): ## Turn off caching in the muon system from MuonGeoModel.MuonGeoModelConf import MuonDetectorTool MuonDetectorTool = MuonDetectorTool() MuonDetectorTool.FillCacheInitTime = 0 # default is 1 ## Additional material in the muon system from AGDD2GeoSvc.AGDD2GeoSvcConf import AGDDtoGeoSvc AGDD2Geo = AGDDtoGeoSvc() from AthenaCommon import CfgGetter if not "MuonAGDDTool/MuonSpectrometer" in AGDD2Geo.Builders: ToolSvc += CfgGetter.getPublicTool("MuonSpectrometer", checkType=True) AGDD2Geo.Builders += ["MuonAGDDTool/MuonSpectrometer"] from AtlasGeoModel.MuonGMJobProperties import MuonGeometryFlags if (MuonGeometryFlags.hasSTGC() and MuonGeometryFlags.hasMM()): if not "NSWAGDDTool/NewSmallWheel" in AGDD2Geo.Builders: ToolSvc += CfgGetter.getPublicTool("NewSmallWheel", checkType=True) AGDD2Geo.Builders += ["NSWAGDDTool/NewSmallWheel"] theApp.CreateSvc += ["AGDDtoGeoSvc"] ServiceMgr += AGDD2Geo ## Add configured GeoModelSvc to service manager ServiceMgr += gms ## Run the geometry envelope setup earlier than GeoSD self._do_GeoEnv() #TODO remove AtlasG4Eng.G4Eng.log.verbose('AtlasSimSkeleton._do_external :: done')
"MuonSTEP_Propagator") addTool("MuonRecExample.MuonRecTools.MuonSTEP_Propagator", "MuonPropagator") addTool("MuonRecExample.MuonRecTools.MuonSTEP_Propagator", "MCTBPropagator") addTool("Trk::STEP_Propagator", "MuonStraightLinePropagator") addTool("MuonRecExample.MuonRecTools.MuonExtrapolator", "MuonExtrapolator") addTool("MuonRecExample.MuonRecTools.MuonStraightLineExtrapolator", "MuonStraightLineExtrapolator") addTool("Trk::KalmanUpdator", "MuonMeasUpdator") addService("Muon::MuonIdHelperSvc", "MuonIdHelperSvc", HasCSC=MuonGeometryFlags.hasCSC(), HasSTgc=MuonGeometryFlags.hasSTGC(), HasMM=MuonGeometryFlags.hasMM()) addTool("Muon::MuonTrackTruthTool", "MuonTrackTruthTool") addTool("MuonRecExample.MooreTools.MuonTrackToSegmentTool", "MuonTrackToSegmentTool") addService("MuonRecExample.MuonRecTools.MuonEDMHelperSvc", "MuonEDMHelperSvc") addTool("MuonRecExample.MuonRecTools.MuonEDMPrinterTool", "MuonEDMPrinterTool") addTool("MuonRecExample.MuonRecTools.MuonKalmanTrackFitter", "MuonKalmanTrackFitter") addTool("MuonRecExample.MuonRecTools.MuonTrackSummaryHelperTool", "MuonTrackSummaryHelperTool")
globalflags.DataSource = 'geant4' if jobproperties.Beam.beamType() == 'cosmics': globalflags.DetGeo = 'commis' else: globalflags.DetGeo = 'atlas' ## At this point we can set the global job properties flag globalflags.DetDescrVersion = simFlags.SimLayout.get_Value() from AthenaCommon.DetFlags import DetFlags ## Tidy up DBM DetFlags: temporary measure DetFlags.DBM_setOff() from AtlasGeoModel.MuonGMJobProperties import MuonGeometryFlags if not MuonGeometryFlags.hasSTGC(): DetFlags.sTGC_setOff() if not MuonGeometryFlags.hasMM(): DetFlags.Micromegas_setOff() if not MuonGeometryFlags.hasCSC(): DetFlags.CSC_setOff() ## Switch off tasks DetFlags.pileup.all_setOff() DetFlags.simulateLVL1.all_setOff() DetFlags.digitize.all_setOff() if not simFlags.IsEventOverlayInputSim(): DetFlags.overlay.all_setOff() DetFlags.readRDOPool.all_setOff() DetFlags.makeRIO.all_setOff() DetFlags.writeBS.all_setOff() DetFlags.readRDOBS.all_setOff() DetFlags.readRIOBS.all_setOff() DetFlags.readRIOPool.all_setOff() DetFlags.writeRIOPool.all_setOff()
DetFlags.LVL1_setOff() else: DetFlags.LVL1_setOn() DetFlags.BCM_setOn() DetFlags.Lucid_setOn() DetFlags.simulateLVL1.Lucid_setOff() #DetFlags.simulateLVL1.LAr_setOn() #DetFlags.simulateLVL1.Tile_setOn() #DetFlags.overlay.LAr_setOff() DetFlags.overlay.Truth_setOn() if not MuonGeometryFlags.hasCSC(): DetFlags.CSC_setOff() if not MuonGeometryFlags.hasSTGC(): DetFlags.sTGC_setOff() if not MuonGeometryFlags.hasMM(): DetFlags.Micromegas_setOff() # TODO: need to do it better # DetFlags.makeRIO.all_setOff() # needed for MT TRT conditions DetFlags.pileup.all_setOff() # DetFlags.readRDOBS.all_setOff() ## Needed for BS converters DetFlags.readRDOPool.all_setOff() DetFlags.readRIOBS.all_setOff() DetFlags.readRIOPool.all_setOff() DetFlags.simulate.all_setOff() DetFlags.writeBS.all_setOff() DetFlags.writeRIOPool.all_setOff() DetFlags.Print() include ( "RecExCond/AllDet_detDescr.py" )
def MuonIdHelperSvc(name="MuonIdHelperSvc", **kwargs): from MuonIdHelpers.MuonIdHelpersConf import Muon__MuonIdHelperSvc kwargs.setdefault("HasCSC", MuonGeometryFlags.hasCSC()) kwargs.setdefault("HasSTgc", MuonGeometryFlags.hasSTGC()) kwargs.setdefault("HasMM", MuonGeometryFlags.hasMM()) return Muon__MuonIdHelperSvc(name, **kwargs)
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration from AthenaCommon.DetFlags import DetFlags from AtlasGeoModel.MuonGMJobProperties import MuonGeometryFlags if (DetFlags.detdescr.Muon_on()): from AthenaCommon import CfgGetter from AthenaCommon.AppMgr import ToolSvc, ServiceMgr, theApp from AGDD2GeoSvc.AGDD2GeoSvcConf import AGDDtoGeoSvc AGDD2Geo = AGDDtoGeoSvc() if not "MuonAGDDTool/MuonSpectrometer" in AGDD2Geo.Builders.__str__(): AGDD2Geo.Builders += [ CfgGetter.getPrivateTool("MuonSpectrometer", checkType=True) ] if (MuonGeometryFlags.hasSTGC() and MuonGeometryFlags.hasMM()): if not "NSWAGDDTool/NewSmallWheel" in AGDD2Geo.Builders.__str__(): AGDD2Geo.Builders += [ CfgGetter.getPrivateTool("NewSmallWheel", checkType=True) ] theApp.CreateSvc += ["AGDDtoGeoSvc"] ServiceMgr += AGDD2Geo
def hits_persistency(): """ HITS POOL file persistency """ from G4AtlasApps.SimFlags import simFlags from AthenaCommon.DetFlags import DetFlags from AthenaCommon.AthenaCommonFlags import athenaCommonFlags from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream ## Not yet understood, but need to treat StreamHITS as alg in Hive. ## Seems to also work fine outside of Hive, but to be extra safe I'm ## only changing it in Hive. from AthenaCommon.ConcurrencyFlags import jobproperties as concurrencyProps if concurrencyProps.ConcurrencyFlags.NumThreads() > 0: as_alg = True else: as_alg = False ## NB. Two-arg constructor is needed, since otherwise metadata writing fails! stream1 = AthenaPoolOutputStream("StreamHITS", athenaCommonFlags.PoolHitsOutput(), asAlg=as_alg, noTag=True) ## Write geometry tag info - move to main method #import EventInfoMgt.EventInfoMgtInit ## EventInfo & TruthEvent always written by default stream1.ItemList = [ "EventInfo#*", "McEventCollection#TruthEvent", "JetCollection#*" ] ## If we are running quasi-stable particle simulation, include the original event record if hasattr( simFlags, 'IncludeParentsInG4Event' ) and simFlags.IncludeParentsInG4Event.statusOn and simFlags.IncludeParentsInG4Event( ): stream1.ItemList += ["McEventCollection#GEN_EVENT"] stream1.ItemList += ["xAOD::JetContainer#*", "xAOD::JetAuxContainer#*"] ## Make stream aware of aborted events stream1.AcceptAlgs = ["G4AtlasAlg"] ## Detectors ## Inner Detector if DetFlags.ID_on(): stream1.ItemList += [ "SiHitCollection#*", "TRTUncompressedHitCollection#*", "TrackRecordCollection#CaloEntryLayer" ] ## Calo if DetFlags.Calo_on(): stream1.ItemList += [ "CaloCalibrationHitContainer#*", "LArHitContainer#*", "TileHitVector#*", #"SimpleScintillatorHitCollection#*", "TrackRecordCollection#MuonEntryLayer" ] ## Muon if DetFlags.Muon_on(): stream1.ItemList += [ "RPCSimHitCollection#*", "TGCSimHitCollection#*", "MDTSimHitCollection#*", "TrackRecordCollection#MuonExitLayer" ] if MuonGeometryFlags.hasCSC(): stream1.ItemList += ["CSCSimHitCollection#*"] if MuonGeometryFlags.hasSTGC(): stream1.ItemList += ["sTGCSimHitCollection#*"] if MuonGeometryFlags.hasMM(): stream1.ItemList += ["MMSimHitCollection#*"] ## Lucid if DetFlags.Lucid_on(): stream1.ItemList += ["LUCID_SimHitCollection#*"] ## FwdRegion if DetFlags.FwdRegion_on(): stream1.ItemList += ["SimulationHitCollection#*"] ## ZDC if DetFlags.ZDC_on(): stream1.ItemList += [ "ZDC_SimPixelHit_Collection#*", "ZDC_SimStripHit_Collection#*" ] ## ALFA if DetFlags.ALFA_on(): stream1.ItemList += [ "ALFA_HitCollection#*", "ALFA_ODHitCollection#*" ] ## AFP if DetFlags.AFP_on(): stream1.ItemList += [ "AFP_TDSimHitCollection#*", "AFP_SIDSimHitCollection#*" ] ### Ancillary scintillators #stream1.ItemList += ["ScintillatorHitCollection#*"] ## TimingAlg stream1.ItemList += ["RecoTimingObj#EVNTtoHITS_timings"] ## Add cosmics and test beam configuration hit persistency if required cf. geom tag layout = simFlags.SimLayout.get_Value() if "tb" not in layout: from AthenaCommon.BeamFlags import jobproperties if jobproperties.Beam.beamType() == 'cosmics' or \ (hasattr(simFlags, "WriteTR") and simFlags.WriteTR.statusOn) or \ (hasattr(simFlags, "ReadTR") and simFlags.ReadTR.statusOn): stream1.ItemList += [ "TrackRecordCollection#CosmicRecord", "TrackRecordCollection#CosmicPerigee" ] else: ## CTB-specific if layout.startswith("ctb"): if simFlags.LArFarUpstreamMaterial.statusOn and simFlags.LArFarUpstreamMaterial.get_Value( ): stream1.ItemList.append( "TrackRecordCollection#LArFarUpstreamMaterialExitLayer" ) ## Persistency of test-beam layout if layout.startswith('ctb') or layout.startswith('tb_Tile2000_'): stream1.ItemList += ["TBElementContainer#*"]
# # Joboptions for bootstrapping the loading of the DetectorStore with # the DetDescrCnvSvc # # DLLs theApp.Dlls += ["DetDescrCnvSvc"] # Must create the service theApp.CreateSvc += ["DetDescrCnvSvc"] # Set DetDescrCnvSvc to be a proxy/address provider #ProxyProviderSvc.ProviderNames += { "DetDescrCnvSvc" }; EventPersistencySvc = Service("EventPersistencySvc") EventPersistencySvc.CnvServices += ["DetDescrCnvSvc"] # Specify primary Identifier dictionary to be used DetDescrCnvSvc = Service("DetDescrCnvSvc") DetDescrCnvSvc.IdDictName = "IdDictParser/ATLAS_IDS.xml" # Specify whether CSC/sTgc/MM muon chambers are part of the detector from AtlasGeoModel.MuonGMJobProperties import MuonGeometryFlags DetDescrCnvSvc.HasCSC = MuonGeometryFlags.hasCSC() DetDescrCnvSvc.HasSTgc = MuonGeometryFlags.hasSTGC() DetDescrCnvSvc.HasMM = MuonGeometryFlags.hasMM() # Specify the tag to be used # DetDescrCnvSvc.IdDictGlobalTag = "initial_layout" # Always include the IdDict jobOptions include("IdDictDetDescrCnv/IdDictDetDescrCnv_joboptions.py")
else: from OverlayConfiguration.OverlayHelpersLegacy import setupOverlayLegacyDetectorFlags DetFlags = setupOverlayLegacyDetectorFlags(overlayDetectors) if hasattr(overlayArgs, 'triggerConfig') and overlayArgs.triggerConfig == 'NONE': DetFlags.LVL1_setOff() DetFlags.digitize.LVL1_setOff() from AtlasGeoModel.MuonGMJobProperties import MuonGeometryFlags if not MuonGeometryFlags.hasCSC(): DetFlags.CSC_setOff() if not MuonGeometryFlags.hasSTGC(): DetFlags.sTGC_setOff() if not MuonGeometryFlags.hasMM(): DetFlags.Micromegas_setOff() # TODO: need to do it better # DetFlags.makeRIO.all_setOff() # needed for MT TRT conditions DetFlags.pileup.all_setOff() if not overlayFlags.isDataOverlay(): DetFlags.readRDOBS.all_setOff() DetFlags.readRIOBS.all_setOff() DetFlags.readRIOPool.all_setOff() DetFlags.readRDOPool.all_setOff() DetFlags.simulate.all_setOff() DetFlags.writeBS.all_setOff() DetFlags.writeRIOPool.all_setOff() DetFlags.Print()
def configure(self,keys=None): super(MuonStandalone,self).configure(keys) if not self.isEnabled(): return from AthenaCommon.BeamFlags import jobproperties beamFlags = jobproperties.Beam SegmentLocation = "MuonSegments" if muonStandaloneFlags.segmentOrigin == 'TruthTracking': SegmentLocation = "ThirdChainSegments" # do the following in case of (at least one) NSW if (MuonGeometryFlags.hasSTGC() and MuonGeometryFlags.hasMM()): 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 "") ) ) if not muonStandaloneFlags.patternsOnly(): SegmentFinder = getPublicTool("MuonClusterSegmentFinderTool") Cleaner = getPublicToolClone("MuonTrackCleaner_seg","MuonTrackCleaner") Cleaner.Extrapolator = getPublicTool("MuonStraightLineExtrapolator") Cleaner.Fitter = getPublicTool("MCTBSLFitterMaterialFromTrack") Cleaner.PullCut = 3 Cleaner.PullCutPhi = 3 Cleaner.UseSLFit = True SegmentFinder.TrackCleaner = Cleaner # for test purposes allow parallel running of truth segment finding and new segment finder MuonSegmentFinderAlg = CfgMgr.MuonSegmentFinderAlg( "MuonSegmentMaker",SegmentCollectionName=SegmentLocation, MuonPatternCalibration = getPublicTool("MuonPatternCalibration"), MuonPatternSegmentMaker = getPublicTool("MuonPatternSegmentMaker"), MuonTruthSummaryTool = None, 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(): getPublicTool("CscSegmentUtilTool") getPublicTool("Csc2dSegmentMaker") getPublicTool("Csc4dSegmentMaker") else: MuonSegmentFinderAlg.Csc2dSegmentMaker = "" MuonSegmentFinderAlg.Csc4dSegmentMaker = "" self.addAlg( MuonSegmentFinderAlg ) else: getPublicTool("MuonLayerHoughTool") self.addAlg(MooSegmentFinderAlg("MuonSegmentMaker")) self.addAlg(MooSegmentFinderNCBAlg("MuonSegmentMaker_NCB")) if (not cfgKeyStore.isInInput ('xAOD::MuonSegmentContainer', 'MuonSegments_NCB')): self.addAlg( CfgMgr.xAODMaker__MuonSegmentCnvAlg("MuonSegmentCnvAlg_NCB",SegmentContainerName="NCB_MuonSegments",xAODContainerName="NCB_MuonSegments") ) if (not cfgKeyStore.isInInput ('xAOD::MuonSegmentContainer', 'MuonSegments')): self.addAlg( CfgMgr.xAODMaker__MuonSegmentCnvAlg("MuonSegmentCnvAlg") ) if muonStandaloneFlags.doSegmentsOnly(): return # Tracks builder # # add the algorithm (which uses the MuonTrackSteering) # TrackBuilder = CfgMgr.MuPatTrackBuilder("MuPatTrackBuilder", TrackSteering = getPublicTool("MuonTrackSteering") ) self.addAlg( TrackBuilder ) self.registerOutputKey("MuonSpectrometerTracks", self.MuPatTrackBuilder, "SpectrometerTrackOutputLocation") self.registerInputKey ("MuonSegments", self.MuPatTrackBuilder, "MuonSegmentCollection" ) if muonStandaloneFlags.createTrackParticles(): xAODTrackParticleCnvAlg = MuonStandaloneTrackParticleCnvAlg("MuonStandaloneTrackParticleCnvAlg") self.addAlg( xAODTrackParticleCnvAlg )
DetFlags.Tile_setOn() DetFlags.BCM_setOn() DetFlags.Lucid_setOn() DetFlags.Truth_setOn() if hasattr(runArgs, "triggerConfig") and runArgs.triggerConfig == "NONE": DetFlags.LVL1_setOff() else: DetFlags.LVL1_setOn() DetFlags.digitize.LVL1_setOff() from AtlasGeoModel.MuonGMJobProperties import MuonGeometryFlags if not MuonGeometryFlags.hasCSC(): DetFlags.CSC_setOff() if not MuonGeometryFlags.hasSTGC(): DetFlags.sTGC_setOff() if not MuonGeometryFlags.hasMM(): DetFlags.Micromegas_setOff() DetFlags.pileup.all_setOff() DetFlags.readRDOBS.all_setOff() DetFlags.readRDOPool.all_setOff() DetFlags.readRIOBS.all_setOff() DetFlags.readRIOPool.all_setOff() DetFlags.simulate.all_setOff() DetFlags.writeBS.all_setOff() DetFlags.writeRIOPool.all_setOff() DetFlags.Print() globalflags.DataSource.set_Value_and_Lock('geant4') #--------------------------------------------------------------
#-------------------------------------------------------------------------- # Do track truth #-------------------------------------------------------------------------- if rec.doTruth() and muonCombinedRecFlags.doxAOD() and rec.doMuonCombined(): from MuonTruthAlgs.MuonTruthAlgsConf import MuonDetailedTrackTruthMaker from TrkTruthAlgs.TrkTruthAlgsConf import TrackTruthSelector colsTP = [ "ExtrapolatedMuonTrackParticles", "CombinedMuonTrackParticles", "MSOnlyExtrapolatedMuonTrackParticles" ] cols = [ "ExtrapolatedMuonTracks", "CombinedMuonTracks", "MSOnlyExtrapolatedTracks" ] topSequence+= MuonDetailedTrackTruthMaker("MuonCombinedDetailedTrackTruthMaker") topSequence.MuonCombinedDetailedTrackTruthMaker.TrackCollectionNames = cols from AtlasGeoModel.MuonGMJobProperties import MuonGeometryFlags topSequence.MuonCombinedDetailedTrackTruthMaker.HasCSC = MuonGeometryFlags.hasCSC() topSequence.MuonCombinedDetailedTrackTruthMaker.HasSTgc = MuonGeometryFlags.hasSTGC() topSequence.MuonCombinedDetailedTrackTruthMaker.HasMM = MuonGeometryFlags.hasMM() from TrkTruthAlgs.TrkTruthAlgsConf import TrackParticleTruthAlg for i in range(0, len(cols)): topSequence += TrackTruthSelector(name= cols[i] + "Selector", DetailedTrackTruthName = cols[i] + "DetailedTruth", OutputName = cols[i] + "Truth" ) topSequence += TrackParticleTruthAlg(name = cols[i]+"TruthAlg", TrackTruthName=cols[i]+"Truth", TrackParticleName = colsTP[i] ) from MuonTruthAlgs.MuonTruthAlgsConf import MuonTruthAssociationAlg topSequence += MuonTruthAssociationAlg("MuonTruthAssociationAlg") try: from PyUtils.MetaReaderPeeker import metadata
#### TGC #### if DetFlags.detdescr.TGC_on(): from MuonRegionSelector.MuonRegionSelectorConf import TGC_RegionSelectorTable TGC_RegionSelectorTable = TGC_RegionSelectorTable( name="TGC_RegionSelectorTable") ToolSvc += TGC_RegionSelectorTable print TGC_RegionSelectorTable else: TGC_RegionSelectorTable = None #### New small wheel #### # could avoid first check in case DetFlags.detdescr.Micromegas_on() would take into account MuonGeometryFlags already if MuonGeometryFlags.hasMM() and DetFlags.detdescr.Micromegas_on(): from MuonRegionSelector.MuonRegionSelectorConf import MM_RegionSelectorTable MM_RegionSelectorTable = MM_RegionSelectorTable( name="MM_RegionSelectorTable") ToolSvc += MM_RegionSelectorTable print MM_RegionSelectorTable else: MM_RegionSelectorTable = None # could avoid first check in case DetFlags.detdescr.sTGC_on() would take into account MuonGeometryFlags already if MuonGeometryFlags.hasSTGC() and DetFlags.detdescr.sTGC_on(): from MuonRegionSelector.MuonRegionSelectorConf import sTGC_RegionSelectorTable sTGC_RegionSelectorTable = sTGC_RegionSelectorTable( name="sTGC_RegionSelectorTable")
DecodeBS=DetFlags.readRDOBS.MDT_on()) theDataPreparator.TGCDataPreparator = MuonSA.TrigL2MuonSA__TgcDataPreparator( DecodeBS=DetFlags.readRDOBS.TGC_on()) theDataPreparator.CSCDataPreparator = MuonSA.TrigL2MuonSA__CscDataPreparator( DecodeBS=DetFlags.readRDOBS.CSC_on()) theDataPreparator.STGCDataPreparator = MuonSA.TrigL2MuonSA__StgcDataPreparator( DecodeBS=DetFlags.readRDOBS.sTGC_on()) theDataPreparator.MMDataPreparator = MuonSA.TrigL2MuonSA__MmDataPreparator( DecodeBS=DetFlags.readRDOBS.Micromegas_on()) from AtlasGeoModel.MuonGMJobProperties import MuonGeometryFlags if not MuonGeometryFlags.hasSTGC(): theDataPreparator.STGCDataPreparator.DoDecoding = False theDataPreparator.STGCDataPreparator.DecodeBS = False theDataPreparator.STGCDataPreparator.StgcPrepDataContainer = "" if not MuonGeometryFlags.hasMM(): theDataPreparator.MMDataPreparator.DoDecoding = False theDataPreparator.MMDataPreparator.DecodeBS = False theDataPreparator.MMDataPreparator.MmPrepDataContainer = "" if not MuonGeometryFlags.hasCSC(): theDataPreparator.CSCDataPreparator.DoDecoding = False theDataPreparator.CSCDataPreparator.DecodeBS = False theDataPreparator.CSCDataPreparator.CSCPrepDataContainer = "" #Need different PRD collection names to run offline and Run 2 trigger in same job if not TriggerFlags.doMT(): from MuonMDT_CnvTools.MuonMDT_CnvToolsConf import Muon__MdtRdoToPrepDataTool MdtRdoToMdtPrepDataTool = Muon__MdtRdoToPrepDataTool( name="TrigMdtRdoToPrepDataTool", OutputCollection="TrigMDT_DriftCircles") ToolSvc += MdtRdoToMdtPrepDataTool
muonRecFlags.setDefaults() topSequence = AlgSequence() # ESDtoAOD and AODtoTAG need a configured MuonIdHelperSvc (e.g. for the RPC_ResidualPullCalculator) # Since it is not automatically created by the job configuration (as for RDOtoESD), # do it here manually (hope this will be fixed with the movement to the new configuration for release 22) if rec.readESD() or rec.readAOD(): from MuonRecExample.MuonRecTools import MuonIdHelperSvc MuonIdHelperSvc() if muonRecFlags.doCSCs() and not MuonGeometryFlags.hasCSC(): muonRecFlags.doCSCs = False if muonRecFlags.dosTGCs() and not MuonGeometryFlags.hasSTGC(): muonRecFlags.dosTGCs = False if muonRecFlags.doMicromegas() and not MuonGeometryFlags.hasMM(): muonRecFlags.doMicromegas = False if muonRecFlags.doDigitization(): include("MuonRecExample/MuonDigitization_jobOptions.py") if rec.readRDO(): if globalflags.InputFormat == 'bytestream': include("MuonCnvExample/MuonReadBS_jobOptions.py") else: include("MuonCnvExample/MuonReadRDO_jobOptions.py") if DetFlags.makeRIO.Muon_on(): include("MuonRecExample/MuonRDO_to_PRD_jobOptions.py") ### add PRD -> xAOD if (rec.readRDO() or rec.readESD()) and muonRecFlags.prdToxAOD():