51 from AthenaConfiguration.ComponentFactory
import CompFactory
54 from TrigConfigSvc.TriggerConfigAccess
import getHLTMonitoringAccess
55 moniAccess = getHLTMonitoringAccess(helper.flags)
56 Chains = moniAccess.monitoredChains(signatures=
"muonMon",monLevels=[
"shifter",
"t0",
"val"])
57 MonitoredChains = [c
for c
in Chains
if 'HLT_mu' in c]
60 if len(MonitoredChains) == 0:
62 MonitoredChains = [
'HLT_mu6_L1MU5VF',
'HLT_mu24_ivarmedium_L1MU14FCH',
'HLT_mu50_L1MU14FCH',
'HLT_mu60_0eta105_msonly_L1MU14FCH',
'HLT_mu14_L1MU8F',
'HLT_mu22_mu8noL1_L1MU14FCH',
'HLT_mu6_mu6noL1_L1MU5VF']
66 if not singlemu_chains_sorted:
67 log.warning(
'No suitable single-muon trigger chain found as tag for ttbar tag&probe')
70 tagandprobe_chain = singlemu_chains_sorted[0]
71 log.info(f
'Using {tagandprobe_chain} as tag and event trigger in ttbar tag&probe')
73 from MuonSelectorTools.MuonSelectorToolsConfig
import MuonLoosenedNonCalibratedSelectionToolCfg
74 from .MuonMatchingToolConfig
import MuonMatchingToolConfig
77 kwargs.setdefault(
"MuonContainerName",
"Muons")
79 for chain
in MonitoredChains:
80 monAlg = helper.addAlgorithm(CompFactory.TrigMuonEfficiencyMon,
'TrigMuEff_ttbar_'+chain,
81 MuonSelectionTool = helper.result().popToolsAndMerge(MuonLoosenedNonCalibratedSelectionToolCfg(helper.flags,
83 MuonMatchingTool = helper.result().popToolsAndMerge(MuonMatchingToolConfig(helper.flags,
85 MuonContainerName=kwargs[
"MuonContainerName"])),
88 monAlg.EventTrigger = tagandprobe_chain
89 monAlg.TagTrigger = tagandprobe_chain
90 monAlg.Method =
'TTbarTagAndProbe'
91 monAlg.MonitoredChains = [chain]
92 threshold, level1 =
regex(
'HLT_mu([0-9]+).*_(L1MU[A-Za-z0-9_]+)').
match(chain).groups()
93 monAlg.L1Seeds = [
regex(
'L1MU').sub(
'L1_MU', level1)]
94 monAlg.Thresholds = [float(threshold)]
95 monAlg.Group =
'Eff_ttbar_'+chain
97 GroupName =
'Eff_ttbar_'+chain
98 histGroup = helper.addGroup(monAlg, GroupName,
'HLT/MuonMon/Efficiency/ttbar/'+chain)
108 from AthenaConfiguration.ComponentFactory
import CompFactory
111 from TrigConfigSvc.TriggerConfigAccess
import getHLTMonitoringAccess
112 moniAccess = getHLTMonitoringAccess(helper.flags)
113 Chains = moniAccess.monitoredChains(signatures=
"muonMon",monLevels=[
"shifter",
"t0",
"val"])
114 MonitoredChains = [c
for c
in Chains
if 'HLT_mu' in c]
117 if len(MonitoredChains) == 0:
119 MonitoredChains = [
'HLT_mu6_L1MU5VF',
'HLT_mu24_ivarmedium_L1MU14FCH',
'HLT_mu50_L1MU14FCH',
'HLT_mu60_0eta105_msonly_L1MU14FCH',
'HLT_mu14_L1MU8F',
'HLT_mu22_mu8noL1_L1MU14FCH',
'HLT_mu6_mu6noL1_L1MU5VF']
123 if not singlemu_chains_sorted:
124 log.warning(
'No suitable single-muon trigger chain found as tag for Z tag&probe.')
127 tagandprobe_chain = singlemu_chains_sorted[0]
128 log.info(f
'Using {tagandprobe_chain} as tag and event trigger in Z tag&probe')
131 from MuonSelectorTools.MuonSelectorToolsConfig
import MuonLoosenedNonCalibratedSelectionToolCfg
132 from .MuonMatchingToolConfig
import MuonMatchingToolConfig
135 kwargs.setdefault(
"MuonContainerName",
"Muons")
137 for chain
in MonitoredChains:
138 monAlg = helper.addAlgorithm(CompFactory.TrigMuonEfficiencyMon,
'TrigMuEff_ZTP_'+chain,
139 MuonSelectionTool = helper.result().popToolsAndMerge(MuonLoosenedNonCalibratedSelectionToolCfg(helper.flags,
141 MuonMatchingTool = helper.result().popToolsAndMerge(MuonMatchingToolConfig(helper.flags,
143 MuonContainerName=kwargs[
"MuonContainerName"])),
146 monAlg.EventTrigger = tagandprobe_chain
147 monAlg.TagTrigger = tagandprobe_chain
148 monAlg.Method =
'ZTagAndProbe'
149 monAlg.MonitoredChains = [chain]
150 threshold, level1 =
regex(
'HLT_mu([0-9]+).*_(L1MU[A-Za-z0-9_]+)').
match(chain).groups()
151 monAlg.L1Seeds = [
regex(
'L1MU').sub(
'L1_MU', level1)]
152 monAlg.Thresholds = [float(threshold)]
153 monAlg.Group =
'Eff_ZTP_'+chain
155 GroupName =
'Eff_ZTP_'+chain
156 histGroup = helper.addGroup(monAlg, GroupName,
'HLT/MuonMon/Efficiency/ZTP/'+chain)
191 def defineEachStepHistograms(xvariable, xlabel, xbins, xmin, xmax):
192 histGroup.defineHistogram(GroupName+
'_'+xvariable+
';'+xvariable,
193 title=
'All offline combined muon '+chain+
';'+xlabel+
';Events',
194 type=
'TH1F',path=
'',xbins=xbins,xmin=xmin,xmax=xmax)
196 histGroup.defineHistogram(GroupName+
'_L1pass,'+GroupName+
'_'+xvariable+
';EffL1MU_'+xvariable+
'_wrt_Probe',
197 title=
'L1MU Efficiency '+chain+
';'+xlabel+
';Efficiency',
198 type=
'TEfficiency', path=
'',xbins=xbins,xmin=xmin,xmax=xmax)
201 histGroup.defineHistogram(GroupName+
'_L2SApass,'+GroupName+
'_'+xvariable+
';EffL2SA_'+xvariable+
'_wrt_Upstream',
202 title=
'L2MuonSA Efficiency '+chain+
' wrt Upstream;'+xlabel+
';Efficiency',
203 cutmask=GroupName+
'_L1pass',
204 type=
'TEfficiency', path=
'',xbins=xbins,xmin=xmin,xmax=xmax)
206 histGroup.defineHistogram(GroupName+
'_L2SApass,'+GroupName+
'_'+xvariable+
';EffL2SA_'+xvariable+
'_wrt_offlineCB',
207 title=
'L2MuonSA Efficiency '+chain+
' wrt offlineCB;'+xlabel+
';Efficiency',
208 type=
'TEfficiency', path=
'',xbins=xbins,xmin=xmin,xmax=xmax)
211 histGroup.defineHistogram(GroupName+
'_L2CBpass,'+GroupName+
'_'+xvariable+
';EffL2CB_'+xvariable+
'_wrt_Upstream',
212 title=
'L2muComb Efficiency '+chain+
' wrt Upstream;'+xlabel+
';Efficiency',
213 cutmask=GroupName+
'_L2SApass',
214 type=
'TEfficiency', path=
'',xbins=xbins,xmin=xmin,xmax=xmax)
216 histGroup.defineHistogram(GroupName+
'_L2CBpass,'+GroupName+
'_'+xvariable+
';EffL2CB_'+xvariable+
'_wrt_offlineCB',
217 title=
'L2muComb Efficiency '+chain+
' wrt offlineCB;'+xlabel+
';Efficiency',
218 type=
'TEfficiency', path=
'',xbins=xbins,xmin=xmin,xmax=xmax)
221 histGroup.defineHistogram(GroupName+
'_EFSApass,'+GroupName+
'_'+xvariable+
';EffEFSA_'+xvariable+
'_wrt_Upstream',
222 title=
'EFSA Muon Efficiency '+chain+
' wrt Upstream;'+xlabel+
';Efficiency',
223 cutmask=GroupName+
'_L2CBpass',
224 type=
'TEfficiency', path=
'',xbins=xbins,xmin=xmin,xmax=xmax)
226 histGroup.defineHistogram(GroupName+
'_EFSApass,'+GroupName+
'_'+xvariable+
';EffEFSA_'+xvariable+
'_wrt_offlineCB',
227 title=
'EFSA Muon Efficiency '+chain+
' wrt offlineCB;'+xlabel+
';Efficiency',
228 type=
'TEfficiency', path=
'',xbins=xbins,xmin=xmin,xmax=xmax)
230 histGroup.defineHistogram(GroupName+
'_EFSApass,'+GroupName+
'_'+xvariable+
';EffEFSA_'+xvariable+
'_wrt_offlineCB_passedL2SA',
231 title=
'EFSA Muon Efficiency passed L2SA '+chain+
' wrt offlineCB;'+xlabel+
';Efficiency',
232 cutmask=GroupName+
'_L2SApass',
233 type=
'TEfficiency', path=
'',xbins=xbins,xmin=xmin,xmax=xmax)
236 histGroup.defineHistogram(GroupName+
'_EFCBpass,'+GroupName+
'_'+xvariable+
';EffEFCB_'+xvariable+
'_wrt_Upstream',
237 title=
'EFCB Muon Efficiency '+chain+
' wrt Upstream;'+xlabel+
';Efficiency',
238 cutmask=GroupName+
'_EFSApass',
239 type=
'TEfficiency', path=
'',xbins=xbins,xmin=xmin,xmax=xmax)
241 histGroup.defineHistogram(GroupName+
'_EFCBpass,'+GroupName+
'_'+xvariable+
';EffEFCB_'+xvariable+
'_wrt_offlineCB',
242 title=
'EFCB Muon Efficiency '+chain+
' wrt offlineCB;'+xlabel+
';Efficiency',
243 type=
'TEfficiency', path=
'',xbins=xbins,xmin=xmin,xmax=xmax)
245 histGroup.defineHistogram(GroupName+
'_EFCBpass,'+GroupName+
'_'+xvariable+
';EffEFCB_'+xvariable+
'_wrt_offlineCB_passedL2CB',
246 title=
'EFCB Muon Efficiency passed L2CB '+chain+
' wrt offlineCB;'+xlabel+
';Efficiency',
247 cutmask=GroupName+
'_L2CBpass',
248 type=
'TEfficiency', path=
'',xbins=xbins,xmin=xmin,xmax=xmax)
251 histGroup.defineHistogram(GroupName+
'_EFSAFSpass,'+GroupName+
'_'+xvariable+
';EffEFSAFS_'+xvariable+
'_wrt_Upstream',
252 title=
'EFSAFS Muon Efficiency '+chain+
' wrt Upstream;'+xlabel+
';Efficiency',
253 cutmask=GroupName+
'_EFCBpass',
254 type=
'TEfficiency', path=
'',xbins=xbins,xmin=xmin,xmax=xmax)
256 histGroup.defineHistogram(GroupName+
'_EFSAFSpass,'+GroupName+
'_'+xvariable+
';EffEFSAFS_'+xvariable+
'_wrt_offlineCB',
257 title=
'EFSAFS Muon Efficiency '+chain+
' wrt offlineCB;'+xlabel+
';Efficiency',
258 type=
'TEfficiency', path=
'',xbins=xbins,xmin=xmin,xmax=xmax)
260 histGroup.defineHistogram(GroupName+
'_EFSAFSpass,'+GroupName+
'_'+xvariable+
';EffEFSAFS_'+xvariable+
'_wrt_offlineCB_passedL2SA',
261 title=
'EFSAFS Muon Efficiency passed L2SA '+chain+
' wrt offlineCB;'+xlabel+
';Efficiency',
262 cutmask=GroupName+
'_L2SApass',
263 type=
'TEfficiency', path=
'',xbins=xbins,xmin=xmin,xmax=xmax)
266 histGroup.defineHistogram(GroupName+
'_EFCBFSpass,'+GroupName+
'_'+xvariable+
';EffEFCBFS_'+xvariable+
'_wrt_Upstream',
267 title=
'EFCBFS Muon Efficiency '+chain+
' wrt Upstream;'+xlabel+
';Efficiency',
268 cutmask=GroupName+
'_EFSAFSpass',
269 type=
'TEfficiency', path=
'',xbins=xbins,xmin=xmin,xmax=xmax)
271 histGroup.defineHistogram(GroupName+
'_EFCBFSpass,'+GroupName+
'_'+xvariable+
';EffEFCBFS_'+xvariable+
'_wrt_offlineCB',
272 title=
'EFCBFS Muon Efficiency '+chain+
' wrt offlineCB;'+xlabel+
';Efficiency',
273 type=
'TEfficiency', path=
'',xbins=xbins,xmin=xmin,xmax=xmax)
275 histGroup.defineHistogram(GroupName+
'_EFCBFSpass,'+GroupName+
'_'+xvariable+
';EffEFCBFS_'+xvariable+
'_wrt_offlineCB_passedL2CB',
276 title=
'EFCBFS Muon Efficiency passed L2CB '+chain+
' wrt offlineCB;'+xlabel+
';Efficiency',
277 cutmask=GroupName+
'_L2CBpass',
278 type=
'TEfficiency', path=
'',xbins=xbins,xmin=xmin,xmax=xmax)
282 histGroup.defineHistogram(GroupName+
'_EFIsopass,'+GroupName+
'_'+xvariable+
';EffEFIso_'+xvariable+
'_wrt_Upstream',
283 title=
'EFIso Muon Efficiency '+chain+
' wrt Upstream;'+xlabel+
';Efficiency',
284 cutmask=GroupName+
'_EFCBpass',
285 type=
'TEfficiency', path=
'',xbins=xbins,xmin=xmin,xmax=xmax)
287 histGroup.defineHistogram(GroupName+
'_EFIsopass,'+GroupName+
'_'+xvariable+
';EffEFIso_'+xvariable+
'_wrt_offlineCB',
288 title=
'EFIso Muon Efficiency '+chain+
' wrt offlineCB;'+xlabel+
';Efficiency',
289 type=
'TEfficiency', path=
'',xbins=xbins,xmin=xmin,xmax=xmax)
292 defineEachStepHistograms(
'muPt',
'p_{T} [GeV]', 50, 0.0, 100.)
293 defineEachStepHistograms(
'muEta',
'#eta', 30, -3.0, 3.0)
294 defineEachStepHistograms(
'muPhi',
'#phi', 30, -math.pi, math.pi)
295 if flags.GeoModel.Run >= LHCPeriod.Run4:
296 defineEachStepHistograms(
'averageMu',
'average pileup', 4, 100., 220.)
298 defineEachStepHistograms(
'averageMu',
'average pileup', 4, 0., 80.)
301 histGroup.defineHistogram(GroupName+
'_invmass;invmass',
302 title=
'invariant mass of tag & probe muon '+chain+
';inv mass [GeV];Events',
303 type=
'TH1F',path=
'',xbins=40,xmin=0.,xmax=200.)