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.*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 
174 def 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 
252 def 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 
321 def 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 
373 def 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 
405 def 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 
435 def 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"], monlevel )
455 
456  if len(chains)>0 :
457 
458  tidabphysics.ntupleChainNames += chains
459 
460  tidabphysics.MonTools = createMonTools( flags, tidabphysics.SliceTag, chains )
461 
462  tools += [ tidabphysics ]
463 
464 
465 
466 
467 def TIDAutt( flags, key, toolkey, tools, monlevel, mcTruth ) :
468 
469 
470 
471  if mcTruth:
472  tidautt = TrigR3Mon_builder( flags, name = "IDUttTruth"+toolkey+"Tool", mcTruth=True )
473  tidautt.SliceTag = "HLT/TRIDT/UTT/"+key
474  else:
475  tidautt = TrigR3Mon_builder( flags, name = "IDUtt"+toolkey+"Tool" )
476  tidautt.SliceTag = "HLT/TRIDT/UTT/"+key
477 
478  tidautt.AnalysisConfig = "Tier0"
479 
480  from TrigInDetMonitoring.TIDAChains import getchains
481 
482  chains = getchains( flags,
483  [ "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 )
484 
485  if len(chains)>0 :
486 
487  tidautt.ntupleChainNames += chains
488 
489  tidautt.MonTools = createMonTools( flags, tidautt.SliceTag, chains )
490 
491  tools += [ tidautt ]
492 
493 
494 
495 
496 
497 
498 
499 
500 # create a separate specific monTool for each analysis chain
501 # - simplifies the overall analysis configuration
502 
503 def createMonTools( flags, label, chains, excludeTagChains=True ):
504  tools = []
505  from TrigInDetAnalysisExample.chainString import chainString
506  from TrigInDetAnalysisExample.TIDAMonTool import createMonTool
507  for mt in chains :
508  if excludeTagChains and "tag" in chainString(mt).extra:
509  continue
510  tool = createMonTool( flags, label, mt )
511  tools += [ tool ]
512  return tools
513 
514 
515 # create the actual algorithm - calling with this wrapper lets us use the same
516 # code for the old, or new configuration
517 def TrigR3Mon_builder( flags=None, name="NoName", useHighestPT=False, mcTruth=False, pdgID=0 ):
518 
519  if flags is None:
520  from TrigInDetAnalysisExample.TrigInDetAnalysisExampleConf import TrigR3Mon
521  alg = TrigR3Mon( name = name )
522  else:
523  from AthenaConfiguration.ComponentFactory import CompFactory
524  alg = CompFactory.TrigR3Mon( name=name )
525 
526  alg.UseHighestPT = useHighestPT
527  alg.mcTruth = False
528 
529  if mcTruth :
530  alg.mcTruth = True
531  alg.pixHitsOffline = -1
532  alg.sctHitsOffline = -1
533  alg.siHitsOffline = -1
534 
535  if pdgID != 0 :
536  if pdgID == 15 :
537  alg.SelectParentTruthPdgId = 15
538  else :
539  alg.SelectTruthPdgId = pdgID
540 
541  return alg
542 
543 
544 
545 
546 # wrapper function for the central monitoring configuration
547 
548 def TrigInDetMonConfig( flags, monlevels=None ):
549  return TIDAMonitoringCA( flags, monlevels )
550 
551 
552 
553 # component accumulator wrapper around the overall monitoring functiom
554 
555 def TIDAMonitoringCA( flags, monlevels=None ):
556 
557  from AthenaMonitoring import AthMonitorCfgHelper
558  monConfig = AthMonitorCfgHelper(flags, "TrigIDMon")
559 
560  # algs = TIDAMonitoring(flags, "All" )
561  algs = TIDAMonitoring(flags, "Tier0", monlevel="idMon:t0:shifter" )
562  algs += TIDAMonitoring(flags, "Shifter", monlevel="idMon:shifter", mcTruth=False )
563 
564  if flags.Input.isMC:
565  algs += TIDAMonitoring(flags, name="PhysVal", monlevel="idMon:t0", mcTruth=True )
566  algs += TIDAMonitoring(flags, name="PhysValShifter", monlevel="idMon:shifter", mcTruth=True )
567 
568  for a in algs:
569  monConfig.addAlgorithm(a)
570 
571  from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
572  ca = ComponentAccumulator()
573  ca.merge(monConfig.result())
574  return ca
575 
576 
577 
578 
579 
580 
581 def histsvc( flags ):
582 
583  from AthenaCommon.Logging import log
584 
585  if flags.Output.HISTFileName:
586  log.info( "histsvc: Create THistSvc with file name: "+flags.Output.HISTFileName )
587 
588  from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
589  ca = ComponentAccumulator()
590 
591  from AthenaConfiguration.ComponentFactory import CompFactory
592  THistSvc = CompFactory.THistSvc
593 
594  histsvc = THistSvc()
595  if flags.Output.HISTFileName:
596  histsvc.Output += ["%s DATAFILE='%s' OPT='RECREATE'" % (flags.DQ.FileKey, flags.Output.HISTFileName)]
597  log.info( "histsvc: "+histsvc.Output[-1] )
598 
599  ca.addService(histsvc)
600 
601  return ca
602 
603 
604 
605 if __name__=='__main__':
606 
607  # Setup logs
608  from AthenaCommon.Logging import log
609  log.info( "test running" )
610 
611  # Set the Athena configuration flags
612  from AthenaConfiguration.AllConfigFlags import initConfigFlags
613 
614  flags = initConfigFlags()
615 
616  # Input files
617  # AOD file to be run w/ MT access and Mon Groups implemented
618  file = 'AOD.pool.root'
619 
620  flags.Input.Files = [file]
621  flags.Input.isMC = True
622 
623  flags.Output.HISTFileName = 'duff.root'
624 
625  flags.lock()
626 
627  # Initialize configuration object, add accumulator, merge, and run.
628  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
629  from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
630  cfg = MainServicesCfg(flags)
631 
632  cfg.merge( PoolReadCfg(flags) )
633 
634  cfg.merge( histsvc(flags) )
635 
636  cfg.merge( TrigInDetMonConfig( flags ) )
637 
638  # If you want to turn on more detailed messages ...
639  cfg.printConfig(withDetails=False) # set True for exhaustive info
640 
641  Nevents = 10
642  cfg.run(Nevents)
643 
644 
645 
python.TIDAChains.getchains
def getchains(flags, analyses, monlevel=None)
Definition: TIDAChains.py:18
python.TIDAMonitoring.TIDAMonitoringCA
def TIDAMonitoringCA(flags, monlevels=None)
Definition: TIDAMonitoring.py:555
python.TIDAMonitoring.TIDAcosmic
def TIDAcosmic(flags, key, toolkey, tools, monlevel, mcTruth)
Definition: TIDAMonitoring.py:405
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.TIDAMonitoring.TrigInDetMonConfig
def TrigInDetMonConfig(flags, monlevels=None)
Definition: TIDAMonitoring.py:548
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:467
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:310
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:517
python.TIDAMonitoring.TIDAminbias
def TIDAminbias(flags, key, toolkey, tools, monlevel, mcTruth)
Definition: TIDAMonitoring.py:373
python.TIDAMonitoring.createMonTools
def createMonTools(flags, label, chains, excludeTagChains=True)
Definition: TIDAMonitoring.py:503
python.TIDAMonitoring.TIDAbjet
def TIDAbjet(flags, key, toolkey, tools, monlevel, mcTruth)
Definition: TIDAMonitoring.py:321
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:435
python.TIDAMonitoring.histsvc
def histsvc(flags)
Definition: TIDAMonitoring.py:581
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
python.TIDAMonitoring.TIDAtau
def TIDAtau(flags, key, toolkey, tools, monlevel, mcTruth)
Definition: TIDAMonitoring.py:252
python.TIDAMonitoring.TIDAmuon
def TIDAmuon(flags, key, toolkey, tools, monlevel, mcTruth)
Definition: TIDAMonitoring.py:174
str
Definition: BTagTrackIpAccessor.cxx:11
python.PoolReadConfig.PoolReadCfg
def PoolReadCfg(flags)
Definition: PoolReadConfig.py:71