ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigMonitoring
TrigInDetMonitoring
python
TIDAChains.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
2
3
# access the list of configured chains and expand the analysis chains
4
# to be actual configued entries
5
6
7
# get the list of configured chains matching the regex
8
# input parameter
9
10
# NB: All these trigger chains start with "HLT_", so the getchains function
11
# will try to match with "HLT_xxx" first and if that doesn't match
12
# it will then try "EF_xxx" At some point, when we are mostly dealing with
13
# chains, we can swap them round.
14
15
16
import
re
17
18
19
# get a chain configuration of the form "some_regex:key=Track:vtx=Vertex" etc
20
# parse to determine the trigger chain pattern, determine the chains
21
# matching the pattern, then recreate the full analysis string using all the
22
# matched chains - can take an individual analysis pattern, or a list of them
23
24
def
getchains
( flags, analyses, monlevel=None ):
25
26
if
isinstance( analyses, list ):
27
a = analyses
28
else
:
29
a = [ analyses ]
30
31
chains = []
32
33
for
analysis
in
a:
34
if
":"
in
analysis:
35
36
parts = analysis.split(
":"
, 1 )
37
cchains =
getconfiguredchains
( flags, parts[0], monlevel )
38
39
for
c
in
cchains:
40
if
parts[1]
is
not
None
:
41
chain = c +
":"
+ parts[1]
42
else
:
43
chain = c
44
45
if
chain
not
in
chains:
46
chains.append( chain )
47
48
return
chains
49
50
51
52
53
def
getconfiguredchains
( flags, regex, monlevel=None ):
54
if
monlevel
is
None
:
55
return
_getconfiguredchains
( flags, regex )
56
else
:
57
return
_getmonchains
( flags, regex, monlevel )
58
59
60
61
# cached full chain list
62
63
_chains =
None
64
65
def
_getconfiguredchains
( flags, regex ):
66
67
r = regex
68
69
r1 =
None
70
if
regex.startswith(
"HLT"
) : r1 =
"EF"
+regex[3:]
71
72
global
_chains
73
74
if
_chains
is
None
:
75
# from datetime import datetime
76
# print( datetime.now(), "getting trigger configuration" )
77
78
from
TrigConfigSvc.TriggerConfigAccess
import
getHLTMenuAccess
79
80
if
flags
is
None
:
81
82
from
AthenaConfiguration.AllConfigFlags
import
ConfigFlags
83
flags = ConfigFlags
84
85
_chains = getHLTMenuAccess( flags )
86
87
# print( datetime.now(), "configured chains: ", len(_chains) )
88
89
chains = []
90
for
c
in
_chains:
91
if
re.fullmatch(r,c)
or
(r1
and
re.fullmatch(r1,c) ): chains.append(c)
92
93
return
chains
94
95
96
97
def
_getmonchains
( flags, regex, monlevel=None ):
98
99
r = regex
100
r1 =
None
101
if
regex.startswith(
"HLT"
) : r1 =
"EF"
+regex[3:]
102
103
chains = []
104
105
if
monlevel
is
None
:
106
return
chains
107
108
parts = monlevel.split(
":"
, 1 )
109
110
if
parts[0]
is
None
:
111
return
chains
112
113
if
parts[1]
is
None
:
114
return
chains
115
116
sig = parts[0]
117
levels = parts[1].
split
(
":"
)
118
119
_monchains =
None
120
121
if
_monchains
is
None
:
122
123
# from datetime import datetime
124
# print( datetime.now(), "getting trigger configuration" )
125
126
from
TrigConfigSvc.TriggerConfigAccess
import
getHLTMonitoringAccess
127
128
if
flags
is
None
:
129
from
AthenaConfiguration.AllConfigFlags
import
ConfigFlags
130
flags = ConfigFlags
131
132
moniAccess = getHLTMonitoringAccess(flags, filterOnActiveChains=
True
)
133
134
_monchains = moniAccess.monitoredChains( signatures=sig, monLevels=levels )
135
136
# print( datetime.now(), "configured chains: ", len(_monchains) )
137
138
for
c
in
_monchains:
139
if
re.fullmatch(r,c)
or
(r1
and
re.fullmatch(r1,c)) : chains.append(c)
140
141
return
chains
142
143
split
std::vector< std::string > split(const std::string &s, const std::string &t=":")
Definition
hcg.cxx:179
python.TIDAChains._getconfiguredchains
_getconfiguredchains(flags, regex)
Definition
TIDAChains.py:65
python.TIDAChains._getmonchains
_getmonchains(flags, regex, monlevel=None)
Definition
TIDAChains.py:97
python.TIDAChains.getconfiguredchains
getconfiguredchains(flags, regex, monlevel=None)
Definition
TIDAChains.py:53
python.TIDAChains.getchains
getchains(flags, analyses, monlevel=None)
Definition
TIDAChains.py:24
Generated on
for ATLAS Offline Software by
1.17.0