8 from shutil
import copyfile
12 log = logging.getLogger(__name__)
15 ROOT.gInterpreter.ProcessLine(
'#include "xAODTrigger/TrigConfKeys.h"')
18 bs_filename =
'bs-streamerinfos.root'
20 from 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)+
">"))
41 if __name__ ==
'__main__':
44 from TrigEDMConfig.TriggerEDMRun3
import TriggerHLTListRun3
45 from TrigEDMConfig.DataScoutingInfo
import getAllDataScoutingIdentifiers
47 log.warning(
"BS_destinations = {}".
format(BS_destinations))
48 for item
in TriggerHLTListRun3:
49 if any(bs
in item[1].
split()
for bs
in BS_destinations):
50 objects.append(item[0].
split(
"#")[0])
53 os.system(
"get_files -data clid.db")
54 classid =
open(
"clid.db",
"r")
56 items = cl.split(
"; ")
57 class_name = items[3].rstrip()
58 isxAOD = re.search(
'_v[0-9].*$', class_name)
59 if isxAOD
is not None:
60 log.info (class_name +
" is versioned xAOD class")
63 log.info (class_name +
" is not an xAOD class")
67 log.warning(
"Will extract TStreamerInfo for the following types:")
70 copyfile(bs_filename,
"original_" + bs_filename)
76 black_list = [
"string::_Alloc_hider",
"string"]
77 new_objects = [item
for item
in updated_objects
if item[0]
not in black_list]
79 if len(new_objects) > 0:
80 log.warning(
"The following {} new objects were detected:".
format(len(new_objects)))
81 for item
in new_objects:
82 log.warning(
"{}: 0x{:x}".
format(item[0], item[1]))
83 log.warning(
"Please ask the Trigger EDM coordinator to add them to bs-streamerinfos.root")
85 log.warning(
"No new objects detected")
87 exit_code_err = len(new_objects)
89 log.error(
"New TStreamerInfos detected")
91 log.info(
"No new TStreamerInfos detected")
95 sys.exit(exit_code_err)