Trigger Menu Integration

Last update: 16 Sep 2020 [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.

Terminology

There is quite some terminology connected to this topic which the following is supposed to clarify a bit . Some of this is based on the Trigger Glossary which contains many more definitions to look up. Only the ones relevant for this section will be defined below.

  • Trigger menu: List of all possible trigger chains and their properties (e.g. stream, rate/bandwidth group, etc) and their configuration. Menus can be defined depending on their data-taking purpose (e.g. proton-proton collisions, heavy ions, cosmic menu).
  • Trigger menu prescale set: Defines the composition of active trigger chains in terms of their prescales for the L1 seed item and the HLT selection. There can be many prescale sets for one menu, e.g. defining a set of triggers for a given luminosity step.
  • Trigger chain: Each trigger chain is identified by a unique name (see Run 3 naming convention ) with properties like one or several streams, rate and bandwidth group, prescales assigned to it. In the majority of cases, trigger chains are seeded by L1 items which, if satisfied, starts the HLT processing. The HLT configuration of a chain is made up of one or several steps.
  • Step: The step of a chain is represented by 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: Each menu sequences is made up of one InputMaker algorithm, followed by reconstruction algorithms and completed with one hypothesis testing algorithm.
  • Reconstruction algorithms: See the section on Reconstruction Algorithms
  • Hypothesis algorithms: See the section on Hypothesis Algorithms
  • Control Flow (CF): Configures 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. This produces early termination of an execution path if triggers are not accepted.
  • Data Flow (DF): Gaudi scheduler execution is based on the Data Flow, meaning that the execution order is ruled by the availability of data handles.
  • HLT Filter Algorithm: This is the Region of Interest Sequence Filter (RoRSeqFilter) which filters HLT decisions and impacts the Control Flow.
  • InputMakerAlg/EventViewCreatorAlg: It inherits from InputMakerBase and starts the sequence, creates the collections for the first RecoAlg, propagates decisions to the HypoAlg; The EventViewCreator, in addition, creates the EventViews.
  • Athena Sequencer (AthSequencer): Sequence used to collect algorithms that need to run in a Menu Sequence, with all algorithms already configured and connected via data handles. It needs to include the 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 EventvViews in the previous step. 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.

The TriggerMenuMT package

The TriggerMenuMT package is divided into two sub-directories:

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

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

LVL1MenuConfig

Description of LVL1 components - to follow.

HLTMenuConfig

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

  • All chains defined in a given menu (e.g. LS2_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/HLTMenuConfig/. 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 generateMT and is defined in this file. It handles the forwarding of the dictionary to the MuonDef.py to set up the steps as well as the above described cases of multiple muon chain dictionaries for specific chains.
  • MuonDef.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:

  • MuonSetup.py: Setup of all the different algorithms that are needed to reconstruct muons (including data prepreparation, L2, and EF)
  • MuonSequenceSetup.py: Contains the various sequences needed in the steps, including the maker, hypo and hypo tool
  • MuonMenuConfig.py: Configuration for the L2 algorithms, which will be moved to be within the offline muon configuration code Generally, these additional files should be kept to a minimum though.

A very important remark to add here is that when sequences are being prepared, a check is required to see if they have been declared already via the RecoFragmentsPool.retrieve(XXXAthSequence,ConfigFlags), which automatically checks if the same sequence has been already instantiated, and returns the link to it.

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

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 ElectronSequenceSetup.py Make a function for any sequence creation and instantiate the algorithms follow this logic:
    • 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
    • Import the HypoTools
    • The sequences:
      • AthSequencer containing the algorithms running in views configured as parallel OR, an example is: sequenceView = parOR(name, [alg or seq])
      • AthSequencer with all feature extraction algorithms configured as sequential AND: an example is: mysequence =seqAND(name, [alg or seq])
      • MenuSequence with an example being: MenuSequence( Sequence = fastCaloAthSequence, Maker = fastCaloViewsMaker, Hypo = theFastCaloHypo, HypoToolGen = TrigL2CaloHypoToolFromName )

Adding a chain to TriggerMenuMT

Once all the algorithms are set up and ready, you can add the chain in a menu. For the LS2 development period this is LS2_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. ElectronDef.py
  • If needed, you can add some top level steering of the dictionary, that is passed in ‘GenerateElectronChainDefs.py’. This might e.g. be necessary for muons, see this example from Run-2

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. E.g. LS2_v1.py
      TriggerFlags.AwesomeSlice.signatures = [ ... ]
    
  • 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.
  • The slice should have its own flags, currently defined here (one example slice) but being migrated here
  • Enable the slice in different places
    • A flag to enable the slice in the menu generation has to be defined here.
    • The slice should be made available here.
    • Test job options might require additionally enabling the slice, for example testHLT_MT.py

How to test your changes

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