ATLAS Offline Software
Loading...
Searching...
No Matches
TIDAMonitoring.py
Go to the documentation of this file.
2# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3#
4# create all the histograms for each analysis - this will get called once for each
5# configured chain - we can set the HistPath either already here, or from the c++
6# code
7
8
9# actual code to configure al;l the different algorithm instances for
10# the different slices
11
12# NB: All these trigger chains start with "HLT_", so the getchains function
13# will try to match with "HLT_xxx" first and if that doesn't match
14# it will then try "EF_xxx" At some point, when we are mostly dealing with
15# chains, we can swap them round.
16
17def TIDAMonitoring( flags=None, name=None, monlevel=None, mcTruth=False ) :
18
19 tools = []
20
21 from AthenaCommon.Logging import logging
22 log = logging.getLogger("TIDAMonitoring")
23
24 log.info( "Creating TIDA monitoring: " + name )
25 log.info( " mcTruth: " + str(mcTruth) )
26
27 key = "All"
28 toolkey = ""
29
30 if monlevel is not None:
31 log.info( "TIDA monitoring not None: monlevel: " + monlevel )
32 if "t0" in monlevel:
33 key = "Expert"
34 toolkey = "Expert"
35 elif "shifter" in monlevel:
36 key = "Shifter"
37 toolkey = "Shifter"
38
39 # each signature has it's own function now so it makes it easier to disable
40 # any of them is need be
41
42 TIDAelectron( flags, key, toolkey, tools, monlevel, mcTruth )
43 TIDAmuon( flags, key, toolkey, tools, monlevel, mcTruth )
44 TIDAtau( flags, key, toolkey, tools, monlevel, mcTruth )
45 TIDAbjet( flags, key, toolkey, tools, monlevel, mcTruth )
46 TIDAminbias( flags, key, toolkey, tools, monlevel, mcTruth )
47 TIDAcosmic( flags, key, toolkey, tools, monlevel, mcTruth )
48 TIDAbphys( flags, key, toolkey, tools, monlevel, mcTruth )
49 TIDAutt( flags, key, toolkey, tools, monlevel, mcTruth )
50
51 return tools
52
53
54# could we maybe eventually replace by a single creator function, as below, if we can find a way to
55# pass in all the custom variables, such as d0 etc, with out resorting to an egregious kwargs pattern
56# like this ...
57
58# TIDAsignature( flags, "Egamma", key, toolkey, tools, monlevel, mcTruth,
59# [ "HLT_e.(?!.*lrtloose.*).*idperf(?!.*lrtloose.*).*:key=HLT_IDTrack_Electron_FTF:roi=HLT_Roi_FastElectron",
60# "HLT_e.(?!.*lrtloose.*).*idperf(?!.*lrtloose.*).*:key=HLT_IDTrack_Electron_IDTrig",
61# "HLT_e.(?!.*lrtloose.*).*idperf(?!.*lrtloose.*)(?!.*nogsf.*).*:key=HLT_IDTrack_Electron_GSF",
62# "HLT_e.*_lhtight.*_e.*_idperf_tight_nogsf_probe_.*inv.*:key=HLT_IDTrack_Electron_FTF:roi=HLT_Roi_FastElectron:te=1",
63# "HLT_e.*_lhtight.*_e.*_idperf_tight_nogsf_probe_.*inv.*:key=HLT_IDTrack_Electron_FTF:extra=el_tag:roi=HLT_Roi_FastElectron:te=0",
64# "HLT_e.*_lhtight.*_e.*_idperf_tight_nogsf_probe_.*inv.*:key=HLT_IDTrack_Electron_FTF:extra=el_probe:roi=HLT_Roi_FastElectron:te=1",
65# "HLT_e.*_lhtight.*_e.*_idperf_tight_nogsf_probe_.*inv.*:key=HLT_IDTrack_Electron_IDTrig:te=1",
66# "HLT_e.*_lhtight.*_e.*_idperf_tight_nogsf_probe_.*inv.*:key=HLT_IDTrack_Electron_IDTrig:extra=el_tag:te=0",
67# "HLT_e.*_lhtight.*_e.*_idperf_tight_nogsf_probe_.*inv.*:key=HLT_IDTrack_Electron_IDTrig:extra=el_probe:te=1",
68# "HLT_e.*_lhtight.*_e.*_idperf_tight_probe_.*inv.*:key=HLT_IDTrack_Electron_GSF:te=1",
69# "HLT_e.*_lhtight.*_e.*_idperf_tight_probe_.*inv.*:key=HLT_IDTrack_Electron_GSF:extra=el_tag:te=0",
70# "HLT_e.*_lhtight.*_e.*_idperf_tight_probe_.*inv.*:key=HLT_IDTrack_Electron_GSF:extra=el_probe:te=1" ] )
71
72
73def TIDAsignature( flags, signature, key, toolkey, tools, monlevel, mcTruth, chain_regex ) :
74
75 if mcTruth:
76 tida = TrigR3Mon_builder( flags, name = "ID"+signature+"Truth"+toolkey+"Tool", mcTruth=True, pdgID=11 )
77 tida.SliceTag = "HLT/TRIDT/"+signature+"Truth/"+key
78 else:
79 tida = TrigR3Mon_builder( flags, name = "ID"+signature+toolkey+"Tool", useHighestPT=True )
80 tida.SliceTag = "HLT/TRIDT/"+signature+"/"+key
81
82 tida.AnalysisConfig = "Tier0"
83
84 from TrigInDetMonitoring.TIDAChains import getchains
85
86 chains = getchains( flags, chain_regex, monlevel )
87
88
89 if len(chains)>0 :
90
91 tida.ntupleChainNames = chains
92
93 tida.MonTools = createMonTools( flags, tida.SliceTag, chains )
94
95 tools += [ tida ]
96
97
98
99
100
101
102
103def TIDAelectron( flags, key, toolkey, tools, monlevel, mcTruth ) :
104
105
106
107 if mcTruth:
108 tidaegamma = TrigR3Mon_builder( flags, name = "IDEgammaTruth"+toolkey+"Tool", mcTruth=True, pdgID=11 )
109 tidaegamma.SliceTag = "HLT/TRIDT/EgammaTruth/"+key
110 else:
111 tidaegamma = TrigR3Mon_builder( flags, name = "IDEgamma"+toolkey+"Tool", useHighestPT=True )
112 tidaegamma.SliceTag = "HLT/TRIDT/Egamma/"+key
113
114 tidaegamma.AnalysisConfig = "Tier0"
115
116 from TrigInDetMonitoring.TIDAChains import getchains
117
118 chains = getchains( flags,
119 [ "HLT_e.(?!.*lrtloose.*).*idperf(?!.*lrtloose.*).*:key=HLT_IDTrack_Electron_FTF:roi=HLT_Roi_FastElectron",
120 "HLT_e.(?!.*lrtloose.*).*idperf(?!.*lrtloose.*).*:key=HLT_IDTrack_Electron_IDTrig",
121 "HLT_e.(?!.*lrtloose.*).*idperf(?!.*lrtloose.*)(?!.*nogsf.*).*:key=HLT_IDTrack_Electron_GSF",
122 "HLT_e.*idperf.*ion.*:key=HLT_IDTrack_Electron_FTF:roi=HLT_Roi_FastElectron",
123 "HLT_e.*idperf.*ion.*:key=HLT_IDTrack_Electron_FTF",
124 "HLT_e.*idperf.*ion.*:key=HLT_IDTrack_Electron_IDTrig",
125 "HLT_e.*_lhtight.*_e.*_idperf_tight_nogsf_probe_.*inv.*:key=HLT_IDTrack_Electron_FTF:roi=HLT_Roi_FastElectron:te=1",
126 "HLT_e.*_lhtight.*_e.*_idperf_tight_nogsf_probe_.*inv.*:key=HLT_IDTrack_Electron_FTF:extra=el_tag:roi=HLT_Roi_FastElectron:te=0",
127 "HLT_e.*_lhtight.*_e.*_idperf_tight_nogsf_probe_.*inv.*:key=HLT_IDTrack_Electron_FTF:extra=el_probe:roi=HLT_Roi_FastElectron:te=1",
128 "HLT_e.*_lhtight.*_e.*_idperf_tight_nogsf_probe_.*inv.*:key=HLT_IDTrack_Electron_IDTrig:te=1",
129 "HLT_e.*_lhtight.*_e.*_idperf_tight_nogsf_probe_.*inv.*:key=HLT_IDTrack_Electron_IDTrig:extra=el_tag:te=0",
130 "HLT_e.*_lhtight.*_e.*_idperf_tight_nogsf_probe_.*inv.*:key=HLT_IDTrack_Electron_IDTrig:extra=el_probe:te=1",
131 "HLT_e.*_lhtight.*_e.*_idperf_tight_probe_.*inv.*:key=HLT_IDTrack_Electron_GSF:te=1",
132 "HLT_e.*_lhtight.*_e.*_idperf_tight_probe_.*inv.*:key=HLT_IDTrack_Electron_GSF:extra=el_tag:te=0",
133 "HLT_e.*_lhtight.*_e.*_idperf_tight_probe_.*inv.*:key=HLT_IDTrack_Electron_GSF:extra=el_probe:te=1" ], monlevel )
134
135 if len(chains)>0 :
136
137 tidaegamma.ntupleChainNames = chains
138
139 tidaegamma.MonTools = createMonTools( flags, tidaegamma.SliceTag, chains )
140
141 tools += [ tidaegamma ]
142
143
144
145
146
147 if mcTruth:
148 tidaegammalrt = TrigR3Mon_builder( flags, name = "IDEgammaLRTTruth"+toolkey+"Tool", mcTruth=True, pdgID=11 )
149 tidaegammalrt.SliceTag = "HLT/TRIDT/EgammaLRTTruth/"+key
150 else:
151 tidaegammalrt = TrigR3Mon_builder( flags, name = "IDEgammaLRT"+toolkey+"Tool", useHighestPT=True )
152 tidaegammalrt.SliceTag = "HLT/TRIDT/EgammaLRT/"+key
153
154 tidaegammalrt.AnalysisConfig = "Tier0"
155 tidaegammalrt.mind0CutOffline = 2.
156
157 from TrigInDetMonitoring.TIDAChains import getchains
158
159 chains = getchains( flags,
160 [ "HLT_e.*idperf_loose_lrtloose.*:key=HLT_IDTrack_ElecLRT_FTF:roi=HLT_Roi_FastElectron_LRT",
161 "HLT_e.*idperf_loose_lrtloose.*:key=HLT_IDTrack_ElecLRT_IDTrig:roi=HLT_Roi_FastElectron_LRT",
162 "HLT_e.*lrtloose_idperf.*:key=HLT_IDTrack_ElecLRT_FTF:roi=HLT_Roi_FastElectron_FTF",
163 "HLT_e.*lrtloose_idperf.*:key=HLT_IDTrack_ElecLRT_IDTrig:roi=HLT_Roi_FastElectron_LRT",
164 ], monlevel )
165
166 if len(chains)>0 :
167
168 tidaegammalrt.ntupleChainNames = chains
169 tidaegammalrt.ntupleChainNames += [ "Offline", "Offline:+InDetLargeD0TrackParticles" ]
170
171 tidaegammalrt.MonTools = createMonTools( flags, tidaegammalrt.SliceTag, chains )
172
173 tools += [ tidaegammalrt ]
174
175
176
177
178def TIDAmuon( flags, key, toolkey, tools, monlevel, mcTruth ) :
179
180
181
182 if mcTruth:
183 tidamuon = TrigR3Mon_builder( flags, name = "IDMuonTruth"+toolkey+"Tool", mcTruth=True, pdgID=13 )
184 tidamuon.SliceTag = "HLT/TRIDT/MuonTruth/"+key
185 else:
186 tidamuon = TrigR3Mon_builder( flags, name = "IDMuon"+toolkey+"Tool", useHighestPT=True )
187 tidamuon.SliceTag = "HLT/TRIDT/Muon/"+key
188
189 tidamuon.AnalysisConfig = "Tier0"
190
191 from TrigInDetMonitoring.TIDAChains import getchains
192
193 chains = getchains( flags,
194 [ "HLT_mu(?!.*LRT.*)(?!.*tau.*).*_idperf.*:key=HLT_IDTrack_Muon_FTF:roi=HLT_Roi_L2SAMuon",
195 "HLT_mu(?!.*LRT.*)(?!.*tau.*).*_idperf.*:key=HLT_IDTrack_Muon_IDTrig:roi=HLT_Roi_L2SAMuon",
196 "HLT_mu.*ivarperf.*:key=HLT_IDTrack_MuonIso_FTF:roi=HLT_Roi_MuonIso",
197 "HLT_mu.*ivarperf.*:key=HLT_IDTrack_MuonIso_IDTrig:roi=HLT_Roi_MuonIso",
198 "HLT_mu.*_mu.*_idperf.*:key=HLT_IDTrack_Muon_FTF:roi=HLT_Roi_L2SAMuon",
199 "HLT_mu.*_mu.*_idperf.*:key=HLT_IDTrack_Muon_IDTrig:roi=HLT_Roi_L2SAMuon",
200 "HLT_mu.*_mu.*idtp.*:key=HLT_IDTrack_Muon_FTF:roi=HLT_Roi_L2SAMuon",
201 "HLT_mu.*_mu.*idtp.*:key=HLT_IDTrack_Muon_IDTrig:roi=HLT_Roi_L2SAMuon",
202 "HLT_mu.*_mu.*idtp.*:key=HLT_IDTrack_Muon_FTF:roi=HLT_Roi_L2SAMuon:te=1",
203 "HLT_mu.*_mu.*idtp.*:key=HLT_IDTrack_Muon_IDTrig:roi=HLT_Roi_L2SAMuon:te=1",
204 "HLT_mu.*_mu.*idtp.*:key=HLT_IDTrack_Muon_FTF:roi=HLT_Roi_L2SAMuon:extra=mu_tag:te=0",
205 "HLT_mu.*_mu.*idtp.*:key=HLT_IDTrack_Muon_FTF:roi=HLT_Roi_L2SAMuon:extra=mu_probe:te=1",
206 "HLT_mu.*_mu.*idtp.*:key=HLT_IDTrack_Muon_IDTrig:roi=HLT_Roi_L2SAMuon:extra=mu_tag:te=0",
207 "HLT_mu.*_mu.*idtp.*:key=HLT_IDTrack_Muon_IDTrig:roi=HLT_Roi_L2SAMuon:extra=mu_probe:te=1",
208 "HLT_mu.*_mu.*_idperf.*:key=HLT_IDTrack_Muon_FTF:roi=HLT_Roi_L2SAMuon:te=1",
209 "HLT_mu.*_mu.*_idperf.*:key=HLT_IDTrack_Muon_IDTrig:roi=HLT_Roi_L2SAMuon:te=1",
210 "HLT_mu.*_mu.*_idperf.*:key=HLT_IDTrack_Muon_FTF:roi=HLT_Roi_L2SAMuon:extra=mu_tag:te=0",
211 "HLT_mu.*_mu.*_idperf.*:key=HLT_IDTrack_Muon_FTF:roi=HLT_Roi_L2SAMuon:extra=mu_probe:te=1",
212 "HLT_mu.*_mu.*_idperf.*:key=HLT_IDTrack_Muon_IDTrig:roi=HLT_Roi_L2SAMuon:extra=mu_tag:te=0",
213 "HLT_mu.*_mu.*_idperf.*:key=HLT_IDTrack_Muon_IDTrig:roi=HLT_Roi_L2SAMuon:extra=mu_probe:te=1" ], monlevel )
214
215 if len(chains)>0 :
216
217 tidamuon.ntupleChainNames = chains
218
219 tidamuon.MonTools = createMonTools( flags, tidamuon.SliceTag, chains )
220
221 tools += [ tidamuon ]
222
223
224
225
226
227 if mcTruth:
228 tidamuonlrt = TrigR3Mon_builder(flags, name = "IDMuonLRTTruth"+toolkey+"Tool", mcTruth=True, pdgID=13 )
229 tidamuonlrt.SliceTag = "HLT/TRIDT/MuonLRTTruth/"+key
230 else:
231 tidamuonlrt = TrigR3Mon_builder( flags, name = "IDMuonLRT"+toolkey+"Tool", useHighestPT=True )
232 tidamuonlrt.SliceTag = "HLT/TRIDT/MuonLRT/"+key
233
234 tidamuonlrt.AnalysisConfig = "Tier0"
235 tidamuonlrt.mind0CutOffline = 2.
236
237 from TrigInDetMonitoring.TIDAChains import getchains
238
239 chains = getchains( flags,
240 [ "HLT_mu.*_LRT_idperf.*:key=HLT_IDTrack_MuonLRT_FTF:roi=HLT_Roi_L2SAMuon_LRT",
241 "HLT_mu.*_LRT_idperf.*:key=HLT_IDTrack_MuonLRT_IDTrig:roi=HLT_Roi_L2SAMuon_LRT"], monlevel )
242
243 if len(chains)>0 :
244
245 tidamuonlrt.ntupleChainNames = chains
246 tidamuonlrt.ntupleChainNames += [ "Offline", "Offline:+InDetLargeD0TrackParticles" ]
247
248 tidamuonlrt.MonTools = createMonTools( flags, tidamuonlrt.SliceTag, chains )
249
250 tools += [ tidamuonlrt ]
251
252
253
254
255
256def TIDAtau( flags, key, toolkey, tools, monlevel, mcTruth ) :
257
258
259
260 if mcTruth:
261 tidatau = TrigR3Mon_builder( flags, name = "IDTauTruth"+toolkey+"Tool", mcTruth=True, pdgID=15 )
262 tidatau.SliceTag = "HLT/TRIDT/TauTruth/"+key
263 else:
264 tidatau = TrigR3Mon_builder( flags, name = "IDTau"+toolkey+"Tool", useHighestPT=True )
265 tidatau.SliceTag = "HLT/TRIDT/Tau/"+key
266
267 tidatau.AnalysisConfig = "Tier0"
268
269 from TrigInDetMonitoring.TIDAChains import getchains
270
271 chains = getchains( flags,
272 [ "HLT_tau.*idperf.*tracktwoMVA_.*:key=HLT_IDTrack_TauCore_FTF:roi=HLT_Roi_TauCore",
273 "HLT_tau.*idperf.*tracktwoMVA_.*:key=HLT_IDTrack_TauIso_FTF:roi=HLT_Roi_TauIso",
274 "HLT_tau.*idperf.*tracktwoMVA_.*:key=HLT_IDTrack_Tau_IDTrig:roi=HLT_Roi_TauIso",
275 "HLT_mu.*tau.*idperf.*:key=HLT_IDTrack_TauCore_FTF:roi=HLT_Roi_TauCore",
276 "HLT_mu.*tau.*idperf.*:key=HLT_IDTrack_TauIso_FTF:roi=HLT_Roi_TauIso",
277 "HLT_mu.*tau.*idperf.*:key=HLT_IDTrack_Tau_IDTrig:roi=HLT_Roi_TauIso",
278 "HLT_mu.*tau.*idperf.*:key=HLT_IDTrack_Muon_FTF:roi=HLT_Roi_L2SAMuon:extra=tau1_tag:te=0",
279 "HLT_mu.*tau.*idperf.*:key=HLT_IDTrack_TauCore_FTF:roi=HLT_Roi_TauCore:extra=tau1_probe:te=1",
280 "HLT_mu.*tau.*idperf.*:key=HLT_IDTrack_Muon_FTF:roi=HLT_Roi_L2SAMuon:extra=tau0_tag:te=0",
281 "HLT_mu.*tau.*idperf.*:key=HLT_IDTrack_TauIso_FTF:roi=HLT_Roi_TauIso:extra=tau0_probe:te=1",
282 "HLT_mu.*tau.*idperf.*:key=HLT_IDTrack_Muon_IDTrig:roi=HLT_Roi_L2SAMuon:extra=tau_tag:te=0",
283 "HLT_mu.*tau.*idperf.*:key=HLT_IDTrack_Tau_IDTrig:roi=HLT_Roi_TauIso:extra=tau_probe:te=1" ], monlevel )
284
285 if len(chains)>0 :
286
287 tidatau.ntupleChainNames = chains
288
289 tidatau.MonTools = createMonTools( flags, tidatau.SliceTag, chains )
290
291 tools += [ tidatau ]
292
293
294
295
296 if mcTruth:
297 tidataulrt = TrigR3Mon_builder(flags, name = "IDTauLRTTruth"+toolkey+"Tool", mcTruth=True, pdgID=15 )
298 tidataulrt.SliceTag = "HLT/TRIDT/TauLRTTruth/"+key
299 else:
300 tidataulrt = TrigR3Mon_builder( flags, name = "IDTauLRT"+toolkey+"Tool", useHighestPT=True )
301 tidataulrt.SliceTag = "HLT/TRIDT/TauLRT/"+key
302
303 tidataulrt.AnalysisConfig = "Tier0"
304 tidataulrt.mind0CutOffline = 2.
305
306 from TrigInDetMonitoring.TIDAChains import getchains
307
308 chains = getchains( flags,
309 [ "HLT_tau.*_idperf.*_trackLRT.*:key=HLT_IDTrack_TauLRT_FTF:roi=HLT_Roi_LRT",
310 "HLT_tau.*_idperf.*_trackLRT.*:key=HLT_IDTrack_TauLRT_IDTrig:roi=HLT_Roi_TauLRT"], monlevel )
311
312 if len(chains)>0 :
313
314 tidataulrt.ntupleChainNames = chains
315 tidataulrt.ntupleChainNames += [ "Offline", "Offline:+InDetLargeD0TrackParticles" ]
316
317 tidataulrt.MonTools = createMonTools( flags, tidataulrt.SliceTag, chains )
318
319 tools += [ tidataulrt ]
320
321
322
323
324
325def TIDAbjet( flags, key, toolkey, tools, monlevel, mcTruth ) :
326
327
328
329 if mcTruth:
330 tidabjet = TrigR3Mon_builder( flags, name = "IDBjetTruth"+toolkey+"Tool", mcTruth=True )
331 tidabjet.SliceTag = "HLT/TRIDT/BjetTruth/"+key
332 else:
333 tidabjet = TrigR3Mon_builder( flags, name = "IDBjet"+toolkey+"Tool" )
334 tidabjet.SliceTag = "HLT/TRIDT/Bjet/"+key
335
336 tidabjet.AnalysisConfig = "Tier0"
337
338 from TrigInDetMonitoring.TIDAChains import getchains
339
340 chains = getchains( flags,
341 [ "HLT_j.*presel.*b.*:key=HLT_IDTrack_JetSuper_FTF:roi=HLT_Roi_JetSuper:vtx=HLT_IDVertex_JetSuper",
342 "HLT_j.*roiftf.*:key=HLT_IDTrack_JetSuper_FTF:roi=HLT_Roi_JetSuper:vtx=HLT_IDVertex_JetSuper",
343 "HLT_j.*presel.*b.*:key=HLT_IDTrack_FS_FTF:roi=HLT_FSRoI:vtx=HLT_IDVertex_FS",
344 "HLT_j.*boffperf.*:key=HLT_IDTrack_Bjet_FTF:roi=HLT_Roi_Bjet",
345 "HLT_j.*boffperf.*:key=HLT_IDTrack_Bjet_IDTrig:roi=HLT_Roi_Bjet",
346 "HLT_j45_pf_ftf_preselj20_L1J15:key=HLT_IDTrack_FS_FTF:roi=HLT_FSRoI:vtx=HLT_IDVertex_FS",
347 "HLT_j.*_ftf.*boffperf.*:key=HLT_IDTrack_FS_FTF:roi=HLT_FSRoI:vtx=HLT_IDVertex_FS",
348 "HLT_j.*boffperf.*_ftf.*:key=HLT_IDTrack_FS_FTF:roi=HLT_FSRoI:vtx=HLT_IDVertex_FS",
349 "HLT_.*_j.*ion.*:key=HLT_IDTrack_FS_FTF:roi=HLT_FSRoI:vtx=HLT_IDVertex_FS",
350 "HLT_.*_j.*ion.*:key=HLT_IDTrack_Bjet_FTF:roi=HLT_Roi_Bjet",
351 "HLT_.*_j.*ion.*:key=HLT_IDTrack_Bjet_IDTrig:roi=HLT_Roi_Bjet"
352 ], monlevel )
353
354 # if we find no chains, try to get more generic chains
355
356 if len(chains)==0 :
357 chains = getchains( flags,
358 [
359# "HLT_j(?!0).*:key=HLT_IDTrack_Bjet_FTF",
360# "HLT_j(?!0).*:key=HLT_IDTrack_Bjet_IDTrig",
361 "HLT_j(?!0).*:key=HLT_IDTrack_FS_FTF:roi=HLT_FSRoI:vtx=HLT_IDVertex_FS",
362 ], None )
363
364
365 if len(chains)>0 :
366
367 tidabjet.ntupleChainNames += chains
368
369 tidabjet.MonTools = createMonTools( flags, tidabjet.SliceTag, chains )
370
371 tools += [ tidabjet ]
372
373
374
375
376
377def TIDAminbias( flags, key, toolkey, tools, monlevel, mcTruth ) :
378
379
380
381 if mcTruth:
382 tidaminbias = TrigR3Mon_builder( flags, name = "IDMinbiasTruth"+toolkey+"Tool", mcTruth=True )
383 tidaminbias.SliceTag = "HLT/TRIDT/MinbiasTruth/"+key
384 else:
385 tidaminbias = TrigR3Mon_builder( flags, name = "IDMinbias"+toolkey+"Tool" )
386 tidaminbias.SliceTag = "HLT/TRIDT/Minbias/"+key
387
388 tidaminbias.AnalysisConfig = "Tier0"
389 tidaminbias.z0CutOffline = 120
390 tidaminbias.pTCutOffline = 200
391
392 from TrigInDetMonitoring.TIDAChains import getchains
393
394 chains = getchains( flags,
395 [ "HLT_mb_sptrk.*:key=HLT_IDTrack_MinBias_IDTrig",
396 "HLT_mb_.*pix.*:key=HLT_IDTrack_MinBiasPixel_IDTrig" ], monlevel )
397
398 if len(chains)>0 :
399
400 tidaminbias.ntupleChainNames += chains
401
402 tidaminbias.MonTools = createMonTools( flags, tidaminbias.SliceTag, chains )
403
404 tools += [ tidaminbias ]
405
406
407
408
409def TIDAcosmic( flags, key, toolkey, tools, monlevel, mcTruth ) :
410
411
412
413 if mcTruth:
414 tidacosmic = TrigR3Mon_builder( flags, name = "CosmicTruth"+toolkey+"Tool", mcTruth=True )
415 tidacosmic.SliceTag = "HLT/TRIDT/CosmicTruth/"+key
416 else:
417 tidacosmic = TrigR3Mon_builder( flags, name = "IDCosmic"+toolkey+"Tool" )
418 tidacosmic.SliceTag = "HLT/TRIDT/Cosmic/"+key
419
420 tidacosmic.AnalysisConfig = "Tier0"
421
422 from TrigInDetMonitoring.TIDAChains import getchains
423
424 chains = getchains( flags,
425 [ "HLT_.*cosmic.*:key=HLT_IDTrack_Cosmic_IDTrig" ], monlevel )
426
427 if len(chains)>0 :
428
429 tidacosmic.ntupleChainNames += chains
430
431 tidacosmic.MonTools = createMonTools( flags, tidacosmic.SliceTag, chains )
432
433 tools += [ tidacosmic ]
434
435
436
437
438
439def TIDAbphys( flags, key, toolkey, tools, monlevel, mcTruth ) :
440
441
442
443 if mcTruth:
444 tidabphysics = TrigR3Mon_builder( flags, name = "IDBphysicsTruth"+toolkey+"Tool", mcTruth=True, pdgID=531 )
445 tidabphysics.SliceTag = "HLT/TRIDT/BphysicsTruth/"+key
446 else:
447 tidabphysics = TrigR3Mon_builder( flags, name = "IDBphysics"+toolkey+"Tool", useHighestPT=True )
448 tidabphysics.SliceTag = "HLT/TRIDT/Bphysics/"+key
449
450 tidabphysics.AnalysisConfig = "Tier0"
451
452 from TrigInDetMonitoring.TIDAChains import getchains
453
454 chains = getchains( flags,
455 [ "HLT_mu.*_bBmumux_BsmumuPhi.*:key=HLT_IDTrack_Bmumux_FTF",
456 "HLT_mu.*_bBmumux_BsmumuPhi.*:key=HLT_IDTrack_Bmumux_IDTrig",
457 "HLT_mu.*_bBmumux_Bidperf.*:key=HLT_IDTrack_Bmumux_FTF",
458 "HLT_mu.*_bBmumux_Bidperf.*:key=HLT_IDTrack_Bmumux_IDTrig",
459 "HLT_.*Bhh.*:key=HLT_IDTrack_Bhh_FTF:roi=HLT_Roi_Bhh"], monlevel )
460
461 if len(chains)>0 :
462
463 tidabphysics.ntupleChainNames += chains
464
465 tidabphysics.MonTools = createMonTools( flags, tidabphysics.SliceTag, chains )
466
467 tools += [ tidabphysics ]
468
469
470
471
472def TIDAutt( flags, key, toolkey, tools, monlevel, mcTruth ) :
473
474
475
476 if mcTruth:
477 tidautt = TrigR3Mon_builder( flags, name = "IDUttTruth"+toolkey+"Tool", mcTruth=True )
478 tidautt.SliceTag = "HLT/TRIDT/UTT/"+key
479 else:
480 tidautt = TrigR3Mon_builder( flags, name = "IDUtt"+toolkey+"Tool" )
481 tidautt.SliceTag = "HLT/TRIDT/UTT/"+key
482
483 tidautt.AnalysisConfig = "Tier0"
484
485 from TrigInDetMonitoring.TIDAChains import getchains
486
487 chains = getchains( flags,
488 [ "HLT_j180_.*dispjet.*_L1J100:key=HLT_IDTrack_DJLRT_FTF:roi=HLT_Roi_DJ",
489 "HLT_j180_.*dispjet.*_L1jJ160:key=HLT_IDTrack_DJLRT_FTF:roi=HLT_Roi_DJ" ], monlevel )
490
491 if len(chains)>0 :
492
493 tidautt.ntupleChainNames += chains
494
495 tidautt.MonTools = createMonTools( flags, tidautt.SliceTag, chains )
496
497 tools += [ tidautt ]
498
499
500
501
502
503
504
505
506# create a separate specific monTool for each analysis chain
507# - simplifies the overall analysis configuration
508
509def createMonTools( flags, label, chains, excludeTagChains=True ):
510 tools = []
511 from TrigInDetAnalysisExample.chainString import chainString
512 from TrigInDetAnalysisExample.TIDAMonTool import createMonTool
513 for mt in chains :
514 if excludeTagChains and "tag" in chainString(mt).extra:
515 continue
516 tool = createMonTool( flags, label, mt )
517 tools += [ tool ]
518 return tools
519
520
521# create the actual algorithm - calling with this wrapper lets us use the same
522# code for the old, or new configuration
523def TrigR3Mon_builder( flags=None, name="NoName", useHighestPT=False, mcTruth=False, pdgID=0 ):
524
525 if flags is None:
526 from TrigInDetAnalysisExample.TrigInDetAnalysisExampleConf import TrigR3Mon
527 alg = TrigR3Mon( name = name )
528 else:
529 from AthenaConfiguration.ComponentFactory import CompFactory
530 alg = CompFactory.TrigR3Mon( name=name )
531
532 alg.UseHighestPT = useHighestPT
533 alg.mcTruth = False
534
535 if mcTruth :
536 alg.mcTruth = True
537 alg.pixHitsOffline = -1
538 alg.sctHitsOffline = -1
539 alg.siHitsOffline = -1
540
541 if pdgID != 0 :
542 if pdgID == 15 :
543 alg.SelectParentTruthPdgId = 15
544 else :
545 alg.SelectTruthPdgId = pdgID
546
547 return alg
548
549
550
551
552# wrapper function for the central monitoring configuration
553
554def TrigInDetMonConfig( flags, monlevels=None ):
555 return TIDAMonitoringCA( flags, monlevels )
556
557
558
559# component accumulator wrapper around the overall monitoring functiom
560
561def TIDAMonitoringCA( flags, monlevels=None ):
562
563 from AthenaMonitoring import AthMonitorCfgHelper
564 monConfig = AthMonitorCfgHelper(flags, "TrigIDMon")
565
566 # algs = TIDAMonitoring(flags, "All" )
567 algs = TIDAMonitoring(flags, "Tier0", monlevel="idMon:t0:shifter" )
568 algs += TIDAMonitoring(flags, "Shifter", monlevel="idMon:shifter", mcTruth=False )
569
570 if flags.Input.isMC:
571 algs += TIDAMonitoring(flags, name="PhysVal", monlevel="idMon:t0", mcTruth=True )
572 algs += TIDAMonitoring(flags, name="PhysValShifter", monlevel="idMon:shifter", mcTruth=True )
573
574 for a in algs:
575 monConfig.addAlgorithm(a)
576
577 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
578 ca = ComponentAccumulator()
579 ca.merge(monConfig.result())
580
581 return ca
582
583
584
585
586
587
588def histsvc( flags ):
589
590 from AthenaCommon.Logging import log
591
592 if flags.Output.HISTFileName:
593 log.info( "histsvc: Create THistSvc with file name: "+flags.Output.HISTFileName )
594
595 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
596 ca = ComponentAccumulator()
597
598 from AthenaConfiguration.ComponentFactory import CompFactory
599 THistSvc = CompFactory.THistSvc
600
601 histsvc = THistSvc()
602 if flags.Output.HISTFileName:
603 histsvc.Output += ["%s DATAFILE='%s' OPT='RECREATE'" % (flags.DQ.FileKey, flags.Output.HISTFileName)]
604 log.info( "histsvc: "+histsvc.Output[-1] )
605
606 ca.addService(histsvc)
607
608 return ca
609
610
611
612if __name__=='__main__':
613
614 # Setup logs
615 from AthenaCommon.Logging import log
616 log.info( "test running" )
617
618 # Set the Athena configuration flags
619 from AthenaConfiguration.AllConfigFlags import initConfigFlags
620
621 flags = initConfigFlags()
622
623 # Input files
624 # AOD file to be run w/ MT access and Mon Groups implemented
625 file = 'AOD.pool.root'
626
627 flags.Input.Files = [file]
628 flags.Input.isMC = True
629
630 flags.Output.HISTFileName = 'duff.root'
631
632 flags.lock()
633
634 # Initialize configuration object, add accumulator, merge, and run.
635 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
636 from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
637 cfg = MainServicesCfg(flags)
638
639 cfg.merge( PoolReadCfg(flags) )
640
641 cfg.merge( histsvc(flags) )
642
643 cfg.merge( TrigInDetMonConfig( flags ) )
644
645 # If you want to turn on more detailed messages ...
646 cfg.printConfig(withDetails=False) # set True for exhaustive info
647
648 Nevents = 10
649 cfg.run(Nevents)
650
651
652
TIDAcosmic(flags, key, toolkey, tools, monlevel, mcTruth)
createMonTools(flags, label, chains, excludeTagChains=True)
TIDAsignature(flags, signature, key, toolkey, tools, monlevel, mcTruth, chain_regex)
TrigInDetMonConfig(flags, monlevels=None)
TIDAutt(flags, key, toolkey, tools, monlevel, mcTruth)
TIDAelectron(flags, key, toolkey, tools, monlevel, mcTruth)
TIDAbphys(flags, key, toolkey, tools, monlevel, mcTruth)
TIDAtau(flags, key, toolkey, tools, monlevel, mcTruth)
TIDAMonitoringCA(flags, monlevels=None)
TrigR3Mon_builder(flags=None, name="NoName", useHighestPT=False, mcTruth=False, pdgID=0)
TIDAbjet(flags, key, toolkey, tools, monlevel, mcTruth)
TIDAmuon(flags, key, toolkey, tools, monlevel, mcTruth)
TIDAminbias(flags, key, toolkey, tools, monlevel, mcTruth)