ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
LumiBlock
LumiBlockComps
python
BunchCrossingCondAlgTest.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.BunchCrossingCondAlgConfig
import
BunchCrossingCondAlgCfg
5
from
AthenaConfiguration.Enums
import
BunchStructureSource
6
from
IOVDbSvc.IOVDbSvcConfig
import
IOVDbSvcCfg
7
from
LumiBlockComps.dummyLHCFillDB
import
createSqlite,fillFolder
8
9
import
os
10
import
sys
11
12
def
createBCMask1
():
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
32
def
createBCMask2
():
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:
50
try
:
51
os.remove(
"test.db"
)
52
except
OSError:
53
pass
54
55
#Copy the standard db content for one run (330470, LB301) to IOV 1 - 2
56
copycmd=
'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
58
from
subprocess
import
getstatusoutput
59
stat,out=getstatusoutput(copycmd)
60
61
if
(stat):
62
print
(out)
63
sys.exit(-1)
64
65
db,folder=createSqlite(
"test.db"
)
66
67
d1=
createBCMask1
()
68
d2=
createBCMask2
()
69
70
onesec=1000000000
71
72
#Add two dummy masks with iov 2-3 and 3-4
73
fillFolder(folder,d1,iovMin=2*onesec,iovMax=3*onesec)
74
fillFolder(folder,d2,3*onesec,4*onesec)
75
76
db.closeDatabase()
77
78
from
AthenaConfiguration.AllConfigFlags
import
initConfigFlags
79
from
AthenaConfiguration.MainServicesConfig
import
MainServicesCfg
80
flags = initConfigFlags()
81
flags.Input.Files=[]
82
flags.Input.isMC=
False
83
flags.Beam.BunchStructureSource=BunchStructureSource.FILLPARAMS
84
flags.IOVDb.DatabaseInstance=
"CONDBR2"
85
flags.IOVDb.GlobalTag=
"CONDBR2-BLKPA-2017-05"
86
from
AthenaConfiguration.TestDefaults
import
defaultGeometryTags
87
flags.GeoModel.AtlasVersion=defaultGeometryTags.RUN2
88
flags.lock()
89
90
result=MainServicesCfg(flags)
91
92
from
McEventSelector.McEventSelectorConfig
import
McEventSelectorCfg
93
result.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
103
result.merge(BunchCrossingCondAlgCfg(flags))
104
105
print
(flags.Beam.BunchStructureSource)
106
result.merge(IOVDbSvcCfg(flags))
107
result.getService(
"IOVDbSvc"
).Folders=[
"<db>sqlite://;schema=test.db;dbname=CONDBR2</db><tag>HEAD</tag>/TDAQ/OLC/LHC/FILLPARAMS"
]
108
result.getCondAlgo(
"BunchCrossingCondAlgDefault"
).OutputLevel=1
109
110
BunchCrossingCondTest=CompFactory.BunchCrossingCondTest
111
result.addEventAlgo(
BunchCrossingCondTest
(FileName=
"BCData.txt"
,compact=
True
))
112
113
#result.setDebugStage("exec")
114
115
result.run(3)
print
void print(char *figname, TCanvas *c1)
Definition
TRTCalib_StrawStatusPlots.cxx:26
BunchCrossingCondTest
Definition
BunchCrossingCondTest.h:18
python.BunchCrossingCondAlgTest.createBCMask1
createBCMask1()
Definition
BunchCrossingCondAlgTest.py:12
python.BunchCrossingCondAlgTest.createBCMask2
createBCMask2()
Definition
BunchCrossingCondAlgTest.py:32
Generated on
for ATLAS Offline Software by
1.17.0