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
11 from TrigEDMConfig.TriggerEDM import AllowedOutputFormats
12 from TriggerMenuMT.HLT.Menu import Dev_pp_run3_v1, EventBuildingInfo, StreamInfo
13 from TriggerMenuMT.HLT.Config.Utility.ChainDefInMenu import ChainProp
14 from TriggerMenuMT.HLT.CommonSequences import EventBuildingSequences
15 from TrigPartialEventBuilding.TrigPartialEventBuildingConfig import StaticPEBInfoWriterToolCfg, RoIPEBInfoWriterToolCfg
16 from libpyeformat_helper import SubDetector, SourceIdentifier
17 from AthenaCommon.Logging import logging
18 log = logging.getLogger('dataScoutingTest')
19 
20 # Add new allowed event building identifiers : isRoIBasedPEB
21 EventBuildingInfo._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
28 DataScoutingInfo._DataScoutingIdentifiers['ElectronDSTest'] = 3
29 DataScoutingInfo._DataScoutingIdentifiers['ElectronDSPEBTest'] = 3
30 DataScoutingInfo.TruncationThresholds[3] = 5*(1024**2) # 5 MB
31 
32 # Hack/update AllowedOutputFormats for this test
33 AllowedOutputFormats.extend(DataScoutingInfo.getAllDataScoutingIdentifiers())
34 
35 # Override the setupMenu function from Dev_pp_run3_v1
36 def 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_L1EM3', 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_L1EM3', 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_L1EM3', 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_L1EM3', 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_L1EM3', 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 
70 Dev_pp_run3_v1.setupMenu = myMenu
71 
72 # Override the pebInfoWriterTool function from EventBuildingSequences
73 def 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)
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)
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
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
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
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)
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 
143 EventBuildingSequences.pebInfoWriterToolCfg = myPebInfoWriterToolCfg
144 
145 # Define streams and override StreamInfo
146 myAllStreams = [
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 
157 StreamInfo._all_streams = myAllStreams
158 
159 def 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)
185  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:73
python.PEBDSTest.run
def run(flags)
Definition: PEBDSTest.py:159
TrigPartialEventBuildingConfig.StaticPEBInfoWriterToolCfg
def StaticPEBInfoWriterToolCfg(flags, name='StaticPEBInfoWriterTool', list[SourceIdentifier] ROBs=[], list[SubDetector] subDets=[], **kwargs)
Definition: TrigPartialEventBuildingConfig.py:85
python.PEBDSTest.myMenu
def myMenu()
Definition: PEBDSTest.py:36