## get a handle to the ApplicationManager, to the ServiceManager and to the ToolSvc from AthenaCommon.AppMgr import (theApp, ServiceMgr as svcMgr, ToolSvc) ## define the DB Gobal Tag : svcMgr.IOVDbSvc.GlobalTag = LArCalib_Flags.globalFlagDB try: svcMgr.IOVDbSvc.DBInstance = "" except: pass theByteStreamInputSvc = svcMgr.ByteStreamInputSvc if not 'FullFileName' in dir(): PedestalAutoCorrLog.info( "No FullFileName! Please give a FullFileName list") theApp.exit(-1) else: svcMgr.EventSelector.Input = FullFileName from LArByteStream.LArByteStreamConf import LArRodDecoder svcMgr.ToolSvc += LArRodDecoder() theByteStreamAddressProviderSvc = svcMgr.ByteStreamAddressProviderSvc theByteStreamAddressProviderSvc.TypeNames += [ "LArFebHeaderContainer/LArFebHeader" ] theByteStreamAddressProviderSvc.TypeNames += ["LArDigitContainer/HIGH"] theByteStreamAddressProviderSvc.TypeNames += [ "LArAccumulatedDigitContainer/HIGH" ]
preconfig = "AthenaCommon" ### Athena configuration ----------------------------------------------------- theApp = iService( "ApplicationMgr" ) # proxy theApp.Dlls += [ 'AthenaServices' ] include( "%s/Bootstrap.py" % preconfig ) ## create the application manager and start in a non-initialised state from AthenaCommon.AppMgr import theApp, ToolSvc, ServiceMgr, theAuditorSvc ## basic job configuration include( "AthenaCommon/Atlas.UnixStandardJob.py" ) include.block( "AthenaCommon/Atlas.UnixStandardJob.py" ) EventLoopMgr = iService( 'EventLoopMgr' ) AthenaEventLoopMgr = EventLoopMgr # for historic reasons ### execution ---------------------------------------------------------------- from AthenaCommon.ResourceLimits import SetMaxLimits SetMaxLimits() del SetMaxLimits include( sys.argv[1] ) try: theApp.run() # runs until theApp.EvtMax events reached except RuntimeError, e: print 'RuntimeError:', str(e) theApp.exit() # exits program, yields theApp._exitstate on shell
theApp._exitstate = ExitCodes.IMPORT_ERROR sys.exit(ExitCodes.IMPORT_ERROR) raise print(" +------------------------------------------------+ ") print(" | Execute command after jobOptions script END. | ") print(" +------------------------------------------------+ ") print("\n") ### Dump properties and convert to JSON if requested ------------------------- if PscConfig.dumpJobProperties: from AthenaCommon import ConfigurationShelve from TrigConfIO.JsonUtils import create_joboptions_json ConfigurationShelve.storeJobOptionsCatalogue('HLTJobOptions.pkl') fname = 'HLTJobOptions' with open(fname + '.pkl', "rb") as f: import pickle jocat = pickle.load(f) # basic job properties jocfg = pickle.load(f) # some specialized services jocat.update(jocfg) # merge the two dictionaries psclog.info('Dumping joboptions to "%s.json"', fname) create_joboptions_json(jocat, fname + ".json") if PscConfig.exitAfterDump: theApp.exit(0) else: # storeJobOptionsCatalogue calls setup() itself, so we only need it here theApp.setup() ### Cleanup del psclog
include("LArConditionsCommon/LArConditionsCommon_comm_jobOptions.py") #if dspth: # conddb.addFolder("LAR_ONL","/LAR/Configuration/DSPThreshold/Templates<tag>LARConfigurationDSPThresholdTemplates-Qt5sigma-samp5sigma</tag>") from AthenaCommon.AlgSequence import AlgSequence job = AlgSequence() ## import my algorithm and add it to the list of algorithms to be run from LArConditionsCommon.LArCellConditionsAlg import LArCellConditionsAlg theLArCellConditionsAlg = LArCellConditionsAlg("LArCellConditions", printConditions=printCond, printLocation=geo, printDSPTh=dspth) job += theLArCellConditionsAlg theApp.initialize() import readline if os.path.exists(fhistory): readline.read_history_file(fhistory) readline.set_history_length(128) #readline.parse_and_bind( 'tab:') theApp.nextEvent( 2) #First event is dummy to close DB connections, second has the user-loop theApp.finalize() readline.write_history_file(fhistory) theApp.exit() #theApp.EvtMax = 1 ## EOF ##
# Increase scheduler checks and verbosity #-------------------------------------------------------------- from AthenaCommon.AlgScheduler import AlgScheduler AlgScheduler.CheckDependencies(True) AlgScheduler.ShowControlFlow(True) AlgScheduler.ShowDataDependencies(True) AlgScheduler.EnableVerboseViews(True) #-------------------------------------------------------------- # Set the FailIfNoProxy property of SGInputLoader #-------------------------------------------------------------- if not hasattr(topSequence, "SGInputLoader"): log.error( 'Cannot set FailIfNoProxy property because SGInputLoader not found in topSequence' ) theApp.exit(1) topSequence.SGInputLoader.FailIfNoProxy = opt.failIfNoProxy #-------------------------------------------------------------- # Event Info setup #-------------------------------------------------------------- # If no xAOD::EventInfo is found in a POOL file, schedule conversion from old EventInfo if ConfigFlags.Input.Format == 'POOL': from RecExConfig.ObjKeyStore import objKeyStore from PyUtils.MetaReaderPeeker import convert_itemList objKeyStore.addManyTypesInputFile(convert_itemList(layout='#join')) if objKeyStore.isInInput("xAOD::EventInfo"): topSequence.SGInputLoader.Load += [('xAOD::EventInfo', 'StoreGateSvc+EventInfo')] else: from AthenaCommon.AlgSequence import AthSequencer