4def JetEfficiencyMonitoringConfig(flags):
5 '''Function to configure LVL1 JetEfficiency algorithm in the monitoring system.'''
6
7
8 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
9 from AthenaConfiguration.ComponentFactory import CompFactory
10 from TrigConfigSvc.TriggerConfigAccess import getL1MenuAccess
11 result = ComponentAccumulator()
12 l1menu = getL1MenuAccess(flags)
13
14
15 from AthenaConfiguration.Enums import Format
16
18 if flags.Input.Format is Format.POOL and not flags.Input.isMC and not any(["AOD" in a for a in flags.Input.ProcessingTags]):
19 from JetRecConfig.JetRecConfig import JetRecCfg
20 from JetRecConfig.StandardSmallRJets import AntiKt4EMPFlow
21 result.merge( JetRecCfg(flags,AntiKt4EMPFlow) )
22
23 from eflowRec.PFCfg import PFGlobalFlowElementLinkingCfg
24 if flags.DQ.Environment == "AOD":
25 result.merge(PFGlobalFlowElementLinkingCfg(flags, useMuonTopoClusters=True))
26 else:
27 result.merge(PFGlobalFlowElementLinkingCfg(flags))
28 from eflowRec.PFCfg import PFGlobalFlowElementLinkingCfg
29 result.merge(PFGlobalFlowElementLinkingCfg(flags))
30 from METReconstruction.METAssociatorCfg import METAssociatorCfg
32 from METUtilities.METMakerConfig import METMakerCfg
33 result.merge(METMakerCfg(flags, 'AntiKt4EMPFlow'))
34
35
36
37 from TrigT1CaloMonitoring.LVL1CaloMonitoringConfig import L1CaloMonitorCfgHelper
38 helper = L1CaloMonitorCfgHelper(flags,CompFactory.JetEfficiencyMonitorAlgorithm,'JetEfficiencyMonAlg')
39 groupName = 'JetEfficiencyMonitor'
40 JetEfficiencyMonAlg = helper.alg
41 JetEfficiencyMonAlg.PackageName = groupName
42
43
44
48
49
50
51
52
53 passedb4Prescale = True
54 JetEfficiencyMonAlg.PassedBeforePrescale = passedb4Prescale
55
56
60
61
62 hltRandom_reference_triggers = ['HLT_j0_perf_L1RD0_FILLED', 'HLT_j0_perf_pf_ftf_L1RD0_FILLED']
63 JetEfficiencyMonAlg.HLTRandomReferenceTriggers = hltRandom_reference_triggers
64
65 muon_reference_triggers = ["L1_MU14FCH", "L1_MU18VFCH", "L1_2MU8F", "L1_MU8VF_2MU5VF", "L1_3MU3VF", "L1_MU5VF_3MU3VF", "L1_4MU3V", "L1_2MU5VF_3MU3V"]
66 JetEfficiencyMonAlg.MuonReferenceTriggers = muon_reference_triggers
67
68 JetEfficiencyMonAlg.BootstrapReferenceTrigger='L1_J15'
69
70 trigPath = 'Developer/JetEfficiency/'
71 ExpertTrigPath = 'Expert/Efficiency/'
72 distributionPath = 'Distributions/'
73 noRefPath = 'NoReferenceTrigger/'
74 muonRefPath = 'MuonReferenceTrigger/'
75 randomRefPath = 'RandomHLTReferenceTrigger/'
76 bsRefPath = 'BootstrapReferenceTrigger/'
77 GeV = 1000
78
79
80 gfex_SR_triggers = ['L1_gJ20p0ETA25', 'L1_gJ50p0ETA25', 'L1_gJ100p0ETA25', 'L1_gJ400p0ETA25']
81 gfex_LR_triggers = ['L1_gLJ80p0ETA25', 'L1_gLJ100p0ETA25', 'L1_gLJ140p0ETA25', 'L1_gLJ160p0ETA25']
82
83 jfex_SR_triggers = ['L1_jJ30','L1_jJ40','L1_jJ50', 'L1_jJ60', 'L1_jJ80','L1_jJ90', 'L1_jJ125','L1_jJ140','L1_jJ160', 'L1_jJ180']
84 jfex_LR_triggers = ['L1_SC175-SCjJ10']
85
86 all_SR_triggers = gfex_SR_triggers + jfex_SR_triggers
87 all_LR_triggers = gfex_LR_triggers + jfex_LR_triggers
88
89
90 JetEfficiencyMonAlg.SmallRadiusJetTriggers_phase1 = [trigger for trigger in all_SR_triggers if trigger in l1menu]
91 JetEfficiencyMonAlg.LargeRadiusJetTriggers_phase1 = [trigger for trigger in all_LR_triggers if trigger in l1menu]
92
93 JetEfficiencyMonAlg.SmallRadiusJetTriggers_gFEX = [trigger for trigger in gfex_SR_triggers if trigger not in l1menu]
94 JetEfficiencyMonAlg.LargeRadiusJetTriggers_gFEX = [trigger for trigger in gfex_LR_triggers if trigger not in l1menu]
95
96
97 if len(JetEfficiencyMonAlg.SmallRadiusJetTriggers_gFEX ) == 0: JetEfficiencyMonAlg.mygFexSRJetRoIContainer = ""
98 if len(JetEfficiencyMonAlg.LargeRadiusJetTriggers_gFEX ) == 0: JetEfficiencyMonAlg.mygFexLRJetRoIContainer = ""
99
100
101 reference_paths = {"Muon" : muonRefPath, "RandomHLT": randomRefPath, "No": noRefPath, "Bootstrap": bsRefPath}
102 references = ["Muon", "No", "Bootstrap"]
103
104
105 sr_props = ["SRpt"]
106 lr_props = ["LRpt"]
107 trigger_group_list = {"gfex_SR_triggers" : gfex_SR_triggers,
108 "gfex_LR_triggers" : gfex_LR_triggers,
109 "jfex_SR_triggers" : jfex_SR_triggers,
110 "jfex_LR_triggers" : jfex_LR_triggers }
111 properties_per_trigger_group = {"gfex_SR_triggers" : sr_props, "jfex_SR_triggers" : sr_props,
112 "gfex_LR_triggers" : lr_props, "jfex_LR_triggers" : lr_props }
113 pathadd_per_trigger_group = {"gfex_SR_triggers" : "gFEX/", "jfex_SR_triggers" : "jFEX/",
114 "gfex_LR_triggers" : "gFEX/", "jfex_LR_triggers" : "jFEX/" }
115 trigger_groups = list(trigger_group_list.keys())
116
117 xlabel_for_prop = { "SRpt" :'pT [MeV]', "SReta" : '#eta', "LRpt" :'pT [MeV]', "LReta" : '#eta'}
118 nbins = {"SRpt": 220, "SReta" :32, "LRpt": 220, "LReta" :32}
119 binmin = {"SRpt": -50, "SReta" :-3.3, "LRpt": -50, "LReta" :-3.3}
120 binmax = {"SRpt": 1800*GeV, "SReta" :3.3, "LRpt": 1800*GeV, "LReta" :3.3}
121
122
123 plotDistrubutions = False
124 if plotDistrubutions:
125 helper.defineHistogram('raw_pt',title='pT for all leading offline jets (with no trigger requirments);PT [MeV];Events', fillGroup=groupName, path=trigPath + distributionPath, xbins=nbins["SRpt"], xmin=binmin["SRpt"], xmax=binmax["SRpt"])
126
127 helper.defineHistogram('raw_eta', title='Eta Distribution for all leading offline jets (with no trigger requirments);#eta; Count', fillGroup=groupName, path=trigPath + distributionPath, xbins=nbins["SReta"], xmin=binmin["SReta"], xmax=binmax["SReta"])
128
129
130 for tgroup in trigger_groups:
131 for t in trigger_group_list[tgroup]:
132
133
134 thresholdConfig = {"Plateau":plateau_dict.get(t,[0.99,0.95])}
135 thresholdConfig["Threshold"] = get_or_estimate_thresholds(t)
136 xMaxConfig =
min(thresholdConfig[
"Threshold"][1]*2.5, binmax[
"SRpt"])
137
138 helper.defineDQAlgorithm("JetEfficiency_"+t,
139 hanConfig={"libname":"libdqm_algorithms.so","name":"Simple_fermi_Fit_TEff", "xmax":xMaxConfig, "ImproveFit":1},
140 thresholdConfig=thresholdConfig
141 )
142 for p in properties_per_trigger_group[tgroup]:
143 for r in references:
144
145
146 if t in l1menu: eff_plot_title = t+';'+xlabel_for_prop[p]+'; Efficiency '
147 elif t not in l1menu and t in (gfex_SR_triggers + gfex_LR_triggers): eff_plot_title = t+' Emulated;'+xlabel_for_prop[p]+'; Efficiency '
148 else: eff_plot_title = t+' NOT in Menu;'+xlabel_for_prop[p]+'; Efficiency '
149
150
151 if r == "Muon" and p in ["SRpt", "LRpt"]:
152 helper.defineHistogram(f"bool_{r}_{t}, val_{p};{p}_{t}", type='TEfficiency', title=eff_plot_title, fillGroup=groupName, path=ExpertTrigPath + pathadd_per_trigger_group[tgroup]+ reference_paths[r], xbins=nbins[p], xmin=binmin[p], xmax=binmax[p], hanConfig={"algorithm":"JetEfficiency_"+t}, opt='kAlwaysCreate')
153 else:
154 helper.defineHistogram(f"bool_{r}_{t}, val_{p};{p}_{t}", type='TEfficiency', title=eff_plot_title, fillGroup=groupName, path=trigPath + pathadd_per_trigger_group[tgroup]+ reference_paths[r], xbins=nbins[p], xmin=binmin[p], xmax=binmax[p], opt='kAlwaysCreate')
155
156
157
158 acc = helper.result()
159 result.merge(acc)
160 print(
"flags.DQ.Environment = " + flags.DQ.Environment )
161 return result
162