Loading [MathJax]/extensions/tex2jax.js
 |
ATLAS Offline Software
|
◆ _getJSONFromMetadata()
Optional[dict[str,Any]] python.TriggerConfigAccess._getJSONFromMetadata |
( |
|
flags, |
|
|
|
key |
|
) |
| |
|
private |
Definition at line 105 of file TriggerConfigAccess.py.
106 if flags.Input.Format != Format.POOL:
107 raise RuntimeError(
"Cannot read trigger configuration (%s) from input type %s", key, flags.Input.Format)
108 from AthenaConfiguration.AutoConfigFlags
import GetFileMD
110 menu_json = metadata.get(key,
None)
111 if menu_json
is None:
112 menu_json = metadata.get(
'DataVector<xAOD::TriggerMenuJson_v1>_%s' % key,
None)
113 if menu_json
is None:
114 if key ==
'TriggerMenuJson_HLTMonitoring':
116 log.info(
"Trigger metadata with key 'TriggerMenuJson_HLTMonitoring' is not available in this file. This feature is currently being introduced.")
119 raise RuntimeError(
"Cannot read trigger configuration (%s) from input file metadata" % key)
◆ getBunchGroupSetAccess()
BunchGroupSetAccess python.TriggerConfigAccess.getBunchGroupSetAccess |
( |
|
flags = None | ) |
|
Definition at line 169 of file TriggerConfigAccess.py.
171 if tc[
"SOURCE"] ==
"FILE":
173 elif tc[
"SOURCE"] ==
"COOL":
174 """This is the case when reconstructing the data."""
175 if len(flags.Input.RunNumbers) == 0:
176 raise RuntimeError(
"No run number available in input metadata")
178 cfg = BunchGroupSetAccess( dbalias = keysFromCool[
"DB"], bgskey = keysFromCool[
'BGSK'] )
179 elif tc[
"SOURCE"] ==
"DB":
180 cfg = BunchGroupSetAccess( dbalias = tc[
"DBCONN"], bgskey = tc[
"BGSK"] )
181 elif tc[
"SOURCE"] ==
"INFILE":
182 if flags.Input.Format != Format.POOL:
183 raise RuntimeError(f
"Cannot read trigger configuration (Bunchgroup Set) from input type {flags.Input.Format}")
184 raise NotImplementedError(
"Python access to the trigger configuration (Bunchgroup Set) from in-file metadata not yet implemented")
186 raise RuntimeError(
"Unknown source of trigger configuration: %s" % tc[
"SOURCE"])
◆ getDBKeysFromMetadata()
Optional[dict[str, Any]] python.TriggerConfigAccess.getDBKeysFromMetadata |
( |
|
flags | ) |
|
Provides access to the database keys from the in-file metadata
Gets the database keys from the in-file metadata which are stored together with the json representation
If the keys are in the file, then usually SMK, L1PSK and HLTPSK are present.
The bunchgroupset is not stored in the metadata, so 0 is returned for the BGS key for completeness.
@returns: dictionary with the DB keys. Returns 'None' if information is not present.
Definition at line 81 of file TriggerConfigAccess.py.
82 """Provides access to the database keys from the in-file metadata
84 Gets the database keys from the in-file metadata which are stored together with the json representation
85 If the keys are in the file, then usually SMK, L1PSK and HLTPSK are present.
86 The bunchgroupset is not stored in the metadata, so 0 is returned for the BGS key for completeness.
88 @returns: dictionary with the DB keys. Returns 'None' if information is not present.
91 keys = metadata.get(
"TriggerConfigInfo",
None)
95 'SMK': keys[
'HLT'][
'key']
if 'HLT' in keys
else 0,
96 'L1PSK': keys[
'L1PS'][
'key']
if 'L1PS' in keys
else 0,
97 'HLTPSK': keys[
'HLTPS'][
'key']
if 'HLTPSK' in keys
else 0,
102 Returns a string-serialised JSON object from the metadata store.
103 Checks AOD syntax first, then fully-qualified ESD syntax
◆ getHLTJobOptionsAccess()
HLTJobOptionsAccess python.TriggerConfigAccess.getHLTJobOptionsAccess |
( |
|
flags = None | ) |
|
Definition at line 236 of file TriggerConfigAccess.py.
238 if tc[
"SOURCE"] ==
"FILE":
240 elif tc[
"SOURCE"] ==
"COOL":
241 """This is the case when reconstructing the data."""
242 if len(flags.Input.RunNumbers) == 0:
243 raise RuntimeError(
"No run number available in input metadata")
245 cfg = HLTJobOptionsAccess( dbalias = keysFromCool[
"DB"], smkey = keysFromCool[
'SMK'] )
246 elif tc[
"SOURCE"] ==
"DB":
247 cfg = HLTJobOptionsAccess( dbalias = tc[
"DBCONN"], smkey = tc[
"SMK"] )
248 elif tc[
"SOURCE"] ==
"INFILE":
249 raise NotImplementedError(
"Python access to the HLT Job Options configuration from in-file metadata is NOT SUPPORTED (this file is huge!)")
251 raise RuntimeError(
"Unknown source of trigger configuration: %s" % tc[
"SOURCE"])
◆ getHLTMenuAccess()
HLTMenuAccess python.TriggerConfigAccess.getHLTMenuAccess |
( |
|
flags = None | ) |
|
Definition at line 196 of file TriggerConfigAccess.py.
198 if tc[
"SOURCE"] ==
"FILE":
200 elif tc[
"SOURCE"] ==
"COOL":
201 """This is the case when reconstructing the data."""
202 if len(flags.Input.RunNumbers) == 0:
203 raise RuntimeError(
"No run number available in input metadata")
205 cfg = HLTMenuAccess( dbalias = keysFromCool[
"DB"], smkey = keysFromCool[
'SMK'] )
206 elif tc[
"SOURCE"] ==
"DB":
207 cfg = HLTMenuAccess( dbalias = tc[
"DBCONN"], smkey = tc[
"SMK"] )
208 elif tc[
"SOURCE"] ==
"INFILE":
211 raise RuntimeError(
"Unknown source of trigger configuration: %s" % tc[
"SOURCE"])
◆ getHLTMonitoringAccess()
HLTMonitoringAccess python.TriggerConfigAccess.getHLTMonitoringAccess |
( |
|
flags = None | ) |
|
Definition at line 256 of file TriggerConfigAccess.py.
258 if tc[
"SOURCE"] ==
"FILE":
260 elif tc[
"SOURCE"] ==
"COOL":
261 """This is the case when reconstructing the data."""
262 if len(flags.Input.RunNumbers) == 0:
263 raise RuntimeError(
"No run number available in input metadata")
265 cfg = HLTMonitoringAccess( dbalias = keysFromCool[
"DB"], smkey = keysFromCool[
'SMK'] )
266 elif tc[
"SOURCE"] ==
"DB":
267 cfg = HLTMonitoringAccess( dbalias = tc[
"DBCONN"], smkey = tc[
"SMK"] )
268 elif tc[
"SOURCE"] ==
"INFILE":
270 if jsonHLTMon
is not None:
271 cfg = HLTMonitoringAccess(jsonString=jsonHLTMon)
274 smkey = keysFromInfileMD[
'SMK']
if keysFromInfileMD
is not None else 0
275 if smkey < 3000
and not flags.Input.isMC:
277 log.info(
"Trigger metadata with key 'TriggerMenuJson_HLTMonitoring' is not available for Run 2 data. Returning empty dummy.")
278 jsonHLTMon =
'{"filetype": "hltmonitoringsummary","name": "EmptyDefault", "signatures": {}}'
279 cfg = HLTMonitoringAccess(jsonString=jsonHLTMon)
283 log.info(
"Falling back on reading the HLTMonitoring from the TRIGGERDB_RUN3 for SMK %i.", smkey)
284 cfg = HLTMonitoringAccess( dbalias =
"TRIGGERDB_RUN3", smkey = smkey )
287 log.info(
"Trigger HLTMonitoring is not available for SMK %i. Returning empty dummy.", smkey)
288 jsonHLTMon =
'{"filetype": "hltmonitoringsummary","name": "EmptyDefault", "signatures": {}}'
289 cfg = HLTMonitoringAccess(jsonString=jsonHLTMon)
292 raise RuntimeError(
"Unknown source of trigger configuration: %s" % tc[
"SOURCE"])
◆ getHLTPrescalesSetAccess()
HLTPrescalesSetAccess python.TriggerConfigAccess.getHLTPrescalesSetAccess |
( |
|
flags = None | ) |
|
Definition at line 216 of file TriggerConfigAccess.py.
218 if tc[
"SOURCE"] ==
"FILE":
220 elif tc[
"SOURCE"] ==
"COOL":
221 """This is the case when reconstructing the data."""
222 if len(flags.Input.RunNumbers) == 0:
223 raise RuntimeError(
"No run number available in input metadata")
225 cfg = HLTPrescalesSetAccess( dbalias = keysFromCool[
"DB"], hltpskey = keysFromCool[
'HLTPSK'] )
226 elif tc[
"SOURCE"] ==
"DB":
227 cfg = HLTPrescalesSetAccess( dbalias = tc[
"DBCONN"], hltpskey = tc[
"HLTPSK"] )
228 elif tc[
"SOURCE"] ==
"INFILE":
229 cfg = HLTPrescalesSetAccess(jsonString=
_getJSONFromMetadata(flags, key=
'TriggerMenuJson_HLTPS'))
231 raise RuntimeError(
"Unknown source of trigger configuration: %s" % tc[
"SOURCE"])
◆ getKeysFromCool()
dict[str,int] python.TriggerConfigAccess.getKeysFromCool |
( |
int |
runNr, |
|
|
int |
lbNr = 0 |
|
) |
| |
Return dictionary of trigger keys for given run and lumiblock number
Definition at line 52 of file TriggerConfigAccess.py.
53 """Return dictionary of trigger keys for given run and lumiblock number
55 from TrigConfStorage.TriggerCoolUtil
import TriggerCoolUtil
56 condb =
"CONDBR2" if runNr > 236108
else "COMP200"
57 db = TriggerCoolUtil.GetConnection(condb)
58 run_range = [[runNr,runNr]]
59 d = { k: TriggerCoolUtil.getHLTConfigKeys(db, run_range)[runNr][k]
for k
in [
'SMK',
'DB'] }
60 for ( key, lbfirst, lblast)
in TriggerCoolUtil.getBunchGroupKey(db, run_range)[runNr][
'BGKey']:
61 if lbNr>=lbfirst
and (lbNr<=lblast
or lblast==-1):
64 for ( key, lbfirst, lblast)
in TriggerCoolUtil.getL1ConfigKeys(db, run_range)[runNr][
'LVL1PSK']:
65 if lbNr>=lbfirst
and (lbNr<=lblast
or lblast==-1):
68 for ( key, lbfirst, lblast)
in TriggerCoolUtil.getHLTPrescaleKeys(db, run_range)[runNr][
'HLTPSK2']:
69 if lbNr>=lbfirst
and (lbNr<=lblast
or lblast==-1):
74 dbaliasMapping = {
"TRIGGERDBR2R" :
"TRIGGERDB",
75 "TRIGGERDBV2" :
"TRIGGERDB_RUN1" }
76 if d[
"DB"]
in dbaliasMapping:
77 d[
"DB"] = dbaliasMapping[ d[
"DB"] ]
◆ getL1MenuAccess()
L1MenuAccess python.TriggerConfigAccess.getL1MenuAccess |
( |
|
flags = None | ) |
|
Definition at line 129 of file TriggerConfigAccess.py.
131 if tc[
"SOURCE"] ==
"FILE":
133 elif tc[
"SOURCE"] ==
"COOL":
134 """This is the case when reconstructing the data."""
135 if len(flags.Input.RunNumbers) == 0:
136 raise RuntimeError(
"No run number available in input metadata")
138 cfg = L1MenuAccess( dbalias = keysFromCool[
"DB"], smkey = keysFromCool[
'SMK'] )
139 elif tc[
"SOURCE"] ==
"DB":
140 cfg = L1MenuAccess( dbalias = tc[
"DBCONN"], smkey = tc[
"SMK"] )
141 elif tc[
"SOURCE"] ==
"INFILE":
144 raise RuntimeError(
"Unknown source of trigger configuration: %s" % tc[
"SOURCE"])
◆ getL1PrescalesSetAccess()
L1PrescalesSetAccess python.TriggerConfigAccess.getL1PrescalesSetAccess |
( |
|
flags = None | ) |
|
Definition at line 149 of file TriggerConfigAccess.py.
151 if tc[
"SOURCE"] ==
"FILE":
153 elif tc[
"SOURCE"] ==
"COOL":
154 """This is the case when reconstructing the data."""
155 if len(flags.Input.RunNumbers) == 0:
156 raise RuntimeError(
"No run number available in input metadata")
158 cfg = L1PrescalesSetAccess( dbalias = keysFromCool[
"DB"], l1pskey = keysFromCool[
'L1PSK'] )
159 elif tc[
"SOURCE"] ==
"DB":
160 cfg = L1PrescalesSetAccess( dbalias = tc[
"DBCONN"], l1pskey = tc[
"L1PSK"] )
161 elif tc[
"SOURCE"] ==
"INFILE":
164 raise RuntimeError(
"Unknown source of trigger configuration: %s" % tc[
"SOURCE"])
◆ log
python.TriggerConfigAccess.log |
◆ maxsize
python.TriggerConfigAccess.maxsize |
def GetFileMD(filenames, allowEmpty=True, maxLevel='peeker')
def getHLTMenuFileName(flags)
HLTMonitoringAccess getHLTMonitoringAccess(flags=None)
def getTrigConfigFromFlag(flags)
def getL1MenuFileName(flags)
def getHLTJobOptionsFileName()
def getBunchGroupSetFileName(flags)
def getL1PrescalesSetFileName(flags)
L1MenuAccess getL1MenuAccess(flags=None)
HLTPrescalesSetAccess getHLTPrescalesSetAccess(flags=None)
Optional[dict[str, Any]] getDBKeysFromMetadata(flags)
L1PrescalesSetAccess getL1PrescalesSetAccess(flags=None)
def getHLTMonitoringFileName(flags)
HLTJobOptionsAccess getHLTJobOptionsAccess(flags=None)
HLTMenuAccess getHLTMenuAccess(flags=None)
Optional[dict[str, Any]] _getJSONFromMetadata(flags, key)
BunchGroupSetAccess getBunchGroupSetAccess(flags=None)
dict[str, int] getKeysFromCool(int runNr, int lbNr=0)
def getHLTPrescalesSetFileName(flags)