Trigger Menu Basics

Last update: 30 Sep 2024 [History] [Edit]

Introduction

The ATLAS trigger menu consists of several hundreds of trigger chains which are used during data taking. Each chain defines the selection criteria at the first and high-level trigger for one or several physics signatures.

The TriggerMenuMT package contains the Run 3 trigger menu and chain configuration and replaces the Run-2 TriggerMenu package. It’s designed to define the chains in terms of their names, streams, bandwidth and rate groups and other properties, to configure them in terms of steps and the sequences within the steps and to build the control flow.

General information about the menu group and and its organisation can be found on the TriggerMenuInformation twiki.

For more advanced information, please see the topic-specific guides under “Trigger Menu for Experts”.

Terminology

There is quite some terminology connected to this topic, for which brief definitions of the most relevant terms are given below. For more extensive definitions, see the Trigger Glossary. References to technical terms/code classes are made here instead.

L1 item
A single selecting algorithm in the hardware trigger. Can use simple threshold counting from the L1Calo or L1Muon inputs, or more complex combinations built in the L1Topo processor.
Trigger Menu
List of all possible trigger selections at L1 and HLT, intended for specific data-taking conditions (e.g. proton-proton collisions, heavy ion collisions, cosmic ray collection).
L1 and HLT prescales
Defines which of the triggers in the menu are active, and their corresponding prescale values. The PS for an HLT chain is the product of the PS for the L1 item and an additional HLT-specific PS.
Bunch group set
The categorisation of LHC buckets (identified by BCID) into 16 groups corresponding to different filling conditions (colliding bunch pair, empty, adjacent to colliding etc). Each L1 item accepts events only in a single bunch group.
Trigger keys
Parts of the trigger configuration are retrieved from the trigger database by an identifying index, known as keys. These include:
  • Super Master Key (SMK): Retrieves the L1 and HLT menus, the HLT job options and associated settings for HLT monitoring.
  • Prescale Key (PSK): Retrieves the prescale settings for L1 or HLT, which are defined independently.
  • Bunch group key (BGK): Retrieves a particular bunch group set.
Trigger database
A relational database that holds the configuration components, and provides access via the trigger keys.
HLT chain
A single selecting unit for the HLT, typically combining a L1 item and the HLT logic combining reconstruction and hypothesis components.
  • Some HLT chains are seeded by a combination of L1 item (multiseed)
  • HLT processing starts if the L1 item accepts the event and the event is not rejected by prescale.
  • HLT trigger chains are identified by unique names (see Run 3 naming convention ) and are assigned a particular output stream and identifying group labels.
Step
The configuration of a chain is made up of one or several steps, each step is represented by an instance of the ChainStep class. Each step is made of a list of MenuSequences. Each menu sequence is executed on a single decision object, so single decision chains will only have one MenuSequence per step. The division into steps allows further processing to be avoided if a (fast) negative decision is made in an earlier step. It also allows (event-wide) early rejection if there are no chains passing a given step.
Menu Sequence
The logical component of a step for a single signature chain-leg. The menu sequence is represented by an instance of the MenuSequence class. It includes reconstruction algorithms and a hypothesis algorithm, as well as additional supporting infrastructure algorithms.
In particular, the menu sequence opens with an InputMaker algorithm providing the appropriate object needed to start the reconstruction in a step. In case of processing in EventViews, the additional algorithm EventViewVerifier may be necessary to propagate objects from EventViews in the previous step.
Athena Sequencer (AthSequencer)
A special class of Athena algorithm, responsible for scheduling other algorithms and propagating filter decision logic. AthSequencers can be nested, i.e. contain other sequences.
The sequencers are configured to form either an AND or an OR of the status of their children and return this as their own status. They can be configured in two ways, parallel or sequential, depending on the way the children are allowed to be executed. In the HLT Control Flow we have two main configurations: sequential AND (seqAND) and parallel OR (parOR). The seqAND returns immediately upon any child returning False, and does not execute any remaining children.
Control Flow (CF)
The part of the HLT configuration governing the selection logic including the early rejection capability in step-by-step processing.
This constructs an execution graph made of Athena Sequencers that logically collect executions of algorithms. Athena Sequencers represent the control flow nodes. The filter algorithms are used to allow or skip the execution of a given node.
Data Flow (DF)
The part of the HLT configuration that enables scheduling of all algorithm execution.
In AthenaMT, the Gaudi scheduler activates algorithms when their input data dependencies become available. The DF configuration stitches together the HLT infrastructure to ensure that data dependencies for successive steps and their filter algorithms are satisfied.
HLT Filter Algorithm
An algorithm that evaluates whether the preceding step decisions satisfies the conditions to activate the next step in a chain. Implemented in the RoRSeqFilter class.
InputMakerAlg/EventViewCreatorAlg
Algorithm responsible for starting a menu sequence, creating the collections for the first RecoAlg, and propagates decisions from the preceding step to the HypoAlg. The EventViewCreator, in addition, creates the EventViews. Inherits from InputMaakerBase.

See also the following sections for information on the two major HLT algorithm classes:

The TriggerMenuMT package

The TriggerMenuMT package is divided into two sub-directories:

  • L1 for L1 configuration details and
  • HLT for the HLT configuration of trigger chains.

The generateMT function in GenerateMenu.py handles the generation of the menu configuration for L1 and HLT.

L1

The L1 menu generation code has three components, Base, Config and Menu

  • Config/ contains the high-level building blocks of a menu, such us algorithms for L1Topo, and thresholds, and items for the CTP. Here new topological algorithms, muon and calorimeter thresholds, and CTP items should be added. The directory further contains information about the inputs from the L1Topo, and MUCTPI on the CTP side.
  • Base/ contains the python classes for the objects that form the L1 menu objects, e.g the L1Items and the L1TopoAlgorithms without any menu-specific content. It should be touched only by people familiar with the trigger configuration code.
  • Menu/ contains the top-level definition of the L1 trigger menu for different types of data taking (pp, HI, MC). This comprises the algorithm assignment of the L1Topo output and the L1 item assignment in the CTP output.

Details are in section L1 Menu Construction.

HLT

The generation of the HLT trigger menu configuration can be summarised in the following steps:

  • All chains defined in a given menu (e.g. Physics_pp_run3_v1.py) are read into a big list.
  • For each chain, a dictionary is generated by DictFromChainName.py.
  • The chain dictionaries are then prepared to be passed to the corresponding signature code to generate the chain step configuration. This means in particular:
    • Combined chains: The dictionary is divided according to the signatures of the combined chain and sent to the corresponding signature code. The returned configuration will then be combined given the merging strategy specified in the chain definition.
    • Chains of one signature type with more than one leg (e.g. HLT_mu6_mu8): The dictionary with both chain parts is passed to the corresponding signature code, similarly to the case of a chain with multiplicity great than 1 (e.g. HLT_2mu6). The multiplicities are then handled according to the specific setups within a given signature.
  • The dictionaries are sent to the corresponding signature code. The handling of the step setup is individual to a signature and won’t be discussed here. The signature code sends back a Chain object which is defined in MenuComponents.py to contain the HLT chain name, the L1 item seeding the chain and a list of chain steps.
  • The configuration of all chain objects is then added to a list and passed to the control flow via the makeHLTTree function.
    • Please note: As an additional step, the merging of the Chain objects for combined chains will need to be handled, this still needs implementing in the control flow.

The sections below contain a little more detail on the steps for developers.

Chain definition

The chain definition in a menu is based on a namedtuple defined in ChainDefInMenu.py with some default values assigned. This is subject to changes, so please refer to the file for up-to-date information.

Chain name decoding and allowed values

The chain name decoding has not changed w.r.t. the version implemented in Run 2 and is based on the same concept. The allowed values for each signature are defined in the SignatureDicts.py. An example for a dictionary for a chain of type HLT_e3_etcut1step_L1EM3 is:

{      "L1item": "L1_EM3",
        "chainCounter": 1,
        "chainMultiplicities": ["1"],
        "chainName": "HLT_e3_etcut1step_L1EM3",
        "chainParts": [   {   "IDinfo": "",
                              "L1item": "",
                              "L2IDAlg": "",
                              "addInfo": ["etcut1step"],
                              "caloInfo": "",
                              "chainPartName": "e3_etcut1step_L1EM3",
                              "etaRange": "0eta250",
                              "eventBuildType": "",
                              "extra": "",
                              "isoInfo": "",
                              "lhInfo": "",
                              "multiplicity": "1",
                              "signature": "Electron",
                              "threshold": "3",
                              "trigType": "e",
                              "trkInfo": ""}],
        "groups": ["RATE:SingleElectron", "BW:Electron"],
        "signature": "Electron",
        "signatures": "",
        "stream": ["Main"],
        "topo": [],
        "topoStartFrom": False  }

Most information is extracted by the DictFromChainName code from the chain name itself, e.g. the signature type, L1 item and the chainPart specific fields. However some information needs to be specified in the definition of the chain, like e.g. the bandwidth and rate groups and merging strategy (not shown here as it’s a single electron chain). The chainParts key is a list of signature specific sub-directories which will contain more entries in case of multi-leg chains.

The dictionary keys can be chosen freely by each signature. Please make sure to remove obsolete strings. An explanation of the meaning of each sub-string can be found here - not yet setup- pointing to Run2 twiki.

Signature specific code

Each signature has a subdirectory under TriggerMenuMT/python/HLT/. The structure of the signature code will be explained at hand of the muon signature. Within the directory, there are two files generally needed by the TriggerMenuMT framework:

  • GenerateMuonChainDefs.py: The function generateChainConfigs(chainDict) is called from the generateMenuMT in HLT/Config/generateMenuMT and is defined in this file. It handles the forwarding of the dictionary to the MuonChainConfiguration.py to set up the steps as well as the above described cases of multiple muon chain dictionaries for specific chains.
  • MuonChainConfiguration.py: The class MuonChainConfiguration in this file is based on a base class ChainConfigurationBase which can be extended with functions from which most/all signatures can benefit. Please feel free to add code to this class to reduce the lines in each signature specific code. Within this class, the steps of the particular chain that is being configured, are set up. This can be done in form of a dictionary to avoid the many if-elif-else statements we had in the Run 2 code, e.g.
          stepDictionary = {
              "":(self.getmuFast(),self.getmuComb(),self.getmuEFSA(),self.getmuEFCB()),
              "fast":[self.getmuFast()],
              "Comb":[self.getmuFast(), self.getmuComb()],
              "ivar":[self.getmuFast(), self.getmuComb(), self.getmuIso()],
              "noL1":[self.getFSmuEFSA(), self.getFSmuEFCB()],
          }
          key = self.chainPart["extra"]+self.chainPart["isoInfo"]
          steps=stepDictionary[key]
          for step in steps:
              chainSteps+=[step]
    
          myChain = self.buildChain(chainSteps)
    

There can be additional files in the signature directory, in the muon example, we have additionally:

  • MuonMenuSequences.py: Contains the various sequences needed in the steps, including the maker, hypo and hypo tool
  • MuonRecoSequences.py: Configuration for the reconstruction algorithms, shared with the offline muon configuration code. Generally, these additional files should be kept to a minimum though.

More details about the menu generation is here.

Generation of control flow

The control flow is then generated based on the Chain object that was passed from the signature specific code containing the configuration of the chain steps. This happens in the function makeHLTTree which is located in HLTCFConfig.py and makes use of further functions in MenuComponents.py and HLTCFComponents.py.

More details on the Control Flow generation is in this section.

How to add a trigger chain

To add a new trigger chain, please follow the steps outlined below. You will first need to get the steps ready in terms of algorithms before being able to add them as part of a trigger chain to to TriggerMenuMT. Sometimes you’ll be able to skip a step if e.g. the algorithms have been prepared already.

Preparing the algorithms and steps

  • Create the HypoAlg, which is inherited from HypoBase, see an example TrigL2CaloHypoAlgMT
  • Create HypoTools, an example is TrigL2CaloHypoToolInc
  • Configure the HypoTools like in TrigL2CaloHypoTool.py Please not that there is a defined format required, for example TrigL2CaloHypoToolFromName( name, conf )
  • Create a configuration file, in which all the menu sequences are included and configured, an example is in MuonMenuSequences.py.

In this latter file create a function for any sequence generation and instantiate all the algorithms, which must include:

  • The feature extraction algorithms needed to create the offline objects to be processed by the hypo, with all their configurations
  • The EventViewCreatorAlgorithm, needed to run in the views, alternatively add one InputMaker
  • The Hypo Algorithm
  • The HypoTools imported from dedicated packages

In this function make use of dedicated classes that allow to properly configure the MenuSequence in the correct way. For this purpose, instantiate these CA classes following the hierarchy described in details in this section:

  • the SelectionCA to represent the full reconstruction sequence, plus the HypoAlg in CA mode and give the name to the sequence
  • the InViewRecoCA to include all the reconstruction within Views
  • the MenuSequence to merge selection and HypoTools, representing the complete sequence; an example being: MenuSequence(flags, selectionCA, HypoToolGen = TrigMufastHypoToolFromDict)

Please remember that:

  • AthSequencer containing the algorithms running in views are configured as parallel OR, an example is: sequenceView = parOR(name, [alg or seq])
  • AthSequencer with all feature extraction algorithms are configured as sequential AND: an example is: mysequence =seqAND(name, [alg or seq])

Adding a chain to TriggerMenuMT

Once all the algorithms are set up and ready, you can add the chain in a menu. For triggers in development, this is Dev_pp_run3_v1.py

  • Make sure you define the chain in the correct signature list with all needed parameters, please take a look at the base class in ChainDefInMenu.py
  • Make sure all strings of your chain name are following the naming convention and are listed in SignatureDicts.py
  • Check the corresponding logic in your signature directory and if needed, implement the steps that are needed in this particular chain. This is normally done in e.g. MuonChainConfiguration.py
  • Add some top level steering of the dictionary, that is passed in ‘GenerateMuonChainDefs.py’.

Adding a new signature to TriggerMenuMT

In order to add or activate a new signature to TriggerMenuMT, the procedure is:

  • If it doesn’t exist yet, create a new slice in the corresponding menu by adding a new key to the chains object. E.g. Dev_pp_run3_v1.py
      chains["Awesome"] = [ ... ]
    
  • A file with the slice generation has to exist with the exact name GenerateAwesomeChainDefs.py in the folder Awesome, as the slice is generated via this line
    • Several slices can be defined in the same folder. Follow the example of Photon or Streaming.

How to test your changes

Please refer to the section Testing of code changes in this guide.