ATLAS Offline Software
JetTriggerContentRun3TLA.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2 
3 from DerivationFrameworkCore.JetTriggerContentRun3 import JetTriggerContentRun3
4 
5 
6 excludedTriggerContentForTLA = [
7  # substrings listing excluded content
8  "AntiKt10", # ALL large-R jets
9 ]
10 
11 additionalTriggerContentForTLA = []
12 
13 
14 def triggerContentIsExcludedForTLA(content:str, exclusionList:list)->bool:
15  excluded = False
16  for excludedStr in exclusionList:
17  if excludedStr in content:
18  excluded = True
19  break
20  return excluded
21 
22 # create list for TLA jet trigger content
23 # excluding content configured for removal
24 # in excludedTriggerContentForTLA
25 JetTriggerContentRun3TLA = [
26  element for element in JetTriggerContentRun3
27  if not triggerContentIsExcludedForTLA(element, excludedTriggerContentForTLA)
28 ]
29 
30 for additionalContent in additionalTriggerContentForTLA:
31  # determine whether processing an Aux container or not
32  if "Aux" not in additionalContent:
33  JetTriggerContentRun3TLA.append(additionalContent)
34  else:
35  # processing an Aux container so different handling is needed
36  # check if the Aux container exists and then compare Aux attributes
37  # and use all unique elements
38  matchedAuxElementIdx = -1
39  for idx, element in enumerate(JetTriggerContentRun3TLA):
40  if additionalContent.split(".")[0] == element.split(".")[0]:
41  matchedAuxElementIdx = idx
42 
43  if matchedAuxElementIdx < 0:
44  # Aux container doesn't already exist in TLA jet trigger content
45  JetTriggerContentRun3TLA.append(additionalContent)
46  else:
47  # check whether we are taking the whole Aux container or just selected attributes
48  if additionalContent.split(".")[-1] == "" and len(additionalContent.split(".")) == 2:
49  # overwrite the existing entry with the updated content for TLA
50  JetTriggerContentRun3TLA[matchedAuxElementIdx] = additionalContent
51  else:
52  # Aux container already exists, keep unique Aux attributes
53  JetTriggerContentRun3TLA[matchedAuxElementIdx] = ".".join([additionalContent.split(".")[0]] + list(set(additionalContent.split(".")[1:] + JetTriggerContentRun3TLA[matchedAuxElementIdx].split(".")[1:])))
54 
55 # remove any duplicates introduced by
56 # adding non-Aux containers in additionalTriggerContentForTLA
57 JetTriggerContentRun3TLA = list(set(JetTriggerContentRun3TLA))
58 
59 
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
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
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
Trk::split
@ split
Definition: LayerMaterialProperties.h:38
JetTriggerContentRun3TLA.triggerContentIsExcludedForTLA
bool triggerContentIsExcludedForTLA(str content, list exclusionList)
Definition: JetTriggerContentRun3TLA.py:14