5 from AthenaConfiguration.ComponentFactory
import CompFactory
6 from AthenaMonitoring
import AthMonitorCfgHelper
7 from TrigConfigSvc.TriggerConfigAccess
import getHLTMonitoringAccess
8 from AthenaCommon.Logging
import logging
10 from .utils
import getMinBiasChains
12 log = logging.getLogger(
'TrigFwdAFPMonitoring')
15 'Topo':
'AntiKt4EMTopoJets',
16 'PFlow':
'AntiKt4EMPFlowJets',
17 'HLTTopo':
'HLT_AntiKt4EMTopoJets_subjesIS',
18 'HLTPFlow':
'HLT_AntiKt4EMPFlowJets_subjesIS_ftf'
23 """ Configure general AFP chains monitoring algs """
25 monConfig = AthMonitorCfgHelper(flags,
'FwdAFPMonitoringAlgs')
31 algCount = monConfig.addAlgorithm(CompFactory.FwdAFPCountMonitoringAlg,
'FwdAFPCountMonitoringAlg')
32 algCount.chains = [name
for name, _
in afp_chains]
34 log.info(f
'Monitoring {len(afp_chains)} AFP chains')
36 afpCountGroup = monConfig.addGroup(algCount,
'AFPCount', topPath=
'HLT/FwdAFP/')
37 afpCountGroup.defineHistogram(
'counts', title=
'Trigger counts;;Counts', xbins=len(algCount.chains),
38 xmin=0, xmax=len(algCount.chains), xlabels=
list(algCount.chains))
40 return monConfig.result()
44 """ Configure AFP+jet chains monitoring algs """
46 monConfig = AthMonitorCfgHelper(flags,
'FwdAFPJetMonitoringAlgs')
51 ref_chains = [
'HLT_mb_sp_L1RD0_FILLED',
'HLT_mb_sptrk_L1RD0_FILLED',
'HLT_noalg_L1RD0_FILLED',
52 'HLT_noalg_L1AFP_A_OR_C',
'HLT_noalg_L1AFP_A_OR_C']
54 log.info(f
'Monitoring {len(chains_afp)} AFP+DiJet chains')
55 log.debug([name
for name, _
in chains_afp])
58 for jet, container
in jet_containers.items():
59 algEff = monConfig.addAlgorithm(CompFactory.FwdAFPJetMonitoringAlg,
'FwdAFP' + jet +
'JetMonitoringAlg')
61 algEff.chains = [name
for name, _
in chains_afp]
62 algEff.jetContainer = container
64 for chain, level
in chains_afp:
65 afpJetGroup = monConfig.addGroup(algEff, f
'{chain}_{container}', topPath=f
'HLT/FwdAFP/{level}/Jet/{chain}/{container}/')
66 afpJetGroup.defineHistogram(
'jetPt', title=f
'{jet} jet pT;Jet pT [GeV];Entries', xbins=100, xmin=0, xmax=200)
67 afpJetGroup.defineHistogram(
'jetEta', title=f
'{jet} jet eta;Jet #eta;Entries', xbins=100, xmin=-4.9, xmax=4.9)
68 afpJetGroup.defineHistogram(
'jetPhi', title=f
'{jet} jet phi;Jet #varphi;Entries', xbins=100, xmin=-math.pi, xmax=math.pi)
69 afpJetGroup.defineHistogram(
'jetEta,jetPhi', type=
'TH2F', title=f
'{jet} jet eta vs phi;Jet #eta;Jet #varphi;Entries',
70 xbins=40, xmin=-4.9, xmax=4.9, ybins=40, ymin=-math.pi, ymax=math.pi)
71 afpJetGroup.defineHistogram(
'jetEta,jetPt', type=
'TH2F', title=f
'{jet} jet eta vs phi;Jet #eta;Jet pT [GeV];Entries',
72 xbins=40, xmin=-4.9, xmax=4.9, ybins=40, ymin=0, ymax=200)
74 afpJetGroup.defineHistogram(
'leadingJetPt', title=f
'Leading {jet} jet pT;Leading jet pT [GeV];Entries',
75 xbins=100, xmin=0, xmax=200)
76 afpJetGroup.defineHistogram(
'leadingJetEta', title=f
'Leading {jet} jet eta;Leading jet #eta;Entries',
77 xbins=100, xmin=-4.9, xmax=4.9)
78 afpJetGroup.defineHistogram(
'leadingJetPhi', title=f
'Leading {jet} jet phi;Leading jet #varphi;Entries',
79 xbins=100, xmin=-math.pi, xmax=math.pi)
80 afpJetGroup.defineHistogram(
'leadingJetEta,leadingJetPhi', type=
'TH2F',
81 title=f
'Leading {jet} jet eta vs phi;Leading jet #eta;Leading jet #varphi;Entries',
82 xbins=40, xmin=-4.9, xmax=4.9, ybins=40, ymin=-math.pi, ymax=math.pi)
83 afpJetGroup.defineHistogram(
'leadingJetEta,leadingJetPt', type=
'TH2F',
84 title=f
'Leading {jet} jet eta vs phi;Leading jet #eta;Leading jet pT [GeV];Entries',
85 xbins=40, xmin=-4.9, xmax=4.9, ybins=40, ymin=0, ymax=200)
88 algEff = monConfig.addAlgorithm(CompFactory.FwdAFPJetEffMonitoringAlg,
'FwdAFPJetEffMonitoringAlg')
89 algEff.chains = [name
for name, _l
in chains_afp
for _r
in range(len(ref_chains))]
90 algEff.references = ref_chains * len(chains_afp)
92 for chain, level
in chains_afp:
93 for ref
in ref_chains:
94 afpJetEffGroup = monConfig.addGroup(algEff, f
'{chain}_{ref}', topPath=f
'HLT/FwdAFP/{level}/Jet/Eff/')
95 afpJetEffGroup.defineHistogram(f
'effPassed,leadingJetPt;{chain}_vs_{ref}', type=
'TEfficiency',
96 title=f
'{chain} vs {ref};Leading jet pT [GeV];Efficiency', xbins=100, xmin=0, xmax=200)
98 return monConfig.result()
102 """ Collect all configured AFP chains algorithms """
104 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
113 if __name__ ==
'__main__':
114 """ Test AFP+jet monitoring by running: python -m TrigMinBiasMonitoring.TrigFwdAFPMonitoring --filesInput=... """
116 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
119 flags.Output.HISTFileName =
'TestFwdAfpMonitorOutput.root'
124 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
125 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
130 cfg.printConfig(withDetails=
True)
131 with open(
'cfg.pkl',
'wb')
as f: