ATLAS Offline Software
Loading...
Searching...
No Matches
HLTPrescaleJSON Namespace Reference

Functions

 generatePrescaleJSON (flags, chainDicts)

Variables

 __log = logging.getLogger( __name__ )

Function Documentation

◆ generatePrescaleJSON()

HLTPrescaleJSON.generatePrescaleJSON ( flags,
chainDicts )
 Generates JSON given the ChainProps and sequences

Definition at line 8 of file HLTPrescaleJSON.py.

8def generatePrescaleJSON(flags, chainDicts):
9 """ Generates JSON given the ChainProps and sequences
10 """
11 # Prescale dictionary that is used to create the JSON content
12 prescaleDict = {
13 "filetype": "hltprescale",
14 "name": flags.Trigger.triggerMenuSetup,
15 "prescales": {}
16 }
17 # Sort chains by name not counter for easier post processing
18 for chain in sorted(chainDicts, key=lambda d: d['chainName']):
19 # Enabled flag is what determines disabling (here is based on prescale list from MenuPrescaleConfig)
20 chainEnabled = True
21 if (int(chain["prescale"]) <= 0):
22 chainEnabled = False
23
24 # Now have all information to write the chain to the prescale dictionary
25 chainName = chain["chainName"]
26 prescaleDict["prescales"][chainName] = {
27 "hash": chain["chainNameHash"],
28 "prescale": chain["prescale"],
29 "enabled": chainEnabled
30 }
31 # Add express stream information
32 if "express" in chain["stream"]:
33 prescaleDict["prescales"][chainName]['prescale_express'] = chain["prescale"]
34 prescaleDict["prescales"][chainName]['enabled_express'] = chainEnabled
35
36 # Prescale dictionary now completed, write to JSON
37 fileName = getHLTPrescalesSetFileName(flags)
38 __log.info( "Writing HLT Prescale JSON to %s", fileName )
39 with open( fileName, 'w' ) as fp:
40 json.dump( prescaleDict, fp, indent=4, sort_keys=False )
41

Variable Documentation

◆ __log

HLTPrescaleJSON.__log = logging.getLogger( __name__ )
private

Definition at line 6 of file HLTPrescaleJSON.py.