ATLAS Offline Software
Functions | Variables
trigbs_dumpHLTContentInBS Namespace Reference

Functions

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

Variables

 __doc__
 
 parser
 
 description
 
 metavar
 
 nargs
 
 help
 
 action
 
 type
 
 default
 
 int
 
 False
 
 const
 
 args
 
 res
 
 featureSizes
 
 stats
 
 smk
 

Function Documentation

◆ CTP_Info()

def trigbs_dumpHLTContentInBS.CTP_Info (   event,
  module_id = 1 
)

Definition at line 100 of file trigbs_dumpHLTContentInBS.py.

100 def 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

◆ getL1Menu()

def trigbs_dumpHLTContentInBS.getL1Menu (   smk)

Definition at line 131 of file trigbs_dumpHLTContentInBS.py.

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

◆ Lvl1_Info()

def trigbs_dumpHLTContentInBS.Lvl1_Info (   event)

Definition at line 94 of file trigbs_dumpHLTContentInBS.py.

94 def 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()

def trigbs_dumpHLTContentInBS.my_dump (   bsfile)
Runs the dumping routines

Definition at line 144 of file trigbs_dumpHLTContentInBS.py.

144 def 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 

◆ printL1Items()

def trigbs_dumpHLTContentInBS.printL1Items (   items,
  smk 
)

Definition at line 135 of file trigbs_dumpHLTContentInBS.py.

135 def 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__

trigbs_dumpHLTContentInBS.__doc__
private

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

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.

◆ description

trigbs_dumpHLTContentInBS.description

Definition at line 15 of file trigbs_dumpHLTContentInBS.py.

◆ False

trigbs_dumpHLTContentInBS.False

Definition at line 41 of file trigbs_dumpHLTContentInBS.py.

◆ featureSizes

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

Definition at line 15 of file trigbs_dumpHLTContentInBS.py.

◆ res

trigbs_dumpHLTContentInBS.res

Definition at line 84 of file trigbs_dumpHLTContentInBS.py.

◆ smk

trigbs_dumpHLTContentInBS.smk

Definition at line 92 of file trigbs_dumpHLTContentInBS.py.

◆ stats

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.

trigbs_dumpHLTContentInBS.int
int
Definition: trigbs_dumpHLTContentInBS.py:32
trigbs_dumpHLTContentInBS.Lvl1_Info
def Lvl1_Info(event)
Definition: trigbs_dumpHLTContentInBS.py:94
max
#define max(a, b)
Definition: cfImp.cxx:41
trigbs_dumpHLTContentInBS.CTP_Info
def CTP_Info(event, module_id=1)
Definition: trigbs_dumpHLTContentInBS.py:100
trigbs_dumpHLTContentInBS.printL1Items
def printL1Items(items, smk)
Definition: trigbs_dumpHLTContentInBS.py:135
histSizes.code
code
Definition: histSizes.py:129
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
DerivationFramework::TriggerMatchingUtils::sorted
std::vector< typename T::value_type > sorted(T begin, T end)
Helper function to create a sorted vector from an unsorted one.
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
trigbs_dumpHLTContentInBS.my_dump
def my_dump(bsfile)
Definition: trigbs_dumpHLTContentInBS.py:144
CTPfragment::getFolderUpdates
std::map< const FolderIndex, FolderEntry > getFolderUpdates(const CTPfragment::ExtraPayload &x)
Definition: TrigByteStreamToolsDict.h:26
python.hltResult.collect_feature_sizes
def collect_feature_sizes(dest, result)
collect the sizes
Definition: hltResult.py:173
python.hltResult.print_HLTResult
def print_HLTResult(result, opt)
Definition: hltResult.py:113
trigbs_dumpHLTContentInBS.getL1Menu
def getL1Menu(smk)
Definition: trigbs_dumpHLTContentInBS.py:131
str
Definition: BTagTrackIpAccessor.cxx:11
dbg::print
void print(std::FILE *stream, std::format_string< Args... > fmt, Args &&... args)
Definition: SGImplSvc.cxx:70