ATLAS Offline Software
Functions | Variables
python.TriggerEDM Namespace Reference

Functions

def recordable (arg, runVersion=3)
 
def getTriggerEDMList (key, runVersion, extraEDMList=[])
 
def getRun3TrigObjProducedInView (theKey, trigEDMList)
 
def handleRun3ViewContainers (el)
 
def getRun3BSList (keys)
 
def getRun3TrigObjList (destination, trigEDMList)
 
def getRun3TrigEDMSlimList (key)
 
def getTriggerEDMSlimList (key)
 
def getCategory (s)
 
def getTypeAndKey (s)
 
def keyToLabel (key)
 
def getTriggerObjList (destination, lst)
 
def getTrigIDTruthList (dst)
 
def getLvl1ESDList ()
 
def getLvl1AODList ()
 
def getL2PreregistrationList ()
 
def getEFPreregistrationList ()
 
def getHLTPreregistrationList ()
 
def getPreregistrationList (version=2, doxAODConversion=True)
 
def getEFDSList ()
 
def getHLTDSList ()
 
def getL2BSList ()
 
def getEFBSList ()
 
def getHLTBSList ()
 
def getL2BSTypeList ()
 
def getEFBSTypeList ()
 
def getHLTBSTypeList ()
 
def getEFDSTypeList ()
 
def getHLTDSTypeList ()
 
def getTPList (version=2)
 
def getARATypesRenaming ()
 
def getEDMLibraries ()
 
def InsertContainerNameForHLT (typedict)
 
def getEFRun1BSList ()
 
def getEFRun2EquivalentList ()
 
def getL2Run1BSList ()
 
def getL2Run2EquivalentList ()
 

Variables

 log
 
 AllowedOutputFormats
 
 _allowedEDMPrefixes
 

Function Documentation

◆ getARATypesRenaming()

def python.TriggerEDM.getARATypesRenaming ( )
Defines how to rename collecion keys in ARA when two types have the same key.
i.e. TrigRoiDescriptorCollection#HLT
and TrigTau#HLT
After the remapping they will be named HLT_tau and HLT_roi so are distinct.

Definition at line 641 of file TriggerEDM.py.

641 def getARATypesRenaming():
642  """
643  Defines how to rename collecion keys in ARA when two types have the same key.
644  i.e. TrigRoiDescriptorCollection#HLT
645  and TrigTau#HLT
646  After the remapping they will be named HLT_tau and HLT_roi so are distinct.
647  """
648  edm = set(TriggerL2List + TriggerEFList + TriggerHLTList)
649  keys = [ getTypeAndKey(i[0])[1] for i in edm]
650  # find repeating keys
651  tmp = [ i for i in keys if keys.count(i) > 1 ]
652  nonunique = {}
653  for i in tmp:
654  nonunique[i] = 1
655  # nonunique = nonunique.keys()
656 
657  # define remens for all object of which key appeared in nonunique
658  renames = {}
659  for entry in edm:
660  t, key = getTypeAndKey(entry[0])
661  if key in nonunique: # potential problem we have to do something
662 
663  if 'typealias' not in EDMDetails[t] or EDMDetails[t]['typealias'] == '':
664  if nonunique[key] == 1:
665  # First time's ok.
666  nonunique[key] = t
667  elif nonunique[key] == t:
668  # Duplicate entry; ok.
669  continue
670  else:
671  log.error("types/keys will catch %s %s", t, key)
672  continue
673  else:
674  obj = t
675  if 'collection' in EDMDetails[t]:
676  obj = EDMDetails[t]['collection']
677 
678  # form the branch name
679  bname = key+'_'+EDMDetails[t]['typealias']
680 
681  renames[(key, obj)] = bname
682 
683  return renames
684 

◆ getCategory()

def python.TriggerEDM.getCategory (   s)
From name of object in AOD/ESD found by checkFileTrigSize.py, return category 
Clean up object name 

Definition at line 297 of file TriggerEDM.py.

297 def getCategory(s):
298  """ From name of object in AOD/ESD found by checkFileTrigSize.py, return category """
299 
300  """ Clean up object name """
301  s = s.strip()
302 
303  # To-do
304  # seperate the first part of the string at the first '_'
305  # search in EDMDetails for the key corresponding to the persistent value
306  # if a key is found, use this as the first part of the original string
307  # put the string back together
308 
309  if s.count('.') : s = s[:s.index('.')]
310  if s.count('::'): s = s[s.index(':')+2:]
311  if s.count('<'): s = s[s.index('<')+1:]
312  if s.count('>'): s = s[:s.index('>')]
313  if s.count('.') : s = s[:s.index('.')]
314  if s.count('Dyn') : s = s[:s.index('Dyn')]
315 
316  # containers from Run 1-2 and 3 require different preprocessing
317  # s12 is for Run 1-2, s is for Run 3
318  s12 = s
319 
320  if s12.startswith('HLT_xAOD__') or s12.startswith('HLT_Rec__') or s12.startswith('HLT_Analysis__') :
321  s12 = s12[s12.index('__')+2:]
322  s12 = s12[s12.index('_')+1:]
323  #if s12.count('.') : s12 = s12[:s12.index('.')]
324  s12 = "HLT_"+s12
325  elif s12.startswith('HLT_'):
326  #if s.count('Dyn') : s = s[:s.index('Dyn')]
327  if s12.count('_'): s12 = s12[s12.index('_')+1:]
328  if s12.count('_'): s12 = s12[s12.index('_')+1:]
329  s12 = "HLT_"+s12
330 
331  TriggerListRun1 = TriggerL2List + TriggerEFList + TriggerResultsRun1List
332  TriggerListRun2 = TriggerResultsList + TriggerLvl1List + TriggerIDTruth + TriggerHLTList
333  TriggerListRun3 = TriggerHLTListRun3
334 
335  category = ''
336  bestMatch = ''
337 
338  """ Loop over all objects already defined in lists (and hopefully categorized!!) """
339  for item in TriggerListRun1+TriggerListRun2:
340  t,k = getTypeAndKey(item[0])
341 
342  """ Clean up type name """
343  if t.count('::'): t = t[t.index(':')+2:]
344  if t.count('<'): t = t[t.index('<')+1:]
345  if t.count('>'): t = t[:t.index('>')]
346  if (s12.startswith(t) and s12.endswith(k)) and (len(t) > len(bestMatch)):
347  bestMatch = t
348  category = item[2]
349 
350  if k.count('.'): k = k[:k.index('.')]
351  if (s12 == k):
352  bestMatch = k
353  category = item[2]
354 
355  for item in TriggerListRun3:
356  t,k = getTypeAndKey(item[0])
357 
358  """ Clean up type name """
359  if t.count('::'): t = t[t.index(':')+2:]
360  if t.count('<'): t = t[t.index('<')+1:]
361  if t.count('>'): t = t[:t.index('>')]
362 
363  if (s.startswith(t) and s.endswith(k)) and (len(t) > len(bestMatch)):
364  bestMatch = t
365  category = item[2]
366 
367  if k.count('.'): k = k[:k.index('.')]
368  if (s == k):
369  bestMatch = k
370  category = item[2]
371 
372  if category == '' and 'HLTNav' in s:
373  category = 'HLTNav'
374 
375  if category == '': return 'NOTFOUND'
376  return category
377 
378 
379 

◆ getEDMLibraries()

def python.TriggerEDM.getEDMLibraries ( )

Definition at line 685 of file TriggerEDM.py.

685 def getEDMLibraries():
686  return EDMLibraries
687 

◆ getEFBSList()

def python.TriggerEDM.getEFBSList ( )
List (Literally Python list) of EF trigger objects to be placed in output BS

Definition at line 533 of file TriggerEDM.py.

533 def getEFBSList():
534  """
535  List (Literally Python list) of EF trigger objects to be placed in output BS
536  """
537  l = []
538  for item in TriggerEFList:
539  if 'BS' in item[1]:
540  t,k = getTypeAndKey(item[0])
541  l += [t+"#"+keyToLabel(k)]
542  return l
543 

◆ getEFBSTypeList()

def python.TriggerEDM.getEFBSTypeList ( )
List of EF types to be read from BS, used by the TP

Definition at line 567 of file TriggerEDM.py.

567 def getEFBSTypeList():
568  """ List of EF types to be read from BS, used by the TP
569  """
570  l = []
571  for item in TriggerEFList:
572  t,k = getTypeAndKey(item[0])
573  ctype = t
574  if 'collection' in EDMDetails[t]:
575  ctype = EDMDetails[t]['collection']
576  l += [ctype]
577  return l
578 

◆ getEFDSList()

def python.TriggerEDM.getEFDSList ( )
List (Literally Python list) of trigger objects to be placed in RAW data. i.e. BS after EF

Definition at line 500 of file TriggerEDM.py.

500 def getEFDSList():
501  """
502  List (Literally Python list) of trigger objects to be placed in RAW data. i.e. BS after EF
503  """
504  l = []
505  for item in TriggerEFList:
506  if 'DS' in item[1].split():
507  t,k = getTypeAndKey(item[0])
508  l += [t+"#"+keyToLabel(k)]
509  return l
510 

◆ getEFDSTypeList()

def python.TriggerEDM.getEFDSTypeList ( )
List of types to be placed in BS after EF

Definition at line 591 of file TriggerEDM.py.

591 def getEFDSTypeList():
592  """ List of types to be placed in BS after EF
593  """
594  l = []
595  for item in TriggerEFList:
596  if 'DS' in item[1].split():
597  t,k = getTypeAndKey(item[0])
598  ctype = t
599  if 'collection' in EDMDetails[t]:
600  ctype = EDMDetails[t]['collection']
601  l += [ctype]
602  return l
603 

◆ getEFPreregistrationList()

def python.TriggerEDM.getEFPreregistrationList ( )
List (Literally Python list) of trigger objects to be preregistered i.e. this objects we want in every event for EF

Definition at line 452 of file TriggerEDM.py.

453  """
454  List (Literally Python list) of trigger objects to be preregistered i.e. this objects we want in every event for EF
455  """
456  l = []
457  for item in TriggerEFList:
458  if len (item[1]) == 0: continue
459  t,k = getTypeAndKey(item[0])
460  if('Aux' in t):
461  continue #we don't wat to preregister Aux containers
462  l += [t+"#"+keyToLabel(k)]
463  return l
464 

◆ getEFRun1BSList()

def python.TriggerEDM.getEFRun1BSList ( )
List of EF trigger objects that were written to ByteStream in Run 1

Definition at line 705 of file TriggerEDM.py.

705 def getEFRun1BSList():
706  """
707  List of EF trigger objects that were written to ByteStream in Run 1
708  """
709  l = []
710  for item in TriggerEFEvolutionList:
711  if len (item[1]) == 0: continue
712  t,k = getTypeAndKey(item[0])
713  l += [t+"#"+keyToLabel(k)]
714  return l
715 

◆ getEFRun2EquivalentList()

def python.TriggerEDM.getEFRun2EquivalentList ( )
List of Run-2 containers equivalent to Run-1 EF containers

Definition at line 716 of file TriggerEDM.py.

717  """
718  List of Run-2 containers equivalent to Run-1 EF containers
719  """
720  l = []
721  for item in TriggerEFEvolutionList:
722  if len (item[1]) == 0: continue
723  t,k = getTypeAndKey(item[1])
724  l += [t+"#"+keyToLabel(k)]
725  return l
726 

◆ getHLTBSList()

def python.TriggerEDM.getHLTBSList ( )
List (Literally Python list) of merged HLT trigger objects to be placed in output BS

Definition at line 544 of file TriggerEDM.py.

544 def getHLTBSList():
545  """
546  List (Literally Python list) of merged HLT trigger objects to be placed in output BS
547  """
548  l = []
549  for item in TriggerHLTList:
550  if 'BS' in item[1]:
551  t,k = getTypeAndKey(item[0])
552  l += [t+"#"+keyToLabel(k)]
553  return l
554 

◆ getHLTBSTypeList()

def python.TriggerEDM.getHLTBSTypeList ( )
List of HLT types to be read from BS, used by the TP

Definition at line 579 of file TriggerEDM.py.

579 def getHLTBSTypeList():
580  """ List of HLT types to be read from BS, used by the TP
581  """
582  l = []
583  for item in TriggerHLTList:
584  t,k = getTypeAndKey(item[0])
585  ctype = t
586  if 'collection' in EDMDetails[t]:
587  ctype = EDMDetails[t]['collection']
588  l += [ctype]
589  return l
590 

◆ getHLTDSList()

def python.TriggerEDM.getHLTDSList ( )
List (Literally Python list) of trigger objects to be placed in RAW data. i.e. BS after merged L2EF

Definition at line 511 of file TriggerEDM.py.

511 def getHLTDSList():
512  """
513  List (Literally Python list) of trigger objects to be placed in RAW data. i.e. BS after merged L2EF
514  """
515  l = []
516  for item in TriggerHLTList:
517  if 'DS' in item[1].split():
518  t,k = getTypeAndKey(item[0])
519  l += [t+"#"+keyToLabel(k)]
520  return l
521 

◆ getHLTDSTypeList()

def python.TriggerEDM.getHLTDSTypeList ( )
List of types to be placed in BS after L2EF

Definition at line 604 of file TriggerEDM.py.

604 def getHLTDSTypeList():
605  """ List of types to be placed in BS after L2EF
606  """
607  l = []
608  for item in TriggerHLTList:
609  if 'DS' in item[1].split():
610  t,k = getTypeAndKey(item[0])
611  ctype = t
612  if 'collection' in EDMDetails[t]:
613  ctype = EDMDetails[t]['collection']
614  l += [ctype]
615  return l
616 
617 

◆ getHLTPreregistrationList()

def python.TriggerEDM.getHLTPreregistrationList ( )
List (Literally Python list) of trigger objects to be preregistered i.e. this objects we want in every event for merged L2/EF in addition to default L2 and EF

Definition at line 465 of file TriggerEDM.py.

466  """
467  List (Literally Python list) of trigger objects to be preregistered i.e. this objects we want in every event for merged L2/EF in addition to default L2 and EF
468  """
469  l = []
470  for item in TriggerHLTList:
471  if len (item[1]) == 0: continue
472  t,k = getTypeAndKey(item[0])
473  if('Aux' in t):
474  continue #we don't wat to preregister Aux containers
475  l += [t+"#"+keyToLabel(k)]
476  return l
477 
478 

◆ getL2BSList()

def python.TriggerEDM.getL2BSList ( )
List (Literally Python list) of L2 trigger objects to be placed in output BS

Definition at line 522 of file TriggerEDM.py.

522 def getL2BSList():
523  """
524  List (Literally Python list) of L2 trigger objects to be placed in output BS
525  """
526  l = []
527  for item in TriggerL2List:
528  if 'BS' in item[1]:
529  t,k = getTypeAndKey(item[0])
530  l += [t+"#"+keyToLabel(k)]
531  return l
532 

◆ getL2BSTypeList()

def python.TriggerEDM.getL2BSTypeList ( )
List of L2 types to be read from BS, used by the TP

Definition at line 555 of file TriggerEDM.py.

555 def getL2BSTypeList():
556  """ List of L2 types to be read from BS, used by the TP
557  """
558  l = []
559  for item in TriggerL2List:
560  t,k = getTypeAndKey(item[0])
561  ctype = t
562  if 'collection' in EDMDetails[t]:
563  ctype = EDMDetails[t]['collection']
564  l += [ctype]
565  return l
566 

◆ getL2PreregistrationList()

def python.TriggerEDM.getL2PreregistrationList ( )
List (Literally Python list) of trigger objects to be preregistered i.e. this objects we want in every event for L2

Definition at line 439 of file TriggerEDM.py.

440  """
441  List (Literally Python list) of trigger objects to be preregistered i.e. this objects we want in every event for L2
442  """
443  l = []
444  for item in TriggerL2List:
445  if len (item[1]) == 0: continue
446  t,k = getTypeAndKey(item[0])
447  if('Aux' in t):
448  continue #we don't wat to preregister Aux containers
449  l += [t+"#"+keyToLabel(k)]
450  return l
451 

◆ getL2Run1BSList()

def python.TriggerEDM.getL2Run1BSList ( )
List of L2 trigger objects that were written to ByteStream in Run 1

Definition at line 727 of file TriggerEDM.py.

727 def getL2Run1BSList():
728  """
729  List of L2 trigger objects that were written to ByteStream in Run 1
730  """
731  l = []
732  for item in TriggerL2EvolutionList:
733  if len (item[1]) == 0: continue
734  t,k = getTypeAndKey(item[0])
735  l += [t+"#"+keyToLabel(k)]
736  return l
737 

◆ getL2Run2EquivalentList()

def python.TriggerEDM.getL2Run2EquivalentList ( )
List of Run-2 containers equivalent to Run-1 L2 containers

Definition at line 738 of file TriggerEDM.py.

739  """
740  List of Run-2 containers equivalent to Run-1 L2 containers
741  """
742  l = []
743  for item in TriggerL2EvolutionList:
744  if len (item[1]) == 0: continue
745  t,k = getTypeAndKey(item[1])
746  l += [t+"#"+keyToLabel(k)]
747  return l

◆ getLvl1AODList()

def python.TriggerEDM.getLvl1AODList ( )
Gives back the Python dictionary  with the lvl1 trigger result content of AOD which can be inserted in OKS.

Definition at line 431 of file TriggerEDM.py.

431 def getLvl1AODList():
432  """
433  Gives back the Python dictionary with the lvl1 trigger result content of AOD which can be inserted in OKS.
434  """
435  return getTriggerObjList('AODFULL',[TriggerLvl1List])
436 
437 
438 

◆ getLvl1ESDList()

def python.TriggerEDM.getLvl1ESDList ( )
Gives back the Python dictionary  with the lvl1 trigger result content of ESD which can be inserted in OKS.

Definition at line 425 of file TriggerEDM.py.

425 def getLvl1ESDList():
426  """
427  Gives back the Python dictionary with the lvl1 trigger result content of ESD which can be inserted in OKS.
428  """
429  return getTriggerObjList('ESD',[TriggerLvl1List])
430 

◆ getPreregistrationList()

def python.TriggerEDM.getPreregistrationList (   version = 2,
  doxAODConversion = True 
)
List (Literally Python list) of trigger objects to be preregistered i.e. this objects we want for all levels
version can be: '1 (Run1)', '2 (Run2)'

Definition at line 479 of file TriggerEDM.py.

479 def getPreregistrationList(version=2, doxAODConversion=True):
480  """
481  List (Literally Python list) of trigger objects to be preregistered i.e. this objects we want for all levels
482  version can be: '1 (Run1)', '2 (Run2)'
483  """
484 
485  l=[]
486  if version==2:
488  elif version==1:
489  # remove duplicates while preserving order
491  if doxAODConversion:
492  objs += getHLTPreregistrationList()
493  l=list(dict.fromkeys(objs))
494  else:
495  raise RuntimeError("Invalid version=%s supplied to getPreregistrationList" % version)
496  return l
497 
498 
499 

◆ getRun3BSList()

def python.TriggerEDM.getRun3BSList (   keys)
The keys should contain BS and all the identifiers used for scouting.
Returns list of tuples (typename#key, [keys], [properties]).

Definition at line 206 of file TriggerEDM.py.

206 def getRun3BSList(keys):
207  """
208  The keys should contain BS and all the identifiers used for scouting.
209  Returns list of tuples (typename#key, [keys], [properties]).
210  """
211 
212  from TrigEDMConfig.TriggerEDMRun3 import persistent
213  keys = set(keys[:])
214  collections = []
215  for definition in TriggerHLTListRun3:
216 
217  typename,collkey = definition[0].split("#")
218  # normalise collection name and the key (decorations)
219  typename = persistent(typename)
220  collkey = handleRun3ViewContainers( collkey )
221  destination = keys & set(definition[1].split())
222  if len(destination) > 0:
223  collections.append( (typename+"#"+collkey, list(destination),
224  definition[3] if len(definition)>3 else []) )
225 
226  return collections
227 
228 

◆ getRun3TrigEDMSlimList()

def python.TriggerEDM.getRun3TrigEDMSlimList (   key)
Run 3 version
Modified EDM list to remove all dynamic variables
Requires changing the list to have 'Aux.-'

Definition at line 258 of file TriggerEDM.py.

258 def getRun3TrigEDMSlimList(key):
259  """
260  Run 3 version
261  Modified EDM list to remove all dynamic variables
262  Requires changing the list to have 'Aux.-'
263  """
264  _edmList = getRun3TrigObjList(key,[TriggerHLTListRun3])
265  from collections import OrderedDict
266  output = OrderedDict()
267  for k,v in _edmList.items():
268  newnames = []
269  for el in v:
270  newnames.append( handleRun3ViewContainers( el ) )
271  output[k] = newnames
272  return output
273 
274 #************************************************************
275 #
276 # For Run 1 and Run 2 (not modified (so far))
277 #
278 #************************************************************

◆ getRun3TrigObjList()

def python.TriggerEDM.getRun3TrigObjList (   destination,
  trigEDMList 
)
Run 3 version
Gives back the Python dictionary  with the content of ESD/AOD (dst) which can be inserted in OKS.

Definition at line 229 of file TriggerEDM.py.

229 def getRun3TrigObjList(destination, trigEDMList):
230  """
231  Run 3 version
232  Gives back the Python dictionary with the content of ESD/AOD (dst) which can be inserted in OKS.
233  """
234  dset = set(destination.split())
235  from collections import OrderedDict
236  toadd = OrderedDict()
237  import itertools
238 
239  for item in itertools.chain(*trigEDMList):
240  if item[1] == '': # no output has been defined
241  continue
242 
243  confset = set(item[1].split())
244 
245  if dset & confset: # intersection of the sets
246  t,k = getTypeAndKey(item[0])
247  colltype = t
248 
249  if colltype in toadd:
250  if k not in toadd[colltype]:
251  toadd[colltype] += [k]
252  else:
253  toadd[colltype] = [k]
254 
255  return toadd
256 
257 

◆ getRun3TrigObjProducedInView()

def python.TriggerEDM.getRun3TrigObjProducedInView (   theKey,
  trigEDMList 
)
Run 3 only
Finds a given key from within the trigEDMList.
Returns true if this collection is produced inside EventViews
(Hence, has the special viewIndex Aux decoration applied by steering)

Definition at line 165 of file TriggerEDM.py.

165 def getRun3TrigObjProducedInView(theKey, trigEDMList):
166  """
167  Run 3 only
168  Finds a given key from within the trigEDMList.
169  Returns true if this collection is produced inside EventViews
170  (Hence, has the special viewIndex Aux decoration applied by steering)
171  """
172  from TrigEDMConfig.TriggerEDMRun3 import InViews
173  import itertools
174 
175  return any(coll for coll in itertools.chain(*trigEDMList) if
176  len(coll)>3 and theKey==coll[0].split('#')[1] and
177  any(isinstance(v, InViews) for v in coll[3]))
178 
179 

◆ getTPList()

def python.TriggerEDM.getTPList (   version = 2)
Mapping  of Transient objects to Peristent during serialization (BS creation)
version can be: '1 (Run1)', '2 (Run2)'

Definition at line 618 of file TriggerEDM.py.

618 def getTPList(version=2):
619  """
620  Mapping of Transient objects to Peristent during serialization (BS creation)
621  version can be: '1 (Run1)', '2 (Run2)'
622  """
623  l = {}
624  if version==2:
625  bslist = getHLTBSTypeList()
626  elif version==1:
627  bslist = list(set(getL2BSTypeList() + getEFBSTypeList()))
628  else:
629  raise RuntimeError("Invalid version=%s supplied to getTPList" % version)
630 
631  for t,d in EDMDetails.items():
632  colltype = t
633  if 'collection' in d:
634  colltype = EDMDetails[t]['collection']
635  if colltype in bslist:
636  l[colltype] = d['persistent']
637  return l
638 
639 
640 #FPP: how to change this for the merged HLT in view of splitting?

◆ getTriggerEDMList()

def python.TriggerEDM.getTriggerEDMList (   key,
  runVersion,
  extraEDMList = [] 
)
List (Literally Python dict) of trigger objects to be placed with flags:
key can be" 'ESD', 'AODSLIM', 'AODFULL'
run can be: '1 (Run1)', '2 (Run2)', '3' (Run 3), '4' (Run 4)

Definition at line 67 of file TriggerEDM.py.

67 def getTriggerEDMList(key, runVersion, extraEDMList=[]):
68  """
69  List (Literally Python dict) of trigger objects to be placed with flags:
70  key can be" 'ESD', 'AODSLIM', 'AODFULL'
71  run can be: '1 (Run1)', '2 (Run2)', '3' (Run 3), '4' (Run 4)
72  """
73  if runVersion == 1:
74  return getTriggerObjList(key,[TriggerL2List,TriggerEFList, TriggerResultsRun1List])
75 
76  elif runVersion == 2:
77  if 'SLIM' in key:
78  return getTriggerEDMSlimList(key)
79  else:
80  return getTriggerObjList(key,[TriggerHLTList, TriggerResultsList])
81 
82  elif runVersion >= 3:
83  if key in AllowedOutputFormats: # AllowedOutputFormats is the entire list of output formats including ESD
84  # this keeps only the dynamic variables that have been specified in TriggerEDMRun3
85  Run3TrigEDM = {}
86  Run3TrigEDMCOMM = {}
87  Run3TrigEDMSLIM = {}
88 
89  if extraEDMList:
90  log.info( "Adding extra collections to EDM: %s", str(extraEDMList))
91  # TODO - This function is currently changing a global state.
92  # Should re-work it to return a copy of TriggerHLTListRun3 with the additional content added.
93  addExtraCollectionsToEDMList(TriggerHLTListRun3, extraEDMList)
94 
95  if "AODFULL" in key:
96  #Containers marked with AODCOMM to be added to AODFULL
97 
98  Run3TrigEDM.update(getRun3TrigEDMSlimList(key))
99 
100  Run3TrigEDMCOMM.update(getRun3TrigEDMSlimList("AODCOMM"))
101  for kcomm,vcomm in Run3TrigEDMCOMM.items():
102  if kcomm in Run3TrigEDM:
103  Run3TrigEDM[kcomm].extend(vcomm)
104  else:
105  Run3TrigEDM[kcomm] = vcomm
106 
107  elif "AODSLIM" in key:
108  # remove the variables that are defined in TriggerEDMRun3.varToRemoveFromAODSLIM from the containers
109 
110  # get all containers from list that are marked with AODSLIM
111  if len(varToRemoveFromAODSLIM) == 0:
112  Run3TrigEDM.update(getRun3TrigEDMSlimList(key))
113  log.info("No decorations are listed to be removed from AODSLIM")
114  else:
115  Run3TrigEDMSLIM.update(getRun3TrigEDMSlimList(key))
116  log.info("The following decorations are going to be removed from the listed collections in AODSLIM {}".format(varToRemoveFromAODSLIM))
117  # Go through all container values and remove the variables to remove
118  # Format of Run3TrigEDMSLIM is {'xAOD::Cont': ['coll1.varA.varB', 'coll2.varD',...],...}
119  for cont, values in Run3TrigEDMSLIM.items():
120  if (isinstance(values, list)):
121  newValues = []
122  for value in values:
123  newValue = value+'.'
124  coll = value.split('.')[0]
125 
126  varRemovedFlag = False
127  for myTuple in varToRemoveFromAODSLIM:
128  var = myTuple[0]
129 
130  if var in value and coll in myTuple:
131  varRemovedFlag = True
132  removeVar = '.'+var+'.'
133  newValue = newValue.replace(removeVar, '.')
134 
135  if newValue[-1:] == '.':
136  newValue = newValue[:-1]
137 
138  if varRemovedFlag is False:
139  newValues.append(value)
140  elif varRemovedFlag is True:
141  newValues.append(newValue)
142  else:
143  raise RuntimeError("Decoration removed but no new Value was available, not sure what to do...")
144 
145  # Filling the Run3TrigEDM dictionary with the new set of values for each cont
146  Run3TrigEDM[cont] = newValues
147  else:
148  raise RuntimeError("Value in Run3TrigEDM dictionary is not a list")
149 
150  else: # ESD
151  Run3TrigEDM.update(getRun3TrigEDMSlimList(key))
152 
153  log.debug('TriggerEDM for EDM set {} contains the following collections: {}'.format(key, Run3TrigEDM) )
154  return Run3TrigEDM
155 
156  else:
157  log.warning('Output format: %s is not in list of allowed formats, please check!', key)
158  return getRun3TrigObjList(key, [TriggerHLTListRun3])
159 
160  else:
161  raise RuntimeError("Invalid runVersion=%s supplied to getTriggerEDMList" % runVersion)
162 
163 
164 

◆ getTriggerEDMSlimList()

def python.TriggerEDM.getTriggerEDMSlimList (   key)
Run 2 version
Modified EDM list to remove all dynamic variables
Requires changing the list to have 'Aux.-'

Definition at line 279 of file TriggerEDM.py.

279 def getTriggerEDMSlimList(key):
280  """
281  Run 2 version
282  Modified EDM list to remove all dynamic variables
283  Requires changing the list to have 'Aux.-'
284  """
285  _edmList = getTriggerObjList(key,[TriggerHLTList, TriggerResultsList])
286  output = {}
287  for k,v in _edmList.items():
288  newnames = []
289  for el in v:
290  if 'Aux' in el:
291  newnames+=[el.split('.')[0]+'.-']
292  else:
293  newnames+=[el]
294  output[k] = newnames
295  return output
296 

◆ getTriggerObjList()

def python.TriggerEDM.getTriggerObjList (   destination,
  lst 
)
Gives back the Python dictionary  with the content of ESD/AOD (dst) which can be inserted in OKS.

Definition at line 393 of file TriggerEDM.py.

393 def getTriggerObjList(destination, lst):
394  """
395  Gives back the Python dictionary with the content of ESD/AOD (dst) which can be inserted in OKS.
396  """
397  dset = set(destination.split())
398 
399  toadd = {}
400  import itertools
401 
402  for item in itertools.chain(*lst):
403  if item[1] == '':
404  continue
405  confset = set(item[1].split())
406  if dset & confset: # intersection of the sets
407  t,k = getTypeAndKey(item[0])
408  colltype = t
409  if 'collection' in EDMDetails[t]:
410  colltype = EDMDetails[t]['collection']
411  if colltype in toadd:
412  if k not in toadd[colltype]:
413  toadd[colltype] += [k]
414  else:
415  toadd[colltype] = [k]
416  return InsertContainerNameForHLT(toadd)
417 
418 

◆ getTrigIDTruthList()

def python.TriggerEDM.getTrigIDTruthList (   dst)
Gives back the Python dictionary  with the truth trigger content of ESD/AOD (dst) which can be inserted in OKS.

Definition at line 419 of file TriggerEDM.py.

419 def getTrigIDTruthList(dst):
420  """
421  Gives back the Python dictionary with the truth trigger content of ESD/AOD (dst) which can be inserted in OKS.
422  """
423  return getTriggerObjList(dst,[TriggerIDTruth])
424 

◆ getTypeAndKey()

def python.TriggerEDM.getTypeAndKey (   s)
From the strings containing type and key of trigger EDM extract type and key

Definition at line 380 of file TriggerEDM.py.

380 def getTypeAndKey(s):
381  """ From the strings containing type and key of trigger EDM extract type and key
382  """
383  return s[:s.index('#')], s[s.index('#')+1:]
384 

◆ handleRun3ViewContainers()

def python.TriggerEDM.handleRun3ViewContainers (   el)

Definition at line 180 of file TriggerEDM.py.

180 def handleRun3ViewContainers( el ):
181  if 'Aux.' in el:
182  # Get equivalent non-aux string (fragile!!!)
183  keyNoAux = el.split('.')[0].replace('Aux','')
184  # Check if this interface container is produced inside a View
185  inView = getRun3TrigObjProducedInView(keyNoAux, [TriggerHLTListRun3])
186  if el.split('.')[1] == '':
187  # Aux lists zero dynamic vars to save ...
188  if inView:
189  # ... but it was produced in a View, so we need to add the viewIndex dynamic aux
190  return el.split('.')[0]+'.viewIndex'
191  else:
192  # ... and was not in a View, strip all dynamic
193  return el.split('.')[0]+'.-'
194  else:
195  # Aux lists one or more dynamic vars to save ...
196  if inView:
197  # ... and was produced in a View, so add the viewIndex dynamic as well
198  return el+'.viewIndex'
199  else:
200  # ... and was not produced in a View, keep user-supplied list
201  return el
202  else: # no Aux
203  return el
204 
205 

◆ InsertContainerNameForHLT()

def python.TriggerEDM.InsertContainerNameForHLT (   typedict)

Definition at line 688 of file TriggerEDM.py.

688 def InsertContainerNameForHLT(typedict):
689  import re
690  output = {}
691  for k,v in typedict.items():
692  newnames = []
693  for el in v:
694  if el.startswith('HLT_') or el == 'HLT':
695  prefixAndLabel = el.split('_',1) #only split on first underscore
696  containername = k if 'Aux' not in k else EDMDetails[k]['parent'] #we want the type in the Aux SG key to be the parent type #104811
697  #maybe this is not needed anymore since we are now versionless with the CLIDs but it's not hurting either
698  containername = re.sub('::','__',re.sub('_v[0-9]+$','',containername))
699  newnames+=['_'.join([prefixAndLabel[0],containername]+([prefixAndLabel[1]] if len(prefixAndLabel) > 1 else []))]
700  else:
701  newnames+=[el]
702  output[k] = newnames
703  return output
704 

◆ keyToLabel()

def python.TriggerEDM.keyToLabel (   key)
The key is usually HLT_*, this function returns second part of it or empty string

Definition at line 385 of file TriggerEDM.py.

385 def keyToLabel(key):
386  """ The key is usually HLT_*, this function returns second part of it or empty string
387  """
388  if '_' not in key:
389  return ''
390  else:
391  return key[key.index('_'):].lstrip('_')
392 

◆ recordable()

def python.TriggerEDM.recordable (   arg,
  runVersion = 3 
)
Verify that the name is in the list of recorded objects and conform to the name convention

In Run 2 it was a delicate process to configure correctly what got recorded
as it had to be set in the algorithm that produced it as well in the TriggerEDM.py in a consistent manner.

For Run 3 every alg input/output key can be crosschecked against the list of objects to record which is defined here.
I.e. in the configuration alg developer would do this:
from TriggerEDM.TriggerEDMRun3 import recordable

alg.outputKey = recordable("SomeKey")
If the names are correct the outputKey is assigned with SomeKey, if there is a missmatch an exception is thrown.

Definition at line 30 of file TriggerEDM.py.

30 def recordable( arg, runVersion=3 ):
31  """
32  Verify that the name is in the list of recorded objects and conform to the name convention
33 
34  In Run 2 it was a delicate process to configure correctly what got recorded
35  as it had to be set in the algorithm that produced it as well in the TriggerEDM.py in a consistent manner.
36 
37  For Run 3 every alg input/output key can be crosschecked against the list of objects to record which is defined here.
38  I.e. in the configuration alg developer would do this:
39  from TriggerEDM.TriggerEDMRun3 import recordable
40 
41  alg.outputKey = recordable("SomeKey")
42  If the names are correct the outputKey is assigned with SomeKey, if there is a missmatch an exception is thrown.
43 
44  """
45 
46  # Allow passing DataHandle as argument - convert to string and remove store name
47  name = str(arg).replace('StoreGateSvc+','')
48 
49  if "HLTNav_" in name:
50  log.error( "Don't call recordable({0}), or add any \"HLTNav_\" collection manually to the EDM. See:collectDecisionObjects.".format( name ) )
51  pass
52  else: #negative filtering
53  if not any([name.startswith(p) for p in _allowedEDMPrefixes]):
54  raise RuntimeError( f"The collection name {name} does not start with any of the allowed prefixes: {_allowedEDMPrefixes}" )
55  if "Aux" in name and not name[-1] != ".":
56  raise RuntimeError( f"The collection name {name} is Aux but the name does not end with the '.'" )
57 
58  if runVersion >= 3:
59  for entry in TriggerHLTListRun3:
60  if entry[0].split( "#" )[1] == name:
61  return arg
62  msg = "The collection name {0} is not declared to be stored by HLT. Add it to TriggerEDMRun3.py".format( name )
63  log.error("ERROR in recordable() - see following stack trace.")
64  raise RuntimeError( msg )
65 
66 

Variable Documentation

◆ _allowedEDMPrefixes

python.TriggerEDM._allowedEDMPrefixes
private

Definition at line 29 of file TriggerEDM.py.

◆ AllowedOutputFormats

python.TriggerEDM.AllowedOutputFormats

Definition at line 25 of file TriggerEDM.py.

◆ log

python.TriggerEDM.log

Definition at line 14 of file TriggerEDM.py.

python.TriggerEDM.keyToLabel
def keyToLabel(key)
Definition: TriggerEDM.py:385
replace
std::string replace(std::string s, const std::string &s2, const std::string &s3)
Definition: hcg.cxx:307
python.TriggerEDMRun3.persistent
def persistent(transient)
Definition: TriggerEDMRun3.py:1171
python.TriggerEDM.handleRun3ViewContainers
def handleRun3ViewContainers(el)
Definition: TriggerEDM.py:180
vtune_athena.format
format
Definition: vtune_athena.py:14
python.TriggerEDM.getL2Run1BSList
def getL2Run1BSList()
Definition: TriggerEDM.py:727
python.TriggerEDM.getL2PreregistrationList
def getL2PreregistrationList()
Definition: TriggerEDM.py:439
python.TriggerEDM.getRun3BSList
def getRun3BSList(keys)
Definition: TriggerEDM.py:206
python.TriggerEDM.getHLTDSTypeList
def getHLTDSTypeList()
Definition: TriggerEDM.py:604
python.TriggerEDM.getTypeAndKey
def getTypeAndKey(s)
Definition: TriggerEDM.py:380
python.TriggerEDM.getHLTBSTypeList
def getHLTBSTypeList()
Definition: TriggerEDM.py:579
python.TriggerEDMRun3.addExtraCollectionsToEDMList
def addExtraCollectionsToEDMList(edmList, extraList)
Definition: TriggerEDMRun3.py:1228
python.TriggerEDM.getHLTPreregistrationList
def getHLTPreregistrationList()
Definition: TriggerEDM.py:465
python.TriggerEDM.getTrigIDTruthList
def getTrigIDTruthList(dst)
Definition: TriggerEDM.py:419
python.TriggerEDM.getEFBSList
def getEFBSList()
Definition: TriggerEDM.py:533
python.TriggerEDM.getEDMLibraries
def getEDMLibraries()
Definition: TriggerEDM.py:685
python.TriggerEDM.getEFPreregistrationList
def getEFPreregistrationList()
Definition: TriggerEDM.py:452
python.TriggerEDM.getL2BSTypeList
def getL2BSTypeList()
Definition: TriggerEDM.py:555
python.TriggerEDM.getRun3TrigEDMSlimList
def getRun3TrigEDMSlimList(key)
Definition: TriggerEDM.py:258
python.TriggerEDM.getEFRun1BSList
def getEFRun1BSList()
Definition: TriggerEDM.py:705
python.TriggerEDM.getTPList
def getTPList(version=2)
Definition: TriggerEDM.py:618
python.TriggerEDM.getCategory
def getCategory(s)
Definition: TriggerEDM.py:297
python.TriggerEDM.getTriggerEDMSlimList
def getTriggerEDMSlimList(key)
Definition: TriggerEDM.py:279
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
python.TriggerEDM.getL2BSList
def getL2BSList()
Definition: TriggerEDM.py:522
python.TriggerEDM.getARATypesRenaming
def getARATypesRenaming()
Definition: TriggerEDM.py:641
CxxUtils::set
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.
Definition: bitmask.h:224
python.TriggerEDM.getHLTBSList
def getHLTBSList()
Definition: TriggerEDM.py:544
python.TriggerEDM.getTriggerEDMList
def getTriggerEDMList(key, runVersion, extraEDMList=[])
Definition: TriggerEDM.py:67
python.TriggerEDM.getHLTDSList
def getHLTDSList()
Definition: TriggerEDM.py:511
python.TriggerEDM.getL2Run2EquivalentList
def getL2Run2EquivalentList()
Definition: TriggerEDM.py:738
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
python.TriggerEDM.getEFRun2EquivalentList
def getEFRun2EquivalentList()
Definition: TriggerEDM.py:716
python.TriggerEDM.getPreregistrationList
def getPreregistrationList(version=2, doxAODConversion=True)
Definition: TriggerEDM.py:479
python.TriggerEDM.getLvl1ESDList
def getLvl1ESDList()
Definition: TriggerEDM.py:425
python.TriggerEDM.InsertContainerNameForHLT
def InsertContainerNameForHLT(typedict)
Definition: TriggerEDM.py:688
python.TriggerEDM.getTriggerObjList
def getTriggerObjList(destination, lst)
Definition: TriggerEDM.py:393
python.TriggerEDM.getLvl1AODList
def getLvl1AODList()
Definition: TriggerEDM.py:431
if
if(febId1==febId2)
Definition: LArRodBlockPhysicsV0.cxx:569
python.TriggerEDM.recordable
def recordable(arg, runVersion=3)
Definition: TriggerEDM.py:30
python.TriggerEDM.getEFDSTypeList
def getEFDSTypeList()
Definition: TriggerEDM.py:591
str
Definition: BTagTrackIpAccessor.cxx:11
python.TriggerEDM.getRun3TrigObjList
def getRun3TrigObjList(destination, trigEDMList)
Definition: TriggerEDM.py:229
python.TriggerEDM.getEFBSTypeList
def getEFBSTypeList()
Definition: TriggerEDM.py:567
Trk::split
@ split
Definition: LayerMaterialProperties.h:38
python.TriggerEDM.getRun3TrigObjProducedInView
def getRun3TrigObjProducedInView(theKey, trigEDMList)
Definition: TriggerEDM.py:165
python.TriggerEDM.getEFDSList
def getEFDSList()
Definition: TriggerEDM.py:500