3 from copy
import deepcopy
22 flatCableBIS78 = [0, 4, 8, 12, 16, 20, 24, 28, 1, 5, 9, 13, 17, 21, 25, 29, 2, 6, 10, 14, 18, 22, 26, 30, 3, 7, 11, 15, 19, 23, 27, 31]
26 "pinAssignment" : [(p+1,t)
for t, p
in enumerate(flatCableBIS78)]
30 "pinAssignment" : [(s,t)
for s, t
in enumerate([ 0, 8, 16, 24, 1, 9, 17, 25],1)]
34 "pinAssignment" : [(s,t)
for s,t
in enumerate([4,12,20,28,5,13, 21, 29, 6, 14, 22, 30, 7, 15, 23, 31],1)]
42 for sector
in range(1, 9):
45 for gasGap
in [0, 1, 2]:
48 "station": station_name,
51 "doubletR" : doubletR,
53 "doubletPhi": doubletPhi,
57 "subDetector": sub_detector,
58 "tdcSector" : sector*2+16,
64 cabling_data[
"firstStrip"] = 1
66 cabling_data["lastStrip"] = 32 # Standard: 32 eta strips for BIS7 -> special case: BIS7 with 40 eta strips added below
67 cabling_data["firstTdcChan"] = 0
68 cabling_data["lastTdcChan"] = 31 # Standard: 32 channels per TDC
70 cabling_data[
"tdc"] = gasGap
72 cabling_data[
"firstStrip"] = 1
74 cabling_data["lastStrip"] = 16 # Standard: 16 eta strips for BIS8 cabled on the second half of the TDC (that means the strips 1-16)
75 cabling_data["firstTdcChan"] = 16
76 cabling_data["lastTdcChan"] = 31 # Last 16 TDC channels
78 cabling_data[
"tdc"] = gasGap + 9
79 cabling_data[
"flatCableId"] = 1
80 idTranslateDict.append(deepcopy(cabling_data))
84 cabling_data[
"firstStrip"] = 1
86 cabling_data["lastStrip"] = 32 # Total 64 phi strips for BIS7 -> First half
87 cabling_data["firstTdcChan"] = 1
88 cabling_data["lastTdcChan"] = 32 # Standard: 32 channels per TDC
90 cabling_data[
"tdc"] = gasGap + 3
92 cabling_data[
"firstStrip"] = 1
94 cabling_data["lastStrip"] = 32 # Total 64 phi strips for BIS7 -> First half
95 cabling_data["firstTdcChan"] = 0
96 cabling_data["lastTdcChan"] = 31 # Standard: 32 channels per TDC
98 cabling_data[
"tdc"] = gasGap + 12
99 idTranslateDict.append(deepcopy(cabling_data))
101 cabling_data[
"firstStrip"] = 33
103 cabling_data["lastStrip"] = 64 # Total 64 phi strips for BIS7 -> Second half
104 cabling_data["firstTdcChan"] = 0
105 cabling_data["lastTdcChan"] = 31 # Standard: 32 channels per TDC
107 cabling_data[
"tdc"] = gasGap + 6
109 cabling_data[
"firstStrip"] = 33
111 cabling_data["lastStrip"] = 64 # Total 64 phi strips for BIS7 -> Second half
112 cabling_data["firstTdcChan"] = 0
113 cabling_data["lastTdcChan"] = 31 # Standard: 32 channels per TDC
115 cabling_data[
"tdc"] = gasGap + 15
117 idTranslateDict.append(deepcopy(cabling_data))
124 cabling_data[
"firstStrip"] = 33
126 cabling_data["lastStrip"] = 40 # Special case: BIS7 with 40 eta strips -> Adding the 8 leftover strips
127 cabling_data["firstTdcChan"] = 0
128 cabling_data["lastTdcChan"] = 7 # First 8 channels of the TDC used for BIS8 eta strips
130 cabling_data[
"tdc"] = gasGap + 9
131 cabling_data[
"flatCableId"] = 2
132 idTranslateDict.append(deepcopy(cabling_data))
135 print (len(idTranslateDict))
137 json_dict= {
"chamberMap" : idTranslateDict,
138 "readoutCards": readoutDict }
139 with open(
"CablingFile.json",
"w")
as my_file:
140 my_file.write(json.dumps(json_dict,indent=4))