ATLAS Offline Software
Loading...
Searching...
No Matches
trigbs_dumpHLTContentInBS Namespace Reference

Functions

 Lvl1_Info (event)
 CTP_Info (event, module_id=1)
 getL1Menu (smk)
 printL1Items (items, smk)
 my_dump (bsfile)

Variables

str __doc__
 parser = argparse.ArgumentParser(description = __doc__)
 metavar
 nargs
 help
 action
 type
 default
 int
 False
 const
 args = parser.parse_args()
 res = hltResult()
dict featureSizes = {}
dict stats = {}
 smk = None

Function Documentation

◆ CTP_Info()

trigbs_dumpHLTContentInBS.CTP_Info ( event,
module_id = 1 )

Definition at line 100 of file trigbs_dumpHLTContentInBS.py.

100def CTP_Info(event, module_id=1):
101 ctp_robs = [rob for rob in event.children() \
102 if rob.source_id().subdetector_id() == eformat.helper.SubDetector.TDAQ_CTP \
103 and rob.source_id().module_id()==module_id]
104
105 if len(ctp_robs)==0:
106 print("No CTP ROB found")
107
108 for rob in ctp_robs:
109 x = CTPfragment.getExtraPayloadObject(rob)
110 folderUpdates = CTPfragment.getFolderUpdates(x)
111 upd = ''.join(['[%d,%d]' % (f.second.folderIndex,f.second.lumiBlock) for f in folderUpdates])
112 print("ROB 0x%0x, L1ID %10d, LB %4d, Version %d, Bunch %d, HLT counter: %3d, Payload #%d %s L1PSK %d BGK %d COOLUPD %s" % (
113 rob.source_id().code(),
114 event.lvl1_id(),
115 event.lumi_block(),
116 CTPfragment.ctpFormatVersion(rob),
117 CTPfragment.lvl1AcceptBunch(rob),
118 CTPfragment.hltCounter(rob),
119 CTPfragment.numberHltExtraPayloadWords(rob),
120 CTPfragment.hltExtraPayloadWords(rob),
121 x.getL1PSK(),
122 x.getBGK(),
123 upd
124 ))
125 for w in ['TBP','TAP','TAV']:
126 items = CTPfragment.decodeTriggerBits(CTPfragment.getTriggerWords(rob,w))
127 print("ROB 0x%0x, %s: %s" % (rob.source_id().code(), w, printL1Items(items,smk)))
128
129
130@cache
void print(char *figname, TCanvas *c1)
std::map< const FolderIndex, FolderEntry > getFolderUpdates(const CTPfragment::ExtraPayload &x)

◆ getL1Menu()

trigbs_dumpHLTContentInBS.getL1Menu ( smk)

Definition at line 131 of file trigbs_dumpHLTContentInBS.py.

131def getL1Menu(smk):
132 from CoolRunQuery.utils.AtlRunQueryTriggerUtils import getL1Menu
133 return getL1Menu(str(smk))
134

◆ Lvl1_Info()

trigbs_dumpHLTContentInBS.Lvl1_Info ( event)

Definition at line 94 of file trigbs_dumpHLTContentInBS.py.

94def Lvl1_Info(event):
95 info = event.lvl1_trigger_info()
96 nwords = len(info)/3 # TBP,TAP,TAV
97 return [CTPfragment.decodeTriggerBits(info[i*nwords:(i+1)*nwords]) for i in range(3)]
98
99

◆ my_dump()

trigbs_dumpHLTContentInBS.my_dump ( bsfile)
Runs the dumping routines

Definition at line 144 of file trigbs_dumpHLTContentInBS.py.

144def my_dump(bsfile):
145 """Runs the dumping routines"""
146
147 global smk
148
149 # open a file
150 print("="*100)
151 print("Opening", bsfile)
152
153 input = eformat.istream(bsfile)
154
155 if args.interactive:
156 import code
157 code.interact(local=locals())
158
159 event_count = 0
160 l2_event_count = 0
161 ef_event_count = 0
162 offset = args.skip if args.skip else 0
163 for event in input:
164 if offset>0:
165 offset -= 1
166 continue
167
168 event_count += 1
169
170 if args.events is not None and event_count>args.events:
171 break
172
173 print("======================= RunNumber : %d , Event: %d, LB: %d, LVL1_ID: %d, Global_ID: %d bunch-x: %d TT: x%x =========================="
174 % ( event.run_no(), event_count, event.lumi_block(), event.lvl1_id(), event.global_id(), event.bc_id(), event.lvl1_trigger_type()))
175
176 smk = args.smk
177 if args.decodeItems and args.smk==0: # Need to get SMK from HLT result
178 hltrob = [f for f in event.children() if f.source_id().subdetector_id() in [eformat.helper.SubDetector.TDAQ_LVL2,eformat.helper.SubDetector.TDAQ_EVENT_FILTER] ]
179 if len(hltrob)==0:
180 print("ERROR: Cannot find HLT result. Will not decode trigger item names.")
181 args.decodeItems = False
182 else:
183 res.load(hltrob[0])
184 smk = res.getConfigSuperMasterKey()
185 if smk==0:
186 print("ERROR: No SMK stored in HLT result. Will not decode trigger item names.")
187 args.decodeItems = False
188
189 if args.l1:
190 #print "L1 TriggerInfo: ", ["0x%x"%i for i in event.lvl1_trigger_info() ]
191 words = Lvl1_Info(event)
192 print("L1 CTP IDs - TBP: ", printL1Items(words[0],smk))
193 print("L1 CTP IDs - TAP: ", printL1Items(words[1],smk))
194 print("L1 CTP IDs - TAV: ", printL1Items(words[2],smk))
195
196 if args.ctp:
197 CTP_Info(event,int(args.ctp))
198
199 if args.l2:
200 print("L2 TriggerInfo: ", ["0x%x"%i for i in event.lvl2_trigger_info() ])
201
202 # loop over the SubDetFragments and find LVL2
203 if args.l2res or args.sizeSummary:
204 found=False
205 for f in event.children():
206 if f.source_id().subdetector_id() == eformat.helper.SubDetector.TDAQ_LVL2:
207 print('.. %s %s %s bytes' % (f.__class__.__name__, f.source_id(), f.fragment_size_word()*4))
208 res.load(f)
209 found=True
210 l2_event_count += 1
211
212 if args.l2res:
213 print_HLTResult(res, args)
214 if args.sizeSummary:
215 collect_feature_sizes(featureSizes, res)
216 print(".. EOF HLTResult for L2")
217 if not found:
218 print(".. No HLTResult for L2")
219
220
221 if args.ef:
222 print("EF TriggerInfo: ", ["0x%x"%i for i in event.event_filter_info()])
223
224
225 # loop over the SubDetFragments and find EF
226 if args.efres or args.sizeSummary:
227 found=False
228 for f in event.children():
229 if f.source_id().subdetector_id() == eformat.helper.SubDetector.TDAQ_EVENT_FILTER:
230 print('.. %s %s %s bytes' % (f.__class__.__name__, f.source_id(), f.fragment_size_word()*4))
231 try:
232 res.load(f)
233 found = True
234 ef_event_count += 1
235
236 if args.efres:
237 print_HLTResult(res, args)
238 if args.sizeSummary:
239 collect_feature_sizes(featureSizes, res)
240 except Exception as ex:
241 print('... **** problems in analyzing payload', ex)
242 print('... **** raw data[:10]', list(f.rod_data())[:10])
243 print(".. EOF HLTResult for EF")
244 if not found:
245 print(".. No HLTResult for EF")
246
247 if args.stag:
248 print("StreamTag: ", [(s.name, s.type) for s in event.stream_tag()])
249
250 event_count = max(l2_event_count, ef_event_count)
251 if args.sizeSummary:
252 print('... '+20*'-'+'sizes by type')
253 for f,s in sorted(featureSizes.items(),key=operator.itemgetter(1),reverse=True):
254 if '#' not in f:
255 print(".... %-70s %6d B %6d B/ev" %(f, s, (1.*s)/event_count))
256 print('... '+20*'-'+'sizes by type#key')
257 for f,s in sorted(featureSizes.items(),key=operator.itemgetter(1),reverse=True):
258 if '#' in f:
259 print(".... %-70s %6d B %6d B/ev" %(f, s, (1.*s)/event_count))
260
261
#define max(a, b)
Definition cfImp.cxx:41

◆ printL1Items()

trigbs_dumpHLTContentInBS.printL1Items ( items,
smk )

Definition at line 135 of file trigbs_dumpHLTContentInBS.py.

135def printL1Items(items,smk):
136 if not args.decodeItems:
137 return items
138
139 l1menu = getL1Menu(smk)
140 names = [l1menu[i].name for i in items]
141 return names
142
143

Variable Documentation

◆ __doc__

str trigbs_dumpHLTContentInBS.__doc__
private
Initial value:
1= """\
2Dump content of the HLT result and HLT related details from the event header.
3"""

Definition at line 10 of file trigbs_dumpHLTContentInBS.py.

◆ action

trigbs_dumpHLTContentInBS.action

Definition at line 20 of file trigbs_dumpHLTContentInBS.py.

◆ args

trigbs_dumpHLTContentInBS.args = parser.parse_args()

Definition at line 79 of file trigbs_dumpHLTContentInBS.py.

◆ const

trigbs_dumpHLTContentInBS.const

Definition at line 41 of file trigbs_dumpHLTContentInBS.py.

◆ default

trigbs_dumpHLTContentInBS.default

Definition at line 26 of file trigbs_dumpHLTContentInBS.py.

◆ False

trigbs_dumpHLTContentInBS.False

Definition at line 41 of file trigbs_dumpHLTContentInBS.py.

◆ featureSizes

dict trigbs_dumpHLTContentInBS.featureSizes = {}

Definition at line 90 of file trigbs_dumpHLTContentInBS.py.

◆ help

trigbs_dumpHLTContentInBS.help

Definition at line 18 of file trigbs_dumpHLTContentInBS.py.

◆ int

trigbs_dumpHLTContentInBS.int

Definition at line 32 of file trigbs_dumpHLTContentInBS.py.

◆ metavar

trigbs_dumpHLTContentInBS.metavar

Definition at line 17 of file trigbs_dumpHLTContentInBS.py.

◆ nargs

trigbs_dumpHLTContentInBS.nargs

Definition at line 17 of file trigbs_dumpHLTContentInBS.py.

◆ parser

trigbs_dumpHLTContentInBS.parser = argparse.ArgumentParser(description = __doc__)

Definition at line 15 of file trigbs_dumpHLTContentInBS.py.

◆ res

trigbs_dumpHLTContentInBS.res = hltResult()

Definition at line 84 of file trigbs_dumpHLTContentInBS.py.

◆ smk

trigbs_dumpHLTContentInBS.smk = None

Definition at line 92 of file trigbs_dumpHLTContentInBS.py.

◆ stats

dict trigbs_dumpHLTContentInBS.stats = {}

Definition at line 91 of file trigbs_dumpHLTContentInBS.py.

◆ type

trigbs_dumpHLTContentInBS.type

Definition at line 20 of file trigbs_dumpHLTContentInBS.py.