![]() |
ATLAS Offline Software
|
Public Member Functions | |
| __init__ (self, input=None, *, grl=None, flags=None, json=None, menu=None, file=None, period=None) | |
| save (self, path) | |
| chains (self, *, triggerType=TriggerType.ALL) | |
| triggerInfo (self) | |
| runs (self) | |
| setRunRange (self, start=0, end=999999) | |
| getLowestUnprescaled (self, *, triggerType=TriggerType.ALL, livefraction=1.0, runStart=0, runEnd=999999) | |
| getLowestUnprescaledByRun (self, *, triggerType=TriggerType.ALL, livefraction=1.0, runStart=0, runEnd=999999) | |
| getLowestUnprescaledAnyRun (self, *, triggerType=TriggerType.ALL, livefraction=1.0, runStart=0, runEnd=999999) | |
| getLiveFractions (self, *, triggerType=TriggerType.ALL, runStart=0, runEnd=999999) | |
| getLowerUnprescaled (self, *, chainName, triggerType=TriggerType.ALL, livefraction=1.0, runStart=0, runEnd=999999) | |
Public Attributes | |
| dict | dbQueries = {} |
| customGRL = None | |
| flags = None | |
| release = None | |
| bool | cacheread = True |
--------------------------------------------------------------------------------------------------------------------
TriggerAPI helper class. Use the following import in your code:
from TriggerMenuMT.TriggerAPI import TriggerAPISession,TriggerType,TriggerPeriod
Examples of use:
================
Set of triggers of a given type that are unprescaled for an entire GRL:
s = TriggerAPISession("path/to/grl.xml") # can be a PathResolver path as well
triggers = s.getLowestUnprescaled(triggerType=TriggerType.el_single)
Dictionary of sets of triggers of a given type that are unprescaled, for each run in the GRL:
s = TriggerAPISession("path/to/grl.xml")
triggersByRun = s.getLowestUnprescaledByRun(triggerType=TriggerType.el_single)
Set of triggers that are unprescaled for all runs between two run numbers (inclusive), in a GRL:
s = TriggerAPISession("path/to/grl.xml")
triggers = s.getLowestUnprescaledByRun(triggerType=TriggerType.el_single,runStart=123456,runEnd=234567)
Other helpful methods are:
- Set of runs present in the session's GRL: s.runs()
- List of trigger types: [x.name for x in TriggerType]
- Dictionary of livefractions between given runs, key = trigger chain name:
liveFractions = s.getLiveFractions(triggerType=TriggerType.el_single,runStart=123456,runEnd=234567)
- Dictionary of chains (key is chain.name): s.chains()
- Set of triggers that are deemed to be of same type and lower threshold than a given trigger and unprescaled:
triggers = s.getLowerPrescaled(chainName="myChain")
Each method accepts an "additionalTriggerType" parameter that is used for multi-leg triggers of different type
(e.g. e-mu triggers).
Instead of passing a GRL you can pass a menu name ("menu_name") in the constructor, and the unprescaled
triggers will be the Primary|TagAndProbe triggers from the menu.
Saving a session
================
Sessions can be saved to json file and reloaded at a later time (to save requerying the database):
s.save("myDump.json")
s2 = TriggerAPISession(json="myDump.json") # reloads the session
--------------------------------------------------------------------------------------------------------------------
Definition at line 14 of file TriggerAPISession.py.
| python.TriggerAPI.TriggerAPISession.TriggerAPISession.__init__ | ( | self, | |
| input = None, | |||
| * | , | ||
| grl = None, | |||
| flags = None, | |||
| json = None, | |||
| menu = None, | |||
| file = None, | |||
| period = None ) |
Specify one and only one of the following parameters to construct your API session: :param input: If specified, will try to auto-infer which of the things below it is: :param grl: Path to a GRL file, locatable by PathResolver :param flags: flag container, used if reading triggers from the trigger menu (in the file or the release) - EXPERT OPTION :param json: Path to a JSON file, locatable by PathResolver, containing a cache of TriggerAPI session :param menu: Specify a menu to use, such as "Physics_pp_run3_v1". This is otherwise taken from flags :param file: Specify a root file (AOD etc) from which the menu will be taken :param period: Legacy option, can specify a TriggerPeriod and will load through the hardcoded GRLs (TriggerPeriodData)
Definition at line 67 of file TriggerAPISession.py.
| python.TriggerAPI.TriggerAPISession.TriggerAPISession.chains | ( | self, | |
| * | , | ||
| triggerType = TriggerType.ALL ) |
:param triggerType: you can list available types with "[x.name for x in TriggerType]" :return: dictionary of triggerChain objects of given types, key = chain Name
Definition at line 166 of file TriggerAPISession.py.
| python.TriggerAPI.TriggerAPISession.TriggerAPISession.getLiveFractions | ( | self, | |
| * | , | ||
| triggerType = TriggerType.ALL, | |||
| runStart = 0, | |||
| runEnd = 999999 ) |
:param triggerType: can be a single type or a list of types :param runStart: :param runEnd: :return: a dictionary of live fractions for triggers matching given trigger types
Definition at line 262 of file TriggerAPISession.py.
| python.TriggerAPI.TriggerAPISession.TriggerAPISession.getLowerUnprescaled | ( | self, | |
| * | , | ||
| chainName, | |||
| triggerType = TriggerType.ALL, | |||
| livefraction = 1.0, | |||
| runStart = 0, | |||
| runEnd = 999999 ) |
:param chainName: :param triggerType: :param livefraction: :param runStart: :param runEnd: :return: set of chains of unprescaled triggers that were lower than the given chain
Definition at line 276 of file TriggerAPISession.py.
| python.TriggerAPI.TriggerAPISession.TriggerAPISession.getLowestUnprescaled | ( | self, | |
| * | , | ||
| triggerType = TriggerType.ALL, | |||
| livefraction = 1.0, | |||
| runStart = 0, | |||
| runEnd = 999999 ) |
:param triggerType: list available types with "[x.name for x in TriggerType] .. provide a list of length 2 for multi-leg types" :param livefraction: threshold to be considered unprescaled :param runStart: :param runEnd: :return: set of lowest unprescaled (according to livefraction) triggers of given type
Definition at line 203 of file TriggerAPISession.py.
| python.TriggerAPI.TriggerAPISession.TriggerAPISession.getLowestUnprescaledAnyRun | ( | self, | |
| * | , | ||
| triggerType = TriggerType.ALL, | |||
| livefraction = 1.0, | |||
| runStart = 0, | |||
| runEnd = 999999 ) |
Definition at line 257 of file TriggerAPISession.py.
| python.TriggerAPI.TriggerAPISession.TriggerAPISession.getLowestUnprescaledByRun | ( | self, | |
| * | , | ||
| triggerType = TriggerType.ALL, | |||
| livefraction = 1.0, | |||
| runStart = 0, | |||
| runEnd = 999999 ) |
:param triggerType: :param livefraction: :param runStart: :param runEnd: :return: lowest unprescaled trigger by run. If this session does not have per-run info, all triggers will be listed under a dummy key of ""
Definition at line 237 of file TriggerAPISession.py.
| python.TriggerAPI.TriggerAPISession.TriggerAPISession.runs | ( | self | ) |
:return: set of runs covered by this session
Definition at line 188 of file TriggerAPISession.py.
| python.TriggerAPI.TriggerAPISession.TriggerAPISession.save | ( | self, | |
| path ) |
:param path: Save a cache of the current session to the given json file :return: result of json dump
Definition at line 158 of file TriggerAPISession.py.
| python.TriggerAPI.TriggerAPISession.TriggerAPISession.setRunRange | ( | self, | |
| start = 0, | |||
| end = 999999 ) |
Definition at line 199 of file TriggerAPISession.py.
| python.TriggerAPI.TriggerAPISession.TriggerAPISession.triggerInfo | ( | self | ) |
Definition at line 185 of file TriggerAPISession.py.
| bool python.TriggerAPI.TriggerAPISession.TriggerAPISession.cacheread = True |
Definition at line 106 of file TriggerAPISession.py.
| python.TriggerAPI.TriggerAPISession.TriggerAPISession.customGRL = None |
Definition at line 103 of file TriggerAPISession.py.
| python.TriggerAPI.TriggerAPISession.TriggerAPISession.dbQueries = {} |
Definition at line 102 of file TriggerAPISession.py.
| python.TriggerAPI.TriggerAPISession.TriggerAPISession.flags = None |
Definition at line 104 of file TriggerAPISession.py.
| python.TriggerAPI.TriggerAPISession.TriggerAPISession.release = None |
Definition at line 105 of file TriggerAPISession.py.