8from shutil
import copyfile
11log = logging.getLogger(__name__)
12logging.basicConfig(format =
'%(message)s', level = logging.INFO)
15ROOT.gInterpreter.ProcessLine(
'#include "xAODTrigger/TrigConfKeys.h"')
18bs_filename =
'bs-streamerinfos.root'
20from TrigSerializeResult.dictwrite
import update_streamerinfos
24 if "CPMTowerAuxContainer" in cname
or "CMMEtSumsAuxContainer" in cname
or "JEMHitsAuxContainer" in cname
or "JEMEtSumsAuxContainer" in cname
or "JetElementAuxContainer" in cname
or "AFPDataAuxContainer" in cname
or "_Alloc_hide" in cname
or cname ==
"string" or "CMXJetTobAuxContainer" in cname
or "RODHeaderAuxContainer" in cname
or "CMMCPHitsAuxContainer" in cname
or "CMXCPHitsAuxContainer" in cname
or "TruthVertexAuxContainer" in cname
or "CMXEtSumsAuxContainer" in cname
or "CMXJetHitsAuxContainer" in cname
or "CMMJetHitsAuxContainer" in cname
or "CPMHitsAuxContain" in cname:
26 isxAOD = re.search(
'_v[0-9]$', class_name)
27 isxAODDV = re.search(
'_v[0-9]>$', class_name)
29 if isxAOD
is not None:
30 version = [int(s)
for s
in cname.split(
"_v")
if s.isdigit()][-1]
31 for i
in range (1, version+1):
32 objects.append(cname.replace(
"_v"+str(version),
"_v"+str(i)))
33 elif isxAODDV
is not None:
34 version = [int(s)
for s
in re.split(
'_v|>',cname)
if s.isdigit()][-1]
35 for i
in range (1, version+1):
36 objects.append(cname.replace(
"_v"+str(version)+
">",
"_v"+str(i)+
">"))
41if __name__ ==
'__main__':
43 is_main = os.getenv(
'AtlasBuildBranch') ==
'main'
47 from TrigEDMConfig.TriggerEDM
import getRawTriggerEDMList
48 from TrigEDMConfig.DataScoutingInfo
import getAllDataScoutingIdentifiers
49 BS_destinations = [
"BS"] + getAllDataScoutingIdentifiers()
50 log.info(
"BS_destinations = {}".
format(BS_destinations))
51 for item
in getRawTriggerEDMList(flags=
None, runVersion=3):
52 if any(bs
in item[1].
split()
for bs
in BS_destinations):
53 objects.append(item[0].
split(
"#")[0])
56 os.system(
"get_files -data clid.db")
57 classid = open(
"clid.db",
"r")
59 items = cl.split(
"; ")
60 class_name = items[3].rstrip()
61 isxAOD = re.search(
'_v[0-9].*$', class_name)
62 if isxAOD
is not None:
63 log.info (class_name +
" is versioned xAOD class")
66 log.info (class_name +
" is not an xAOD class")
68 objects = list(
set(objects))
70 log.info(
"Will extract TStreamerInfo for the following types:")
73 copyfile(bs_filename,
"original_" + bs_filename)
76 update_streamerinfos(objects, updated_objects)
79 black_list = [
"string::_Alloc_hider",
"string"]
80 new_objects = [item
for item
in updated_objects
if item[0]
not in black_list]
82 if len(new_objects) > 0:
83 log.warning(
"The following {} new objects were detected:".
format(len(new_objects)))
84 for item
in new_objects:
85 log.warning(
"{}: 0x{:x}".
format(item[0], item[1]))
86 log.warning(
"Please ask the Trigger EDM coordinator to add them to bs-streamerinfos.root")
88 log.info(
"No new objects detected")
90 exit_code_err = len(new_objects)
93 log.warning(
"New TStreamerInfos detected but ignoring this error for early Phase II commissioning period in main during P1 data taking.")
96 log.error(
"New TStreamerInfos detected")
98 log.info(
"No new TStreamerInfos detected")
102 sys.exit(exit_code_err)
std::vector< std::string > split(const std::string &s, const std::string &t=":")
append_versions(objects, cname)