4 from copy
import deepcopy
5 from collections
import OrderedDict
as odict
6 from functools
import total_ordering
8 from AthenaCommon.Logging
import logging
10 from ..Config.TypeWideThresholdConfig
import getTypeWideThresholdConfig
11 from .ThresholdType
import ThrType
12 from .Limits
import CaloLimits
as CL
13 from .TopoAlgorithms
import AlgCategory
15 log = logging.getLogger(__name__)
45 if type(thrName)
is not str:
46 raise TypeError(
"Can not access threshold by %r, it is a %s" % (thrName,
type(thrName)))
47 if thrName
not in self:
48 raise KeyError(
"Threshold %s is not in the menu" % thrName)
58 return self.thresholdsNames
59 return set([thr.name
for thr
in self
if thr.ttype == ttype])
67 for ttype
in (ThrType.Run3Types() + ThrType.NIMTypes() + [ThrType.TOPO, ThrType.MUTOPO] + [ThrType.LArSat, ThrType.NSWMon] ):
68 confObj[ttype.name] = odict()
69 confObj[ttype.name][
"type"] = ttype.name
70 confObj[ttype.name][
"thresholds"] = odict()
75 confObj[thr.ttype.name][
"thresholds"][thr.name] = thr.json()
77 raise RuntimeError(
"Run 3 threshold %s is of unsupported type %s" % (thr.name, thr.ttype.name))
79 for ttype
in ThrType.Run3Types():
86 for ttype
in (ThrType.LegacyTypes() + [ThrType.R2TOPO]):
87 confObj[ttype.name] = odict()
88 confObj[ttype.name][
"type"] = ttype.name
89 confObj[ttype.name][
"thresholds"] = odict()
91 if not thr.isLegacy():
93 if thr.ttype.name
in confObj:
94 confObj[thr.ttype.name][
"thresholds"][thr.name] = thr.json()
95 for ttype
in ThrType.LegacyTypes():
102 __slots__ = [
'name',
'ttype',
'mapping',
'thresholdValues',
'run']
105 l1configForRegistration =
None
109 Threshold.l1configForRegistration = mc
111 def __init__(self, name, ttype, mapping = -1, run = 0):
118 if Threshold.l1configForRegistration:
119 Threshold.l1configForRegistration.registerThreshold(self)
125 """returns a string that can be used as a varname"""
139 confObj[
"todo"] =
"implement"
140 if self.
ttype == ThrType.ZB:
141 confObj[
"seed"] = self.seed
142 confObj[
"seed_multi"] = self.seed_multi
143 confObj[
"bc_delay"] = self.
mapping
153 super(LegacyThreshold,self).
__init__(name = name, ttype = ttype, mapping = mapping, run = 2)
158 if self.
ttype == ThrType.JET:
160 if self.
ttype in [ThrType.JE, ThrType.TE, ThrType.XE, ThrType.XS ]:
162 raise RuntimeError(
"addThrValue() not defined for threshold type %s (%s)" % (self.
ttype, self.
name))
166 defargs = ThresholdValue.getDefaults(self.
ttype.name)
167 posargs = dict(zip([
'etamin',
'etamax',
'phimin',
'phimax',
'em_isolation',
'had_isolation',
'had_veto',
'priority',
'isobits',
'use_relIso'], args))
169 p = deepcopy(defargs)
173 etamin = p[
'etamin'],
177 priority = p[
'priority'],
178 name = self.
name+
'full')
179 thrv.setIsolation( em_isolation = p[
'em_isolation'],
180 had_isolation = p[
'had_isolation'],
181 had_veto = p[
'had_veto'],
182 isobits = p[
'isobits'],
183 use_relIso = p[
'use_relIso'])
189 defargs = ThresholdValue.getDefaults(self.
ttype.name)
190 posargs = dict(zip([
'etamin',
'etamax',
'phimin',
'phimax',
'window',
'priority'], args))
191 p = deepcopy(defargs)
200 priority=p[
'priority'],
201 name=self.
name+
'full')
206 defargs = ThresholdValue.getDefaults(self.
ttype.name)
207 posargs = dict(zip([
'etamin',
'etamax',
'phimin',
'phimax',
'priority'], args))
208 p = deepcopy(defargs)
217 priority=p[
'priority'],
218 name=self.
name+
'full')
224 confObj[
"mapping"] = self.
mapping
225 if self.
ttype == ThrType.EM:
226 confObj[
"thrValues"] = []
228 confObj[
"thrValues"].
append( odict([
229 (
"value", thrV.value),
230 (
"isobits", thrV.isobits),
231 (
"etamin", thrV.etamin),
232 (
"etamax", thrV.etamax),
233 (
"phimin", thrV.phimin),
234 (
"phimax", thrV.phimax),
235 (
"priority", thrV.priority)
237 elif self.
ttype == ThrType.TAU:
239 confObj[
"thrValues"] = []
241 confObj[
"thrValues"].
append( odict([
242 (
"value", thrV.value),
243 (
"etamin", thrV.etamin),
244 (
"etamax", thrV.etamax),
245 (
"phimin", thrV.phimin),
246 (
"phimax", thrV.phimax),
247 (
"priority", thrV.priority)
249 elif self.
ttype == ThrType.JET:
250 confObj[
"thrValues"] = []
252 confObj[
"thrValues"].
append( odict([
253 (
"value", thrV.value),
254 (
"etamin", thrV.etamin),
255 (
"etamax", thrV.etamax),
256 (
"phimin", thrV.phimin),
257 (
"phimax", thrV.phimax),
258 (
"window", thrV.window),
259 (
"priority", thrV.priority)
261 elif self.
ttype == ThrType.TE:
265 confObj[
"thrValues"] = []
267 confObj[
"thrValues"].
append( odict([
268 (
"value", thrV.value),
269 (
"etamin", thrV.etamin),
270 (
"etamax", thrV.etamax),
271 (
"priority", thrV.priority)
273 elif self.
ttype == ThrType.XE:
277 confObj[
"thrValues"] = []
279 confObj[
"thrValues"].
append( odict([
280 (
"value", thrV.value),
281 (
"etamin", thrV.etamin),
282 (
"etamax", thrV.etamax),
283 (
"priority", thrV.priority)
285 elif self.
ttype == ThrType.XS:
288 raise RuntimeError(
"No json implementation for legacy threshold type %s" % self.
ttype)
295 def __init__(self, name, ttype = 'eEM', mapping = -1):
296 super(eEMThreshold,self).
__init__(name = name, ttype = ttype, mapping = mapping, run = 3
if ttype==
'eEM' else 2)
297 mres = re.match(
"(?P<type>[A-z]*)[0-9]*(?P<suffix>[VHILMT]*)",name).groupdict()
316 allowed = [
"None",
"Loose",
"Medium",
"Tight" ]
317 if rhad
not in allowed:
318 raise RuntimeError(
"Threshold %s of type %s: isolation wp %s not allowed for rhad, must be one of %s", self.
name, self.
ttype, rhad,
', '.
join(allowed) )
319 if reta
not in allowed:
320 raise RuntimeError(
"Threshold %s of type %s: isolation wp %s not allowed for reta, must be one of %s", self.
name, self.
ttype, reta,
', '.
join(allowed) )
321 if wstot
not in allowed:
322 raise RuntimeError(
"Threshold %s of type %s: isolation wp %s not allowed for wstot, must be one of %s", self.
name, self.
ttype, wstot,
', '.
join(allowed) )
330 defargs = ThresholdValue.getDefaults(self.
ttype.name)
331 posargs = dict(zip([
'etamin',
'etamax',
'phimin',
'phimax',
'priority'], args))
334 p = deepcopy(defargs)
339 etamin = p[
'etamin'], etamax=p[
'etamax'], phimin=p[
'phimin'], phimax=p[
'phimax'],
340 priority = p[
'priority'], name = self.
name+
'full')
342 raise RuntimeError(
"Threshold %s of type %s cannot have multiple Et cuts" % ( self.
name, self.
ttype ) )
348 confObj[
"mapping"] = self.
mapping
349 confObj[
"rhad"] = self.
rhad
350 confObj[
"reta"] = self.
reta
351 confObj[
"wstot"] = self.
wstot
352 confObj[
"thrValues"] = []
355 tvco[
"value"] = thrV.value
356 tvco[
"etamin"] = thrV.etamin
357 tvco[
"etamax"] = thrV.etamax
358 tvco[
"priority"] = thrV.priority
359 confObj[
"thrValues"].
append( tvco )
364 def __init__(self, name, ttype = 'eEM', mapping = -1):
365 super(eEMVarThreshold,self).
__init__(name = name, ttype = ttype, mapping = mapping, run = 3
if ttype==
'eEM' else 2)
366 mres = re.match(
"(?P<type>[A-z]*)[0-9]*(?P<suffix>[VHILMT]*)",name).groupdict()
385 allowed = [
"None",
"Loose",
"Medium",
"Tight" ]
386 if rhad
not in allowed:
387 raise RuntimeError(
"Threshold %s of type %s: isolation wp %s not allowed for rhad, must be one of %s", self.
name, self.
ttype, rhad,
', '.
join(allowed) )
388 if reta
not in allowed:
389 raise RuntimeError(
"Threshold %s of type %s: isolation wp %s not allowed for reta, must be one of %s", self.
name, self.
ttype, reta,
', '.
join(allowed) )
390 if wstot
not in allowed:
391 raise RuntimeError(
"Threshold %s of type %s: isolation wp %s not allowed for wstot, must be one of %s", self.
name, self.
ttype, wstot,
', '.
join(allowed) )
399 defargs = ThresholdValue.getDefaults(self.
ttype.name)
400 posargs = dict(zip([
'etamin',
'etamax',
'phimin',
'phimax',
'priority'], args))
403 p = deepcopy(defargs)
408 etamin = p[
'etamin'], etamax=p[
'etamax'], phimin=p[
'phimin'], phimax=p[
'phimax'],
409 priority = p[
'priority'], name = self.
name+
'full')
416 confObj[
"mapping"] = self.
mapping
417 confObj[
"rhad"] = self.
rhad
418 confObj[
"reta"] = self.
reta
419 confObj[
"wstot"] = self.
wstot
420 confObj[
"thrValues"] = []
423 tvco[
"value"] = thrV.value
424 tvco[
"etamin"] = thrV.etamin
425 tvco[
"etamax"] = thrV.etamax
426 tvco[
"priority"] = thrV.priority
427 confObj[
"thrValues"].
append( tvco )
433 def __init__(self, name, ttype = 'jEM', mapping = -1):
434 super(jEMThreshold,self).
__init__(name = name, ttype = ttype, mapping = mapping, run = 3
if ttype==
'jEM' else 2)
435 mres = re.match(
"(?P<type>[A-z]*)[0-9]*(?P<suffix>[VHILMT]*)",name).groupdict()
454 allowed = [
"None",
"Loose",
"Medium",
"Tight" ]
455 if iso
not in allowed:
456 raise RuntimeError(
"Threshold %s of type %s: isolation wp %s not allowed for iso, must be one of %s", self.
name, self.
ttype, iso,
', '.
join(allowed) )
457 if frac
not in allowed:
458 raise RuntimeError(
"Threshold %s of type %s: isolation wp %s not allowed for frac, must be one of %s", self.
name, self.
ttype, frac,
', '.
join(allowed) )
459 if frac2
not in allowed:
460 raise RuntimeError(
"Threshold %s of type %s: isolation wp %s not allowed for frac2, must be one of %s", self.
name, self.
ttype, frac2,
', '.
join(allowed) )
468 defargs = ThresholdValue.getDefaults(self.
ttype.name)
469 posargs = dict(zip([
'etamin',
'etamax',
'phimin',
'phimax',
'priority'], args))
472 p = deepcopy(defargs)
477 etamin = p[
'etamin'], etamax=p[
'etamax'], phimin=p[
'phimin'], phimax=p[
'phimax'],
478 priority = p[
'priority'], name = self.
name+
'full')
480 raise RuntimeError(
"Threshold %s of type %s cannot have multiple Et cuts" % ( self.
name, self.
ttype ) )
486 confObj[
"mapping"] = self.
mapping
487 confObj[
"iso"] = self.
iso
488 confObj[
"frac"] = self.
frac
489 confObj[
"frac2"] = self.
frac2
490 confObj[
"thrValues"] = []
493 tvco[
"value"] = thrV.value
494 tvco[
"etamin"] = thrV.etamin
495 tvco[
"etamax"] = thrV.etamax
496 tvco[
"priority"] = thrV.priority
497 confObj[
"thrValues"].
append( tvco )
503 def __init__(self, name, run = 3, tgcFlags = "", mapping = -1):
504 super(MuonThreshold,self).
__init__(name = name, ttype =
'MU', mapping = mapping, run = run)
519 """@det can be any combination of 'BA','EC',FW' or can be 'ALL' (case doesn't matter)"""
520 tmp =
set([x.strip()
for x
in det.split(
',')])
522 if not x.upper()
in [
'BA',
'EC',
'FW',
'ALL']:
523 raise RuntimeError(
"Unknown detector specification %s for muon threshold %s" % (x, self.
name))
524 tmp =
sorted([x.upper()
for x
in tmp])
531 """flags can be a logical expression like 'F & C | F & H | C & H'"""
536 """flags can be a logical expression like 'M'"""
545 def setThrValue(self, thr = None, ba = None, ec = None, fw = None):
547 pT parameters thr, ba, ec, fw are in GeV
548 Specifying thr sets all: ba, ec, and fw to that value
549 ba, ec, fw can then be used to overwrite it for a certain region
562 raise RuntimeError(
"In muon threshold %s setThrValue() at least one region is unspecified" % self.
name)
568 except KeyError
as ex:
569 log.error(
"Muon PT threshold %i does not have a defined road in the barrel", self.
baThr)
570 log.error(
"Only these barrel roads are define (in L1/Config/TypeWideThresholdConfig.py): %s",
', '.
join([
'%i'%x
for x
in muonRoads[
"rpc"]]))
575 except KeyError
as ex:
576 log.error(
"Muon PT threshold %i does not have a defined road in the endcap", self.
ecThr)
577 log.error(
"Only these endcaps roads are define (in L1/Config/TypeWideThresholdConfig.py): %s",
', '.
join([
'%i'%x
for x
in muonRoads[
"tgc"]]))
582 except KeyError
as ex:
583 log.error(
"Muon PT threshold %i does not have a defined road in the endcap", self.
ecThr)
584 log.error(
"Only these endcaps roads are define (in L1/Config/TypeWideThresholdConfig.py): %s",
', '.
join([
'%i'%x
for x
in muonRoads[
"tgc"]]))
592 confObj[
"mapping"] = self.
mapping
594 confObj[
"thr"] = self.
thr
596 confObj[
"baThr"] = self.
baThr
597 confObj[
"ecThr"] = self.
ecThr
598 confObj[
"fwThr"] = self.
fwThr
599 confObj[
"baIdx"] = self.
baIdx
600 confObj[
"ecIdx"] = self.
ecIdx
601 confObj[
"fwIdx"] = self.
fwIdx
604 confObj[
"region"] = self.
region
612 super(NSWMonThreshold,self).
__init__(name = name, ttype = ThrType.NSWMon, mapping=mapping, run = 3)
617 confObj[
"mapping"] = self.
mapping
623 def __init__(self, name, ttype = 'eTAU', mapping = -1):
624 super(eTauThreshold,self).
__init__(name = name, ttype = ttype, mapping = mapping, run = 3
if ttype==
'eTAU' else 2)
626 mres = re.match(
"(?P<type>[A-z]*)[0-9]*(?P<suffix>[LMTH]*)",name).groupdict()
650 defargs = ThresholdValue.getDefaults(self.
ttype.name)
651 posargs = dict(zip([
'etamin',
'etamax',
'phimin',
'phimax',
'priority'], args))
654 p = deepcopy(defargs)
659 etamin = p[
'etamin'], etamax=p[
'etamax'], phimin=p[
'phimin'], phimax=p[
'phimax'],
660 priority = p[
'priority'], name = self.
name+
'full')
662 raise RuntimeError(
"Threshold %s of type %s cannot have multiple Et cuts" % ( self.
name, self.
ttype ) )
667 allowed_rCore = [
"None",
"Loose",
"Medium",
"Tight" ]
668 allowed_rHad = [
"None",
"Loose",
"Medium",
"Tight"]
669 if rCore
not in allowed_rCore:
670 raise RuntimeError(
"Threshold %s of type %s: isolation wp %s not allowed for rCore, must be one of %s", self.
name, self.
ttype, rCore,
', '.
join(allowed_rCore) )
671 if rHad
not in allowed_rHad:
672 raise RuntimeError(
"Threshold %s of type %s: isolation wp %s not allowed for rHad, must be one of %s", self.
name, self.
ttype, rHad,
', '.
join(allowed_rHad) )
679 confObj[
"mapping"] = self.
mapping
680 confObj[
"rCore"] = self.
rCore
681 confObj[
"rHad"] = self.
rHad
682 confObj[
"thrValues"] = []
684 confObj[
"thrValues"].
append( odict([
685 (
"value", thrV.value),
686 (
"etamin", thrV.etamin),
687 (
"etamax", thrV.etamax),
688 (
"phimin", thrV.phimin),
689 (
"phimax", thrV.phimax),
690 (
"priority", thrV.priority)
696 def __init__(self, name, ttype = 'jTAU', mapping = -1):
697 super(jTauThreshold,self).
__init__(name = name, ttype = ttype, mapping = mapping, run = 3
if ttype==
'jTAU' else 2)
699 mres = re.match(
"(?P<type>[A-z]*)[0-9]*(?P<suffix>[LMT]*)",name).groupdict()
719 defargs = ThresholdValue.getDefaults(self.
ttype.name)
720 posargs = dict(zip([
'etamin',
'etamax',
'phimin',
'phimax',
'priority'], args))
723 p = deepcopy(defargs)
728 etamin = p[
'etamin'], etamax=p[
'etamax'], phimin=p[
'phimin'], phimax=p[
'phimax'],
729 priority = p[
'priority'], name = self.
name+
'full')
731 raise RuntimeError(
"Threshold %s of type %s cannot have multiple Et cuts" % ( self.
name, self.
ttype ) )
736 allowed = [
"None",
"Loose",
"Medium",
"Tight" ]
737 if isolation
not in allowed:
738 raise RuntimeError(
"Threshold %s of type %s: isolation wp %s not allowed for isolation, must be one of %s", self.
name, self.
ttype, isolation,
', '.
join(allowed) )
744 confObj[
"mapping"] = self.
mapping
746 confObj[
"thrValues"] = []
748 confObj[
"thrValues"].
append( odict([
749 (
"value", thrV.value),
750 (
"etamin", thrV.etamin),
751 (
"etamax", thrV.etamax),
752 (
"phimin", thrV.phimin),
753 (
"phimax", thrV.phimax),
754 (
"priority", thrV.priority)
760 def __init__(self, name, ttype = 'cTAU', mapping = -1):
761 super(cTauThreshold,self).
__init__(name = name, ttype = ttype, mapping = mapping, run = 3
if ttype==
'cTAU' else 2)
763 mres = re.match(
"(?P<type>[A-z]*)[0-9]*(?P<suffix>[LMT]*)",name).groupdict()
783 defargs = ThresholdValue.getDefaults(self.
ttype.name)
784 posargs = dict(zip([
'etamin',
'etamax',
'phimin',
'phimax',
'priority'], args))
787 p = deepcopy(defargs)
792 etamin = p[
'etamin'], etamax=p[
'etamax'], phimin=p[
'phimin'], phimax=p[
'phimax'],
793 priority = p[
'priority'], name = self.
name+
'full')
795 raise RuntimeError(
"Threshold %s of type %s cannot have multiple Et cuts" % ( self.
name, self.
ttype ) )
800 allowed = [
"None",
"Loose",
"Medium",
"Tight",
"Loose12",
"Loose20",
"Loose30",
"Loose35",
"Medium12",
"Medium20",
"Medium30",
"Medium35",
"Tight12",
"Tight20",
"Tight30",
"Tight35"]
801 if isolation
not in allowed:
802 raise RuntimeError(
"Threshold %s of type %s: isolation wp %s not allowed for isolation, must be one of %s", self.
name, self.
ttype, isolation,
', '.
join(allowed) )
808 confObj[
"mapping"] = self.
mapping
810 confObj[
"thrValues"] = []
812 confObj[
"thrValues"].
append( odict([
813 (
"value", thrV.value),
814 (
"etamin", thrV.etamin),
815 (
"etamax", thrV.etamax),
816 (
"phimin", thrV.phimin),
817 (
"phimax", thrV.phimax),
818 (
"priority", thrV.priority)
824 def __init__(self, name, ttype = 'jJ', mapping = -1):
825 super(jJetThreshold,self).
__init__(name = name, ttype = ttype, mapping = mapping, run = 3
if ttype==
'jJ' else 2)
828 defargs = ThresholdValue.getDefaults(self.
ttype.name)
829 posargs = dict(zip([
'etamin',
'etamax',
'phimin',
'phimax',
'priority'], args))
832 p = deepcopy(defargs)
837 etamin = p[
'etamin'], etamax=p[
'etamax'], phimin=p[
'phimin'], phimax=p[
'phimax'],
838 priority = p[
'priority'], name = self.
name+
'full')
845 confObj[
"mapping"] = self.
mapping
846 confObj[
"thrValues"] = []
849 tvco[
"value"] = thrV.value
850 tvco[
"etamin"] = thrV.etamin
851 tvco[
"etamax"] = thrV.etamax
852 tvco[
"priority"] = thrV.priority
853 confObj[
"thrValues"].
append( tvco )
859 def __init__(self, name, ttype = 'jLJ', mapping = -1):
860 super(jLJetThreshold,self).
__init__(name = name, ttype = ttype, mapping = mapping, run = 3
if ttype==
'jLJ' else 2)
863 defargs = ThresholdValue.getDefaults(self.
ttype.name)
864 posargs = dict(zip([
'etamin',
'etamax',
'phimin',
'phimax',
'priority'], args))
867 p = deepcopy(defargs)
872 etamin = p[
'etamin'], etamax=p[
'etamax'], phimin=p[
'phimin'], phimax=p[
'phimax'],
873 priority = p[
'priority'], name = self.
name+
'full')
880 confObj[
"mapping"] = self.
mapping
881 confObj[
"thrValues"] = []
884 tvco[
"value"] = thrV.value
885 tvco[
"etamin"] = thrV.etamin
886 tvco[
"etamax"] = thrV.etamax
887 tvco[
"priority"] = thrV.priority
888 confObj[
"thrValues"].
append( tvco )
893 def __init__(self, name, ttype = 'gJ', mapping = -1):
894 super(gJetThreshold,self).
__init__(name = name, ttype = ttype, mapping = mapping, run = 3
if ttype==
'gJ' else 2)
897 defargs = ThresholdValue.getDefaults(self.
ttype.name)
898 posargs = dict(zip([
'etamin',
'etamax',
'phimin',
'phimax',
'priority'], args))
900 p = deepcopy(defargs)
905 etamin = p[
'etamin'], etamax=p[
'etamax'], phimin=p[
'phimin'], phimax=p[
'phimax'],
906 priority = p[
'priority'], name = self.
name+
'full')
913 confObj[
"mapping"] = self.
mapping
914 confObj[
"thrValues"] = []
917 tvco[
"value"] = thrV.value
918 tvco[
"etamin"] = thrV.etamin
919 tvco[
"etamax"] = thrV.etamax
920 tvco[
"priority"] = thrV.priority
921 confObj[
"thrValues"].
append( tvco )
927 def __init__(self, name, ttype = 'gLJ', mapping = -1):
928 super(gLJetThreshold,self).
__init__(name = name, ttype = ttype, mapping = mapping, run = 3
if ttype==
'gLJ' else 2)
931 defargs = ThresholdValue.getDefaults(self.
ttype.name)
932 posargs = dict(zip([
'etamin',
'etamax',
'phimin',
'phimax',
'priority'], args))
934 p = deepcopy(defargs)
939 etamin = p[
'etamin'], etamax=p[
'etamax'], phimin=p[
'phimin'], phimax=p[
'phimax'],
940 priority = p[
'priority'], name = self.
name+
'full')
947 confObj[
"mapping"] = self.
mapping
948 confObj[
"thrValues"] = []
951 tvco[
"value"] = thrV.value
952 tvco[
"etamin"] = thrV.etamin
953 tvco[
"etamax"] = thrV.etamax
954 tvco[
"priority"] = thrV.priority
955 confObj[
"thrValues"].
append( tvco )
962 super(XEThreshold,self).
__init__(name = name, ttype = ttype, mapping = mapping, run = 3
if ttype.startswith(
'gXE')
or ttype.startswith(
'gMHT')
or ttype.startswith(
'jXE')
else 2)
966 """xe value in GeV"""
972 confObj[
"value"] = self.
xe
973 confObj[
"mapping"] = self.
mapping
980 super(LArSaturationThreshold,self).
__init__(name = name, ttype = ThrType.LArSat, mapping=mapping, run = 3)
985 confObj[
"mapping"] = self.
mapping
991 super(ZeroBiasThresholdTopo,self).
__init__(name = name, ttype = ThrType.ZBTopo, mapping = mapping, run = 3)
1002 self.
mask0 = seed[0]
1003 self.
mask1 = seed[1]
1004 self.
mask2 = seed[2]
1005 self.
mask3 = seed[3]
1006 self.
mask4 = seed[4]
1007 self.
mask5 = seed[5]
1013 confObj[
"mapping" ] = self.
mapping
1014 confObj[
"delay"] = self.
bcdelay
1015 confObj[
"mask0"] = self.
mask0
1016 confObj[
"mask1"] = self.
mask1
1017 confObj[
"mask2"] = self.
mask2
1018 confObj[
"mask3"] = self.
mask3
1019 confObj[
"mask4"] = self.
mask4
1020 confObj[
"mask5"] = self.
mask5
1029 super(TEThreshold,self).
__init__(name = name, ttype = ttype, mapping = mapping, run = 3
if ttype.startswith(
'gTE')
or ttype.startswith(
'jTE')
else 2)
1033 """te value in GeV"""
1039 confObj[
"value"] = self.
xe
1040 confObj[
"mapping"] = self.
mapping
1046 super(NimThreshold,self).
__init__(name = name, ttype = ttype, mapping = mapping, run = 3)
1050 confObj[
"mapping"] = self.
mapping
1057 super(MBTSSIThreshold,self).
__init__(name = name, ttype =
'MBTSSI', mapping = mapping, run = 3)
1065 confObj[
"mapping"] = self.
mapping
1066 confObj[
"voltage"] = self.
voltage
1073 super(MBTSThreshold,self).
__init__(name = name, ttype =
'MBTS', mapping = mapping, run = 3)
1077 self.
sectors += [ mbtsSector.name ]
1081 confObj[
"mapping"] = self.
mapping
1082 confObj[
"sectors"] = self.
sectors
1089 __slots__ = [
'seed',
'seed_ttype',
'seed_multi',
'bcdelay' ]
1092 super(ZeroBiasThreshold,self).
__init__(name = name, ttype =
'ZB', mapping = mapping, run = 2)
1106 confObj[
"mapping" ] = self.
mapping
1107 confObj[
"seed"] = self.
seed
1108 confObj[
"seedMultiplicity"] = self.
seed_multi
1109 confObj[
"seedBcdelay"] = self.
bcdelay
1117 defaultThresholdValues = {}
1121 ThresholdValue.defaultThresholdValues[ttype] = dic
1132 if ttype ==
'EM' or ttype ==
'TAU':
1133 defaults.update({
'priority': 1,
1134 'em_isolation' : CL.IsolationOff,
1135 'had_isolation' : CL.IsolationOff,
1136 'had_veto' : CL.IsolationOff,
1137 'isobits' :
'00000',
1138 'use_relIso' :
False,
1141 defaults.update({
'window': 8})
1143 if ttype
in ThresholdValue.defaultThresholdValues:
1144 defaults.update( ThresholdValue.defaultThresholdValues[ttype] )
1148 def __init__(self, thrtype, value, etamin, etamax, phimin, phimax, window=0, priority=1, name=''):
1163 for rv
in listOfThrValues:
1166 if (self.
etamax > rv.etamin)
and (self.
etamin < rv.etamax):
1168 raise RuntimeError(
"ThresholdValue %s: Range eta %i - %i (priority %i) overlaps with existing range of the same priority" % \
1171 def setIsolation(self, em_isolation, had_isolation, had_veto, isobits, use_relIso):
1184 return self.
etamin < o.etamin
1185 return self.
name < o.name
1188 return (self.
priority == o.priority)
and \
1189 (self.
etamin == o.etamin)
and \
1190 (self.
name == o.name)
1197 """Class representing a direct input cable to the CTPCORE
1199 In the menu it is treated like a threshold, only the naming
1200 convention is less strict (allows"-" and can start with a number)
1204 multibitPattern = re.compile(
r"(?P<line>.*)\[(?P<bit>\d+)\]")
1208 @param category of type AlgCategory
1211 raise RuntimeError(
"%s is not a valid topo output name, it should not contain a ','" % name)
1213 super(TopoThreshold,self).
__init__(name = name, ttype = algCategory.key, run = 2
if algCategory==AlgCategory.LEGACY
else 3)
1214 if algCategory
not in AlgCategory.getAllCategories():
1215 raise RuntimeError(
"%r is not a valid topo category" % algCategory)
1220 """returns a string that can be used as a varname"""
1225 confObj[
"mapping"] = self.
mapping