ATLAS Offline Software
DQTGlobalWZFinderAlg.py
Go to the documentation of this file.
1 #
2 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 #
5  from AthenaMonitoring import AthMonitorCfgHelper
6  from AthenaConfiguration.ComponentFactory import CompFactory
7  from AthenaConfiguration.Enums import LHCPeriod
8  helper = AthMonitorCfgHelper(flags, 'DQTGlobalWZFinderAlgCfg')
9 
10  algConfObj = CompFactory.DQTGlobalWZFinderAlg
11  muonSelectionTool = CompFactory.CP.MuonSelectionTool("DQTMuonSelectionTool")
12  r3MatchingTool = CompFactory.Trig.R3MatchingTool("R3MatchingTool")
13  truthClassifier = CompFactory.MCTruthClassifier("MCTruthClassifier")
14 
15  # Configure MuonSelectionTool
16  muonSelectionTool.MuQuality=1
17  muonSelectionTool.MaxEta=2.4
18  muonSelectionTool.IsRun3Geo=(flags.GeoModel.Run == LHCPeriod.Run3)
19  muonSelectionTool.TurnOffMomCorr=True
20 
21  monAlg = helper.addAlgorithm(algConfObj, 'DQTGlobalWZFinderAlg',
22  MuonSelectionTool = muonSelectionTool,
23  R3MatchingTool = r3MatchingTool,
24  MCTruthClassifier = truthClassifier)
25 
26  monAlg.doTrigger = flags.DQ.useTrigger
27 
28  monAlg.electronEtCut = 27
29  monAlg.muonPtCut = 27
30  monAlg.zCutLow = 66.0
31  monAlg.zCutHigh = 116.0
32  monAlg.muonMaxEta = muonSelectionTool.MaxEta
33  monAlg.Z_ee_trigger = ["HLT_e26_lhtight_ivarloose_L1eEM26M", "HLT_e60_lhmedium_L1eEM26M", "HLT_e140_lhloose_L1eEM26M", "HLT_e300_etcut_L1eEM26M"]
34  monAlg.Z_mm_trigger = ["HLT_mu24_ivarmedium_L1MU14FCH", "HLT_mu50_L1MU14FCH"]
35 
36 
37 
38  # arguments are: algorithm, name of group used to access it from the alg,
39  # the 'top level path' to put outputs in, and the default duration of
40  # associated histograms
41 
42  maxLB = 3200
43 
44  optMC = ''
45  optData = 'kAlwaysCreate'
46 
47  if flags.Input.isMC:
48  optMC = 'kAlwaysCreate'
49 
50  group = helper.addGroup(monAlg, 'default', 'GLOBAL/DQTGlobalWZFinder', 'run')
51 
52  elegroup = helper.addGroup(monAlg, 'electron', 'GLOBAL/DQTGlobalWZFinder', 'run')
53  muongroup = helper.addGroup(monAlg, 'muon', 'GLOBAL/DQTGlobalWZFinder', 'run')
54 
55  group_Zee = helper.addGroup(monAlg, 'Zee', 'GLOBAL/DQTGlobalWZFinder', 'run')
56  group_Zmumu = helper.addGroup(monAlg, 'Zmumu', 'GLOBAL/DQTGlobalWZFinder', 'run')
57 
58  group_EleTP = helper.addGroup(monAlg, 'EleTP', 'GLOBAL/DQTGlobalWZFinder', 'run')
59  group_EleContainerTP = helper.addGroup(monAlg, 'EleContainerTP', 'GLOBAL/DQTGlobalWZFinder', 'run')
60  group_EleTrigTP = helper.addGroup(monAlg, 'EleTrigTP', 'GLOBAL/DQTGlobalWZFinder', 'run')
61 
62  group_MuonTruthEff = helper.addGroup(monAlg, 'MuonTruthEff', 'GLOBAL/DQTGlobalWZFinder', 'run')
63  group_MuonTriggerTP = helper.addGroup(monAlg, 'MuonTriggerTP', 'GLOBAL/DQTGlobalWZFinder', 'run')
64  group_MuonLooseTP = helper.addGroup(monAlg, 'MuonLooseTP', 'GLOBAL/DQTGlobalWZFinder', 'run')
65  group_MuonInDetTP = helper.addGroup(monAlg, 'MuonInDetTP', 'GLOBAL/DQTGlobalWZFinder', 'run')
66 
67  group.defineHistogram('LB,avgLiveFrac',
68  title='Livetime',
69  type='TProfile',
70  xbins=maxLB,
71  xmin=0.5,
72  xmax=maxLB+0.5,
73  duration='lb',
74  opt='kAlwaysCreate',
75  merge='merge'
76  )
77 
78 
79  group.defineHistogram('LB,duration',
80  title='LB length',
81  type='TProfile',
82  xbins=maxLB,
83  xmin=0.5,
84  xmax=maxLB+0.5,
85  duration='lb',
86  merge='merge'
87  )
88 
89 
90  group.defineHistogram('LB,avgIntPerXing',
91  title='#mu',
92  type='TProfile',
93  xbins=maxLB,
94  xmin=0.5,
95  xmax=maxLB+0.5,
96  duration='lb',
97  merge='merge'
98  )
99 
100  elegroup.defineHistogram('ele_Et',
101  title='Selected Electron E_{T}',
102  xbins=50,
103  xmin=0,
104  xmax=200,
105  weight='evtWeight'
106  )
107 
108  elegroup.defineHistogram('ele_Eta',
109  title='Selected Electron #eta',
110  xbins=50,
111  xmin=-2.5,
112  xmax=2.5,
113  weight='evtWeight'
114  )
115 
116  elegroup.defineHistogram('ele_Phi',
117  title='Selected Electron #phi',
118  xbins=34,
119  xmin=-3.4,
120  xmax=3.4,
121  weight='evtWeight'
122  )
123 
124  muongroup.defineHistogram('muon_Pt',
125  title='Selected Muon p_{T}',
126  xbins=200,
127  xmin=0,
128  xmax=200,
129  weight='evtWeight'
130  )
131 
132  muongroup.defineHistogram('muon_Eta',
133  title='Selected Muon #eta',
134  xbins=50,
135  xmin=-2.5,
136  xmax=2.5,
137  weight='evtWeight'
138  )
139 
140  muongroup.defineHistogram('muon_Phi',
141  title='Selected Muon #phi',
142  xbins=34,
143  xmin=-3.4,
144  xmax=3.4,
145  weight='evtWeight'
146  )
147 
148  m_zCutLow = 66000.0
149  m_zCutHigh = 116000.0
150  nzbins = int( m_zCutHigh*0.001 - m_zCutLow*0.001 )
151 
152  m_zCutLow_elTP = 66000.0
153  m_zCutHigh_elTP = 250000.0
154  nzbins_elTP = int( m_zCutHigh_elTP*0.001 - m_zCutLow_elTP*0.001 )
155 
156  group_Zee.defineHistogram('Zeecharge;m_Z_Q_ele',
157  title='Z#rightarrowee Charge',
158  xbins=7,
159  xmin=-3,
160  xmax=3,
161  weight='evtWeight',
162  opt='kAlwaysCreate'
163  )
164 
165  group_Zee.defineHistogram('mass;m_Z_mass_opsele',
166  title='Z#rightarrowee (op. sign) Mass',
167  xbins=nzbins,
168  xmin=m_zCutLow,
169  xmax=m_zCutHigh,
170  weight='evtWeight',
171  cutmask='osel',
172  duration='lb',
173  opt='kAlwaysCreate'
174  )
175 
176  group_Zee.defineHistogram('LB;m_Z_Counter_el_os',
177  title='Z#rightarrowee count per Lumi Block',
178  xbins=maxLB,
179  xmin=0.5,
180  xmax=maxLB+0.5,
181  weight='evtWeight',
182  cutmask='osel',
183  duration='lb',
184  opt='kAlwaysCreate',
185  merge='merge'
186  )
187 
188  group_Zee.defineHistogram('LB;m_Z_Counter_el_ss',
189  title='Z#rightarrowee count per Lumi Block',
190  xbins=maxLB,
191  xmin=0.5,
192  xmax=maxLB+0.5,
193  weight='evtWeight',
194  cutmask='ssel',
195  duration='lb',
196  opt='kAlwaysCreate',
197  merge='merge'
198  )
199 
200  group_Zee.defineHistogram('mass;m_Z_mass_ssele',
201  title='Z#rightarrowee (same sign) Mass',
202  xbins=nzbins,
203  xmin=m_zCutLow,
204  xmax=m_zCutHigh,
205  weight='evtWeight',
206  cutmask='ssel',
207  duration='lb',
208  opt='kAlwaysCreate'
209  )
210 
211  group_Zee.defineHistogram('pT1;m_leadingele_pt',
212  title='Leading e p_{T}',
213  xbins=200,
214  xmin=0,
215  xmax=200000,
216  weight='evtWeight',
217  cutmask='osel',
218  opt=optData
219  )
220 
221  group_Zee.defineHistogram('pT2;m_subleadingele_pt',
222  title='Subleading e p_{T}',
223  xbins=200,
224  xmin=0,
225  xmax=200000,
226  weight='evtWeight',
227  cutmask='osel',
228  opt=optData
229  )
230 
231  group_Zee.defineHistogram('eta1;m_leadingele_eta',
232  title='Leading e #eta',
233  xbins=50,
234  xmin=-2.5,
235  xmax=2.5,
236  weight='evtWeight',
237  cutmask='osel',
238  opt=optData
239  )
240 
241  group_Zee.defineHistogram('eta2;m_subleadingele_eta',
242  title='Subleading e #eta',
243  xbins=50,
244  xmin=-2.5,
245  xmax=2.5,
246  weight='evtWeight',
247  cutmask='osel',
248  opt=optData
249  )
250 
251  group_Zee.defineHistogram('phi1;m_leadingele_phi',
252  title='Leading e #phi',
253  xbins=34,
254  xmin=-3.4,
255  xmax=3.4,
256  weight='evtWeight',
257  cutmask='osel',
258  opt=optData
259  )
260 
261  group_Zee.defineHistogram('phi2;m_subleadingele_phi',
262  title='Subleading e #phi',
263  xbins=34,
264  xmin=-3.4,
265  xmax=3.4,
266  weight='evtWeight',
267  cutmask='osel',
268  opt=optData
269  )
270 
271  group_Zmumu.defineHistogram('Zmumucharge;m_Z_Q_mu',
272  title='Z#rightarrow#mu#mu Charge',
273  xbins=7,
274  xmin=-3,
275  xmax=3,
276  weight='evtWeight',
277  opt='kAlwaysCreate'
278  )
279 
280  group_Zmumu.defineHistogram('mass;m_Z_mass_opsmu',
281  title='Z#rightarrow#mu#mu (op. sign) Mass',
282  xbins=nzbins,
283  xmin=m_zCutLow,
284  xmax=m_zCutHigh,
285  weight='evtWeight',
286  cutmask='osmu',
287  duration='lb',
288  opt='kAlwaysCreate'
289  )
290 
291  group_Zmumu.defineHistogram('LB;m_Z_Counter_mu',
292  title='Z#rightarrow#mu#mu count per Lumi Block',
293  xbins=maxLB,
294  xmin=0.5,
295  xmax=maxLB+0.5,
296  weight='evtWeight',
297  cutmask='osmu',
298  duration='lb',
299  opt='kAlwaysCreate',
300  merge='merge'
301  )
302 
303  group_Zmumu.defineHistogram('mass;m_Z_mass_ssmu',
304  title='Z#rightarrow#mu#mu (same sign) Mass',
305  xbins=nzbins,
306  xmin=m_zCutLow,
307  xmax=m_zCutHigh,
308  weight='evtWeight',
309  cutmask='ssmu',
310  duration='lb',
311  opt='kAlwaysCreate'
312  )
313 
314  group_Zmumu.defineHistogram('pT1;m_leadingmu_pt',
315  title='Leading #mu p_{T}',
316  xbins=200,
317  xmin=0,
318  xmax=200000,
319  weight='evtWeight',
320  cutmask='osmu',
321  opt=optData
322  )
323 
324  group_Zmumu.defineHistogram('pT2;m_subleadingmu_pt',
325  title='Subleading #mu p_{T}',
326  xbins=200,
327  xmin=0,
328  xmax=200000,
329  weight='evtWeight',
330  cutmask='osmu',
331  opt=optData
332  )
333 
334  group_Zmumu.defineHistogram('eta1;m_leadingmu_eta',
335  title='Leading #mu #eta',
336  xbins=50,
337  xmin=-2.5,
338  xmax=2.5,
339  weight='evtWeight',
340  cutmask='osmu',
341  opt=optData
342  )
343 
344  group_Zmumu.defineHistogram('eta2;m_subleadingmu_eta',
345  title='Subleading #mu #eta',
346  xbins=50,
347  xmin=-2.5,
348  xmax=2.5,
349  weight='evtWeight',
350  cutmask='osmu',
351  opt=optData
352  )
353 
354  group_Zmumu.defineHistogram('phi1;m_leadingmu_phi',
355  title='Leading #mu #phi',
356  xbins=34,
357  xmin=-3.4,
358  xmax=3.4,
359  weight='evtWeight',
360  cutmask='osmu',
361  opt=optData
362  )
363 
364  group_Zmumu.defineHistogram('phi2;m_subleadingmu_phi',
365  title='Subleading #mu #phi',
366  xbins=34,
367  xmin=-3.4,
368  xmax=3.4,
369  weight='evtWeight',
370  cutmask='osmu',
371  opt=optData
372  )
373 
374  group_Zmumu.defineTree('pT1, pT2, phi1, phi2, eta1, eta2, mass, evtWeight, isTruth, LB, eventNumber, runNumber;muontree',
375  title='muontree',
376  treedef='pT1/F:pT2/F:phi1/F:phi2/F:eta1/F:eta2/F:mass/F:evtWeight/F:isTruth/O:LB/I:eventNumber/l:runNumber/I',
377  cutmask='writeTTrees',
378  opt=optMC
379  )
380 
381  group_EleTP.defineHistogram('mass;m_ele_tight_bad_os',
382  title='',
383  xbins=nzbins_elTP,
384  xmin=m_zCutLow_elTP,
385  xmax=m_zCutHigh_elTP,
386  cutmask='bad_os',
387  duration='lb',
388  opt=optData
389  )
390 
391  group_EleTP.defineHistogram('mass;m_ele_tight_bad_ss',
392  title='',
393  xbins=nzbins_elTP,
394  xmin=m_zCutLow_elTP,
395  xmax=m_zCutHigh_elTP,
396  cutmask='bad_ss',
397  duration='lb',
398  opt=optData
399  )
400 
401  group_EleTP.defineHistogram('mass;m_ele_tight_good_os',
402  title='',
403  xbins=nzbins_elTP,
404  xmin=m_zCutLow_elTP,
405  xmax=m_zCutHigh_elTP,
406  cutmask='good_os',
407  duration='lb',
408  opt=optData
409  )
410 
411  group_EleTP.defineHistogram('mass;m_ele_tight_good_ss',
412  title='',
413  xbins=nzbins_elTP,
414  xmin=m_zCutLow_elTP,
415  xmax=m_zCutHigh_elTP,
416  cutmask='good_ss',
417  duration='lb',
418  opt=optData
419  )
420 
421  group_EleTP.defineHistogram('mass;m_ele_template_os',
422  title='',
423  xbins=nzbins_elTP,
424  xmin=m_zCutLow_elTP,
425  xmax=m_zCutHigh_elTP,
426  cutmask='template_os',
427  duration='lb',
428  opt=optData
429  )
430 
431  group_EleTP.defineHistogram('mass;m_ele_template_ss',
432  title='',
433  xbins=nzbins_elTP,
434  xmin=m_zCutLow_elTP,
435  xmax=m_zCutHigh_elTP,
436  cutmask='template_ss',
437  duration='lb',
438  opt=optData
439  )
440 
441  group_EleContainerTP.defineHistogram('mass;m_elContainertp_nomatch',
442  title='',
443  xbins=nzbins_elTP,
444  xmin=m_zCutLow_elTP,
445  xmax=m_zCutHigh_elTP,
446  cutmask='container_nomatch',
447  duration='lb',
448  opt=optData
449  )
450 
451  group_EleContainerTP.defineHistogram('mass;m_ele_tight_passkine',
452  title='',
453  xbins=nzbins_elTP,
454  xmin=m_zCutLow_elTP,
455  xmax=m_zCutHigh_elTP,
456  cutmask='pass_kine',
457  duration='lb',
458  opt=optData
459  )
460 
461  group_EleTP.defineTree('pT, phi, eta, mass, isTruth, runNumber, LB, eventNumber, mtype, weight;electron_reco_tptree',
462  title='electron_reco_tp_tree',
463  treedef='pT/F:phi/F:eta/F:mass/F:runNumber/I:LB/I:eventNumber/l:mtype/I:weight/F',
464  opt=optMC
465  )
466 
467  group_EleTrigTP.defineHistogram('matched;m_eltrigtp_matches_os',
468  title='Electron trigger TP stats',
469  xbins=3,
470  xmin=-0.5,
471  xmax=2.5,
472  weight='weight',
473  cutmask='os',
474  duration='lb',
475  opt=optData
476  )
477 
478  group_EleTrigTP.defineHistogram('matched;m_eltrigtp_matches_ss',
479  title='Electron trigger TP stats',
480  xbins=3,
481  xmin=-0.5,
482  xmax=2.5,
483  weight='weight',
484  cutmask='ss',
485  duration='lb',
486  opt=optData
487  )
488 
489  group_EleTrigTP.defineTree('pT, phi, eta, mass, runNumber, LB, eventNumber, mtype, weight;electron_trig_tptree',
490  title='electron_trig_tptree',
491  treedef='pT/F:phi/F:eta/F:mass/F:runNumber/I:LB/I:eventNumber/l:mtype/I:weight/F',
492  opt=optMC
493  )
494 
495  group_MuonTruthEff.defineHistogram('match;mcmatch',
496  title='Muon matching to truth in acceptance',
497  xbins=2,
498  xmin=-0.5,
499  xmax=1.5,
500  duration='lb',
501  opt=optMC
502  )
503 
504  group_MuonTriggerTP.defineHistogram('matched;m_mutrigtp_matches',
505  title='Muon Trigger TP stats',
506  xbins=3,
507  xmin=-0.5,
508  xmax=2.5,
509  weight='weight',
510  duration='lb',
511  opt=optData
512  )
513 
514  group_MuonTriggerTP.defineTree('matched, isOS;m_bcid_mu_trigtp',
515  title='m_bcid_mu_trigtp',
516  treedef='nTrig_matches/I:isOS/O',
517  cutmask='do_BCID',
518  opt=optMC
519  )
520 
521  group_MuonTriggerTP.defineTree('pT, eta, phi, mass, isTruth, runNumber, LB, eventNumber, mtype, weight;muon_trig_tptree',
522  title='muon_trig_tptree',
523  treedef='pT/F:phi/F:eta/F:mass/F:isTruth/O:runNumber/I:LB/I:eventNumber/l:mtype/I:weight/F',
524  opt=optMC
525  )
526 
527  group_MuonLooseTP.defineHistogram('mass;m_muloosetp_match_os',
528  title='Muon loose TP match OS',
529  xbins=nzbins,
530  xmin=m_zCutLow,
531  xmax=m_zCutHigh,
532  cutmask='osmatch',
533  duration='lb',
534  opt=optData
535  )
536 
537  group_MuonLooseTP.defineHistogram('mass;m_muloosetp_match_ss',
538  title='Muon loose TP match SS',
539  xbins=nzbins,
540  xmin=m_zCutLow,
541  xmax=m_zCutHigh,
542  cutmask='ssmatch',
543  duration='lb',
544  opt=optData
545  )
546 
547  group_MuonLooseTP.defineHistogram('mass;m_muloosetp_nomatch_os',
548  title='Muon loose TP nomatch OS',
549  xbins=nzbins,
550  xmin=m_zCutLow,
551  xmax=m_zCutHigh,
552  cutmask='osnomatch',
553  duration='lb',
554  opt=optData
555  )
556 
557  group_MuonLooseTP.defineHistogram('mass;m_muloosetp_nomatch_ss',
558  title='Muon loose TP nomatch SS',
559  xbins=nzbins,
560  xmin=m_zCutLow,
561  xmax=m_zCutHigh,
562  cutmask='ssnomatch',
563  duration='lb',
564  opt=optData
565  )
566 
567  group_MuonLooseTP.defineTree('pT, phi, eta, mass, isTruth, runNumber, LB, eventNumber, mtype, weight;muon_reco_tptree',
568  title='muon_reco_tptree',
569  treedef='pT/F:phi/F:eta/F:mass/F:isTruth/O:runNumber/I:LB/I:eventNumber/l:mtype/I:weight/F',
570  opt=optMC
571  )
572 
573  group_MuonInDetTP.defineHistogram('mass;m_mu_InDet_tp_match_os',
574  title='Muon inner detector TP match OS',
575  xbins=nzbins,
576  xmin=m_zCutLow,
577  xmax=m_zCutHigh,
578  cutmask='osmatch',
579  duration='lb',
580  opt=optData
581  )
582 
583  group_MuonInDetTP.defineHistogram('mass;m_mu_InDet_tp_match_ss',
584  title='Muon inner detector TP match SS',
585  xbins=nzbins,
586  xmin=m_zCutLow,
587  xmax=m_zCutHigh,
588  cutmask='ssmatch',
589  duration='lb',
590  opt=optData
591  )
592 
593  group_MuonInDetTP.defineHistogram('mass;m_mu_InDet_tp_nomatch_os',
594  title='Muon inner detector TP nomatch OS',
595  xbins=nzbins,
596  xmin=m_zCutLow,
597  xmax=m_zCutHigh,
598  cutmask='osnomatch',
599  duration='lb',
600  opt=optData
601  )
602 
603  group_MuonInDetTP.defineHistogram('mass;m_mu_InDet_tp_nomatch_ss',
604  title='Muon inner detector TP nomatch SS',
605  xbins=nzbins,
606  xmin=m_zCutLow,
607  xmax=m_zCutHigh,
608  cutmask='ssnomatch',
609  duration='lb',
610  opt=optData
611  )
612 
613  group_MuonInDetTP.defineTree('pT, eta, phi, mass, isTruth, runNumber, LB, eventNumber, mtype, weight;muon_indet_tptree',
614  title='muon_indet_tptree',
615  treedef='pT/F:phi/F:eta/F:mass/F:isTruth/O:runNumber/I:LB/I:eventNumber/l:mtype/I:weight/F',
616  opt=optMC
617  )
618 
619  result = helper.result()
620  return result
621 
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
DQTGlobalWZFinderAlg.DQTGlobalWZFinderAlgConfig
def DQTGlobalWZFinderAlgConfig(flags)
Definition: DQTGlobalWZFinderAlg.py:4