def OutputConditionsAlg(name='OutputConditionsAlg', outputFile='condobjs.root', ObjectList=[], IOVTagList=[], WriteIOV=True): import AthenaCommon.AtlasUnixStandardJob # get a handle on the top-level Algorithm sequence from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() # Load POOL support import AthenaPoolCnvSvc.WriteAthenaPool from RegistrationServices.RegistrationServicesConf import OutputConditionsAlg as OPCAlg myAlg = OPCAlg(name, ObjectList=ObjectList, IOVTagList=IOVTagList, WriteIOV=WriteIOV) topSequence += myAlg # create outputStream tool with given filename and pass to myOCA from AthenaServices.AthenaServicesConf import AthenaOutputStreamTool toolname = name + "Tool" myAlg.StreamName = toolname condstream = AthenaOutputStreamTool(toolname) condstream.OutputFile = outputFile condstream.PoolContainerPrefix = "ConditionsContainer" from AthenaCommon.AppMgr import ToolSvc ToolSvc += condstream # return reference to algorithm so can configure further parameters return myAlg
# Select the following to delete and recreate the folders. Default is # NOT to recreate - the content of a folder is delete before being recreated regSvc.RecreateFolders = L1CaloPedestalsMaker_RecreateCOOLFolders #-------------------------------------------------------------- # Use AthenaOutputStreamTool to write # Must "turn off" standard AthenaOutputStream #-------------------------------------------------------------- if L1CaloPedestalsMaker_Store2COOL: theApp.OutStream = [] from AthenaCommon.AppMgr import ToolSvc from AthenaServices.AthenaServicesConf import AthenaOutputStreamTool ToolSvc += AthenaOutputStreamTool("COOLStream", OutputFile="cool.pool.root") #-------------------------------------------------------------- # L1CaloCondSvc settings #-------------------------------------------------------------- from AthenaCommon.AppMgr import ServiceMgr from TrigT1CaloCondSvc.TrigT1CaloCondSvcConf import L1CaloCondSvc # note we can add a fully configured service in one statement ServiceMgr += L1CaloCondSvc() L1CaloCondSvc.OutputLevel = INFO # setup IOV range fro writing to COOL L1CaloCondSvc.BeginRun = IOVBeginRun L1CaloCondSvc.EndRun = IOVEndRun L1CaloCondSvc.BeginLB = IOVBeginLB
# Attribute list, defined as below. # lbn: 0..1..2..3..4..5..6..7..8..9.. # # lbn iov: 1..2.....3..4........5..6..7.. # ts iov: 1..2..34..5......6.7..8...9... * 100 # # event: 11111111112222222222 # (ts) 012345678901234567890123456789 #-------------------------------------------------------------- # Output options #-------------------------------------------------------------- from AthenaServices.AthenaServicesConf import AthenaOutputStreamTool condstream = AthenaOutputStreamTool('CondStream', OutputFile='condtest.pool.root') from DataModelTestDataCommon.DataModelTestDataCommonConf import \ DMTest__CondWriterAlg topSequence += DMTest__CondWriterAlg(Streamer=condstream) # Configure conditions DB output to local sqlite file. try: os.remove('condtest.db') except OSError: pass try: os.remove('condtest.pool.root') except OSError: pass import IOVDbSvc.IOVDb
svcMgr.EventSelector.EventsPerRun = 5 svcMgr.EventSelector.FirstEvent = 1 svcMgr.EventSelector.EventsPerLB = 1 svcMgr.EventSelector.FirstLB = 1 svcMgr.EventSelector.InitialTimeStamp = 0 svcMgr.EventSelector.TimeStampInterval = 5 theApp.EvtMax = 25 #-------------------------------------------------------------- # Load POOL support #-------------------------------------------------------------- import AthenaPoolCnvSvc.WriteAthenaPool from AthenaCommon.AppMgr import ServiceMgr as svcMgr svcMgr.AthenaPoolCnvSvc.PoolContainerPrefix = "ROOTTREE:CollectionTree" #-------------------------------------------------------------- # AthenaPool details #-------------------------------------------------------------- #-------------------------------------------------------------- # Use AthenaOutputStreamTool to write # Must "turn off" standard AthenaOutputStream #-------------------------------------------------------------- theApp.OutStream = [] from AthenaCommon.AppMgr import ToolSvc IOVDbTestAlg.StreamName = "CondStream2" from AthenaServices.AthenaServicesConf import AthenaOutputStreamTool ToolSvc += AthenaOutputStreamTool("CondStream2",OutputFile = "SimplePoolFile.root")
svcMgr += getConfigurable("ProxyProviderSvc")() svcMgr.ProxyProviderSvc.ProviderNames += ["CondProxyProvider"] svcMgr += getConfigurable("CondProxyProvider")() #svcMgr.CondProxyProvider.InputCollections = [ "LArTTCellMap-DC3-05.pool.root" ] svcMgr.CondProxyProvider.InputCollections += [ "LFN:oflcond.000002.conditions.simul.pool.v0000._0048.pool.root" ] #svcMgr.CondProxyProvider.InputCollections +=["LFN:oflcond.000002.conditions.simul.pool.v0000._0047.pool.root"] # Load POOL support import AthenaPoolCnvSvc.WriteAthenaPool theApp.OutStream = [] #from AthenaCommon.AppMgr import ToolSvc from AthenaServices.AthenaServicesConf import AthenaOutputStreamTool ToolSvc += AthenaOutputStreamTool( "CondStream1", OutputFile="LArTTCellMap-HadFcalFix.pool.root") #-------------------------------------------------------------- # Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL ) #-------------------------------------------------------------- MessageSvc = Service("MessageSvc") MessageSvc.OutputLevel = 2 MessageSvc.debugLimit = 200000 MessageSvc.useColors = TRUE theApp.EvtMax = 1 svcMgr.EventSelector.RunNumber = 1 svcMgr.EventSelector.FirstEvent = 1
SCTCalibWriteTool.TagID4NoiseOccupancy = TagID4NoiseOccupancy SCTCalibWriteTool.TagID4RawOccupancy = TagID4RawOccupancy SCTCalibWriteTool.TagID4Efficiency = TagID4Efficiency SCTCalibWriteTool.TagID4BSErrors = TagID4BSErrors SCTCalibWriteTool.TagID4LorentzAngle = TagID4LorentzAngle SCTCalibWriteTool.OutputLevel = INFO print(SCTCalibWriteTool) #-------------------------------------------------------------- # Setup for writing local COOL DB #-------------------------------------------------------------- from AthenaCommon.AppMgr import ToolSvc from AthenaServices.AthenaServicesConf import AthenaOutputStreamTool SCTCalibStream = AthenaOutputStreamTool( "SCTCalibStream", OutputFile = "sctcalib.pool.root" ) ToolSvc += SCTCalibStream #-------------------------------------------------------------- # Configuring SCTCalib #-------------------------------------------------------------- from SCT_CalibAlgs.SCT_CalibAlgsConf import SCTCalib topSequence += SCTCalib() SCTCalib = topSequence.SCTCalib #--- Run number SCTCalib.RunNumber = RunNumber #--- Run stat/end time read from runInfo.txt SCTCalib.RunStartTime = SORTime SCTCalib.RunEndTime = EORTime
ServiceMgr += CondProxyProvider() ServiceMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ] ServiceMgr.CondProxyProvider.InputCollections = [ AlignmentInFilename ] ServiceMgr.CondProxyProvider.OutputLevel=INFO print ServiceMgr.CondProxyProvider ServiceMgr.IOVSvc.preLoadData = True else: ##day1 #siOverride = 'InDetSi_CSC_Day1-01' #trtOverride = 'InDetTRT_CSC_Day1-01' #from IOVDbSvc.CondDB import conddb #conddb.addOverride('/Indet/Align', siOverride) #conddb.addOverride('/TRT/Align', trtOverride) pass if WriteDBPoolFile: from AthenaServices.AthenaServicesConf import AthenaOutputStreamTool InDetCondStream=AthenaOutputStreamTool(name="CondStream1", OutputFile = AlignmentOutFilename) ToolSvc += InDetCondStream print InDetCondStream include( "RegistrationServices/IOVRegistrationSvc_jobOptions.py" ) regSvc = Service( "IOVRegistrationSvc" ) regSvc.RecreateFolders = False IOVDbSvc = Service( "IOVDbSvc" ) #IOVDbSvc.dbConnection = "impl=cool;techno=sqlite;schema=%s;X:COMP200" % DatabaseFilename IOVDbSvc.dbConnection = "sqlite://;schema=%s;dbname=COMP200" % (DatabaseFilename)
#ServiceMgr.EventSelector.Input = ["data12_8TeV.00208485.express_express.merge.RAW._lb0055._SFO-ALL._0001.1","data12_8TeV.00208485.express_express.merge.RAW._lb0056._SFO-ALL._0001.1","data12_8TeV.00208485.express_express.merge.RAW._lb0057._SFO-ALL._0001.1","data12_8TeV.00208485.express_express.merge.RAW._lb0058._SFO-ALL._0001.1","data12_8TeV.00208485.express_express.merge.RAW._lb0059._SFO-ALL._0001.1","data12_8TeV.00208485.express_express.merge.RAW._lb0060._SFO-ALL._0001.1","data12_8TeV.00208485.express_express.merge.RAW._lb0061._SFO-ALL._0001.1","data12_8TeV.00208485.express_express.merge.RAW._lb0062._SFO-ALL._0001.1","data12_8TeV.00208485.express_express.merge.RAW._lb0063._SFO-ALL._0001.1","data12_8TeV.00208485.express_express.merge.RAW._lb0064._SFO-ALL._0001.1","data12_8TeV.00208485.express_express.merge.RAW._lb0065._SFO-ALL._0001.1","data12_8TeV.00208485.express_express.merge.RAW._lb0066._SFO-ALL._0001.1","data12_8TeV.00208485.express_express.merge.RAW._lb0067._SFO-ALL._0001.1","data12_8TeV.00208485.express_express.merge.RAW._lb0068._SFO-ALL._0001.1","data12_8TeV.00208485.express_express.merge.RAW._lb0069._SFO-ALL._0001.1","data12_8TeV.00208485.express_express.merge.RAW._lb0070._SFO-ALL._0001.1"] from AthenaCommon.AppMgr import ToolSvc from TRT_ConditionsServices.TRT_ConditionsServicesConf import TRT_StrawNeighbourSvc TRTStrawNeighbourSvc = TRT_StrawNeighbourSvc() ServiceMgr += TRTStrawNeighbourSvc from TRT_CalibTools.TRT_CalibToolsConf import FitTool TRTCalFitTool = FitTool(name='TRTCalFitTool') ToolSvc += TRTCalFitTool print TRTCalFitTool from AthenaServices.AthenaServicesConf import AthenaOutputStreamTool TRTCondStream = AthenaOutputStreamTool(name="CondStream1", OutputFile="trtcalibout.pool.root") ToolSvc += TRTCondStream print TRTCondStream from TRT_CalibTools.TRT_CalibToolsConf import FillAlignTrkInfo FillAlignTrkInfo = FillAlignTrkInfo(name='FillAlignTrkInfo', TrackSummaryTool=InDetTrackSummaryTool) ToolSvc += FillAlignTrkInfo print FillAlignTrkInfo from TRT_ConditionsServices.TRT_ConditionsServicesConf import TRT_CalDbTool InDetCalDbTool = TRT_CalDbTool(name="TRT_CalDbTool") from TRT_ConditionsServices.TRT_ConditionsServicesConf import TRT_StrawStatusSummaryTool InDetStrawSummaryTool = TRT_StrawStatusSummaryTool(
#include("AthenaPoolCnvSvc/AthenaPool_jobOptions.py") import AthenaPoolCnvSvc.AthenaPool from AthenaSealSvc.AthenaSealSvcConf import AthenaSealSvc ServiceMgr += AthenaSealSvc(CheckDictionary=TRUE) from PoolSvc.PoolSvcConf import PoolSvc ServiceMgr += PoolSvc(DbOpen="update") #from OutputStreamAthenaPool.OutputStreamAthenaPoolConf import AthenaPoolOutputStreamTool #CondStreamPixelDCSTest = AthenaPoolOutputStreamTool("CondStreamPixelDCSTest",OutputFile = "SimplePoolFile.root",OutputLevel = DEBUG) from AthenaServices.AthenaServicesConf import AthenaOutputStreamTool CondStreamPixelDCSTest = AthenaOutputStreamTool( "CondStreamPixelDCSTest", OutputFile="SimplePoolFile.root", OutputLevel=MyOutPut) ToolSvc += CondStreamPixelDCSTest from PixelConditionsTools.PixelConditionsToolsConf import PixelDCSTool ToolSvc += PixelDCSTool( OutputLevel=MyOutPut, RegisterCallback=False, TemperatureFolder="/PIXEL/DCS/TEMPERATURE", HVFolder="/PIXEL/DCS/HV", FSMStatusFolder="/PIXEL/DCS/FSMSTATUS", FSMStateFolder="/PIXEL/DCS/FSMSTATE", WriteDefault=FALSE, Temperature=TRUE,
include("RegistrationServices/RegistrationServices_jobOptions.py") myOCAHT=OutputConditionsAlg(outputFile=outputFileHT,name="myOCAHT") myOCAHT.ObjectList=objectListHT myOCAHT.IOVTagList=tagListHT myOCAHT.Run1=0 myOCAHT.LB1=0 myOCAHT.Run2=2147483647 myOCAHT.LB2=0 myOCAHT.WriteIOV=True topSequence+=myOCAHT from AthenaServices.AthenaServicesConf import AthenaOutputStreamTool TRTCondStream=AthenaOutputStreamTool('myOCATool') TRTCondStream.PoolContainerPrefix='ConditionsTree' TRTCondStream=AthenaOutputStreamTool('myOCAPerTool') TRTCondStream.PoolContainerPrefix='ConditionsTree' TRTCondStream=AthenaOutputStreamTool('myOCAHTTool') TRTCondStream.PoolContainerPrefix='ConditionsTree' ToolSvc += TRTCondStream print TRTCondStream svcMgr = Service( "IOVRegistrationSvc" ) svcMgr.UseGlobalIOVForCollections = True
topSequence = AlgSequence() from AthenaCommon.AppMgr import ToolSvc #------------------------------------------------ # Alignment tools #------------------------------------------------ from InDetAlignGenTools.InDetAlignGenToolsConf import InDetAlignDBTool ToolSvc += InDetAlignDBTool() from TRT_ConditionsServices.TRT_ConditionsServicesConf import TRT_AlignDbSvc ServiceMgr += TRT_AlignDbSvc() # Needed for database-, Pool- and AlignableTransforms-Handling include("DetDescrCondAthenaPool/DetDescrCondAthenaPool_joboptions.py") from AthenaServices.AthenaServicesConf import AthenaOutputStreamTool InDetCondStream = AthenaOutputStreamTool(name="CondStream1", OutputFile=outFilename) ToolSvc += InDetCondStream printfunc(InDetCondStream) # To produced a local SQLite DB with new Alignment Parameters include("RegistrationServices/IOVRegistrationSvc_jobOptions.py") regSvc = Service("IOVRegistrationSvc") regSvc.RecreateFolders = False IOVDbSvc = Service("IOVDbSvc") IOVDbSvc.dbConnection = "sqlite://;schema=%s;dbname=OFLP200" % outdbFilename #------------------------------------------------ # InDetAlignCog algorithm #------------------------------------------------ from InDetAlignGenAlgs.InDetAlignGenAlgsConf import InDetAlignCog InDetAlignCog = InDetAlignCog(
def createOutputStream(streamName, fileName="", asAlg=False, noTag=False, eventInfoKey="EventInfo", decisionFilter="", trigNavThinningSvc=None): if trigNavThinningSvc is None: trigNavThinningSvc = _trigNavThinningSvcs.get(streamName, None) # define athena output stream writingTool = AthenaOutputStreamTool(streamName + "Tool") outputStream = AthenaOutputStream(streamName, WritingTool=writingTool, ItemList=["EventInfo#*"]) #outputStream.ItemList += [ "xAOD::EventInfo#*" ] outputStream.MetadataStore = svcMgr.MetaDataStore outputStream.MetadataItemList = [ "EventStreamInfo#" + streamName, "IOVMetaDataContainer#*" ] ## get a handle on the default top-level algorithm sequence from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() from AthenaCommon.AlgSequence import AthSequencer outSequence = AthSequencer("AthOutSeq") doTag = not noTag if doTag: if ('EventInfoTagBuilder/EventInfoTagBuilder' not in topSequence.getProperties()['Members']): key = "SimpleTag" # Tell tool to pick it up outputStream.WritingTool.AttributeListKey = key # build eventinfo attribute list from .OutputStreamAthenaPoolConf import EventInfoAttListTool, EventInfoTagBuilder EventInfoTagBuilder = EventInfoTagBuilder( AttributeList=key, EventInfoKey=eventInfoKey, FilterString=decisionFilter) from AthenaCommon.GlobalFlags import globalflags if globalflags.InputFormat() == 'bytestream': #No event-tag input in bytestream EventInfoTagBuilder.PropagateInput = False topSequence += EventInfoTagBuilder # decide where to put outputstream in sequencing if asAlg: outSequence += outputStream else: outSequence += outputStream if fileName != "": outputStream.OutputFile = fileName from .OutputStreamAthenaPoolConf import MakeEventStreamInfo streamInfoTool = MakeEventStreamInfo(streamName + "_MakeEventStreamInfo") streamInfoTool.Key = streamName streamInfoTool.EventInfoKey = eventInfoKey outputStream.HelperTools = [streamInfoTool] # Support for MT thinning. from AthenaServices.AthenaServicesConf import Athena__ThinningCacheTool tct = Athena__ThinningCacheTool('ThinningCacheTool_' + streamName, StreamName=streamName) if trigNavThinningSvc is not None: tct.TrigNavigationThinningSvc = trigNavThinningSvc outputStream.HelperTools += [tct] # Set the list of transient items based on what we know is in the transient # store. The output algorithm will then declare input dependencies # for objects which are both listed here and in the ItemList. # (We do it like this because ItemList is typically configured to include # everything which might possibly be output. If this gets cleaned up, # then we can remove this.) # Some builds don't include RecExConfig, so don't crash in that case. # FIXME: Rather than using ObjKeyStore, we could scan all algorithms # and look for write handles. try: tlist = [] from RecExConfig.ObjKeyStore import objKeyStore for typ, klist in objKeyStore['transient'].getProperties().items(): for k in klist: tlist.append(typ + '#' + k) outputStream.TransientItems += tlist except ImportError: pass return outputStream