ATLAS Offline Software
TestUtils.py
Go to the documentation of this file.
1 #
2 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 #
4 from DecisionHandling.DecisionHandlingConfig import ComboHypoCfg
5 from TriggerMenuMT.HLT.Config.MenuComponents import Chain, ChainStep
6 from TriggerMenuMT.HLT.Config.Utility.ChainDefInMenu import ChainProp
7 from TriggerMenuMT.HLT.Config.Utility.ChainDictTools import splitChainDictInLegs
8 from TriggerMenuMT.HLT.Config.Utility.DictFromChainName import dictFromChainName
9 from TriggerMenuMT.HLT.Config.Utility.HLTMenuConfig import HLTMenuConfig
10 from HLTSeeding.HLTSeedingConfig import mapThresholdToL1DecisionCollection
11 
13  """Writes emulation files. key in the dict is a file name (+.dat), list which is value of each dict el is enetered into the file, one el. per line"""
14  for name, d in data.items():
15  with open(name+".dat", "w") as f:
16  for event in d:
17  f.write(event)
18  f.write("\n")
19 
20 
22  """Used to store the step info, regardless of the chainDict"""
23  def __init__(self, name, seq=[], comboHypoCfg=ComboHypoCfg, comboToolConfs=[], chainDicts=None, isEmpty=False):
24  self.name = name
25  self.seq = seq
26  self.comboToolConfs = comboToolConfs
27  self.comboHypoCfg = comboHypoCfg
28  self.chainDicts = chainDicts
29  self.isEmpty = isEmpty
30 
31 
32 chainsCounter = 0
33 
34 def makeChain( flags, name, L1Thresholds, ChainSteps, Streams="physics:Main", Groups=["RATE:TestRateGroup", "BW:TestBW"]):
35  """
36  In addition to making the chain object fills the flags that are used to generate MnuCOnfig JSON file
37  """
38  prop = ChainProp( name=name, l1SeedThresholds=L1Thresholds, groups=Groups )
39  chainDict = dictFromChainName( flags, prop )
40  global chainsCounter
41  chainDict["chainCounter"] = chainsCounter
42  chainsCounter += 1
43 
44  #set default chain prescale
45  chainDict['prescale'] = 1
46 
47  listOfChainDicts = splitChainDictInLegs(chainDict)
48  L1decisions = [ mapThresholdToL1DecisionCollection(stri) for stri in L1Thresholds]
49  # create the ChainSteps, with the chaindict
50  StepConfig = []
51  for step in ChainSteps:
52  StepConfig+=[ChainStep(step.name,
53  step.seq,
54  chainDicts=step.chainDicts if step.chainDicts else listOfChainDicts,
55  comboHypoCfg=step.comboHypoCfg,
56  comboToolConfs=step.comboToolConfs, isEmpty=step.isEmpty)]
57 
58  chainConfig = Chain( name=name, L1decisions=L1decisions, ChainSteps=StepConfig )
59  HLTMenuConfig.registerChain( chainDict )
60 
61  return chainConfig
TestUtils.makeChain
def makeChain(flags, name, L1Thresholds, ChainSteps, Streams="physics:Main", Groups=["RATE:TestRateGroup", "BW:TestBW"])
Definition: TestUtils.py:34
ChainDictTools.splitChainDictInLegs
def splitChainDictInLegs(chainDict)
Definition: ChainDictTools.py:112
DictFromChainName.dictFromChainName
def dictFromChainName(flags, chainInfo)
Definition: DictFromChainName.py:626
TestUtils.makeChainStep
Definition: TestUtils.py:21
TestUtils.writeEmulationFiles
def writeEmulationFiles(data)
Definition: TestUtils.py:12
TestUtils.makeChainStep.comboHypoCfg
comboHypoCfg
Definition: TestUtils.py:27
TestUtils.makeChainStep.comboToolConfs
comboToolConfs
Definition: TestUtils.py:26
TestUtils.makeChainStep.seq
seq
Definition: TestUtils.py:25
TestUtils.makeChainStep.name
name
Definition: TestUtils.py:24
TestUtils.makeChainStep.isEmpty
isEmpty
Definition: TestUtils.py:29
TestUtils.makeChainStep.chainDicts
chainDicts
Definition: TestUtils.py:28
Trk::open
@ open
Definition: BinningType.h:40
TestUtils.makeChainStep.__init__
def __init__(self, name, seq=[], comboHypoCfg=ComboHypoCfg, comboToolConfs=[], chainDicts=None, isEmpty=False)
Definition: TestUtils.py:23
pickleTool.object
object
Definition: pickleTool.py:30
HLTSeedingConfig.mapThresholdToL1DecisionCollection
def mapThresholdToL1DecisionCollection(threshold)
Definition: HLTSeedingConfig.py:79