ATLAS Offline Software
PEBDSTest.py
Go to the documentation of this file.
1 #
2 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 #
4 
5 '''
6 This test defines its own version of the Dev_pp_run3_v1 menu and the corresponding PEB/DS configuration,
7 and executes several chains testing various types of Partial Event Building and Data Scouting
8 '''
9 
10 from TrigEDMConfig import DataScoutingInfo, TriggerEDMRun3
11 
12 # Modify EDM list to add collections to DataScouting results
13 # ATR-28536 - do this first, before the list gets imported into any other modules
14 myTriggerHLTListRun3 = []
15 for collectionConfig in TriggerEDMRun3.TriggerHLTListRun3:
16  if 'Electron' in collectionConfig[0]:
17  modConfig = list(collectionConfig)
18  modConfig[1] += ' ElectronDSTest ElectronDSPEBTest'
19  myTriggerHLTListRun3.append(tuple(modConfig))
20  else:
21  myTriggerHLTListRun3.append(collectionConfig)
22 TriggerEDMRun3.TriggerHLTListRun3 = myTriggerHLTListRun3
23 
24 from TriggerMenuMT.HLT.Menu import Dev_pp_run3_v1, EventBuildingInfo, StreamInfo
25 from TriggerMenuMT.HLT.Config.Utility.ChainDefInMenu import ChainProp
26 from TriggerMenuMT.HLT.CommonSequences import EventBuildingSequences
27 from TrigPartialEventBuilding.TrigPartialEventBuildingConfig import StaticPEBInfoWriterToolCfg, RoIPEBInfoWriterToolCfg
28 from libpyeformat_helper import SubDetector, SourceIdentifier
29 from AthenaCommon.Logging import logging
30 log = logging.getLogger('dataScoutingTest')
31 
32 # Add new allowed event building identifiers : isRoIBasedPEB
33 EventBuildingInfo._PartialEventBuildingIdentifiers |= {'TestPEBOne' : False,
34  'TestPEBTwo' : False,
35  'TestPEBThree' : True,
36  'TestPEBFour' : True,
37  'ElectronDSTest' : False,
38  'ElectronDSPEBTest': False}
39 # Modify these private maps only for the purposes of this test
40 DataScoutingInfo._DataScoutingIdentifiers['ElectronDSTest'] = 3
41 DataScoutingInfo._DataScoutingIdentifiers['ElectronDSPEBTest'] = 3
42 DataScoutingInfo.TruncationThresholds[3] = 5*(1024**2) # 5 MB
43 
44 # Override the setupMenu function from Dev_pp_run3_v1
45 def myMenu(menu_name):
46  log.debug('Executing myMenu')
47 
48  from TriggerMenuMT.HLT.Menu.SignatureDicts import ChainStore
49  chains = ChainStore()
50  chains['Egamma'] = [
51  # DS+PEB chain (special HLT result and subset of detector data saved)
52  ChainProp(name='HLT_e3_etcut_ElectronDSPEBTest_L1EM3', stream=['ElectronDSPEBTest'], groups=['RATE:Test','BW:Other']),
53 
54  # Pure DS chain (only special HLT result saved and no detector data saved)
55  ChainProp(name='HLT_e5_etcut_ElectronDSTest_L1EM3', stream=['ElectronDSTest'], groups=['RATE:Test','BW:Other']),
56 
57  # PEB chain (full HLT result and fixed subset of detector data saved)
58  ChainProp(name='HLT_e7_etcut_TestPEBOne_L1EM3', stream=['TestPEBOne'], groups=['RATE:Test','BW:Other']),
59 
60  # PEB chain (full HLT result and RoI-based subset of detector data saved)
61  ChainProp(name='HLT_e10_etcut_TestPEBThree_L1EM3', stream=['TestPEBThree'], groups=['RATE:Test','BW:Other']),
62 
63  # Standard chain (full HLT result and full detector data saved)
64  ChainProp(name='HLT_e12_etcut_L1EM3', stream=['Main'], groups=['RATE:SingleElectron', 'BW:Electron']),
65  ]
66 
67  chains['Muon'] = [
68  # PEB chain (fixed subset of detector data saved and no HLT result)
69  ChainProp(name='HLT_mu6_TestPEBTwo_L1MU5VF', stream=['TestPEBTwo'], groups=['RATE:Test','BW:Other']),
70 
71  # PEB chain (RoI-based subset of detector data saved and no HLT result)
72  ChainProp(name='HLT_mu6_TestPEBFour_L1MU5VF', stream=['TestPEBFour'], groups=['RATE:Test','BW:Other']),
73 
74  # Standard chain (full HLT result and full detector data saved)
75  ChainProp(name='HLT_2mu6_L12MU5VF', stream=['Main'], groups=['RATE:SingleMuon', 'BW:Muon']),
76  ]
77  return chains
78 
79 Dev_pp_run3_v1.setupMenu = myMenu
80 
81 # Override the pebInfoWriterTool function from EventBuildingSequences
82 def myPebInfoWriterToolCfg(flags, name, eventBuildType):
83  log.debug('Executing myPebInfoWriterToolCfg')
84 
85  # Main CTP and HLT ROB:
86  HLT_ROB = SourceIdentifier(SubDetector.TDAQ_HLT, DataScoutingInfo.getFullHLTResultID())
87 
88  acc = None
89  if 'TestPEBOne' == eventBuildType:
90  # TestPEBOne is an example which saves a few detector ROBs
91  # and the full HLT result (typically saved in physics streams)
93  flags, name,
94  ROBs = [0x42002e, 0x420060, 0x420064, # a few example LAr ROBs
95  HLT_ROB] )
96 
97  elif 'TestPEBTwo' == eventBuildType:
98  # TestPEBTwo is an example which saves some detector data,
99  # but no HLT result (not needed in detector calibration streams)
101  flags, name,
102  subDets = [SubDetector.MUON_RPC_BARREL_A_SIDE,
103  SubDetector.MUON_RPC_BARREL_C_SIDE] ) # example: RPC side A and C
104 
105  elif 'TestPEBThree' == eventBuildType:
106  # TestPEBThree is an example using RoIPEBInfoWriterTool which writes
107  # all ROBs within a given RoI, and also the main (full) HLT result
109  flags, name,
110  EtaEdge = 5.0,
111  EtaWidth = 0.1,
112  PhiWidth = 0.1,
113  MaxRoIs = 3,
114  regSelDets = ['All'],
115  ROBs = [HLT_ROB] )
116 
117  elif 'TestPEBFour' == eventBuildType:
118  # TestPEBFour is similar to TestPEBThree, but saves only muon detector
119  # ROBs within a larger RoI and no HLT result
121  flags, name,
122  EtaWidth = 0.5,
123  PhiWidth = 0.5,
124  regSelDets = ['MDT', 'CSC', 'RPC', 'TGC', 'MM', 'sTGC']) # all muon detectors
125 
126  elif 'ElectronDSTest' == eventBuildType:
127  # ElectronDSTest is an example of pure Data Scouting,
128  # where only the special HLT result is saved and nothing else
130  flags, name,
131  ROBs = [SourceIdentifier(SubDetector.TDAQ_HLT,
132  DataScoutingInfo.getDataScoutingResultID(eventBuildType))])
133 
134  elif 'ElectronDSPEBTest' == eventBuildType:
135  # ElectronDSPEBTest is an example of Data Scouting with PEB,
136  # where a special HLT result and some detector data are saved
137  # (ID + LAr data within an RoI)
139  flags, name,
140  ROBs = [SourceIdentifier(SubDetector.TDAQ_HLT,
141  DataScoutingInfo.getDataScoutingResultID(eventBuildType))],
142  EtaWidth = 0.3,
143  PhiWidth = 0.3,
144  regSelDets = ['Pixel', 'SCT', 'TRT', 'TTEM', 'TTHEC', 'FCALEM', 'FCALHAD'])
145 
146  # Name not matched
147  if acc is None:
148  log.error('PEBInfoWriterTool configuration is missing for event building identifier \'%s\'', eventBuildType)
149 
150  return acc
151 
152 EventBuildingSequences.pebInfoWriterToolCfg = myPebInfoWriterToolCfg
153 
154 # Define streams and override StreamInfo
155 myAllStreams = [
156  # [name, type, obeysLumiBlock, forceFullEventBuilding]
157  StreamInfo.StreamInfo('Main', 'physics', True, True),
158  StreamInfo.StreamInfo('TestPEBOne', 'physics', True, False),
159  StreamInfo.StreamInfo('TestPEBTwo', 'calibration', True, False),
160  StreamInfo.StreamInfo('TestPEBThree', 'physics', True, False),
161  StreamInfo.StreamInfo('TestPEBFour', 'calibration', True, False),
162  StreamInfo.StreamInfo('ElectronDSTest', 'physics', True, False),
163  StreamInfo.StreamInfo('ElectronDSPEBTest', 'physics', True, False),
164 ]
165 
166 StreamInfo._all_streams = myAllStreams
167 
168 
169 
170 
171 def run(flags):
172  from TriggerJobOpts import runHLT
173  # Set and customize default flags
174  runHLT.set_flags(flags)
175  flags.Trigger.triggerMenuSetup = 'Dev_pp_run3_v1'
176  flags.Trigger.enabledSignatures = ['Egamma','Muon']
177  flags.Trigger.doLVL1 = True
178  flags.lock()
179  acc = runHLT.runHLTCfg(flags)
180  return acc
TrigPartialEventBuildingConfig.RoIPEBInfoWriterToolCfg
def RoIPEBInfoWriterToolCfg(flags, name='RoIPEBInfoWriterTool', list[str] regSelDets=[], list[SourceIdentifier] ROBs=[], list[SubDetector] subDets=[], **kwargs)
Definition: TrigPartialEventBuildingConfig.py:61
python.PEBDSTest.myPebInfoWriterToolCfg
def myPebInfoWriterToolCfg(flags, name, eventBuildType)
Definition: PEBDSTest.py:82
python.PEBDSTest.run
def run(flags)
Definition: PEBDSTest.py:171
python.PEBDSTest.myMenu
def myMenu(menu_name)
Definition: PEBDSTest.py:45
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
TrigPartialEventBuildingConfig.StaticPEBInfoWriterToolCfg
def StaticPEBInfoWriterToolCfg(flags, name='StaticPEBInfoWriterTool', list[SourceIdentifier] ROBs=[], list[SubDetector] subDets=[], **kwargs)
Definition: TrigPartialEventBuildingConfig.py:83