ATLAS Offline Software
BunchCrossingAverageCondAlgTest.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2 
3 from AthenaConfiguration.ComponentFactory import CompFactory
4 from LumiBlockComps.BunchCrossingAverageCondAlgConfig import BunchCrossingAverageCondAlgCfg
5 from IOVDbSvc.IOVDbSvcConfig import IOVDbSvcCfg
6 from LumiBlockComps.dummyLHCFillDB import createSqliteForAvg,fillFolderForAvg,createBCMask1,createBCMask2
7 import os
8 
9 
10 
11 #First, create a dummy database to work with:
12 #Delete any previous instance, if there is any:
13 try:
14  os.remove("testAVG.db")
15 except OSError:
16  pass
17 
18 
19 db,folder=createSqliteForAvg("testAVG.db",folderName="/TDAQ/OLC/LHC/LBDATA3")
22 
23 onesec=1000000000
24 #Add two dummy masks with iov 2-3 and 3-4
25 fillFolderForAvg(folder,d1,iovMin=1*onesec,iovMax=2*onesec)
26 fillFolderForAvg(folder,d2,2*onesec,4*onesec)
27 
28 db.closeDatabase()
29 
30 from AthenaConfiguration.AllConfigFlags import initConfigFlags
31 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
32 flags = initConfigFlags()
33 flags.Input.Files=[]
34 flags.Input.isMC=False
35 flags.IOVDb.DatabaseInstance="CONDBR2"
36 flags.IOVDb.GlobalTag="CONDBR2-BLKPA-2017-05"
37 from AthenaConfiguration.TestDefaults import defaultGeometryTags
38 flags.GeoModel.AtlasVersion=defaultGeometryTags.RUN2
39 flags.lock()
40 result=MainServicesCfg(flags)
41 
42 from McEventSelector.McEventSelectorConfig import McEventSelectorCfg
43 #The time stamp correspond to: Wednesday 10 August 2024 22:26:00 (Run 430897)
44 result.merge(McEventSelectorCfg(flags,
45  RunNumber=430897,
46  EventsPerRun=1,
47  FirstEvent=1183722158,
48  FirstLB=310,
49  EventsPerLB=1,
50  InitialTimeStamp=1,
51  TimeStampInterval=1))
52 
53 result.merge(BunchCrossingAverageCondAlgCfg(flags))
54 result.merge(IOVDbSvcCfg(flags))
55 result.getService("IOVDbSvc").Folders=["<db>sqlite://;schema=testAVG.db;dbname=CONDBR2</db><tag>HEAD</tag>/TDAQ/OLC/LHC/LBDATA3"]
56 result.getCondAlgo("BunchCrossingAverageCondAlgDefault").OutputLevel=1
57 BunchCrossingAverageCondTest=CompFactory.BunchCrossingAverageCondTest
58 result.addEventAlgo(BunchCrossingAverageCondTest(FileName="BCAvgData.txt"))
59 result.run(1)
python.BunchCrossingCondAlgTest.createBCMask1
def createBCMask1()
Definition: BunchCrossingCondAlgTest.py:12
python.BunchCrossingAverageCondAlgConfig.BunchCrossingAverageCondAlgCfg
def BunchCrossingAverageCondAlgCfg(flags)
Definition: BunchCrossingAverageCondAlgConfig.py:9
python.BunchCrossingCondAlgTest.createBCMask2
def createBCMask2()
Definition: BunchCrossingCondAlgTest.py:32
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
python.McEventSelectorConfig.McEventSelectorCfg
def McEventSelectorCfg(flags, **kwargs)
Definition: McEventSelectorConfig.py:5
python.dummyLHCFillDB.fillFolderForAvg
def fillFolderForAvg(folder, data=[], iovMin=cool.ValidityKeyMin, iovMax=cool.ValidityKeyMax)
Definition: dummyLHCFillDB.py:164
python.dummyLHCFillDB.createSqliteForAvg
def createSqliteForAvg(sqliteName, folderName="/TDAQ/OLC/LHC/LBDATA3")
Definition: dummyLHCFillDB.py:43
python.IOVDbSvcConfig.IOVDbSvcCfg
def IOVDbSvcCfg(flags, **kwargs)
Definition: IOVDbSvcConfig.py:28
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
BunchCrossingAverageCondTest
Definition: BunchCrossingAverageCondTest.h:18