5 from TriggerMenuMT.TriggerAPI
import TriggerAPISession, TriggerType, TriggerAPI, TriggerPeriod
6 from PathResolver
import PathResolver
7 from AthenaConfiguration.AutoConfigFlags
import GetFileMD
10 """Read a text file containing a list of triggers
11 Returns the list of triggers held in the file
17 if line ==
"" or line.startswith(
"#"):
23 trigger_names_notau = []
24 trigger_names_tau = []
25 for chain_name
in flags.Trigger.derivationsExtraChains:
26 if "tau" in chain_name:
27 trigger_names_tau.append(chain_name)
29 trigger_names_notau.append(chain_name)
30 return (trigger_names_notau, trigger_names_tau)
33 from Campaigns.Utils
import Campaign
34 from AthenaConfiguration.Enums
import Format
35 yearStr =
str(flags.Input.DataYear)
if not flags.Input.isMC
else ""
37 if flags.Input.MCCampaign == Campaign.MC16a
or flags.Input.MCCampaign == Campaign.MC20a:
39 elif flags.Input.MCCampaign == Campaign.MC16d
or flags.Input.MCCampaign == Campaign.MC20d:
41 elif flags.Input.MCCampaign == Campaign.MC16e
or flags.Input.MCCampaign == Campaign.MC20e:
43 elif flags.Input.MCCampaign == Campaign.MC23a
or flags.Input.MCCampaign == Campaign.MC21a:
45 elif flags.Input.MCCampaign == Campaign.MC23c
or flags.Input.MCCampaign == Campaign.MC23d:
47 elif flags.Input.MCCampaign == Campaign.MC23e:
51 "2015":
"TriggerAPISessions/tapis_data15_13TeV_20190708_PHYS_StandardGRL_All_Good_25ns.json",
52 "2016":
"TriggerAPISessions/tapis_data16_13TeV_20190708_PHYS_StandardGRL_All_Good_25ns_WITH_IGNORES.json",
53 "2015_2016":
"TriggerAPISessions/tapis_data15_13TeV_20190708_PHYS_StandardGRL_All_Good_25ns_data16_13TeV_20190708_PHYS_StandardGRL_All_Good_25ns_WITH_IGNORES.json",
54 "2017":
"TriggerAPISessions/tapis_data17_13TeV_20190708_PHYS_StandardGRL_All_Good_25ns_Triggerno17e33prim.json",
55 "2018":
"TriggerAPISessions/tapis_data18_13TeV_20190708_PHYS_StandardGRL_All_Good_25ns_Triggerno17e33prim.json",
56 "2022":
"TriggerAPISessions/tapis_data22_13p6TeV_20230207_PHYS_StandardGRL_All_Good_25ns.json",
57 "2023":
"TriggerAPISessions/tapis_data23_13p6TeV_20230828_PHYS_StandardGRL_All_Good_25ns.json",
58 "2024":
"TriggerAPISessions/tapis_data24_13p6TeV_20241118_PHYS_StandardGRL_All_Good_25ns.json",
61 if yearStr
in session_files:
62 return TriggerAPISession(json=session_files[yearStr])
65 if flags.Input.Format == Format.POOL:
66 return TriggerAPISession(file=flags.Input.Files[0])
68 from AthenaCommon.Logging
import logging
69 logging.getLogger(
'TriggerListHelper::GetTriggerLists::getTapisSession').
error(
'Failed to obtain a session.')
76 TriggerAPI.setConfigFlags(flags)
85 hlt_menu = md.get(
'TriggerMenu', {}).
get(
'HLTChains',
None)
87 if self.
flags.Trigger.EDMVersion <= 2:
96 allperiods = TriggerPeriod.y2015 | TriggerPeriod.y2016 | TriggerPeriod.y2017 | TriggerPeriod.y2018 | TriggerPeriod.future2e34
97 trig_el = TriggerAPI.getLowestUnprescaledAnyPeriod(allperiods, triggerType=TriggerType.el, livefraction=0.8)
98 trig_mu = TriggerAPI.getLowestUnprescaledAnyPeriod(allperiods, triggerType=TriggerType.mu, livefraction=0.8)
99 trig_g = TriggerAPI.getLowestUnprescaledAnyPeriod(allperiods, triggerType=TriggerType.g, livefraction=0.8)
100 trig_tau = TriggerAPI.getLowestUnprescaledAnyPeriod(allperiods, triggerType=TriggerType.tau, livefraction=0.8)
102 trig_em = TriggerAPI.getLowestUnprescaledAnyPeriod(allperiods, triggerType=TriggerType.el, additionalTriggerType=TriggerType.mu, livefraction=0.8)
103 trig_et = TriggerAPI.getLowestUnprescaledAnyPeriod(allperiods, triggerType=TriggerType.el, additionalTriggerType=TriggerType.tau, livefraction=0.8)
104 trig_mt = TriggerAPI.getLowestUnprescaledAnyPeriod(allperiods, triggerType=TriggerType.mu, additionalTriggerType=TriggerType.tau, livefraction=0.8)
106 trig_txe = TriggerAPI.getLowestUnprescaledAnyPeriod(allperiods, triggerType=TriggerType.tau, additionalTriggerType=TriggerType.xe, livefraction=0.8)
109 extra_file_notau =
read_trig_list_file(
"DerivationFrameworkPhys/run2ExtraMatchingTriggers.txt")
110 extra_file_tau =
read_trig_list_file(
"DerivationFrameworkPhys/run2ExtraMatchingTauTriggers.txt")
116 trigger_names_full_notau =
list(
set(trig_el+trig_mu+trig_g+trig_em+trig_et+trig_mt+extra_file_notau+extra_flag_notau))
117 trigger_names_full_tau =
list(
set(trig_tau+trig_txe+extra_file_tau+extra_flag_tau))
120 trigger_names_notau = []
121 trigger_names_tau = []
124 for chain_name
in hlt_menu:
125 if chain_name
in trigger_names_full_notau: trigger_names_notau.append(chain_name)
126 if chain_name
in trigger_names_full_tau: trigger_names_tau.append(chain_name)
128 trigger_names_notau = trigger_names_full_notau
129 trigger_names_tau = trigger_names_full_tau
139 api_trigger_names =
set()
140 api_trigger_names = session.getLowestUnprescaled(triggerType=TriggerType.el, livefraction=lf).union(api_trigger_names)
141 api_trigger_names = session.getLowestUnprescaled(triggerType=TriggerType.mu, livefraction=lf).union(api_trigger_names)
142 api_trigger_names = session.getLowestUnprescaled(triggerType=TriggerType.g, livefraction=lf).union(api_trigger_names)
143 api_trigger_names = session.getLowestUnprescaled(triggerType=TriggerType.tau, livefraction=lf).union(api_trigger_names)
145 api_trigger_names = session.getLowestUnprescaled(triggerType=[TriggerType.el, TriggerType.mu], livefraction=lf).union(api_trigger_names)
146 api_trigger_names = session.getLowestUnprescaled(triggerType=[TriggerType.el, TriggerType.tau], livefraction=lf).union(api_trigger_names)
147 api_trigger_names = session.getLowestUnprescaled(triggerType=[TriggerType.mu, TriggerType.tau], livefraction=lf).union(api_trigger_names)
148 api_trigger_names = session.getLowestUnprescaled(triggerType=[TriggerType.tau, TriggerType.xe], livefraction=lf).union(api_trigger_names)
150 api_trigger_names = session.getLowestUnprescaled(triggerType=[TriggerType.el, TriggerType.g], livefraction=lf).union(api_trigger_names)
151 api_trigger_names = session.getLowestUnprescaled(triggerType=[TriggerType.el, TriggerType.xe], livefraction=lf).union(api_trigger_names)
152 api_trigger_names = session.getLowestUnprescaled(triggerType=[TriggerType.mu, TriggerType.g], livefraction=lf).union(api_trigger_names)
153 api_trigger_names = session.getLowestUnprescaled(triggerType=[TriggerType.g, TriggerType.xe], livefraction=lf).union(api_trigger_names)
154 api_trigger_names = session.getLowestUnprescaled(triggerType=[TriggerType.tau, TriggerType.g], livefraction=lf).union(api_trigger_names)
157 api_trigger_names = session.getLowestUnprescaled(triggerType=TriggerType.j, livefraction=lf).union(api_trigger_names)
158 api_trigger_names = session.getLowestUnprescaled(triggerType=TriggerType.bj, livefraction=lf).union(api_trigger_names)
160 api_trigger_names = session.getLowestUnprescaled(triggerType=[TriggerType.el, TriggerType.j], livefraction=lf).union(api_trigger_names)
161 api_trigger_names = session.getLowestUnprescaled(triggerType=[TriggerType.mu, TriggerType.j], livefraction=lf).union(api_trigger_names)
162 api_trigger_names = session.getLowestUnprescaled(triggerType=[TriggerType.j, TriggerType.bj], livefraction=lf).union(api_trigger_names)
163 api_trigger_names = session.getLowestUnprescaled(triggerType=[TriggerType.j, TriggerType.g], livefraction=lf).union(api_trigger_names)
164 api_trigger_names = session.getLowestUnprescaled(triggerType=[TriggerType.j, TriggerType.tau], livefraction=lf).union(api_trigger_names)
165 api_trigger_names = session.getLowestUnprescaled(triggerType=[TriggerType.j, TriggerType.xe], livefraction=lf).union(api_trigger_names)
166 api_trigger_names = session.getLowestUnprescaled(triggerType=[TriggerType.j, TriggerType.ht], livefraction=lf).union(api_trigger_names)
167 api_trigger_names = session.getLowestUnprescaled(triggerType=[TriggerType.bj, TriggerType.xe], livefraction=lf).union(api_trigger_names)
171 extra_flag = extra_flag_notau + extra_flag_tau