ATLAS Offline Software
Trigger
TrigAnalysis
TrigInDetAnalysisUser
share
TIDAparseGRL.py
Go to the documentation of this file.
1
#!/usr/bin/env python
2
3
__author__ =
"Callum Kilby"
4
5
import
sys
6
import
getopt
7
8
def
main
(filePath) :
9
"""A script that takes in and parses a GRL xml file, and outputs a list of good lumi blocks.
10
The lines are formatted: RUNNUMBER, STARTLUMIBLOCK, ENDLUMIBLOCK."""
11
GRLlist =
open
(filePath)
12
runNum = 0
13
for
line
in
GRLlist :
14
if
'<Run>'
in
line :
15
splitLine = line.split(
'<Run>'
)
16
splitLine = splitLine[1].
split
(
'</Run>'
)
17
runNum = splitLine[0]
18
19
if
'<LBRange Start="'
in
line :
20
line = line.replace(
'<LBRange Start="'
, runNum+
', '
)
21
line = line.replace(
'" End="'
,
', '
)
22
line = line.replace(
'"/>'
,
''
)
23
line = line.strip()
24
print
line
25
26
if
__name__ ==
"__main__"
:
27
usage =
"Usage: parseGRL.py [-h] <pathToGRLxmlFile>"
28
usage +=
"\n-h --help\tprints this help message"
29
30
try
:
31
opts, args = getopt.getopt(sys.argv[1:],
'h'
, [
'help'
])
32
except
getopt.GetoptError:
33
print
usage
34
sys.exit()
35
36
if
args == []:
37
print
usage
38
sys.exit()
39
40
for
opt, arg
in
opts :
41
if
opt == (
'-h'
or
'--help'
) :
42
print
usage
43
sys.exit()
44
45
filePathIn = args[0]
46
main
(filePathIn)
TIDAparseGRL.main
def main(filePath)
Definition:
TIDAparseGRL.py:8
Trk::open
@ open
Definition:
BinningType.h:40
Trk::split
@ split
Definition:
LayerMaterialProperties.h:38
Generated on Sat Jan 4 2025 21:19:16 for ATLAS Offline Software by
1.8.18