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