ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetCalibAlgs
SCT_CalibAlgs
python
runInfo.py
Go to the documentation of this file.
1
#!/bin/env python
2
3
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
4
5
import
os,sys
6
from
PyCool
import
cool
7
8
from
CoolRunQuery.utils.AtlRunQueryLookup
import
InitDetectorMaskDecoder
9
10
def
main
( runNum=None, projectName='' ):
11
if
runNum
is
None
:
12
print
(
'ERROR no runNumber given'
)
13
sys.exit(-1)
14
15
if
projectName ==
''
:
16
print
(
'ERROR no projectName given'
)
17
sys.exit(-1)
18
19
year=int(projectName[4:6])
20
21
print
(
'runInfo from python folder'
)
22
since = ( runNum << 32 )
23
until = ( (runNum+1) << 32 )-1
24
dbSvc = cool.DatabaseSvcFactory.databaseService()
25
#load COMP200 or CONDBR2 depending on date A.Gascon 2014-12-08
26
27
if
os.path.exists(
"/afs/cern.ch/work/s/sctcalib/CondReadPwd"
) :
28
pwdinfo = open(
'/afs/cern.ch/work/s/sctcalib/CondReadPwd'
,
'r'
).
read
()
29
pwdinfolist = pwdinfo.split(
' '
)
30
pwd = pwdinfolist[0]
31
else
:
32
print
(
'ERROR : unable to open pwd file'
)
33
sys.exit(-1)
34
35
if
(year > 13):
36
RunCtrlDB =
'oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_TDAQ;dbname=CONDBR2;user=ATLAS_COOL_READER;password='
+pwd
37
else
:
38
RunCtrlDB =
'oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_TDAQ;dbname=COMP200;user=ATLAS_COOL_READER;password='
+pwd
39
40
try
:
41
RunCtrlDb = dbSvc.openDatabase( RunCtrlDB )
42
except
Exception
as
e:
43
print
(
'Problem opening database'
, e)
44
sys.exit(-1)
45
46
folder_runCtrl = RunCtrlDb.getFolder(
'/TDAQ/RunCtrl/EOR'
)
47
chList = folder_runCtrl.listChannels()
48
if
not
chList:
49
print
(
'ERROR : no data in /TDAQ/RunCtrl/EOR'
)
50
51
for
Id
in
chList:
52
53
objs = folder_runCtrl.browseObjects( since, until, cool.ChannelSelection(Id) )
54
for
obj
in
objs:
55
payl = obj.payload()
56
#print(payl)
57
RunNumber = payl[
'RunNumber'
]
58
SORTime = payl[
'SORTime'
]
59
EORTime = payl[
'EORTime'
]
60
iovstart = obj.since()
61
iovend = obj.until()
62
nLB = iovend - ( iovstart + 1 )
63
ProjectTag = payl[
'T0ProjectTag'
]
64
DetectorMask = payl[
'DetectorMask'
]
65
objs.close()
66
break
67
RunCtrlDb.closeDatabase()
68
69
ts1 = SORTime/1000000000
70
ts2 = EORTime/1000000000
71
72
#--- Detector mask
73
mask= int (DetectorMask,16)
74
75
if
(year < 12):
76
dName, NotInAll, vetoedbits = InitDetectorMaskDecoder( 1 )
77
elif
(year < 21):
78
dName, NotInAll, vetoedbits = InitDetectorMaskDecoder( 2 )
79
else
:
80
dName, NotInAll, vetoedbits = InitDetectorMaskDecoder( 3 )
81
82
res=
''
83
found =
False
84
for
i
in
range(64):
85
if
( mask & (1 << i) ) :
86
if
"SCT BA"
in
dName[i] :
87
found =
True
88
res +=
"SCTBA,"
89
if
"SCT BC"
in
dName[i] :
90
found =
True
91
res +=
"SCTBC,"
92
if
"SCT EA"
in
dName[i] :
93
found =
True
94
res +=
"SCTEA,"
95
if
"SCT EC"
in
dName[i] :
96
found =
True
97
res +=
"SCTEC,"
98
99
if
found:
100
if
len(res)>1:
101
res = res[:-1]
102
else
:
103
res +=
'NONE'
104
105
#print(RunNumber, ProjectTag, ts1, ts2, nLB, res)
106
fw = open(
'runInfo.txt'
,
'w'
)
107
fw.write( str(RunNumber) +
' '
+ str(ProjectTag) +
' '
+ str(ts1) +
' '
+ str(ts2) +
' '
+ str(nLB) +
' '
+ res )
108
fw.close()
109
110
if
__name__ ==
"__main__"
:
111
try
:
112
runNumber = int( sys.argv[1] )
113
except
Exception:
114
print
(
"run number %s could not be converted to int"
%(sys.argv[1]))
115
sys.exit(-1)
116
117
main
(runNum = runNumber)
print
void print(char *figname, TCanvas *c1)
Definition
TRTCalib_StrawStatusPlots.cxx:26
main
int main()
Definition
hello.cxx:18
read
IovVectorMap_t read(const Folder &theFolder, const SelectionCriterion &choice, const unsigned int limit=10)
Definition
openCoraCool.cxx:569
Generated on
for ATLAS Offline Software by
1.17.0