def CreateBookkeeperDumperTool(name='BookkeeperDumperTool'): from AthenaCommon.AppMgr import ServiceMgr as svcMgr # Make sure MetaDataSvc is ready if not hasattr(svcMgr, 'MetaDataSvc'): from AthenaServices.AthenaServicesConf import MetaDataSvc svcMgr += MetaDataSvc('MetaDataSvc') # Add BookkeeperDumperTool from EventBookkeeperTools.EventBookkeeperToolsConf import BookkeeperDumperTool tool = BookkeeperDumperTool(name) svcMgr.ToolSvc += tool # Add tool to MetaDataSvc svcMgr.MetaDataSvc.MetaDataTools += [tool]
def CreateBookkeeperTool( name="CutBookkeepers" ): from AthenaCommon.AppMgr import ServiceMgr as svcMgr # Make sure MetaDataSvc is ready if not hasattr(svcMgr,'MetaDataSvc'): from AthenaServices.AthenaServicesConf import MetaDataSvc svcMgr += MetaDataSvc( "MetaDataSvc" ) # Add BookkeeperTools from EventBookkeeperTools.EventBookkeeperToolsConf import BookkeeperTool # Standard event bookkeepers cutflowtool = BookkeeperTool(name, InputCollName=name, OutputCollName = name) svcMgr.ToolSvc += cutflowtool # Add tool to MetaDataSvc #svcMgr.MetaDataSvc.MetaDataTools += [cutflowtool] return
#USE temporary to DEBUG #from AthenaCommon.AppMgr import theApp #theApp.ReflexPluginDebugLevel=1 from GaudiSvc.GaudiSvcConf import THistSvc # add LumiBlockMetaDataTool to ToolSvc and configure from LumiBlockComps.LumiBlockCompsConf import LumiBlockMetaDataTool ToolSvc += LumiBlockMetaDataTool("LumiBlockMetaDataTool") # add ToolSvc.LumiBlockMetaDataTool to MetaDataSvc from AthenaServices.AthenaServicesConf import MetaDataSvc svcMgr += MetaDataSvc("MetaDataSvc") svcMgr.MetaDataSvc.MetaDataTools += [ToolSvc.LumiBlockMetaDataTool] # Configure the goodrunslist selector tool from GoodRunsLists.GoodRunsListsConf import * ToolSvc += GoodRunsListSelectorTool() GoodRunsListSelectorTool.GoodRunsListVec = [ './data15_13TeV.periodAllYear_DetStatus-v63-pro18-01_DQDefects-00-01-02_PHYS_StandardGRL_All_Good.xml' ] ## This Athena job consists of algorithms that loop over events; ## here, the (default) top sequence is used: from AthenaCommon.AlgSequence import AlgSequence, AthSequencer job = AlgSequence()
def CreateCutFlowSvc( svcName="CutFlowSvc", seq=None, addMetaDataToAllOutputFiles=True ): """ Helper to create the CutFlowSvc, extract the needed information from the input file, and also schedule all the needed stuff. """ # Create a message logger from AthenaCommon.Logging import logging msg = logging.getLogger( "Create"+svcName ) # Get the service manager from AthenaCommon.AppMgr import ServiceMgr as svcMgr # Determine current input stream name inputStreamName = GetCurrentStreamName( msg=msg ) msg.debug("CreateCutFlowSvc: Have inputStreamName = %s" % (inputStreamName) ) # Create the CutFlowSvc instance import AthenaCommon.CfgMgr as CfgMgr if not hasattr(svcMgr,"CutFlowSvc"): svcMgr += CfgMgr.CutFlowSvc() svcMgr.CutFlowSvc.InputStream = inputStreamName # Make sure MetaDataSvc is ready if not hasattr(svcMgr,'MetaDataSvc'): from AthenaServices.AthenaServicesConf import MetaDataSvc svcMgr += MetaDataSvc( "MetaDataSvc" ) # Add BookkeeperTools from EventBookkeeperTools.EventBookkeeperToolsConf import BookkeeperTool # Standard event bookkeepers primary_name = "CutBookkeepers" cutflowtool = BookkeeperTool(primary_name + "Tool", InputCollName = primary_name, OutputCollName= primary_name) svcMgr.ToolSvc += cutflowtool # Add tool to MetaDataSvc svcMgr.MetaDataSvc.MetaDataTools += [cutflowtool] # Check if we have a sequence given if not seq : # Fetch the AthAlgSeq, i.e., one of the existing master sequences where one should attach all algorithms seq = CfgMgr.AthSequencer("AthAlgSeq") pass # First of all, schedule EventCounterAlg if not hasattr(seq,"AllExecutedEvents"): if not seq.isLocked(): # Need to schedule it after the xAODMaker::EventInfoCnvAlg such that xAOD::EventInfo is present index = 0 if hasattr( seq, "xAODMaker::EventInfoCnvAlg" ): for alg in seq: index += 1 if alg.getName() == "xAODMaker::EventInfoCnvAlg": break pass pass msg.debug("Adding EventCounterAlg with name AllExecutedEvents to sequence with name %s at position %i" % (seq.getName(),index)) seq.insert( index, CfgMgr.EventCounterAlg("AllExecutedEvents") ) pass else : msg.info("Could NOT add EventCounterAlg with name AllExecutedEvents to locked sequence with name %s" % seq.getName()) pass pass # If wanted, add the meta-data to all output files if addMetaDataToAllOutputFiles: msg.debug("Adding CutBookkeepers the the output meta data of all output streams") from OutputStreamAthenaPool.MultipleStreamManager import MSMgr # Explicitely add file metadata from input and from transient store, # but only the ones that we always create. MSMgr.AddMetaDataItemToAllStreams( "xAOD::CutBookkeeperContainer#"+primary_name ) MSMgr.AddMetaDataItemToAllStreams( "xAOD::CutBookkeeperAuxContainer#"+primary_name+"Aux.*" ) MSMgr.AddMetaDataItemToAllStreams( "xAOD::CutBookkeeperContainer#Incomplete"+primary_name ) MSMgr.AddMetaDataItemToAllStreams( "xAOD::CutBookkeeperAuxContainer#Incomplete"+primary_name+"Aux.*" ) pass return
## get a handle on the ServiceManager from AthenaCommon.AppMgr import ServiceMgr from CLIDComps.CLIDCompsConf import ClassIDSvc svcMgr += ClassIDSvc() from AthenaCommon.Constants import INFO from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() from AthenaCommon.AlgSequence import AthSequencer athOutSeq = AthSequencer("AthOutSeq") # include MetaDataSvc and initialize properties include("EventSelectorAthenaPool/MetaDataSvc_jobOptions.py") from AthenaServices.AthenaServicesConf import MetaDataSvc svcMgr += MetaDataSvc() svcMgr.MetaDataSvc.OutputLevel = 2 svcMgr.MetaDataSvc.MetaDataContainer = "MetaDataHdr" svcMgr.ProxyProviderSvc.ProviderNames += ["MetaDataSvc"] # include some tools from EventBookkeeperTools.CutFlowHelpers import CreateBookkeeperTool CreateBookkeeperTool() from ByteStreamCnvSvc.ByteStreamCnvSvcConf import ByteStreamMetadataTool svcMgr.MetaDataSvc.MetaDataTools += ["ByteStreamMetadataTool"] #print "SGInputLoader init" #from SGComps.SGCompsConf import SGInputLoader #sgin = SGInputLoader() #sgin.Load = [('EventInfo','ByteStreamEventInfo')]
theApp.EvtMax = 10 #------------------------------------------------------------------------------ # Good Run List #------------------------------------------------------------------------------ if do_grl and sample == 'data': # add LumiBlockMetaDataTool to ToolSvc and configure from LumiBlockComps.LumiBlockCompsConf import LumiBlockMetaDataTool theLumiBlockMetaDataTool = LumiBlockMetaDataTool( "LumiBlockMetaDataTool" ) theLumiBlockMetaDataTool.OutputLevel = INFO ToolSvc += theLumiBlockMetaDataTool # add ToolSvc.LumiBlockMetaDataTool to MetaDataSvc from AthenaServices.AthenaServicesConf import MetaDataSvc theMetaDataSvc = MetaDataSvc( "MetaDataSvc" ) theMetaDataSvc.MetaDataTools += [ theLumiBlockMetaDataTool ] svcMgr += theMetaDataSvc # Configure the goodrunslist selector tool from GoodRunsLists.GoodRunsListsConf import * theGoodRunsListSelectorTool = GoodRunsListSelectorTool() theGoodRunsListSelectorTool.GoodRunsListVec = [ 'MyLBCollection.xml' ] theGoodRunsListSelectorTool.PassThrough = False theGoodRunsListSelectorTool.OutputLevel = INFO ToolSvc += theGoodRunsListSelectorTool ## This Athena job consists of algorithms that loop over events; ## here, the (default) top sequence is used: from AthenaCommon.AlgSequence import AlgSequence, AthSequencer job = AlgSequence()
IOVDbSvc.GlobalTag = ConditionsTag import JetRec.ParticleJetCompatibility if TriggerOn == 1: # Set up trigger configuration service and metadata service it relies on, for analysis job without RecExCommon # set up trigger decision tool # set up metadata services ... NB comment if "aod" state is selected above from EventInfoMgt.EventInfoMgtConf import TagInfoMgr ServiceMgr += TagInfoMgr() #ServiceMgr.TagInfoMgr.AddGeoModelTags = False from IOVDbMetaDataTools.IOVDbMetaDataToolsConf import IOVDbMetaDataTool ToolSvc += IOVDbMetaDataTool("IOVDbMetaDataTool") from AthenaServices.AthenaServicesConf import MetaDataSvc ServiceMgr += MetaDataSvc("MetaDataSvc") ServiceMgr.MetaDataSvc.MetaDataContainer = "MetaDataHdr" ServiceMgr.MetaDataSvc.MetaDataTools += ["IOVDbMetaDataTool"] import IOVDbSvc.IOVDb from RecExConfig.RecFlags import rec rec.readAOD = True rec.doWriteAOD = False rec.doWriteESD = False # from TrigDecisionTool.TrigDecisionConf import TrigDecisionTool # tdt = TrigDecisionTool() from TrigDecisionTool.TrigDecisionToolConf import Trig__TrigDecisionTool tdt = Trig__TrigDecisionTool() ToolSvc += tdt # flags needed for TriggerConfigGetter