ATLAS Offline Software
Loading...
Searching...
No Matches
JetTriggerAnalysisConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
2
3# AnaAlgorithm import(s):
4from AnalysisAlgorithmsConfig.ConfigBlock import ConfigBlock
5from AthenaConfiguration.Enums import LHCPeriod
6
7from TriggerAnalysisAlgorithms.TriggerAnalysisConfig import TriggerAnalysisBlock
8from TriggerAnalysisAlgorithms.TriggerAnalysisSFConfig import trigger_set
9
10
11class JetTriggerMatchingBlock (ConfigBlock):
12
13 def __init__ (self) :
14 super (JetTriggerMatchingBlock, self).__init__ ()
15 self.addOption ('triggerChainsPerYear', {}, type=dict,
16 info="a dictionary with key (string) the year and value (list of "
17 "strings) the trigger chains.")
18 self.addOption ('includeAllYearsPerRun', False, type=bool,
19 info="all configured years in the LHC run will "
20 "be included in all jobs.")
21 self.addOption ('removeHLTPrefix', True, type=bool,
22 info="remove the HLT prefix from trigger chain names.")
23 self.addOption ('containerName', '', type=str,
24 info="the input jet container, with a possible selection, in "
25 "the format `container` or `container.selection`.")
26 self.addOption ('runL1Matching', True, type=bool,
27 info="Add L1 matching decorations")
28 self.addOption ('runHLTMatching', True, type=bool,
29 info="Add HLT matching decorations")
30
31 def instanceName (self) :
32 """Return the instance name for this block"""
33 return self.containerName
34
35 def makeAlgs (self, config) :
36
37 triggers = trigger_set(config, self.triggerChainsPerYear,
38 self.includeAllYearsPerRun)
39 decisionTool = TriggerAnalysisBlock.makeTriggerDecisionTool(config)
40
41 for chain in triggers:
42 chain_noHLT = chain.replace("HLT_", "")
43 chain_out = chain_noHLT if self.removeHLTPrefix else chain
44 chain_out = chain_out.replace("-","_").replace(".","p")
45
46 alg = config.createAlgorithm( 'CP::JetTriggerDecoratorAlg',
47 'JetTriggerDecoratorAlg_' + chain )
48
49 alg.trigger = chain
50
51 # To add missing HLT jets -- only for buggy triggers
52 # These extra jets are added because of bug in trigger navigation
53 # Will be removed once bug fixed at DAOD level
54 alg.triggerBugList = [
55 "HLT_j80c_020jvt_j55c_020jvt_j28c_020jvt_j20c_020jvt_SHARED_2j20c_020jvt_bdl1d77_pf_ftf_presel2c20XX2c20b85_L1J45p0ETA21_3J15p0ETA25",
56 "HLT_j75c_020jvt_j50c_020jvt_j25c_020jvt_j20c_020jvt_SHARED_2j20c_020jvt_bgn177_pf_ftf_presel2c20XX2c20b85_L1J45p0ETA21_3J15p0ETA25"
57 ]
58
59 alg.TrigDecisionTool = f"{decisionTool.getType()}/{decisionTool.getName()}"
60
61 alg.doL1Matching = self.runL1Matching
62 alg.doHLTMatching = self.runHLTMatching
63 alg.jets = config.readName (self.containerName)
64
65 if config.geometry() is LHCPeriod.Run2 and self.runHLTMatching:
66 alg.useEmulationTool = True
67 config.addPrivateTool( 'trigEmulationTool',
68 'Trig::TrigBtagEmulationTool' )
69 # Configuration to adapt from
70 # https://gitlab.cern.ch/atlas/athena/-/blob/main/Trigger/TrigEmulation/TrigBtagEmulationTool/python/TrigBtagEmulationToolConfig.py#L59
71
73 alg.L1Et = "match_" + chain_out + "_L1et_%SYS%"
74 alg.L1Eta = "match_" + chain_out + "_L1eta_%SYS%"
75 alg.L1Phi = "match_" + chain_out + "_L1phi_%SYS%"
76 alg.L1DR = "match_" + chain_out + "_L1dr_%SYS%"
77 alg.L1Threshold = "match_" + chain_out + "_L1thresholds_%SYS%"
78 for var in ["L1et", "L1eta", "L1phi", "L1dr", "L1thresholds"]:
79 config.addOutputVar (self.containerName,
80 "match_" + chain_out + "_" + var + "_%SYS%",
81 "match_" + chain_out + "_" + var, noSys=True)
82
83 if self.runHLTMatching:
84 alg.HLTPt = "match_" + chain_out + "_HLTpt_%SYS%"
85 alg.HLTEta = "match_" + chain_out + "_HLTeta_%SYS%"
86 alg.HLTPhi = "match_" + chain_out + "_HLTphi_%SYS%"
87 alg.HLTDR = "match_" + chain_out + "_HLTdr_%SYS%"
88 alg.HLTThreshold = "match_" + chain_out + "_HLTthresholds_%SYS%"
89 for var in ["HLTpt", "HLTeta", "HLTphi", "HLTdr", "HLTthresholds"]:
90 config.addOutputVar (self.containerName,
91 "match_" + chain_out + "_" + var + "_%SYS%",
92 "match_" + chain_out + "_" + var, noSys=True)
std::string replace(std::string s, const std::string &s2, const std::string &s3)
Definition hcg.cxx:310