11from basf2
import Module
12from ROOT
import Belle2
17 This module is to calculate
and print out the efficiency of each L1 trigger line
with
18 the trigger result
from object
'TRGGDLResults'
25 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]
27 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]
29 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]
32 trglog_phase2 = [
'3 or more 3D tracks',
33 '2 3D tracks, ≥1 within 25 cm, not a trkBhabha',
34 '2 3D tracks, not a trkBhabha',
35 '2 3D tracks, trkBhabha',
36 '1 track, <25cm, clust same hemi, no 2 GeV clust',
37 '1 track, <25cm, clust opp hemi, no 2 GeV clust',
38 '≥3 clusters inc. ≥1 300 MeV, not an eclBhabha',
39 '2 GeV E* in [4,14], not a trkBhabha',
40 '2 GeV E* in [4,14], trkBhabha',
41 '2 GeV E* in 2,3,15 or 16, not a trkBhabha or eclBhabha',
42 '2 GeV E* in 2,3,15 or 16, trkBhabha or eclBhabha',
43 '2 GeV E* in 1 or 17, not a trkBhabha or eclBhabha',
44 '2 GeV E* in 1 or 17, trkBhabha or eclBhabha',
45 'exactly 1 E*>1 GeV and 1 E>300 MeV, in [4,15]',
46 'exactly 1 E*>1 GeV and 1 E>300 MeV, in 2,3 or 16',
47 'clusters back-to-back in phi, both >250 MeV, no 2 GeV',
48 'clusters back-to-back in phi, 1 <250 MeV, no 2 GeV',
49 'clusters back-to-back in 3D, no 2 GeV',
50 'eed: two matched & cluster b2b',
51 'fed: one track & one matched & cluster b2b',
52 'fp: one track & track-cluster b2b',
53 'eeb: two matched & track b2b',
54 'fep: one track & one matched & track-cluster b2b'
58 trglog_phase3 = [
'3 or more 3D tracks',
59 '2 3D tracks, ≥1 within 10 cm, not a trkBhabha',
60 '2 3D tracks, not a trkBhabha',
61 '2 3D tracks, trkBhabha',
62 '1 track, <10cm, clust same hemi, no 2 GeV clust',
63 '1 track, <10cm, clust opp hemi, no 2 GeV clust',
64 '≥3 clusters inc. ≥2 300 MeV, not an eclBhabha',
65 '2 GeV E* in [4,14], not a trkBhabha',
66 '2 GeV E* in [4,14], trkBhabha',
67 '2 GeV E* in 2,3,15 or 16, not a trkBhabha or eclBhabha',
68 '2 GeV E* in 2,3,15 or 16, trkBhabha or eclBhabha',
69 '2 GeV E* in 1 or 17, not a trkBhabha or eclBhabha',
70 '2 GeV E* in 1 or 17, trkBhabha or eclBhabha',
71 'exactly 1 E*>1 GeV and 1 E>300 MeV, in [4,15]',
72 'exactly 1 E*>1 GeV and 1 E>300 MeV, in 2,3 or 16',
73 'clusters back-to-back in phi, both >250 MeV, no 2 GeV',
74 'clusters back-to-back in phi, 1 <250 MeV, no 2 GeV, TrkZ25 is 3D track',
75 'clusters back-to-back in 3D, no 2 GeV',
76 'eed: two matched & cluster b2b',
77 'fed: one track & one matched & cluster b2b',
78 'fp: one track & track-cluster b2b',
79 'eeb: two matched & track b2b',
80 'fep: one track & one matched & track-cluster b2b'
91 """Initialization of EffModule"""
98 Event function to count the numbers of events passing each trigger line
102 summary = trgresult.getPsnmBits(0)
105 sum_bin = bin(summary)
106 for i
in range(len(sum_bin) - 2):
107 trg = int(sum_bin[len(sum_bin) - 1 - i])
113 Calculate the efficiency of each trigger line with the statistical values
in event function
130 print(f
'L1 Trigger efficiency(%): {eff_tot:6.2f}')
131 print(
'Trigger Line', 5 * sp,
'PreScale Factor', 3 * sp,
'Efficiency(%)', 3 * sp,
'Logics')
134 for i
in range(ntrg):
136 print(f
'T{int(i):3} {int(prescale[i]):4} {eff:6.2f} {trglog[i]} ')
139def EffCalculation(path, Belle2Phase="Phase2"):
a (simplified) python wrapper for StoreObjPtr.
list trglog_phase3
trigger bit log for phase3
list prescale_phase3
prescale factors for phase3
def __init__(self, Belle2Phase)
list trglog_phase2
trigger bit log for phase2
int Ntot_event
The total number of events.
Ntot_event
Total number of events.
int Ntrg_event
The number of events passing L1 trigger.
list prescale_phase2
prescale factors for phase2
list Nsubtrg_event
The number of events passing each L1 trigger line.