diff --git a/Control/AthenaConfiguration/python/AllConfigFlags.py b/Control/AthenaConfiguration/python/AllConfigFlags.py index fff969b827bb7b18358f3d9c16482251d9183a66..b4ab8c54cb17d22ec0197b2f0b0dba2898f0c4aa 100644 --- a/Control/AthenaConfiguration/python/AllConfigFlags.py +++ b/Control/AthenaConfiguration/python/AllConfigFlags.py @@ -13,7 +13,15 @@ def _createCfgFlags(): acf.addFlag('Input.isMC', lambda prevFlags : GetFileMD(prevFlags.Input.Files).get("isMC",None)) # former global.isMC acf.addFlag('Input.RunNumber', lambda prevFlags : list(GetFileMD(prevFlags.Input.Files).get("RunNumber",None))) # former global.RunNumber acf.addFlag('Input.ProjectName', lambda prevFlags : GetFileMD(prevFlags.Input.Files).get("Project","data17_13TeV") ) # former global.ProjectName - + + acf.addFlag('Concurrency.NumProcs', 0) + acf.addFlag('Concurrency.NumThreads', 0) + acf.addFlag('Concurrency.NumConcurrentEvents', 0) + + acf.addFlag('Scheduler.CheckDependencies', True) + acf.addFlag('Scheduler.ShowDataDeps', False) + acf.addFlag('Scheduler.ShowDataFlow', False) + acf.addFlag('Scheduler.ShowControlFlow', False) acf.addFlag('Common.isOnline', False ) # Job runs in an online environment (access only to resources available at P1) # former global.isOnline diff --git a/Control/AthenaConfiguration/python/ComponentAccumulator.py b/Control/AthenaConfiguration/python/ComponentAccumulator.py index f0173de4d4ea09b8af9022ed0e82cea7dae16a80..d100edbfac63e9c88f16d2c3e2626862530ec70e 100644 --- a/Control/AthenaConfiguration/python/ComponentAccumulator.py +++ b/Control/AthenaConfiguration/python/ComponentAccumulator.py @@ -7,7 +7,7 @@ from AthenaCommon.AlgSequence import AthSequencer from AthenaConfiguration.AthConfigFlags import AthConfigFlags import GaudiKernel.GaudiHandles as GaudiHandles -from GaudiKernel.GaudiHandles import PublicToolHandle, PublicToolHandleArray, ServiceHandle, PrivateToolHandle +from GaudiKernel.GaudiHandles import PublicToolHandle, PublicToolHandleArray, ServiceHandle, PrivateToolHandle, PrivateToolHandleArray import ast import collections @@ -56,10 +56,33 @@ class ComponentAccumulator(object): - def printConfig(self, withDetails=False): + def printConfig(self, withDetails=False, summariseProps=False): self._msg.info( "Event Inputs" ) self._msg.info( self._eventInputs ) self._msg.info( "Event Algorithm Sequences" ) + + def printProperties(c, nestLevel = 0): + from AthenaCommon.Configurable import ConfigurableAlgTool + for propname, propval in c.getProperties().iteritems(): + # Ignore unset or empty lists + if propval=='<no value>' or propval==[]: + continue + # Printing EvtStore could be relevant for Views? + if propname in ["DetStore","EvtStore"]: + continue + + propstr = str(propval) + if isinstance(propval,PublicToolHandleArray): + ths = [th.getFullName() for th in propval] + propstr = "PublicToolHandleArray([ {0} ])".format(', '.join(ths)) + elif isinstance(propval,PrivateToolHandleArray): + ths = [th.getFullName() for th in propval] + propstr = "PrivateToolHandleArray([ {0} ])".format(', '.join(ths)) + elif isinstance(propval,ConfigurableAlgTool): + propstr = propval.getFullName() + self._msg.info( " "*nestLevel +" * {0}: {1}".format(propname,propstr) ) + return + if withDetails: self._msg.info( self._sequence ) else: @@ -76,6 +99,8 @@ class ComponentAccumulator(object): printSeqAndAlgs(c, nestLevel ) else: self._msg.info( " "*nestLevel +"\__ "+ c.name() +" (alg)" ) + if summariseProps: + printProperties(c, nestLevel) printSeqAndAlgs(self._sequence) self._msg.info( "Condition Algorithms" ) @@ -84,6 +109,14 @@ class ComponentAccumulator(object): self._msg.info( [ s.getName() for s in self._services ] ) self._msg.info( "Outputs" ) self._msg.info( self._outputPerStream ) + self._msg.info( "Public Tools" ) + self._msg.info( "[" ) + for t in self._publicTools: + self._msg.info( " {0},".format(t.getFullName()) ) + # Not nested, for now + if summariseProps: + printProperties(t) + self._msg.info( "]" ) def addSequence(self, newseq, parentName = None ): @@ -396,7 +429,7 @@ class ComponentAccumulator(object): existingAlg = findAlgorithm( dest, c.name(), depth=1 ) if existingAlg: if existingAlg != c: # if it is the same we can just skip it, else this indicates an error - raise ConfigurationError( "Duplicate algorithm %s in source and destination sequences %s" % ( c.name(), src.name() ) ) + raise ConfigurationError( "Duplicate algorithm %s in source and destination sequences %s" % ( c.name(), src.name() ) ) else: # absent, adding self._msg.debug(" Merging algorithm %s to a sequence %s", c.name(), dest.name() ) dest += c diff --git a/Control/AthenaConfiguration/python/MainServicesConfig.py b/Control/AthenaConfiguration/python/MainServicesConfig.py index e34e8275a7261bb7649c742893e852b6d7cc4390..8de68521775f254fa64116a74d0061b8c3bd670f 100644 --- a/Control/AthenaConfiguration/python/MainServicesConfig.py +++ b/Control/AthenaConfiguration/python/MainServicesConfig.py @@ -1,12 +1,12 @@ from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaCommon.AlgSequence import AthSequencer -def MainServicesMiniCfg(): +def MainServicesMiniCfg(LoopMgr='AthenaEventLoopMgr'): #Mininmal basic config, just good enough for HelloWorld and alike cfg=ComponentAccumulator() cfg.setAppProperty('TopAlg',['AthSequencer/AthAlgSeq']) #Just one sequence, no nesting cfg.setAppProperty('MessageSvcType', 'MessageSvc') - cfg.setAppProperty('EventLoop', 'AthenaEventLoopMgr') + cfg.setAppProperty('EventLoop', LoopMgr) cfg.setAppProperty('ExtSvcCreates', 'False') cfg.setAppProperty('JobOptionsSvcType', 'JobOptionsSvc') cfg.setAppProperty('JobOptionsType', 'NONE') @@ -15,9 +15,9 @@ def MainServicesMiniCfg(): return cfg -def MainServicesSerialCfg(): +def MainServicesSerialCfg(LoopMgr='AthenaEventLoopMgr'): cfg=ComponentAccumulator("AthMasterSeq") - cfg.merge(MainServicesMiniCfg()) + cfg.merge(MainServicesMiniCfg(LoopMgr)) cfg.setAppProperty('TopAlg',['AthSequencer/AthMasterSeq'],overwrite=True) cfg.setAppProperty('OutStreamType', 'AthenaOutputStream') @@ -57,3 +57,83 @@ def MainServicesSerialCfg(): cfg.setAppProperty('InitializationLoopCheck',False) return cfg + +def MainServicesThreadedCfg(cfgFlags): + # Neater ways to set the loop manager? Can't be altered + # after setting up the + + # Run a serial job for threads=0 + if cfgFlags.Concurrency.NumThreads==0: + return MainServicesSerialCfg() + + cfg = MainServicesSerialCfg("AthenaHiveEventLoopMgr") + + # Migrated code from AtlasThreadedJob.py + from GaudiCoreSvc.GaudiCoreSvcConf import MessageSvc + from GaudiSvc.GaudiSvcConf import StatusCodeSvc, AuditorSvc + + msgsvc = MessageSvc() + msgsvc.defaultLimit = 0 + msgFmt = "% F%40W%S%4W%e%s%7W%R%T %0W%M" + msgsvc.Format = msgFmt + cfg.addService(msgsvc) + + scsvc = StatusCodeSvc() + scsvc.AbortOnError = False + cfg.addService(scsvc) + cfg.setAppProperty('StatusCodeCheck',False) + + from StoreGate.StoreGateConf import SG__HiveMgrSvc + hivesvc = SG__HiveMgrSvc("EventDataSvc") + hivesvc.NSlots = cfgFlags.Concurrency.NumConcurrentEvents + cfg.addService( hivesvc ) + + import StoreGate.StoreGateConf as StoreGateConf + cfg.addService( StoreGateConf.StoreGateSvc("ConditionStore") ) + + from GaudiHive.GaudiHiveConf import AlgResourcePool + from AthenaCommon.Constants import INFO + arp=AlgResourcePool( OutputLevel = INFO ) + arp.TopAlg=["AthMasterSeq"] #this should enable control flow + cfg.addService( arp ) + + from GaudiHive.GaudiHiveConf import AvalancheSchedulerSvc + scheduler = AvalancheSchedulerSvc() + scheduler.CheckDependencies = cfgFlags.Scheduler.CheckDependencies + scheduler.ShowDataDependencies = cfgFlags.Scheduler.ShowDataDeps + scheduler.ShowDataFlow = cfgFlags.Scheduler.ShowDataFlow + scheduler.ShowControlFlow = cfgFlags.Scheduler.ShowControlFlow + scheduler.ThreadPoolSize = cfgFlags.Concurrency.NumThreads + cfg.addService(scheduler) + + from SGComps.SGCompsConf import SGInputLoader + # FailIfNoProxy=False makes it a warning, not an error, if unmet data + # dependencies are not found in the store. It should probably be changed + # to True eventually. + inputloader = SGInputLoader (FailIfNoProxy = False) + cfg.addEventAlgo( inputloader ) + scheduler.DataLoaderAlg = inputloader.getName() + + from AthenaServices.AthenaServicesConf import AthenaHiveEventLoopMgr + + elmgr = AthenaHiveEventLoopMgr() + elmgr.WhiteboardSvc = "EventDataSvc" + elmgr.SchedulerSvc = scheduler.getName() + cfg.addService( elmgr ) + + # enable timeline recording + from GaudiHive.GaudiHiveConf import TimelineSvc + cfg.addService( TimelineSvc( RecordTimeline = True, Partial = False ) ) + + # + ## Setup SGCommitAuditor to sweep new DataObjects at end of Alg execute + # + + auditorsvc = AuditorSvc() + from SGComps.SGCompsConf import SGCommitAuditor + auditorsvc += SGCommitAuditor() + cfg.addService( auditorsvc ) + cfg.setAppProperty("AuditAlgorithms", True) + + return cfg + diff --git a/Control/AthenaConfiguration/python/UnifyProperties.py b/Control/AthenaConfiguration/python/UnifyProperties.py index a3c289bf875504b4d0df04fc71952587290f5087..e5bf140c7ce709d533ff5cca98251be8cea919c5 100644 --- a/Control/AthenaConfiguration/python/UnifyProperties.py +++ b/Control/AthenaConfiguration/python/UnifyProperties.py @@ -41,6 +41,7 @@ _propsToUnify={"GeoModelSvc.DetectorTools":unifySet, "ProxyProviderSvc.ProviderNames":unifySet, "TagInfoMgr.ExtraTagValuePairs":unifySetOfPairs, "AthenaOutputStream.ItemList":unifySet, + "AthenaPoolCnvSvc.PoolAttributes":unifySet } diff --git a/Database/AthenaPOOL/OutputStreamAthenaPool/python/OutputStreamConfig.py b/Database/AthenaPOOL/OutputStreamAthenaPool/python/OutputStreamConfig.py index 64d8fcaf38d516178cf60bcb5a4ed560e9f0d234..23965b7bff6eab7fa9af388ed9152efeb8329863 100644 --- a/Database/AthenaPOOL/OutputStreamAthenaPool/python/OutputStreamConfig.py +++ b/Database/AthenaPOOL/OutputStreamAthenaPool/python/OutputStreamConfig.py @@ -30,13 +30,33 @@ def OutputStreamCfg(configFlags, streamName, ItemList=[] ): outputStream = AthenaOutputStream( outputAlgName, WritingTool = writingTool, - ItemList = [ "xAOD::EventInfo#*" ]+ItemList, + ItemList = [ "xAOD::EventInfo#*", "xAOD::EventAuxInfo#*" ]+ItemList, OutputFile = fileName, HelperTools = [ streamInfoTool ], ) #outputStream.MetadataStore = svcMgr.MetaDataStore #outputStream.MetadataItemList = [ "EventStreamInfo#" + streamName, "IOVMetaDataContainer#*" ] + # For xAOD output + if streamName=="xAOD": + from xAODEventFormatCnv.xAODEventFormatCnvConf import xAODMaker__EventFormatSvc + # Simplifies naming + result.addService(xAODMaker__EventFormatSvc()) + outputStream.MetadataItemList.append( "xAOD::EventFormat#EventFormat" ) + + from xAODMetaDataCnv.xAODMetaDataCnvConf import xAODMaker__FileMetaDataMarkUpTool + streamMarkUpTool = xAODMaker__FileMetaDataMarkUpTool( streamName + "_FileMetaDataMarkUpTool" ) + streamMarkUpTool.Key = streamName + outputStream.HelperTools += [ streamMarkUpTool ] + outputStream.WritingTool.SubLevelBranchName = "<key>" + + from AthenaPoolCnvSvc.AthenaPoolCnvSvcConf import AthenaPoolCnvSvc + poolcnvsvc = AthenaPoolCnvSvc() + result.addService(poolcnvsvc) + poolcnvsvc.PoolAttributes += [ "DatabaseName = '" + fileName + "'; COMPRESSION_LEVEL = '5'" ] + poolcnvsvc.PoolAttributes += [ "DatabaseName = '" + fileName + "'; ContainerName = 'TTree=CollectionTree'; TREE_AUTO_FLUSH = '-10000000'" ] + poolcnvsvc.PoolAttributes += [ "DatabaseName = '" + fileName + "'; ContainerName = 'TTree=CollectionTree'; CONTAINER_SPLITLEVEL = '1'" ] + poolcnvsvc.PoolAttributes += [ "DatabaseName = '" + fileName + "'; ContainerName = 'TTree=Aux.'; CONTAINER_SPLITLEVEL = '1'"] result.addEventAlgo(outputStream) return result diff --git a/PhysicsAnalysis/MCTruthClassifier/Root/MCTruthClassifier.cxx b/PhysicsAnalysis/MCTruthClassifier/Root/MCTruthClassifier.cxx index 401a600c4e0502e51e1ba3dfe7b1c5d26687eb7e..b973c4856b351d8d5ef805fdbfccf87f25785385 100644 --- a/PhysicsAnalysis/MCTruthClassifier/Root/MCTruthClassifier.cxx +++ b/PhysicsAnalysis/MCTruthClassifier/Root/MCTruthClassifier.cxx @@ -112,7 +112,10 @@ StatusCode MCTruthClassifier::initialize(){ ATH_MSG_INFO( " Initializing MCTruthClassifier" ); - ATH_CHECK(m_truthLinkVecReadHandleKey.initialize()); + // Only needed for GenParticle interface + if(!m_truthLinkVecReadHandleKey.key().empty()) { + ATH_CHECK(m_truthLinkVecReadHandleKey.initialize()); + } ATH_CHECK(m_truthParticleContainerKey.initialize()); //define barcode scheme