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",
386  "HLT_mb_.*pix.*:key=HLT_IDTrack_MinBiasPixel_IDTrig" ], monlevel )
387 
388  if len(chains)>0 :
389 
390  tidaminbias.ntupleChainNames += chains
391 
392  tidaminbias.MonTools = createMonTools( flags, tidaminbias.SliceTag, chains )
393 
394  tools += [ tidaminbias ]
395 
396 
397 
398 
399 def TIDAcosmic( flags, key, toolkey, tools, monlevel, mcTruth ) :
400 
401 
402 
403  if mcTruth:
404  tidacosmic = TrigR3Mon_builder( flags, name = "CosmicTruth"+toolkey+"Tool", mcTruth=True )
405  tidacosmic.SliceTag = "HLT/TRIDT/CosmicTruth/"+key
406  else:
407  tidacosmic = TrigR3Mon_builder( flags, name = "IDCosmic"+toolkey+"Tool" )
408  tidacosmic.SliceTag = "HLT/TRIDT/Cosmic/"+key
409 
410  tidacosmic.AnalysisConfig = "Tier0"
411 
412  from TrigInDetMonitoring.TIDAChains import getchains
413 
414  chains = getchains( flags,
415  [ "HLT_.*cosmic.*:key=HLT_IDTrack_Cosmic_IDTrig" ], monlevel )
416 
417  if len(chains)>0 :
418 
419  tidacosmic.ntupleChainNames += chains
420 
421  tidacosmic.MonTools = createMonTools( flags, tidacosmic.SliceTag, chains )
422 
423  tools += [ tidacosmic ]
424 
425 
426 
427 
428 
429 def TIDAbphys( flags, key, toolkey, tools, monlevel, mcTruth ) :
430 
431 
432 
433  if mcTruth:
434  tidabphysics = TrigR3Mon_builder( flags, name = "IDBphysicsTruth"+toolkey+"Tool", mcTruth=True, pdgID=531 )
435  tidabphysics.SliceTag = "HLT/TRIDT/BphysicsTruth/"+key
436  else:
437  tidabphysics = TrigR3Mon_builder( flags, name = "IDBphysics"+toolkey+"Tool", useHighestPT=True )
438  tidabphysics.SliceTag = "HLT/TRIDT/Bphysics/"+key
439 
440  tidabphysics.AnalysisConfig = "Tier0"
441 
442  from TrigInDetMonitoring.TIDAChains import getchains
443 
444  chains = getchains( flags,
445  [ "HLT_mu.*_bBmumux_BsmumuPhi.*:key=HLT_IDTrack_Bmumux_FTF",
446  "HLT_mu.*_bBmumux_BsmumuPhi.*:key=HLT_IDTrack_Bmumux_IDTrig",
447  "HLT_mu.*_bBmumux_Bidperf.*:key=HLT_IDTrack_Bmumux_FTF",
448  "HLT_mu.*_bBmumux_Bidperf.*:key=HLT_IDTrack_Bmumux_IDTrig"], monlevel )
449 
450  if len(chains)>0 :
451 
452  tidabphysics.ntupleChainNames += chains
453 
454  tidabphysics.MonTools = createMonTools( flags, tidabphysics.SliceTag, chains )
455 
456  tools += [ tidabphysics ]
457 
458 
459 
460 
461 def TIDAutt( flags, key, toolkey, tools, monlevel, mcTruth ) :
462 
463 
464 
465  if mcTruth:
466  tidautt = TrigR3Mon_builder( flags, name = "IDUttTruth"+toolkey+"Tool", mcTruth=True )
467  tidautt.SliceTag = "HLT/TRIDT/UTT/"+key
468  else:
469  tidautt = TrigR3Mon_builder( flags, name = "IDUtt"+toolkey+"Tool" )
470  tidautt.SliceTag = "HLT/TRIDT/UTT/"+key
471 
472  tidautt.AnalysisConfig = "Tier0"
473 
474  from TrigInDetMonitoring.TIDAChains import getchains
475 
476  chains = getchains( flags,
477  [ "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 )
478 
479  if len(chains)>0 :
480 
481  tidautt.ntupleChainNames += chains
482 
483  tidautt.MonTools = createMonTools( flags, tidautt.SliceTag, chains )
484 
485  tools += [ tidautt ]
486 
487 
488 
489 
490 
491 
492 
493 
494 # create a separate specific monTool for each analysis chain
495 # - simplifies the overall analysis configuration
496 
497 def createMonTools( flags, label, chains, excludeTagChains=True ):
498  tools = []
499  from TrigInDetAnalysisExample.chainString import chainString
500  from TrigInDetAnalysisExample.TIDAMonTool import createMonTool
501  for mt in chains :
502  if excludeTagChains and "tag" in chainString(mt).extra:
503  continue
504  tool = createMonTool( flags, label, mt )
505  tools += [ tool ]
506  return tools
507 
508 
509 # create the actual algorithm - calling with this wrapper lets us use the same
510 # code for the old, or new configuration
511 def TrigR3Mon_builder( flags=None, name="NoName", useHighestPT=False, mcTruth=False, pdgID=0 ):
512 
513  if flags is None:
514  from TrigInDetAnalysisExample.TrigInDetAnalysisExampleConf import TrigR3Mon
515  alg = TrigR3Mon( name = name )
516  else:
517  from AthenaConfiguration.ComponentFactory import CompFactory
518  alg = CompFactory.TrigR3Mon( name=name )
519 
520  alg.UseHighestPT = useHighestPT
521  alg.mcTruth = False
522 
523  if mcTruth :
524  alg.mcTruth = True
525  alg.pixHitsOffline = -1
526  alg.sctHitsOffline = -1
527  alg.siHitsOffline = -1
528 
529  if pdgID != 0 :
530  if pdgID == 15 :
531  alg.SelectParentTruthPdgId = 15
532  else :
533  alg.SelectTruthPdgId = pdgID
534 
535  return alg
536 
537 
538 
539 
540 # wrapper function for the central monitoring configuration
541 
542 def TrigInDetMonConfig( flags, monlevels=None ):
543  return TIDAMonitoringCA( flags, monlevels )
544 
545 
546 
547 # component accumulator wrapper around the overall monitoring functiom
548 
549 def TIDAMonitoringCA( flags, monlevels=None ):
550 
551  from AthenaMonitoring import AthMonitorCfgHelper
552  monConfig = AthMonitorCfgHelper(flags, "TrigIDMon")
553 
554  # algs = TIDAMonitoring(flags, "All" )
555  algs = TIDAMonitoring(flags, "Tier0", monlevel="idMon:t0:shifter" )
556  algs += TIDAMonitoring(flags, "Shifter", monlevel="idMon:shifter", mcTruth=False )
557 
558  if flags.Input.isMC:
559  algs += TIDAMonitoring(flags, name="PhysVal", monlevel="idMon:t0", mcTruth=True )
560  algs += TIDAMonitoring(flags, name="PhysValShifter", monlevel="idMon:shifter", mcTruth=True )
561 
562  for a in algs:
563  monConfig.addAlgorithm(a)
564 
565  from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
566  ca = ComponentAccumulator()
567  ca.merge(monConfig.result())
568  return ca
569 
570 
571 
572 
573 
574 
575 def histsvc( flags ):
576 
577  from AthenaCommon.Logging import log
578 
579  if flags.Output.HISTFileName:
580  log.info( "histsvc: Create THistSvc with file name: "+flags.Output.HISTFileName )
581 
582  from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
583  ca = ComponentAccumulator()
584 
585  from AthenaConfiguration.ComponentFactory import CompFactory
586  THistSvc = CompFactory.THistSvc
587 
588  histsvc = THistSvc()
589  if flags.Output.HISTFileName:
590  histsvc.Output += ["%s DATAFILE='%s' OPT='RECREATE'" % (flags.DQ.FileKey, flags.Output.HISTFileName)]
591  log.info( "histsvc: "+histsvc.Output[-1] )
592 
593  ca.addService(histsvc)
594 
595  return ca
596 
597 
598 
599 if __name__=='__main__':
600 
601  # Setup logs
602  from AthenaCommon.Logging import log
603  log.info( "test running" )
604 
605  # Set the Athena configuration flags
606  from AthenaConfiguration.AllConfigFlags import initConfigFlags
607 
608  flags = initConfigFlags()
609 
610  # Input files
611  # AOD file to be run w/ MT access and Mon Groups implemented
612  file = 'AOD.pool.root'
613 
614  flags.Input.Files = [file]
615  flags.Input.isMC = True
616 
617  flags.Output.HISTFileName = 'duff.root'
618 
619  flags.lock()
620 
621  # Initialize configuration object, add accumulator, merge, and run.
622  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
623  from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
624  cfg = MainServicesCfg(flags)
625 
626  cfg.merge( PoolReadCfg(flags) )
627 
628  cfg.merge( histsvc(flags) )
629 
630  cfg.merge( TrigInDetMonConfig( flags ) )
631 
632  # If you want to turn on more detailed messages ...
633  cfg.printConfig(withDetails=False) # set True for exhaustive info
634 
635  Nevents = 10
636  cfg.run(Nevents)
637 
638 
639 
python.TIDAChains.getchains
def getchains(flags, analyses, monlevel=None)
Definition: TIDAChains.py:18
python.TIDAMonitoring.TIDAMonitoringCA
def TIDAMonitoringCA(flags, monlevels=None)
Definition: TIDAMonitoring.py:549
python.TIDAMonitoring.TIDAcosmic
def TIDAcosmic(flags, key, toolkey, tools, monlevel, mcTruth)
Definition: TIDAMonitoring.py:399
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.TIDAMonitoring.TrigInDetMonConfig
def TrigInDetMonConfig(flags, monlevels=None)
Definition: TIDAMonitoring.py:542
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:461
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:260
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:511
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:497
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:429
python.TIDAMonitoring.histsvc
def histsvc(flags)
Definition: TIDAMonitoring.py:575
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