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