17 mapping = get_mapping_from_channel_map(channel_map)
19 mapping = get_mapping(11, 2)
21 thread_name_prefix_ru = [
28 thread_name_prefix_tpg = [
35 crate_group = [[0, 1, 2, 6, 7], [3, 4, 5, 8, 9]]
37 sids = {i : []
for i
in range(len(crate_group))}
38 sid_counters = {i : i * 100
for i
in pd.unique(mapping[
"CRP"])}
40 for cg
in crate_group:
42 crate_map = mapping[mapping[
"Crate"] == crate]
43 amcs = pd.unique(crate_map[
"AMC"])
45 base_sid = pd.unique(crate_map[crate_map[
"AMC"] == amc][
"CRP"])[0]
46 sid_counters[base_sid] += 1
48 index = [crate
in i
for i
in crate_group][0]
49 sids[index].append(str(sid_counters[base_sid]))
51 template = {
"thread_group" : []}
52 for (n, v), s
in zip(enumerate(sids.values()), pd.unique(mapping[
"CRP"])):
53 tg = {
"numa" : n,
"threads" : []}
54 for t
in thread_name_prefix_ru:
55 tg[
"threads"].append(f
"{t}-({'|'.join(v)})")
57 for t
in thread_name_prefix_tpg:
58 tg[
"threads"].append(f
"{t}-({'|'.join([str((10 * s) + j) for j in range(3)])})")
60 template[
"thread_group"].append(tg)
62 file =
"pin_template_tde.json"
63 with open(file,
"w")
as f:
64 json.dump({
"daq_application" : {
"runp02srv004tde" : template}}, f, indent = 4)
65 print(f
"pinning template written to {file}")