3 __all__ = [
'log',
'idgen',
'binstr',
'get_smk_psk_Name']
5 from AthenaCommon.Logging
import logging
6 log = logging.getLogger(__name__)
11 from collections
import defaultdict
15 return str(self.
a[kind])
28 return ''.
join([
str( value >> i & 1 )
for i
in range( width-1, -1, -1 ) ])
33 if "mc_prescale" in menuName:
34 form =
"(.*)_(.*)_mc_prescale"
35 m = re.match(form, menuName)
36 (smkName, pskName) = m.groups()
37 pskName = pskName+
"_mc"
38 elif "prescale" in menuName:
40 form =
"(.*)_(.*)_prescale"
41 m = re.match(form,menuName)
42 (smkName, pskName) = m.groups()
47 smk_psk_Name[
"smkName"] =
str(smkName)
48 smk_psk_Name[
"pskName"] =
str(smkName+
"_"+pskName+
"_prescale")
55 def thr2weights(thrs, factor=1.25):
73 while (jnext < n
and use[index[jnext]]==0):
76 w =
int( (thrs[index[j]]+thrs[index[jnext]]+1)/2.0) - sum
78 w =
int(thrs[index[j]]*factor - sum)
92 if (thr1.count(val)>1):
93 thr1[pos] = -thr1[pos]
96 l1_thrs = triggerPythonConfig.Lvl1Thresholds()
97 jet_thresholds = l1_thrs.allThresholdsOf(
'JET')
98 fjet_thresholds = l1_thrs.allThresholdsOf(
'JF')
99 log.debug(
'N jet thresholds: %d (8 expected)', len(jet_thresholds))
100 log.debug(
'N fjet thresholds: %d (4 expected)', len(fjet_thresholds))
103 jet_names, fjet_names = [
'---']*8, [
'---']*4
104 for j
in jet_thresholds:
105 log.debug(
'jet threshold %s: %d', j.name, j.thresholdInGeV())
107 jthr[j.mapping] = j.thresholdInGeV()
108 jet_names[j.mapping] = j.name
109 for j
in fjet_thresholds:
110 tvalues = j.thresholdValues
114 if tv.priority > priority:
115 threshold_value = tv.value
116 log.debug(
'fjet threshold %s: %d', j.name, threshold_value)
117 fjthr.append(threshold_value)
118 fjthr[j.mapping] = threshold_value
119 fjet_names[j.mapping] = j.name
124 log.debug(
'Jet thresholds: %s', s)
128 log.debug(
'Fjet thresholds: %s', s)
130 w = thr2weights(jthr)
137 w = thr2weights(fjthr)