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:
49 "2015":
"TriggerAPISessions/tapis_data15_13TeV_20190708_PHYS_StandardGRL_All_Good_25ns.json",
50 "2016":
"TriggerAPISessions/tapis_data16_13TeV_20190708_PHYS_StandardGRL_All_Good_25ns_WITH_IGNORES.json",
51 "2015_2016":
"TriggerAPISessions/tapis_data15_13TeV_20190708_PHYS_StandardGRL_All_Good_25ns_data16_13TeV_20190708_PHYS_StandardGRL_All_Good_25ns_WITH_IGNORES.json",
52 "2017":
"TriggerAPISessions/tapis_data17_13TeV_20190708_PHYS_StandardGRL_All_Good_25ns_Triggerno17e33prim.json",
53 "2018":
"TriggerAPISessions/tapis_data18_13TeV_20190708_PHYS_StandardGRL_All_Good_25ns_Triggerno17e33prim.json",
54 "2022":
"TriggerAPISessions/tapis_data22_13p6TeV_20230207_PHYS_StandardGRL_All_Good_25ns.json",
55 "2023":
"TriggerAPISessions/tapis_data23_13p6TeV_20230828_PHYS_StandardGRL_All_Good_25ns.json",
58 if yearStr
in session_files:
59 return TriggerAPISession(json=session_files[yearStr])
62 if flags.Input.Format == Format.POOL:
63 return TriggerAPISession(file=flags.Input.Files[0])
65 from AthenaCommon.Logging
import logging
66 logging.getLogger(
'TriggerListHelper::GetTriggerLists::getTapisSession').
error(
'Failed to obtain a session.')
73 TriggerAPI.setConfigFlags(flags)
82 hlt_menu = md.get(
'TriggerMenu', {}).
get(
'HLTChains',
None)
84 if self.
flags.Trigger.EDMVersion <= 2:
93 allperiods = TriggerPeriod.y2015 | TriggerPeriod.y2016 | TriggerPeriod.y2017 | TriggerPeriod.y2018 | TriggerPeriod.future2e34
94 trig_el = TriggerAPI.getLowestUnprescaledAnyPeriod(allperiods, triggerType=TriggerType.el, livefraction=0.8)
95 trig_mu = TriggerAPI.getLowestUnprescaledAnyPeriod(allperiods, triggerType=TriggerType.mu, livefraction=0.8)
96 trig_g = TriggerAPI.getLowestUnprescaledAnyPeriod(allperiods, triggerType=TriggerType.g, livefraction=0.8)
97 trig_tau = TriggerAPI.getLowestUnprescaledAnyPeriod(allperiods, triggerType=TriggerType.tau, livefraction=0.8)
99 trig_em = TriggerAPI.getLowestUnprescaledAnyPeriod(allperiods, triggerType=TriggerType.el, additionalTriggerType=TriggerType.mu, livefraction=0.8)
100 trig_et = TriggerAPI.getLowestUnprescaledAnyPeriod(allperiods, triggerType=TriggerType.el, additionalTriggerType=TriggerType.tau, livefraction=0.8)
101 trig_mt = TriggerAPI.getLowestUnprescaledAnyPeriod(allperiods, triggerType=TriggerType.mu, additionalTriggerType=TriggerType.tau, livefraction=0.8)
103 trig_txe = TriggerAPI.getLowestUnprescaledAnyPeriod(allperiods, triggerType=TriggerType.tau, additionalTriggerType=TriggerType.xe, livefraction=0.8)
106 extra_file_notau =
read_trig_list_file(
"DerivationFrameworkPhys/run2ExtraMatchingTriggers.txt")
107 extra_file_tau =
read_trig_list_file(
"DerivationFrameworkPhys/run2ExtraMatchingTauTriggers.txt")
113 trigger_names_full_notau =
list(
set(trig_el+trig_mu+trig_g+trig_em+trig_et+trig_mt+extra_file_notau+extra_flag_notau))
114 trigger_names_full_tau =
list(
set(trig_tau+trig_txe+extra_file_tau+extra_flag_tau))
117 trigger_names_notau = []
118 trigger_names_tau = []
121 for chain_name
in hlt_menu:
122 if chain_name
in trigger_names_full_notau: trigger_names_notau.append(chain_name)
123 if chain_name
in trigger_names_full_tau: trigger_names_tau.append(chain_name)
125 trigger_names_notau = trigger_names_full_notau
126 trigger_names_tau = trigger_names_full_tau
136 api_trigger_names =
set()
137 api_trigger_names = session.getLowestUnprescaled(triggerType=TriggerType.el, livefraction=lf).union(api_trigger_names)
138 api_trigger_names = session.getLowestUnprescaled(triggerType=TriggerType.mu, livefraction=lf).union(api_trigger_names)
139 api_trigger_names = session.getLowestUnprescaled(triggerType=TriggerType.g, livefraction=lf).union(api_trigger_names)
140 api_trigger_names = session.getLowestUnprescaled(triggerType=TriggerType.tau, livefraction=lf).union(api_trigger_names)
142 api_trigger_names = session.getLowestUnprescaled(triggerType=[TriggerType.el, TriggerType.mu], livefraction=lf).union(api_trigger_names)
143 api_trigger_names = session.getLowestUnprescaled(triggerType=[TriggerType.el, TriggerType.tau], livefraction=lf).union(api_trigger_names)
144 api_trigger_names = session.getLowestUnprescaled(triggerType=[TriggerType.mu, TriggerType.tau], livefraction=lf).union(api_trigger_names)
145 api_trigger_names = session.getLowestUnprescaled(triggerType=[TriggerType.tau, TriggerType.xe], livefraction=lf).union(api_trigger_names)
147 api_trigger_names = session.getLowestUnprescaled(triggerType=[TriggerType.el, TriggerType.g], livefraction=lf).union(api_trigger_names)
148 api_trigger_names = session.getLowestUnprescaled(triggerType=[TriggerType.el, TriggerType.xe], livefraction=lf).union(api_trigger_names)
149 api_trigger_names = session.getLowestUnprescaled(triggerType=[TriggerType.mu, TriggerType.g], livefraction=lf).union(api_trigger_names)
150 api_trigger_names = session.getLowestUnprescaled(triggerType=[TriggerType.g, TriggerType.xe], livefraction=lf).union(api_trigger_names)
151 api_trigger_names = session.getLowestUnprescaled(triggerType=[TriggerType.tau, TriggerType.g], livefraction=lf).union(api_trigger_names)
154 api_trigger_names = session.getLowestUnprescaled(triggerType=TriggerType.j, livefraction=lf).union(api_trigger_names)
155 api_trigger_names = session.getLowestUnprescaled(triggerType=TriggerType.bj, livefraction=lf).union(api_trigger_names)
157 api_trigger_names = session.getLowestUnprescaled(triggerType=[TriggerType.el, TriggerType.j], livefraction=lf).union(api_trigger_names)
158 api_trigger_names = session.getLowestUnprescaled(triggerType=[TriggerType.mu, TriggerType.j], livefraction=lf).union(api_trigger_names)
159 api_trigger_names = session.getLowestUnprescaled(triggerType=[TriggerType.j, TriggerType.bj], livefraction=lf).union(api_trigger_names)
160 api_trigger_names = session.getLowestUnprescaled(triggerType=[TriggerType.j, TriggerType.g], livefraction=lf).union(api_trigger_names)
161 api_trigger_names = session.getLowestUnprescaled(triggerType=[TriggerType.j, TriggerType.tau], livefraction=lf).union(api_trigger_names)
162 api_trigger_names = session.getLowestUnprescaled(triggerType=[TriggerType.j, TriggerType.xe], livefraction=lf).union(api_trigger_names)
163 api_trigger_names = session.getLowestUnprescaled(triggerType=[TriggerType.j, TriggerType.ht], livefraction=lf).union(api_trigger_names)
164 api_trigger_names = session.getLowestUnprescaled(triggerType=[TriggerType.bj, TriggerType.xe], livefraction=lf).union(api_trigger_names)
168 extra_flag = extra_flag_notau + extra_flag_tau