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