def getMETRebuilder(config): rebuilder = CfgMgr.met__METRebuilder('MET_Rebuilder_'+config.outputname) rebuilder.InputMap = config.inputMap() rebuilder.OutputContainer = config.outputContainer() if 'Ele' in config.inputdict: rebuilder.EleColl = config.inputdict['Ele'] if 'Gamma' in config.inputdict: rebuilder.GammaColl = config.inputdict['Gamma'] if 'Tau' in config.inputdict: rebuilder.TauColl = config.inputdict['Tau'] if 'Jet' in config.inputdict: rebuilder.JetColl = config.inputdict['Jet'] if 'Muon' in config.inputdict: rebuilder.MuonColl = config.inputdict['Muon'] if 'Ele' in config.termdict: rebuilder.EleTerm = config.termdict['Ele'] if 'Gamma' in config.termdict: rebuilder.GammaTerm = config.termdict['Gamma'] if 'Tau' in config.termdict: rebuilder.TauTerm = config.termdict['Tau'] if 'Jet' in config.termdict: rebuilder.JetTerm = config.termdict['Jet'] if 'Muon' in config.termdict: rebuilder.MuonTerm = config.termdict['Muon'] if 'Soft' in config.termdict: rebuilder.SoftTerm = config.termdict['Soft'] return rebuilder
def getMETMakerAlg(suffix): from AthenaCommon import CfgMgr print "Generate METMaker and METMakerAlg for METAssoc_"+suffix from AthenaCommon.AppMgr import ToolSvc from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() doPFlow = 'PFlow' in suffix metMaker = CfgMgr.met__METMaker('METMaker_'+suffix, DoPFlow=doPFlow, JetPtCut=0e3); ToolSvc += metMaker makerAlg = CfgMgr.met__METMakerAlg('METMakerAlg_'+suffix, METMapName='METAssoc_'+suffix, METCoreName='MET_Core_'+suffix, METName='MET_Reference_'+suffix, InputJets=suffix+'Jets', Maker=metMaker) return makerAlg
def getMETUtilAlg(algName='METUtilAlg',configs=[]): if len(configs)==0: configs = [METUtilConfig('RefFinal')] from AthenaCommon.AppMgr import ToolSvc rebuilders = [] for config in configs: tool = getMETRebuilder(config) ToolSvc += tool rebuilders.append(tool) print prefix, 'Added METRebuilder \''+tool.name()+'\' to alg '+algName utilAlg = CfgMgr.met__METUtilAlg(name=algName, Rebuilders=rebuilders) return utilAlg
def makeInDetAlgs(whichSignature='', separateTrackParticleCreator='', rois='EMViewRoIs', doFTF=True, viewVerifier='IDViewDataVerifier'): #If signature specified add suffix to the algorithms signature = whichSignature if whichSignature else '' if signature != "" and separateTrackParticleCreator == "": separateTrackParticleCreator = signature if signature == "": raise ValueError('makeInDetAlgs() No signature specified') #Global keys/names for Trigger collections from .InDetTrigCollectionKeys import TrigPixelKeys, TrigSCTKeys from InDetRecExample.InDetKeys import InDetKeys from TrigInDetConfig.TrigInDetConfig import InDetCacheNames from AthenaCommon.GlobalFlags import globalflags viewAlgs = [] ViewDataVerifier = None if viewVerifier: import AthenaCommon.CfgMgr as CfgMgr ViewDataVerifier = CfgMgr.AthViews__ViewDataVerifier(viewVerifier + signature) ViewDataVerifier.DataObjects = [ ('InDet::PixelClusterContainerCache', InDetCacheNames.Pixel_ClusterKey), ('PixelRDO_Cache', InDetCacheNames.PixRDOCacheKey), ('InDet::SCT_ClusterContainerCache', InDetCacheNames.SCT_ClusterKey), ('SCT_RDO_Cache', InDetCacheNames.SCTRDOCacheKey), ('SpacePointCache', InDetCacheNames.SpacePointCachePix), ('SpacePointCache', InDetCacheNames.SpacePointCacheSCT), ('IDCInDetBSErrContainer_Cache', InDetCacheNames.SCTBSErrCacheKey), ('IDCInDetBSErrContainer_Cache', InDetCacheNames.SCTFlaggedCondCacheKey), ('xAOD::EventInfo', 'StoreGateSvc+EventInfo'), ('TagInfo', 'DetectorStore+ProcessingTags') ] viewAlgs.append(ViewDataVerifier) # Load RDOs if we aren't loading bytestream from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() topSequence.SGInputLoader.Load += [('TagInfo', 'DetectorStore+ProcessingTags')] if not globalflags.InputFormat.is_bytestream(): ViewDataVerifier.DataObjects += [ ('PixelRDO_Container', InDetKeys.PixelRDOs()), ('SCT_RDO_Container', InDetKeys.SCT_RDOs()), ('IDCInDetBSErrContainer', InDetKeys.SCT_ByteStreamErrs()) ] topSequence.SGInputLoader.Load += [ ('PixelRDO_Container', InDetKeys.PixelRDOs()), ('SCT_RDO_Container', InDetKeys.SCT_RDOs()), ('IDCInDetBSErrContainer', InDetKeys.SCT_ByteStreamErrs()) ] from InDetTrigRecExample.InDetTrigFlags import InDetTrigFlags from AthenaCommon.AppMgr import ToolSvc #Only add raw data decoders if we're running over raw data if globalflags.InputFormat.is_bytestream(): #Pixel from PixelRawDataByteStreamCnv.PixelRawDataByteStreamCnvConf import PixelRodDecoder InDetPixelRodDecoder = PixelRodDecoder(name="InDetPixelRodDecoder_" + signature) # Disable duplcated pixel check for data15 because duplication mechanism was used. from RecExConfig.RecFlags import rec if len(rec.projectName()) >= 6 and rec.projectName()[:6] == "data15": InDetPixelRodDecoder.CheckDuplicatedPixel = False ToolSvc += InDetPixelRodDecoder from PixelRawDataByteStreamCnv.PixelRawDataByteStreamCnvConf import PixelRawDataProviderTool InDetPixelRawDataProviderTool = PixelRawDataProviderTool( name="InDetPixelRawDataProviderTool_" + signature, Decoder=InDetPixelRodDecoder, checkLVL1ID=False) ToolSvc += InDetPixelRawDataProviderTool if (InDetTrigFlags.doPrintConfigurables()): print(InDetPixelRawDataProviderTool) # noqa: ATL901 # load the PixelRawDataProvider from PixelRawDataByteStreamCnv.PixelRawDataByteStreamCnvConf import PixelRawDataProvider InDetPixelRawDataProvider = PixelRawDataProvider( name="InDetPixelRawDataProvider_" + signature, RDOKey=InDetKeys.PixelRDOs(), ProviderTool=InDetPixelRawDataProviderTool, ) InDetPixelRawDataProvider.isRoI_Seeded = True InDetPixelRawDataProvider.RoIs = rois InDetPixelRawDataProvider.RDOCacheKey = InDetCacheNames.PixRDOCacheKey viewAlgs.append(InDetPixelRawDataProvider) if (InDetTrigFlags.doPrintConfigurables()): print(InDetPixelRawDataProvider) # noqa: ATL901 #SCT from SCT_RawDataByteStreamCnv.SCT_RawDataByteStreamCnvConf import SCT_RodDecoder InDetSCTRodDecoder = SCT_RodDecoder(name="InDetSCTRodDecoder_" + signature) ToolSvc += InDetSCTRodDecoder from SCT_RawDataByteStreamCnv.SCT_RawDataByteStreamCnvConf import SCTRawDataProviderTool InDetSCTRawDataProviderTool = SCTRawDataProviderTool( name="InDetSCTRawDataProviderTool_" + signature, Decoder=InDetSCTRodDecoder) ToolSvc += InDetSCTRawDataProviderTool if (InDetTrigFlags.doPrintConfigurables()): print(InDetSCTRawDataProviderTool) # noqa: ATL901 # load the SCTRawDataProvider from SCT_RawDataByteStreamCnv.SCT_RawDataByteStreamCnvConf import SCTRawDataProvider InDetSCTRawDataProvider = SCTRawDataProvider( name="InDetSCTRawDataProvider_" + signature, RDOKey=InDetKeys.SCT_RDOs(), ProviderTool=InDetSCTRawDataProviderTool) InDetSCTRawDataProvider.isRoI_Seeded = True InDetSCTRawDataProvider.RoIs = rois InDetSCTRawDataProvider.RDOCacheKey = InDetCacheNames.SCTRDOCacheKey InDetSCTRawDataProvider.BSErrCacheKey = InDetCacheNames.SCTBSErrCacheKey from RegionSelector.RegSelToolConfig import makeRegSelTool_SCT InDetSCTRawDataProvider.RegSelTool = makeRegSelTool_SCT() viewAlgs.append(InDetSCTRawDataProvider) # load the SCTEventFlagWriter from SCT_RawDataByteStreamCnv.SCT_RawDataByteStreamCnvConf import SCTEventFlagWriter InDetSCTEventFlagWriter = SCTEventFlagWriter( name="InDetSCTEventFlagWriter_" + signature) viewAlgs.append(InDetSCTEventFlagWriter) #Pixel clusterisation from InDetTrigRecExample.InDetTrigConfigRecLoadTools import TrigPixelLorentzAngleTool, TrigSCTLorentzAngleTool from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelConfigCondAlg PixelConfigCondAlg.UseCalibConditions = False from SiClusterizationTool.SiClusterizationToolConf import InDet__ClusterMakerTool InDetClusterMakerTool = InDet__ClusterMakerTool( name="InDetClusterMakerTool_" + signature, SCTLorentzAngleTool=TrigSCTLorentzAngleTool, PixelLorentzAngleTool=TrigPixelLorentzAngleTool) ToolSvc += InDetClusterMakerTool from SiClusterizationTool.SiClusterizationToolConf import InDet__MergedPixelsTool InDetMergedPixelsTool = InDet__MergedPixelsTool( name="InDetMergedPixelsTool_" + signature, globalPosAlg=InDetClusterMakerTool, MinimalSplitSize=0, MaximalSplitSize=49, MinimalSplitProbability=0, DoIBLSplitting=True, ) # Enable duplcated RDO check for data15 because duplication mechanism was used. from RecExConfig.RecFlags import rec if len(rec.projectName()) >= 6 and rec.projectName()[:6] == "data15": InDetMergedPixelsTool.CheckDuplicatedRDO = True ToolSvc += InDetMergedPixelsTool from SiClusterizationTool.SiClusterizationToolConf import InDet__PixelGangedAmbiguitiesFinder InDetPixelGangedAmbiguitiesFinder = InDet__PixelGangedAmbiguitiesFinder( name="InDetPixelGangedAmbiguitiesFinder_" + signature) ToolSvc += InDetPixelGangedAmbiguitiesFinder from InDetPrepRawDataFormation.InDetPrepRawDataFormationConf import InDet__PixelClusterization InDetPixelClusterization = InDet__PixelClusterization( name="InDetPixelClusterization_" + signature, clusteringTool=InDetMergedPixelsTool, gangedAmbiguitiesFinder=InDetPixelGangedAmbiguitiesFinder, DataObjectName=InDetKeys.PixelRDOs(), AmbiguitiesMap=TrigPixelKeys.PixelClusterAmbiguitiesMap, ClustersName=TrigPixelKeys.Clusters) InDetPixelClusterization.isRoI_Seeded = True InDetPixelClusterization.RoIs = rois InDetPixelClusterization.ClusterContainerCacheKey = InDetCacheNames.Pixel_ClusterKey viewAlgs.append(InDetPixelClusterization) # Create SCT_ConditionsSummaryTool from SCT_ConditionsTools.SCT_ConditionsSummaryToolSetup import SCT_ConditionsSummaryToolSetup sct_ConditionsSummaryToolSetup = SCT_ConditionsSummaryToolSetup( "InDetSCT_ConditionsSummaryTool_" + signature) sct_ConditionsSummaryToolSetup.setup() InDetSCT_ConditionsSummaryTool = sct_ConditionsSummaryToolSetup.getTool( ) # noqa: F841 sct_ConditionsSummaryToolSetupWithoutFlagged = SCT_ConditionsSummaryToolSetup( "InDetSCT_ConditionsSummaryToolWithoutFlagged_" + signature) sct_ConditionsSummaryToolSetupWithoutFlagged.setup() InDetSCT_ConditionsSummaryToolWithoutFlagged = sct_ConditionsSummaryToolSetupWithoutFlagged.getTool( ) # Add conditions tools to SCT_ConditionsSummaryTool from SCT_ConditionsTools.SCT_ConfigurationConditionsToolSetup import SCT_ConfigurationConditionsToolSetup sct_ConfigurationConditionsToolSetup = SCT_ConfigurationConditionsToolSetup( ) sct_ConfigurationConditionsToolSetup.setToolName( "InDetSCT_ConfigurationConditionsTool_" + signature) sct_ConfigurationConditionsToolSetup.setup() InDetSCT_ConditionsSummaryToolWithoutFlagged.ConditionsTools.append( sct_ConfigurationConditionsToolSetup.getTool().getFullName()) from SCT_ConditionsTools.SCT_ReadCalibDataToolSetup import SCT_ReadCalibDataToolSetup sct_ReadCalibDataToolSetup = SCT_ReadCalibDataToolSetup() sct_ReadCalibDataToolSetup.setToolName("InDetSCT_ReadCalibDataTool_" + signature) sct_ReadCalibDataToolSetup.setup() InDetSCT_ConditionsSummaryToolWithoutFlagged.ConditionsTools.append( sct_ReadCalibDataToolSetup.getTool().getFullName()) from SCT_ConditionsTools.SCT_ByteStreamErrorsToolSetup import SCT_ByteStreamErrorsToolSetup sct_ByteStreamErrorsToolSetup = SCT_ByteStreamErrorsToolSetup() sct_ByteStreamErrorsToolSetup.setToolName("InDetSCT_BSErrorTool_" + signature) sct_ByteStreamErrorsToolSetup.setConfigTool( sct_ConfigurationConditionsToolSetup.getTool()) sct_ByteStreamErrorsToolSetup.setup() InDetSCT_ConditionsSummaryToolWithoutFlagged.ConditionsTools.append( sct_ByteStreamErrorsToolSetup.getTool().getFullName()) if (InDetTrigFlags.doPrintConfigurables()): print(InDetSCT_ConditionsSummaryToolWithoutFlagged) # # --- SCT_ClusteringTool # from SiClusterizationTool.SiClusterizationToolConf import InDet__SCT_ClusteringTool InDetSCT_ClusteringTool = InDet__SCT_ClusteringTool( name="InDetSCT_ClusteringTool_" + signature, globalPosAlg=InDetClusterMakerTool, conditionsTool=InDetSCT_ConditionsSummaryToolWithoutFlagged) if InDetTrigFlags.doSCTIntimeHits(): if InDetTrigFlags.InDet25nsec(): InDetSCT_ClusteringTool.timeBins = "01X" else: InDetSCT_ClusteringTool.timeBins = "X1X" # # --- SCT_Clusterization algorithm # from InDetPrepRawDataFormation.InDetPrepRawDataFormationConf import InDet__SCT_Clusterization InDetSCT_Clusterization = InDet__SCT_Clusterization( name="InDetSCT_Clusterization_" + signature, clusteringTool=InDetSCT_ClusteringTool, # ChannelStatus = InDetSCT_ChannelStatusAlg, DataObjectName=InDetKeys.SCT_RDOs(), ClustersName=TrigSCTKeys.Clusters, #Adding the suffix to flagged conditions SCT_FlaggedCondData="SCT_FlaggedCondData_TRIG", conditionsTool=InDetSCT_ConditionsSummaryToolWithoutFlagged) InDetSCT_Clusterization.isRoI_Seeded = True InDetSCT_Clusterization.RoIs = rois InDetSCT_Clusterization.ClusterContainerCacheKey = InDetCacheNames.SCT_ClusterKey InDetSCT_Clusterization.FlaggedCondCacheKey = InDetCacheNames.SCTFlaggedCondCacheKey from RegionSelector.RegSelToolConfig import makeRegSelTool_SCT InDetSCT_Clusterization.RegSelTool = makeRegSelTool_SCT() viewAlgs.append(InDetSCT_Clusterization) #Space points and FTF from SiSpacePointTool.SiSpacePointToolConf import InDet__SiSpacePointMakerTool InDetSiSpacePointMakerTool = InDet__SiSpacePointMakerTool( name="InDetSiSpacePointMakerTool_" + signature) from AthenaCommon.DetFlags import DetFlags from SiSpacePointFormation.SiSpacePointFormationConf import InDet__SiTrackerSpacePointFinder from SiSpacePointFormation.InDetOnlineMonitor import InDetMonitoringTool InDetSiTrackerSpacePointFinder = InDet__SiTrackerSpacePointFinder( name="InDetSiTrackerSpacePointFinder_" + signature, SiSpacePointMakerTool=InDetSiSpacePointMakerTool, PixelsClustersName=TrigPixelKeys.Clusters, SpacePointsPixelName=TrigPixelKeys.SpacePoints, SCT_ClustersName=TrigSCTKeys.Clusters, SpacePointsSCTName=TrigSCTKeys.SpacePoints, SpacePointsOverlapName=InDetKeys.OverlapSpacePoints(), ProcessPixels=DetFlags.haveRIO.pixel_on(), ProcessSCTs=DetFlags.haveRIO.SCT_on(), ProcessOverlaps=DetFlags.haveRIO.SCT_on(), SpacePointCacheSCT=InDetCacheNames.SpacePointCacheSCT, SpacePointCachePix=InDetCacheNames.SpacePointCachePix, monTool=InDetMonitoringTool()) viewAlgs.append(InDetSiTrackerSpacePointFinder) # Condition algorithm for SiTrackerSpacePointFinder if InDetSiTrackerSpacePointFinder.ProcessSCTs: from AthenaCommon.AlgSequence import AthSequencer condSeq = AthSequencer("AthCondSeq") if not hasattr(condSeq, "InDetSiElementPropertiesTableCondAlg"): # Setup alignment folders and conditions algorithms from SiSpacePointFormation.SiSpacePointFormationConf import InDet__SiElementPropertiesTableCondAlg condSeq += InDet__SiElementPropertiesTableCondAlg( name="InDetSiElementPropertiesTableCondAlg") #FIXME have a flag for now set for True( as most cases call FTF) but potentially separate if doFTF: from TrigFastTrackFinder.TrigFastTrackFinder_Config import TrigFastTrackFinderBase theFTF = TrigFastTrackFinderBase( "TrigFastTrackFinder_" + whichSignature, whichSignature) theFTF.RoIs = rois theFTF.TracksName = "TrigFastTrackFinder_Tracks_" + separateTrackParticleCreator #the following doCloneRemoval modification should be set up in the InDetTrigSliceSettings once legacy trigger not needed if whichSignature == "Electron": theFTF.doCloneRemoval = True viewAlgs.append(theFTF) from TrigInDetConf.TrigInDetPostTools import InDetTrigParticleCreatorToolFTF from TrigEDMConfig.TriggerEDMRun3 import recordable from InDetTrigParticleCreation.InDetTrigParticleCreationConf import InDet__TrigTrackingxAODCnvMT trackCollection = "HLT_IDTrack_" + separateTrackParticleCreator + "_FTF" theTrackParticleCreatorAlg = InDet__TrigTrackingxAODCnvMT( name="InDetTrigTrackParticleCreatorAlg" + whichSignature, TrackName="TrigFastTrackFinder_Tracks_" + separateTrackParticleCreator, ParticleCreatorTool=InDetTrigParticleCreatorToolFTF) if separateTrackParticleCreator == "BeamSpot": theTrackParticleCreatorAlg.TrackParticlesName = trackCollection else: theTrackParticleCreatorAlg.TrackParticlesName = recordable( trackCollection) viewAlgs.append(theTrackParticleCreatorAlg) return viewAlgs, ViewDataVerifier
def getEmptyFastSimulationMasterTool(name="EmptyFastSimulationMasterTool", **kwargs): return CfgMgr.FastSimulationMasterTool(name, **kwargs)
def getEmptySensitiveDetectorMasterTool( name="EmptySensitiveDetectorMasterTool", **kwargs): return CfgMgr.SensitiveDetectorMasterTool(name, **kwargs)
fullname.append(path + '/' + temp[0]) return [fullname, run] # include Flags jobOption include("TileMonitoring/TileRec_FlagOptions.py") ## get a handle to the default top-level algorithm sequence from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() # Get a handle to the ServiceManager from AthenaCommon.AppMgr import ServiceMgr as svcMgr from AthenaCommon import CfgMgr toolSvc = CfgMgr.ToolSvc() # set global flags from AthenaCommon.GlobalFlags import globalflags globalflags.DetGeo.set_Value_and_Lock('commis') globalflags.DataSource.set_Value_and_Lock('data') globalflags.InputFormat.set_Value_and_Lock('bytestream') from AthenaCommon.BeamFlags import jobproperties jobproperties.Beam.beamType.set_Value_and_Lock(beamType) # reset everything which is not needed from AthenaCommon.DetFlags import DetFlags DetFlags.Calo_setOff() #Switched off to avoid geometry DetFlags.ID_setOff() DetFlags.Muon_setOff()
def getMC12EntryLayerFilter(name="ISF_MC12EntryLayerFilter", **kwargs): kwargs.setdefault('AllowOnlyDefinedBarcodes' , True ) kwargs.setdefault('AllowOnlyLegacyPrimaries' , False ) kwargs.setdefault('LegacyParticleGenerationIncrement' , 1000000 ) kwargs.setdefault('LegacyFirstSecondaryBarcode' , 200001 ) return CfgMgr.ISF__GenericBarcodeFilter(name, **kwargs)
def getParticleKillerTool(name="ISF_ParticleKillerTool", **kwargs): return CfgMgr.ISF__ParticleKillerSimTool(name, **kwargs)
def getParticleHelper(name="ISF_ParticleHelper", **kwargs): from G4AtlasApps.SimFlags import simFlags kwargs.setdefault("BarcodeSvc" , simFlags.TruthStrategy.BarcodeServiceName()) return CfgMgr.ISF__ParticleHelper(name, **kwargs)
from ByteStreamCnvSvc.ByteStreamConfig import ByteStreamReadCfg from TrigEDMConfig import DataScoutingInfo from AthenaCommon.CFElements import seqAND from Gaudi.Configuration import DEBUG cfg = MainServicesCfg(ConfigFlags) cfg.merge(ByteStreamReadCfg(ConfigFlags)) histSvc = CompFactory.THistSvc() histSvc.Output += [ "COSTSTREAM DATAFILE='" + args.outputHist + "' OPT='RECREATE'" ] cfg.addService(histSvc) cfg.addSequence(seqAND("Decoding")) cfg.addEventAlgo(CfgMgr.HLTResultMTByteStreamDecoderAlg(), "Decoding") costDataDeserialiser = CfgMgr.TriggerEDMDeserialiserAlg( "CostDataTrigDeserialiser") costDataDeserialiser.ModuleID = DataScoutingInfo.DataScoutingIdentifiers[ "CostMonDS"] cfg.addEventAlgo(costDataDeserialiser, "Decoding") hltConfigSvc = CfgMgr.TrigConf__HLTConfigSvc("HLTConfigSvc") hltConfigSvc.ConfigSource = "None" hltConfigSvc.XMLMenuFile = "None" hltConfigSvc.InputType = "file" hltConfigSvc.JsonFileName = "HLTMenu_9.json" cfg.addService(hltConfigSvc) enhancedBiasWeighter = CfgMgr.EnhancedBiasWeighter() enhancedBiasWeighter.RunNumber = 379158
import AthenaPoolCnvSvc.ReadAthenaPool from AthenaCommon.AthenaCommonFlags import athenaCommonFlags from AthenaCommon.AppMgr import ServiceMgr, ToolSvc, theApp from AthenaCommon import CfgMgr filelist = ['/tmp/boliu/AOD.04607224._000001.pool.root.1'] ServiceMgr.EventSelector.InputCollections = filelist #ServiceMgr.EventSelector.InputCollections =[] from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() ## declare tighttrackvertexassotool by do first PV dz recovery(match the association procedure of JVF and JVT, default would be for each PV). tighttrackvertexassotool = CfgMgr.CP__TightTrackVertexAssociationTool( "TightTrackVertexAssociationTool", dzSinTheta_cut=3, doPV=True) loosetrackvertexassotool = CfgMgr.CP__LooseTrackVertexAssociationTool( "LooseTrackVertexAssociationTool", dzSinTheta_cut=3, d0_cut=2) #tighttrackvertexassotool.OutputLevel=DEBUG ToolSvc += tighttrackvertexassotool ToolSvc += loosetrackvertexassotool testAlg = CfgMgr.TrackVertexAssoTestAlg( TrackContainer="InDetTrackParticles", VertexContainer="PrimaryVertices", TightTrackVertexAssoTool=tighttrackvertexassotool, LooseTrackVertexAssoTool=loosetrackvertexassotool)
tileRawMon=True tileESDMon=False elif DQMonFlags.monManEnvironment() == 'tier0ESD': tileRawMon=False tileESDMon=True else: # it should be 'tier0' tileRawMon=True tileESDMon=True if tileESDMon: TileCellMon = CfgMgr.TileCellMonTool(name = 'TileCellMon' , OutputLevel = INFO , doOnline = athenaCommonFlags.isOnline() , cellsContainerName = "AllCalo" , FillHistogramsForL1Triggers = [] , FillChannelTimePerSampleHistograms = False , FillCellTimeAndEnergyDifferenceHistograms = False , FillDigitizerEnergyVsLBHistograms = False , histoPathBase = "/Tile/Cell") if (jobproperties.Beam.beamType() == 'cosmics' or jobproperties.Beam.beamType() == 'singlebeam'): TileCellMon.FillTimeHistograms = True TileCellMon.energyThresholdForTime = 150.0 ToolSvc += TileCellMon; ManagedAthenaTileMon.AthenaMonTools += [ TileCellMon ]; include ("TileMonitoring/TileMonTower_jobOptions.py")
def createBeamspotFinder(config=jobConfig, containerName="VxPrimaryCandidate", suffix=""): """ Set up a template for creating new beamspot finders. Options can be configures via the config dict """ import AthenaCommon.CfgMgr as CfgMgr from AthenaCommon.AppMgr import ToolSvc from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() # Extra options that may not be in default jobConfig if not 'MinVertexProb' in config: config['MinVertexProb'] = 0.01 if not 'MaxVtxChi2' in config: config['MaxVtxChi2'] = 100 if not 'FixParK' in config: config['FixParK'] = False if not 'MaxSigmaTr' in config: config['MaxSigmaTr'] = 100. if not 'MaxVtxErrTr' in config: config['MaxVtxErrTr'] = 100. if not 'OutlierChi2Tr' in config: config['OutlierChi2Tr'] = 50. InDetBeamSpotVertex = CfgMgr.InDet__InDetBeamSpotVertex( name='InDetBeamSpotVertex_' + containerName + suffix, VertexContainer=containerName, VertexTypes=config['VertexTypes'], MinTracksPerVtx=config['MinTracksPerVtx'], MinVtxNum=config['MinVtxNum'], MaxOutlierLoops=30, OutlierMaxRejection=30, OutlierWidthFail=5.1e-3, # in mm OutlierRhoFail=0.8, DoHists=doVertexHists, OutputLevel=min(INFO, config['outputlevel']), VertexTreeName="Vertices_" + containerName + suffix, MinVertexProb=config['MinVertexProb'], MaxVtxChi2=config['MaxVtxChi2'], MaxSigmaTr=config['MaxSigmaTr'], MaxVtxErrTr=config['MaxVtxErrTr'], OutlierChi2Tr=config['OutlierChi2Tr']) ToolSvc += InDetBeamSpotVertex # Will be automatically printed as part of InDetBeamSpotFinder printout # print ToolSvc.InDetBeamSpotVertex # from InDetBeamSpotFinder.InDetBeamSpotFinderConf import InDet__InDetBeamSpotDbWriterTool InDetBeamSpotDbWriterTool = CfgMgr.InDet__InDetBeamSpotDbWriterTool( name='InDetBeamSpotDbWriterTool_' + containerName + suffix, OutputLevel=min(INFO, config['outputlevel']), TreeName="COOLBeamspot_" + containerName + suffix, Tag=containerName + suffix) ToolSvc += InDetBeamSpotDbWriterTool print ToolSvc.InDetBeamSpotDbWriterTool #from InDetBeamSpotFinder.InDetBeamSpotFinderConf import InDet__InDetBeamSpotFinder as InDetBeamSpotFinder topSequence += CfgMgr.InDet__InDetBeamSpotFinder( name='InDetBeamSpotFinder_' + containerName + suffix, BeamSpotTool=InDetBeamSpotVertex, BeamSpotWriterTool=InDetBeamSpotDbWriterTool, MaxCount=config['MaxCount'], LumiRange=config['LumiRange'], LumiBlockRanges=config['LumiBlockRanges'], RunRange=config['RunRange'], EventRange=config['EventRange'], #ForceRunNumber = 52280, DoHists=doBeamspotHist, WriteDb=False, UseDefaultValues=True, #WriteFailed = True, Default_SigmaX=30.0, Default_SigmaY=30.0, Default_SigmaZ=500.0, Default_SigmaXY=0.0, OutputLevel=min(INFO, config['outputlevel']), BeamSpotRootName="Beamspots_" + containerName + suffix) try: topSequence.InDetBeamSpotFinder.UseLBFromViewed = config[ 'UseLBFromViewed'] topSequence.InDetBeamSpotFinder.UseLBFromAccepted = config[ 'UseLBFromAccepted'] except: print 'ERROR: You are using an older version of InDetBeamSpotFinder - please update to InDetBeamSpotFinder-01-00-29 or later' print topSequence.InDetBeamSpotFinder
def MM_Response_DigitTool(name="MM_Response_DigitTool", **kwargs): kwargs.setdefault("RndmSvc", jobproperties.Digitization.rndmSvc()) mmRndm = kwargs.setdefault("RndmEngine", "MMResponse") jobproperties.Digitization.rndmSeedList.addSeed(mmRndm, 49261510, 105132394) return CfgMgr.MM_Response_DigitTool(name, **kwargs)
def getG4GeometryNotifierSvc(name="G4GeometryNotifierSvc", **kwargs): kwargs.setdefault("ActivateLVNotifier", True) kwargs.setdefault("ActivatePVNotifier", False) return CfgMgr.G4GeometryNotifierSvc(name, **kwargs)
def getForwardFieldSvc(name="ForwardField", **kwargs): kwargs.setdefault("MagneticFieldSvc", "ForwardRegionFieldSvc") #kwargs.setdefault("FieldOn", True) # Must switch on the use of a field svc to be able to have StandardFieldSvc use ForwardRegionFieldSvc kwargs.setdefault("UseMagFieldSvc", True) return CfgMgr.StandardFieldSvc(name, **kwargs)
def configureRunNumberOverrides(): myRunNumber = 1 myFirstLB = 1 myInitialTimeStamp = 0 from G4AtlasApps.SimFlags import simFlags if hasattr(simFlags, "RunNumber") and simFlags.RunNumber.statusOn: myRunNumber = simFlags.RunNumber.get_Value() simMDlog.info('Found run number %d in sim flags.' % myRunNumber) ## Set event selector details based on evgen metadata ######update the run/event info for each event from AthenaCommon.AppMgr import ServiceMgr if not hasattr(ServiceMgr, 'EvtIdModifierSvc'): import AthenaServices.Configurables as asc ServiceMgr += asc.EvtIdModifierSvc(EvtStoreName="StoreGateSvc") from AthenaCommon.AppMgr import theApp theApp.CreateSvc += ["EvtIdModifierSvc"] else: simMDlog.warning( 'Will override the settings of the EvtIdModifierSvc that was previously set up!' ) #fix iov metadata if not hasattr(ServiceMgr.ToolSvc, 'IOVDbMetaDataTool'): from AthenaCommon import CfgMgr ServiceMgr.ToolSvc += CfgMgr.IOVDbMetaDataTool() ServiceMgr.ToolSvc.IOVDbMetaDataTool.MinMaxRunNumbers = [ myRunNumber, 2147483647 ] ## FIXME need to use maxRunNumber = 2147483647 for now to keep overlay working but in the future this should be set properly. # Using event numbers to avoid "some very large number" setting from AthenaCommon.AthenaCommonFlags import athenaCommonFlags totalNumber = 1000000 # TODO possibly get this from MetaReader?? if athenaCommonFlags.EvtMax( ) is not None and athenaCommonFlags.EvtMax() > 0: totalNumber = athenaCommonFlags.EvtMax() + 1 if athenaCommonFlags.SkipEvents( ) is not None and athenaCommonFlags.SkipEvents() > 0: totalNumber += athenaCommonFlags.SkipEvents() try: from RunDependentSimComps.RunDMCFlags import runDMCFlags myInitialTimeStamp = runDMCFlags.RunToTimestampDict.getTimestampForRun( myRunNumber) #print "FOUND TIMESTAMP ", str(myInitialTimeStamp) except: myInitialTimeStamp = 1 ServiceMgr.EvtIdModifierSvc.add_modifier(run_nbr=myRunNumber, lbk_nbr=myFirstLB, time_stamp=myInitialTimeStamp, nevts=totalNumber) if hasattr(ServiceMgr.EventSelector, 'OverrideRunNumberFromInput'): ServiceMgr.EventSelector.OverrideRunNumberFromInput = True elif metadata_lite is not None: # Get evgen run number and lumi block if len(metadata_lite['runNumbers']) > 0: myRunNumber = metadata_lite['runNumbers'][0] simMDlog.info('Found runNumbers %d in hits file metadata.' % myRunNumber) else: simMDlog.warning( 'Failed to find runNumbers in hits file metadata.') if metadata_lite['lumiBlockNumbers']: myFirstLB = metadata_lite['lumiBlockNumbers'][0] else: simMDlog.warning( 'Requires simFlags.RunNumber to be specified in this running mode.\ Using default value of 1 for RunNumber.') from AthenaCommon.AppMgr import ServiceMgr ServiceMgr.EventSelector.OverrideRunNumber = True ServiceMgr.EventSelector.RunNumber = myRunNumber ServiceMgr.EventSelector.FirstLB = myFirstLB # Necessary to avoid a crash ServiceMgr.EventSelector.InitialTimeStamp = myInitialTimeStamp
def getInput_GenericCosmicGenerator(name="GenericCosmicGenerator", **kwargs): ## Configuring the Athena application for a 'generator' job from G4AtlasApps.SimFlags import simFlags simFlags.load_cosmics_flags() ## Set up standard algorithms and random seeds from AthenaCommon.AppMgr import ServiceMgr from PartPropSvc.PartPropSvcConf import PartPropSvc ServiceMgr += PartPropSvc() if not simFlags.RandomSeedList.checkForExistingSeed("COSMICS"): simFlags.RandomSeedList.addSeed("COSMICS", 2040160768, 443921183) kwargs.setdefault('AtRndmGenSvc', simFlags.RandomSvc.get_Value()) from CosmicGenerator.CosmicGeneratorConfig import CavernPropertyCalculator theCavern = CavernPropertyCalculator() ##-------------------------------------------------------------- ## CosmicGenerator parameters ##-------------------------------------------------------------- ## ## Note that in this coordinate frame the y-axis points upward ## such that the cosmics arrive from upward to downward in y. ## The production vertex of cosmics is randomly distributed (flat) ## in the x-z plane with boundaries given below. ## The energy range is given as well. ## ## The following settings are tuned to scintillators of dimensions ## 140 x 0.5 x 100 cm^3 placed at +-115.0 cm kwargs.setdefault('emin', theCavern.CosmicEmin()) kwargs.setdefault('emax', theCavern.CosmicEmax()) #kwargs.setdefault('emin', 10000) # default =10000 #10 GeV #kwargs.setdefault('emax', 5000*1000) # 2 TeV - FIXME?! kwargs.setdefault('xvert_low', theCavern.CosmicLowVertex_X()) kwargs.setdefault('xvert_hig', theCavern.CosmicHighVertex_X()) kwargs.setdefault('zvert_low', theCavern.CosmicLowVertex_Z()) kwargs.setdefault('zvert_hig', theCavern.CosmicHighVertex_Z()) kwargs.setdefault('Radius', theCavern.CosmicRadius()) kwargs.setdefault('yvert_val', 57300. + 41000.) kwargs.setdefault('ctcut', 0.) kwargs.setdefault('OptimizeForCavern', True) kwargs.setdefault('IPx', 0.) kwargs.setdefault('IPy', 0.) kwargs.setdefault('IPz', 0.) if simFlags.CosmicFilterVolumeName.statusOn: print('Using %s Volume setup of Cosmic Generator...' % simFlags.CosmicFilterVolumeName.get_Value()) #special settings from Juerg Beringer if simFlags.CosmicFilterVolumeName == "Pixel" or simFlags.CosmicFilterVolumeName2 == "Pixel": kwargs.setdefault( 'doPathLengthCut', True) # Optimization based on box cut in pixel detector plane kwargs.setdefault( 'energyCutThreshold', 100.) # - margin of error for energy loss calculation (in MeV) kwargs.setdefault( 'doAimedAtPixelsCut', True) # Optimization based on box cut in pixel detector plane kwargs.setdefault('pixelplane_maxx', 1150.) # - require |x| < value in mm kwargs.setdefault('pixelplane_maxz', 1650.) # - require |y| < value in mm kwargs.setdefault( 'doReweighting', True) # Whether to use reweighting for cosmic ray generation kwargs.setdefault( 'rvert_max', 300000.) # - radius in mm for generating primary vertex if simFlags.CosmicPtSlice.statusOn and simFlags.CosmicPtSlice( ) is not 'NONE': print("Configuring cosmic pT slice: %s" % simFlags.CosmicPtSlice.get_Value()) theCavern.reconfigureCavernGeometry() from AthenaCommon import CfgMgr algorithm = CfgMgr.CosmicGenerator(**kwargs) from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() if not hasattr(topSequence, 'CosmicGenerator'): topSequence += algorithm return algorithm
def getStoppedParticleFilter(name="ISF_StoppedParticleFilter", **kwargs): kwargs.setdefault("VolumeNames", ['StoppingPositions'] ) return CfgMgr.ISF__CosmicEventFilterTool(name, **kwargs)
TrigCaloTopoIsolationTool = ToolFactory( xAOD__CaloIsolationTool, name="TrigEgammaCaloTopoIsolationTool", doEnergyDensityCorrection=True, saveOnlyRequestedCorrections=True, IsoLeakCorrectionTool=IsoCorrectionToolTrig, ClustersInConeTool=TrigCaloClustersInConeTool, CaloFillRectangularClusterTool=TrigCaloFillRectangularCluster, UseEMScale=True, TopoClusterEDCentralContainer="HLTTopoClusterIsoCentralEventShape", TopoClusterEDForwardContainer="HLTTopoClusterIsoForwardEventShape") TrigTrackIsolationTool = ToolFactory(xAOD__TrackIsolationTool, name='TrigEgammaTrackIsolationTool') TrkIsoCfg = CfgMgr.xAOD__TrackIsolationTool('TrigEgammaTrackIsolationTool') TrkIsoCfg.TrackSelectionTool.maxZ0SinTheta = 3. TrkIsoCfg.TrackSelectionTool.minPt = 1000. TrkIsoCfg.TrackSelectionTool.CutLevel = "Loose" TrigElectronPIDBuilder = ToolFactory( EMPIDBuilder, name="TrigElectronPIDBuilder", electronIsEMselectors=[ ToolSvc.AsgElectronIsEMVLooseSelector, ToolSvc.AsgElectronIsEMLooseSelector, ToolSvc.AsgElectronIsEMMediumSelector, ToolSvc.AsgElectronIsEMTightSelector ], electronIsEMselectorResultNames=["VLoose", "Loose", "Medium", "Tight"], electronLHselectors=[
def getEnergyParticleOrderingTool(name="ISF_EnergyParticleOrderingTool", **kwargs): return CfgMgr.ISF__EnergyParticleOrderingTool(name, **kwargs)
def SCT_DigitizationPU(name="SCT_DigitizationPU", **kwargs): kwargs.setdefault("DigitizationTool", "SCT_DigitizationToolPU") return CfgMgr.SCT_Digitization(name, **kwargs)
def getMemoryMonitor(name="ISF_MemoryMonitor", **kwargs): return CfgMgr.ISF__MemoryMonitoringTool(name, **kwargs)
def SCT_OverlayDigitization(name="SCT_OverlayDigitization", **kwargs): kwargs.setdefault("DigitizationTool", "SCT_OverlayDigitizationTool") return CfgMgr.SCT_Digitization(name, **kwargs)
def getMC15EntryLayerFilter(name="ISF_MC15EntryLayerFilter", **kwargs): kwargs.setdefault('MinEkinCharged' , 100.*MeV ) kwargs.setdefault('MinEkinNeutral' , -1. ) return CfgMgr.ISF__EntryLayerFilter(name, **kwargs )
def TrackEnergyInCaloTool(name='TrackEnergyInCaloTool', **kwargs): kwargs.setdefault("ExtrapolatorHandle", getPublicTool("AtlasExtrapolator")) return CfgMgr.TrackEnergyInCaloTool(name, **kwargs)
#-------------------------------------------------------------- # disable sending of Level 2 result #-------------------------------------------------------------- if not hasattr( svcMgr, "ByteStreamAddressProviderSvc" ): from ByteStreamCnvSvcBase.ByteStreamCnvSvcBaseConf import ByteStreamAddressProviderSvc svcMgr += ByteStreamAddressProviderSvc() svcMgr.ByteStreamAddressProviderSvc.OutputLevel = OUTPUTLEVEL svcMgr.ByteStreamAddressProviderSvc.TypeNames += [ "ROIB::RoIBResult/RoIBResult" ] #-------------------------------------------------------------- # Private Application Configuration options #-------------------------------------------------------------- HelloWorld = CfgMgr.MTHelloWorldLvl1("HelloWorld") from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() topSequence += HelloWorld #-------------------------------------------------------------- # need to run LVL1 configuration for LVL1 conversion in HLTSSW #-------------------------------------------------------------- svcMgr += CfgMgr.LVL1CTP__L1Config("L1Config") svcMgr += CfgMgr.LVL1CTP__CTPHardware("CTPHardware") L1Config = svcMgr.L1Config CTPHardware = svcMgr.CTPHardware if not ('TrigT1ConfigVersion' in dir()): TrigT1ConfigVersion="CSC-02"
def CaloMuonScoreONNXRuntimeSvc(name='CaloMuonScoreONNXRuntimeSvc', **kwargs): return CfgMgr.CaloMuonScoreONNXRuntimeSvc(name, **kwargs)
def getFastSimulationMasterTool(name="FastSimulationMasterTool", **kwargs): kwargs.setdefault("FastSimulations", generateFastSimulationList()) return CfgMgr.FastSimulationMasterTool(name, **kwargs)
def CaloMuonLikelihoodTool(name='CaloMuonLikelihoodTool', **kwargs): kwargs.setdefault("ParticleCaloExtensionTool", getPublicTool("MuonParticleCaloExtensionTool")) return CfgMgr.CaloMuonLikelihoodTool(name, **kwargs)
#============================================================== from AthenaCommon.AppMgr import ServiceMgr as svcMgr from AthenaCommon.Constants import * from AthenaCommon import CfgMgr svcMgr.ROBDataProviderSvc.OutputLevel = OUTPUTLEVEL svcMgr.ByteStreamAddressProviderSvc.OutputLevel = OUTPUTLEVEL svcMgr.ByteStreamAddressProviderSvc.TypeNames += [ "ROIB::RoIBResult/RoIBResult" ] #-------------------------------------------------------------- # Private Application Configuration options #-------------------------------------------------------------- HelloWorld = CfgMgr.MTCalibPeb("HelloWorld") from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() topSequence += HelloWorld #-------------------------------------------------------------- # Algorithms Private Options #-------------------------------------------------------------- from TriggerJobOpts.TriggerFlags import TriggerFlags if TriggerFlags.doLVL2(): hltInstance = 'L2' elif TriggerFlags.doEF(): hltInstance = 'EF' else: hltInstance = 'HLT'
from MuonMomentumCorrections.MuonMomentumCorrectionsConf import CP__MuonCalibrationAndSmearingTool MuonCorrectionTool = CP__MuonCalibrationAndSmearingTool("MuonCorrectionTool") ToolSvc += MuonCorrectionTool ########### Muon Selection tool ################ from MuonSelectorTools.MuonSelectorToolsConf import CP__MuonSelectionTool MuonSelectionTool = CP__MuonSelectionTool("MuonSelectionTool", MaxEta = 2.7) ToolSvc += MuonSelectionTool ########### Muon Isolation options ################ from IsolationSelection.IsolationSelectionConf import CP__IsolationSelectionTool LooseTrackOnlyIsoTool = CfgMgr.CP__IsolationSelectionTool( "MuonLooseTrackOnlyIsolationSelectionTool" ) LooseTrackOnlyIsoTool.MuonWP = "LooseTrackOnly" ToolSvc += LooseTrackOnlyIsoTool LooseIsoTool = CfgMgr.CP__IsolationSelectionTool( "MuonLooseIsolationSelectionTool" ) LooseIsoTool.MuonWP = "Loose" ToolSvc += LooseIsoTool TightIsoTool = CfgMgr.CP__IsolationSelectionTool( "MuonTightIsolationSelectionTool" ) TightIsoTool.MuonWP = "Tight" ToolSvc += TightIsoTool GradientIsoTool = CfgMgr.CP__IsolationSelectionTool( "MuonGradientIsolationSelectionTool" ) GradientIsoTool.MuonWP = "Gradient" ToolSvc += GradientIsoTool GradientLooseIsoTool = CfgMgr.CP__IsolationSelectionTool( "MuonGradientLooseIsolationSelectionTool" ) GradientLooseIsoTool.MuonWP = "GradientLoose" ToolSvc += GradientLooseIsoTool FixedCutTightTrackOnlyIsoTool = CfgMgr.CP__IsolationSelectionTool( "MuonFixedCutTightTrackOnlyIsolationSelectionTool" )