ATLAS Offline Software
Loading...
Searching...
No Matches
MuonsExtraTriggerConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2
3from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4
5from TriggerMenuMT.TriggerAPI.TriggerAPI import TriggerAPI
6from TriggerMenuMT.TriggerAPI.TriggerEnums import TriggerPeriod, TriggerType
7from AthenaConfiguration.AutoConfigFlags import GetFileMD
8from DerivationFrameworkPhys.TriggerListsHelper import read_trig_list_file
9from DerivationFrameworkPhys.TriggerMatchingCommonConfig import AddRun2TriggerMatchingToSlimmingHelper
10from DerivationFrameworkPhys.TriggerMatchingCommonConfig import TriggerMatchingCommonRun2Cfg
11
12
13# Helper class to add extra trigger content to the Muon derivations.
15 def __init__(self, flags, existingTriggerHelper):
16 self.flags = flags
17 TriggerAPI.setConfigFlags(flags)
19 self.existingTriggerHelper = existingTriggerHelper
21
22 # Find the chains missing in the existing trigger helper
24
25 md = GetFileMD(self.flags.Input.Files)
26 hlt_menu = md.get('TriggerMenu', {}).get('HLTChains', None)
27
28 if self.flags.Trigger.EDMVersion <= 2:
29
30 # Trigger API for Runs 1, 2
31 allperiods = TriggerPeriod.y2015 | TriggerPeriod.y2016 | TriggerPeriod.y2017 | TriggerPeriod.y2018 | TriggerPeriod.future2e34
32 trig_bmu = TriggerAPI.getLowestUnprescaledAnyPeriod(allperiods, triggerType=TriggerType.mu_bphys, livefraction=0.8)
33
34
35 extra_file = read_trig_list_file("DerivationFrameworkMuons/run2ExtraMatchingTriggers.txt")
36
37
38 trigger_names_full = list(set(trig_bmu+extra_file))
39
40 if hlt_menu:
41 for chain_name in hlt_menu:
42 if chain_name in trigger_names_full:
43 self.extraChainList.append(chain_name)
44 else: # No means to filter based on in-file metadata
45 self.extraChainList = trigger_names_full
46
47 # remove overlap with the existing chains
48 self.extraChainList = [c for c in self.extraChainList if c not in self.existingTriggerHelper.Run2TriggerNamesNoTau and c not in self.existingTriggerHelper.Run2TriggerNamesTau ]
49
50 # schedule the trigger matching tool for our new chains
51 def Run2MatchAugmentationCfg(self, flags, name="PhysCommonTrigMatchExtraMuons"):
52 acc = ComponentAccumulator()
53 acc.merge(TriggerMatchingCommonRun2Cfg(
54 flags,
55 name = name,
56 OutputContainerPrefix = "TrigMatch_",
57 ChainNames = self.extraChainList))
58 return acc
59
60 # add our new match branches to the slimming helper
61 def AddRun2MatchingToSlimmingHelper(self,SlimmingHelper,
62 OutputContainerPrefix = "TrigMatch_"):
63 AddRun2TriggerMatchingToSlimmingHelper(SlimmingHelper = SlimmingHelper,
64 OutputContainerPrefix = OutputContainerPrefix,
65 TriggerList = self.extraChainList)
66
list extraChainList
Now reduce the list based on the content of the first input AOD.
Run2MatchAugmentationCfg(self, flags, name="PhysCommonTrigMatchExtraMuons")
AddRun2MatchingToSlimmingHelper(self, SlimmingHelper, OutputContainerPrefix="TrigMatch_")
STL class.
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition hcg.cxx:130