 |
ATLAS Offline Software
|
|
| dict[str, str|int] | getKeysFromConditions (int runNr, int lbNr, flags) |
| |
| dict[str, str|int] | getKeysFromCrest (int runNr, int lbNr, str crest_server) |
| |
| dict[str, str|int] | getKeysFromCool (int runNr, int lbNr=0) |
| |
| Optional[dict[str, Any]] | getDBKeysFromMetadata (flags) |
| |
| Optional[dict[str, Any]] | _getJSONFromMetadata (flags, key) |
| |
| L1MenuAccess | getL1MenuAccess (flags) |
| |
| L1PrescalesSetAccess | getL1PrescalesSetAccess (flags) |
| |
| BunchGroupSetAccess | getBunchGroupSetAccess (flags) |
| |
| HLTMenuAccess | getHLTMenuAccess (flags) |
| |
| HLTPrescalesSetAccess | getHLTPrescalesSetAccess (flags) |
| |
| HLTJobOptionsAccess | getHLTJobOptionsAccess (flags) |
| |
| HLTMonitoringAccess | getHLTMonitoringAccess (flags=None, filterOnActiveChains=False) |
| |
◆ _getJSONFromMetadata()
| Optional[dict[str,Any]] python.TriggerConfigAccess._getJSONFromMetadata |
( |
|
flags, |
|
|
|
key |
|
) |
| |
|
private |
Definition at line 112 of file TriggerConfigAccess.py.
113 if flags.Input.Format != Format.POOL:
114 raise RuntimeError(
"Cannot read trigger configuration (%s) from input type %s", key, flags.Input.Format)
115 from AthenaConfiguration.AutoConfigFlags
import GetFileMD
117 menu_json = metadata.get(key,
None)
118 if menu_json
is None:
119 menu_json = metadata.get(
'DataVector<xAOD::TriggerMenuJson_v1>_%s' % key,
None)
120 if menu_json
is None:
121 if key ==
'TriggerMenuJson_HLTMonitoring':
123 log.info(
"Trigger metadata with key 'TriggerMenuJson_HLTMonitoring' is not available in this file. This feature is currently being introduced.")
126 raise RuntimeError(
"Cannot read trigger configuration (%s) from input file metadata" % key)
◆ getBunchGroupSetAccess()
| BunchGroupSetAccess python.TriggerConfigAccess.getBunchGroupSetAccess |
( |
|
flags | ) |
|
Definition at line 176 of file TriggerConfigAccess.py.
178 if tc[
"SOURCE"] ==
"FILE":
180 elif tc[
"SOURCE"] ==
"COOL":
181 """This is the case when reconstructing the data."""
182 if len(flags.Input.RunNumbers) == 0:
183 raise RuntimeError(
"No run number available in input metadata")
185 cfg = BunchGroupSetAccess( dbalias = keysFromConditions[
"DB"], bgskey = keysFromConditions[
'BGSK'] )
186 elif tc[
"SOURCE"] ==
"DB":
187 cfg = BunchGroupSetAccess( dbalias = tc[
"DBCONN"], bgskey = tc[
"BGSK"] )
188 elif tc[
"SOURCE"] ==
"INFILE":
189 if flags.Input.Format != Format.POOL:
190 raise RuntimeError(f
"Cannot read trigger configuration (Bunchgroup Set) from input type {flags.Input.Format}")
191 raise NotImplementedError(
"Python access to the trigger configuration (Bunchgroup Set) from in-file metadata not yet implemented")
193 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.
Example of the 'TriggerConfigInfo' metadata entry (run 453713, lb 1416):
{
'HLT': {'key': 3221, 'name': 'PhysicsP1_pp_run3_v1'},
'HLTPS': {'key': 6247, 'name': 'PhysicsP1_pp_run3_v1'},
'L1': {'key': 3221, 'name': 'Physics_pp_run3_v1'},
'L1PS': {'key': 7475, 'name': 'Physics_pp_run3_v1'}
}
@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 Example of the 'TriggerConfigInfo' metadata entry (run 453713, lb 1416):
90 'HLT': {'key': 3221, 'name': 'PhysicsP1_pp_run3_v1'},
91 'HLTPS': {'key': 6247, 'name': 'PhysicsP1_pp_run3_v1'},
92 'L1': {'key': 3221, 'name': 'Physics_pp_run3_v1'},
93 'L1PS': {'key': 7475, 'name': 'Physics_pp_run3_v1'}
95 @returns: dictionary with the DB keys. Returns 'None' if information is not present.
98 keys = metadata.get(
"TriggerConfigInfo",
None)
102 'SMK': keys[
'HLT'][
'key']
if 'HLT' in keys
else 0,
103 'LVL1PSK': keys[
'L1PS'][
'key']
if 'L1PS' in keys
else 0,
104 'HLTPSK': keys[
'HLTPS'][
'key']
if 'HLTPS' in keys
else 0,
109 Returns a string-serialised JSON object from the metadata store.
110 Checks AOD syntax first, then fully-qualified ESD syntax
◆ getHLTJobOptionsAccess()
| HLTJobOptionsAccess python.TriggerConfigAccess.getHLTJobOptionsAccess |
( |
|
flags | ) |
|
Definition at line 243 of file TriggerConfigAccess.py.
245 if tc[
"SOURCE"] ==
"FILE":
247 elif tc[
"SOURCE"] ==
"COOL":
248 """This is the case when reconstructing the data."""
249 if len(flags.Input.RunNumbers) == 0:
250 raise RuntimeError(
"No run number available in input metadata")
252 cfg = HLTJobOptionsAccess( dbalias = keysFromConditions[
"DB"], smkey = keysFromConditions[
'SMK'] )
253 elif tc[
"SOURCE"] ==
"DB":
254 cfg = HLTJobOptionsAccess( dbalias = tc[
"DBCONN"], smkey = tc[
"SMK"] )
255 elif tc[
"SOURCE"] ==
"INFILE":
256 raise NotImplementedError(
"Python access to the HLT Job Options configuration from in-file metadata is NOT SUPPORTED (this file is huge!)")
258 raise RuntimeError(
"Unknown source of trigger configuration: %s" % tc[
"SOURCE"])
◆ getHLTMenuAccess()
| HLTMenuAccess python.TriggerConfigAccess.getHLTMenuAccess |
( |
|
flags | ) |
|
Definition at line 203 of file TriggerConfigAccess.py.
205 if tc[
"SOURCE"] ==
"FILE":
207 elif tc[
"SOURCE"] ==
"COOL":
208 """This is the case when reconstructing the data."""
209 if len(flags.Input.RunNumbers) == 0:
210 raise RuntimeError(
"No run number available in input metadata")
212 cfg = HLTMenuAccess( dbalias = keysFromConditions[
"DB"], smkey = keysFromConditions[
'SMK'] )
213 elif tc[
"SOURCE"] ==
"DB":
214 cfg = HLTMenuAccess( dbalias = tc[
"DBCONN"], smkey = tc[
"SMK"] )
215 elif tc[
"SOURCE"] ==
"INFILE":
218 raise RuntimeError(
"Unknown source of trigger configuration: %s" % tc[
"SOURCE"])
◆ getHLTMonitoringAccess()
| HLTMonitoringAccess python.TriggerConfigAccess.getHLTMonitoringAccess |
( |
|
flags = None, |
|
|
|
filterOnActiveChains = False |
|
) |
| |
Definition at line 263 of file TriggerConfigAccess.py.
265 if tc[
"SOURCE"] ==
"FILE":
267 elif tc[
"SOURCE"] ==
"COOL":
268 """This is the case when reconstructing the data."""
269 if len(flags.Input.RunNumbers) == 0:
270 raise RuntimeError(
"No run number available in input metadata")
272 cfg = HLTMonitoringAccess( dbalias = keysFromConditions[
"DB"], smkey = keysFromConditions[
'SMK'] )
273 elif tc[
"SOURCE"] ==
"DB":
274 cfg = HLTMonitoringAccess( dbalias = tc[
"DBCONN"], smkey = tc[
"SMK"] )
275 elif tc[
"SOURCE"] ==
"INFILE":
277 if jsonHLTMon
is not None:
278 cfg = HLTMonitoringAccess(jsonString=jsonHLTMon)
281 smkey = keysFromInfileMD[
'SMK']
if keysFromInfileMD
is not None else 0
282 if smkey < 3000
and not flags.Input.isMC:
284 log.info(
"Trigger metadata with key 'TriggerMenuJson_HLTMonitoring' is not available for Run 2 data. Returning empty dummy.")
285 jsonHLTMon =
'{"filetype": "hltmonitoringsummary","name": "EmptyDefault", "signatures": {}}'
286 cfg = HLTMonitoringAccess(jsonString=jsonHLTMon)
290 log.info(
"Falling back on reading the HLTMonitoring from the TRIGGERDB_RUN3 for SMK %i.", smkey)
291 cfg = HLTMonitoringAccess( dbalias =
"TRIGGERDB_RUN3", smkey = smkey )
294 log.info(
"Trigger HLTMonitoring is not available for SMK %i. Returning empty dummy.", smkey)
295 jsonHLTMon =
'{"filetype": "hltmonitoringsummary","name": "EmptyDefault", "signatures": {}}'
296 cfg = HLTMonitoringAccess(jsonString=jsonHLTMon)
299 raise RuntimeError(
"Unknown source of trigger configuration: %s" % tc[
"SOURCE"])
303 if filterOnActiveChains:
306 for sig
in cfg[
"signatures"]:
307 for chain
in list(cfg[
"signatures"][sig]):
308 if chain
in hltPs.chainNames()
and not hltPs.enabled(chain):
309 del cfg[
"signatures"][sig][chain]
◆ getHLTPrescalesSetAccess()
| HLTPrescalesSetAccess python.TriggerConfigAccess.getHLTPrescalesSetAccess |
( |
|
flags | ) |
|
Definition at line 223 of file TriggerConfigAccess.py.
225 if tc[
"SOURCE"] ==
"FILE":
227 elif tc[
"SOURCE"] ==
"COOL":
228 """This is the case when reconstructing the data."""
229 if len(flags.Input.RunNumbers) == 0:
230 raise RuntimeError(
"No run number available in input metadata")
232 cfg = HLTPrescalesSetAccess( dbalias = keysFromConditions[
"DB"], hltpskey = keysFromConditions[
'HLTPSK'] )
233 elif tc[
"SOURCE"] ==
"DB":
234 cfg = HLTPrescalesSetAccess( dbalias = tc[
"DBCONN"], hltpskey = tc[
"HLTPSK"] )
235 elif tc[
"SOURCE"] ==
"INFILE":
236 cfg = HLTPrescalesSetAccess(jsonString=
_getJSONFromMetadata(flags, key=
'TriggerMenuJson_HLTPS'))
238 raise RuntimeError(
"Unknown source of trigger configuration: %s" % tc[
"SOURCE"])
◆ getKeysFromConditions()
| dict[str, str | int] python.TriggerConfigAccess.getKeysFromConditions |
( |
int |
runNr, |
|
|
int |
lbNr, |
|
|
|
flags |
|
) |
| |
Definition at line 51 of file TriggerConfigAccess.py.
52 if flags.Trigger.useCrest:
53 confKeys: dict[str, str | int] =
getKeysFromCrest(runNr, lbNr, flags.Trigger.crestServer)
59 "TRIGGERDBR2R" :
"TRIGGERDB",
60 "TRIGGERDBV2" :
"TRIGGERDB_RUN1"
62 if confKeys[
"DB"]
in dbaliasMapping:
63 confKeys[
"DB"] = dbaliasMapping[ confKeys[
"DB"] ]
67 @lru_cache(maxsize=
None)
◆ getKeysFromCool()
| dict[str, str | int] python.TriggerConfigAccess.getKeysFromCool |
( |
int |
runNr, |
|
|
int |
lbNr = 0 |
|
) |
| |
Return dictionary of trigger keys for given run and lumiblock number
Definition at line 75 of file TriggerConfigAccess.py.
76 """Return dictionary of trigger keys for given run and lumiblock number
78 from TrigConfStorage.TriggerCoolUtil
import TriggerCoolUtil
79 return TriggerCoolUtil.getTrigConfKeys(runNumber=runNr, lumiBlock=lbNr)
◆ getKeysFromCrest()
| dict[str, str | int] python.TriggerConfigAccess.getKeysFromCrest |
( |
int |
runNr, |
|
|
int |
lbNr, |
|
|
str |
crest_server |
|
) |
| |
Return dictionary of trigger keys for given run and lumiblock number from crest
Definition at line 68 of file TriggerConfigAccess.py.
68 def getKeysFromCrest(runNr: int, lbNr: int, crest_server: str) -> dict[str, str | int]:
69 """Return dictionary of trigger keys for given run and lumiblock number from crest
71 from TrigConfStorage.TriggerCrestUtil
import TriggerCrestUtil
72 return TriggerCrestUtil.getTrigConfKeys(runNumber=runNr, lumiBlock=lbNr, server=crest_server)
74 @lru_cache(maxsize=
None)
◆ getL1MenuAccess()
| L1MenuAccess python.TriggerConfigAccess.getL1MenuAccess |
( |
|
flags | ) |
|
Definition at line 136 of file TriggerConfigAccess.py.
138 if tc[
"SOURCE"] ==
"FILE":
140 elif tc[
"SOURCE"] ==
"COOL":
141 """This is the case when reconstructing the data."""
142 if len(flags.Input.RunNumbers) == 0:
143 raise RuntimeError(
"No run number available in input metadata")
145 cfg = L1MenuAccess( dbalias = keysFromConditions[
"DB"], smkey = keysFromConditions[
'SMK'] )
146 elif tc[
"SOURCE"] ==
"DB":
147 cfg = L1MenuAccess( dbalias = tc[
"DBCONN"], smkey = tc[
"SMK"] )
148 elif tc[
"SOURCE"] ==
"INFILE":
151 raise RuntimeError(
"Unknown source of trigger configuration: %s" % tc[
"SOURCE"])
◆ getL1PrescalesSetAccess()
| L1PrescalesSetAccess python.TriggerConfigAccess.getL1PrescalesSetAccess |
( |
|
flags | ) |
|
Definition at line 156 of file TriggerConfigAccess.py.
158 if tc[
"SOURCE"] ==
"FILE":
160 elif tc[
"SOURCE"] ==
"COOL":
161 """This is the case when reconstructing the data."""
162 if len(flags.Input.RunNumbers) == 0:
163 raise RuntimeError(
"No run number available in input metadata")
165 cfg = L1PrescalesSetAccess( dbalias = keysFromConditions[
"DB"], l1pskey = keysFromConditions[
'LVL1PSK'] )
166 elif tc[
"SOURCE"] ==
"DB":
167 cfg = L1PrescalesSetAccess( dbalias = tc[
"DBCONN"], l1pskey = tc[
"LVL1PSK"] )
168 elif tc[
"SOURCE"] ==
"INFILE":
171 raise RuntimeError(
"Unknown source of trigger configuration: %s" % tc[
"SOURCE"])
◆ log
| python.TriggerConfigAccess.log |
HLTMenuAccess getHLTMenuAccess(flags)
def GetFileMD(filenames, allowEmpty=True, maxLevel='peeker')
L1PrescalesSetAccess getL1PrescalesSetAccess(flags)
def getHLTMenuFileName(flags)
def getTrigConfigFromFlag(flags)
HLTPrescalesSetAccess getHLTPrescalesSetAccess(flags)
HLTMonitoringAccess getHLTMonitoringAccess(flags=None, filterOnActiveChains=False)
def getL1MenuFileName(flags)
def getHLTJobOptionsFileName()
def getBunchGroupSetFileName(flags)
def getL1PrescalesSetFileName(flags)
dict[str, str|int] getKeysFromCrest(int runNr, int lbNr, str crest_server)
dict[str, str|int] getKeysFromConditions(int runNr, int lbNr, flags)
dict[str, str|int] getKeysFromCool(int runNr, int lbNr=0)
Optional[dict[str, Any]] getDBKeysFromMetadata(flags)
def getHLTMonitoringFileName(flags)
L1MenuAccess getL1MenuAccess(flags)
Optional[dict[str, Any]] _getJSONFromMetadata(flags, key)
BunchGroupSetAccess getBunchGroupSetAccess(flags)
HLTJobOptionsAccess getHLTJobOptionsAccess(flags)
def getHLTPrescalesSetFileName(flags)