ATLAS Offline Software
Loading...
Searching...
No Matches
JetTriggerContentRun3TLA.py
Go to the documentation of this file.
1# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2
3from DerivationFrameworkCore.JetTriggerContentRun3 import JetTriggerContentRun3
4
5
6excludedTriggerContentForTLA = [
7 # substrings listing excluded content
8 "AntiKt10", # ALL large-R jets
9]
10
11additionalTriggerContentForTLA = []
12
13
14def 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
25JetTriggerContentRun3TLA = [
26 element for element in JetTriggerContentRun3
27 if not triggerContentIsExcludedForTLA(element, excludedTriggerContentForTLA)
28]
29
30for 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
57JetTriggerContentRun3TLA = list(set(JetTriggerContentRun3TLA))
58
59
STL class.
std::vector< std::string > split(const std::string &s, const std::string &t=":")
Definition hcg.cxx:177
bool triggerContentIsExcludedForTLA(str content, list exclusionList)