3 from basf2
import Module
4 from ROOT
import Belle2
9 This module is to calculate and print out the efficiency of each L1 trigger line with
10 the trigger result from object 'TRGGDLResults'
17 Nsubtrg_event = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
19 prescale_phase2 = [1, 1, 20, 1, 1, 1, 1, 1, 1, 1, 1, 10, 10, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
21 prescale_phase3 = [1, 1, 20, 2, 1, 1, 1, 1, 2, 1, 1, 20, 20, 1, 5, 1, 3, 5, 1, 1, 1, 1, 1]
24 trglog_phase2 = [
'3 or more 3D tracks',
25 '2 3D tracks, ≥1 within 25 cm, not a trkBhabha',
26 '2 3D tracks, not a trkBhabha',
27 '2 3D tracks, trkBhabha',
28 '1 track, <25cm, clust same hemi, no 2 GeV clust',
29 '1 track, <25cm, clust opp hemi, no 2 GeV clust',
30 '≥3 clusters inc. ≥1 300 MeV, not an eclBhabha',
31 '2 GeV E* in [4,14], not a trkBhabha',
32 '2 GeV E* in [4,14], trkBhabha',
33 '2 GeV E* in 2,3,15 or 16, not a trkBhabha or eclBhabha',
34 '2 GeV E* in 2,3,15 or 16, trkBhabha or eclBhabha',
35 '2 GeV E* in 1 or 17, not a trkBhabha or eclBhabha',
36 '2 GeV E* in 1 or 17, trkBhabha or eclBhabha',
37 'exactly 1 E*>1 GeV and 1 E>300 MeV, in [4,15]',
38 'exactly 1 E*>1 GeV and 1 E>300 MeV, in 2,3 or 16',
39 'clusters back-to-back in phi, both >250 MeV, no 2 GeV',
40 'clusters back-to-back in phi, 1 <250 MeV, no 2 GeV',
41 'clusters back-to-back in 3D, no 2 GeV',
42 'eed: two matched & cluster b2b',
43 'fed: one track & one matched & cluster b2b',
44 'fp: one track & track-cluster b2b',
45 'eeb: two matched & track b2b',
46 'fep: one track & one matched & track-cluster b2b'
50 trglog_phase3 = [
'3 or more 3D tracks',
51 '2 3D tracks, ≥1 within 10 cm, not a trkBhabha',
52 '2 3D tracks, not a trkBhabha',
53 '2 3D tracks, trkBhabha',
54 '1 track, <10cm, clust same hemi, no 2 GeV clust',
55 '1 track, <10cm, clust opp hemi, no 2 GeV clust',
56 '≥3 clusters inc. ≥2 300 MeV, not an eclBhabha',
57 '2 GeV E* in [4,14], not a trkBhabha',
58 '2 GeV E* in [4,14], trkBhabha',
59 '2 GeV E* in 2,3,15 or 16, not a trkBhabha or eclBhabha',
60 '2 GeV E* in 2,3,15 or 16, trkBhabha or eclBhabha',
61 '2 GeV E* in 1 or 17, not a trkBhabha or eclBhabha',
62 '2 GeV E* in 1 or 17, trkBhabha or eclBhabha',
63 'exactly 1 E*>1 GeV and 1 E>300 MeV, in [4,15]',
64 'exactly 1 E*>1 GeV and 1 E>300 MeV, in 2,3 or 16',
65 'clusters back-to-back in phi, both >250 MeV, no 2 GeV',
66 'clusters back-to-back in phi, 1 <250 MeV, no 2 GeV, TrkZ25 is 3D track',
67 'clusters back-to-back in 3D, no 2 GeV',
68 'eed: two matched & cluster b2b',
69 'fed: one track & one matched & cluster b2b',
70 'fp: one track & track-cluster b2b',
71 'eeb: two matched & track b2b',
72 'fep: one track & one matched & track-cluster b2b'
83 """Initialization of EffModule"""
90 Event function to count the numbers of events passing each trigger line
94 summary = trgresult.getPsnmBits(0)
97 sum_bin = bin(summary)
98 for i
in range(len(sum_bin) - 2):
99 trg = int(sum_bin[len(sum_bin) - 1 - i])
105 Calculate the efficiency of each trigger line with the statistical values in event function
122 print(
'L1 Trigger efficiency(%%): %6.2f' % (eff_tot))
123 print(
'Trigger Line', 5 * sp,
'PreScale Factor', 3 * sp,
'Efficiency(%)', 3 * sp,
'Logics')
126 for i
in range(ntrg):
128 print(
'T%3d %4d %6.2f %s ' % (i, prescale[i], eff, trglog[i]))
131 def EffCalculation(path, Belle2Phase="Phase2"):