ATLAS Offline Software
Loading...
Searching...
No Matches
BunchCrossingCondAlgTest.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.BunchCrossingCondAlgConfig import BunchCrossingCondAlgCfg
5from AthenaConfiguration.Enums import BunchStructureSource
6from IOVDbSvc.IOVDbSvcConfig import IOVDbSvcCfg
7from LumiBlockComps.dummyLHCFillDB import createSqlite,fillFolder
8
9import os
10import sys
11
13 mask=[]
14 #pre-fill with zero
15 for i in range(0,3564):
16 mask.append(0x0)
17
18 #A train across the wrap-around:
19 for i in range (0,25):
20 mask[i]=0x3
21
22 for i in range (3550,3564):
23 mask[i]=0x3
24
25 #A short sequence of bunches that doesn't qualify as train
26 for i in range (1000,1030):
27
28 mask[i]=0x3
29 return mask
30
31
33 mask=[]
34 #pre-fill with zero
35 for i in range(0,3564):
36 mask.append(0x0)
37
38 t8b4e=[0x3,0x3,0x3,0x3, 0x3,0x3,0x3,0x3, 0x0,0x0,0x0,0x0]
39
40 for i in range(0,20):
41 #create a train of 20 8be4 groups start
42 mask[100+i*12:100+(i+1)*12]=t8b4e
43
44 return mask
45
46
47#First, create a dummy database to work with:
48
49#Delete any previous instance, if there is any:
50try:
51 os.remove("test.db")
52except OSError:
53 pass
54
55#Copy the standard db content for one run (330470, LB301) to IOV 1 - 2
56copycmd='AtlCoolCopy "COOLONL_TDAQ/CONDBR2" "sqlite://;schema=test.db;dbname=CONDBR2" -c -f /TDAQ/OLC/LHC/FILLPARAMS -ts 1500867637 -tu 1500867638 -a -nts 0 -ntu 2'
57
58from subprocess import getstatusoutput
59stat,out=getstatusoutput(copycmd)
60
61if (stat):
62 print(out)
63 sys.exit(-1)
64
65db,folder=createSqlite("test.db")
66
69
70onesec=1000000000
71
72#Add two dummy masks with iov 2-3 and 3-4
73fillFolder(folder,d1,iovMin=2*onesec,iovMax=3*onesec)
74fillFolder(folder,d2,3*onesec,4*onesec)
75
76db.closeDatabase()
77
78from AthenaConfiguration.AllConfigFlags import initConfigFlags
79from AthenaConfiguration.MainServicesConfig import MainServicesCfg
80flags = initConfigFlags()
81flags.Input.Files=[]
82flags.Input.isMC=False
83flags.Beam.BunchStructureSource=BunchStructureSource.FILLPARAMS
84flags.IOVDb.DatabaseInstance="CONDBR2"
85flags.IOVDb.GlobalTag="CONDBR2-BLKPA-2017-05"
86from AthenaConfiguration.TestDefaults import defaultGeometryTags
87flags.GeoModel.AtlasVersion=defaultGeometryTags.RUN2
88flags.lock()
89
90result=MainServicesCfg(flags)
91
92from McEventSelector.McEventSelectorConfig import McEventSelectorCfg
93result.merge(McEventSelectorCfg(flags,
94 RunNumber=330470,
95 EventsPerRun=1,
96 FirstEvent=1183722158,
97 FirstLB=310,
98 EventsPerLB=1,
99 #InitialTimeStamp=1500867637,
100 InitialTimeStamp=1,
101 TimeStampInterval=1))
102
103result.merge(BunchCrossingCondAlgCfg(flags))
104
105print(flags.Beam.BunchStructureSource)
106result.merge(IOVDbSvcCfg(flags))
107result.getService("IOVDbSvc").Folders=["<db>sqlite://;schema=test.db;dbname=CONDBR2</db><tag>HEAD</tag>/TDAQ/OLC/LHC/FILLPARAMS"]
108result.getCondAlgo("BunchCrossingCondAlgDefault").OutputLevel=1
109
110BunchCrossingCondTest=CompFactory.BunchCrossingCondTest
111result.addEventAlgo(BunchCrossingCondTest(FileName="BCData.txt",compact=True))
112
113#result.setDebugStage("exec")
114
115result.run(3)
void print(char *figname, TCanvas *c1)