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