ATLAS Offline Software
createCablingJSON.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 import json
3 from copy import deepcopy
4 
5 
13 station_name = "BIS"
14 eta_index = 7 # To represent BIS78 (Station eta, always 7 for BIS78)
15 doubletR = 1 # Chamber mounted below the Mdts (Always 1 for BIS78)
16 doubletPhi = 1 # Single phi module (Always 1 for BIS78)
17 sub_detector = 101 # 0x65 (same as the RPCs)
18 idTranslateDict = []
19 
20 
21 
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]
23 flatCableBIS78inv = [31, 27, 23, 19, 15, 11, 7, 3, 30, 26, 22, 18, 14, 10, 6, 2, 29, 25, 21, 17, 13, 9, 5, 1, 28, 24, 20, 16, 12, 8, 4, 0] # Inverted strip numbering
24 readoutDict =[
25 {
26  "flatCableId" : 0,
27  "pinAssignment" : [(p+1,t) for t, p in enumerate(flatCableBIS78)]
28 },
29 {
30  "flatCableId" : 2,
31  "pinAssignment" : [(s,t) for s, t in enumerate([ 0, 8, 16, 24, 1, 9, 17, 25],1)]
32 },
33 {
34  "flatCableId" : 1,
35  "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)]
36 },
37 {
38  "flatCableId" : 3,
39  "pinAssignment" : [(p+1,t) for t, p in enumerate(flatCableBIS78inv)]
40 },
41 
42 
43 
44 ]
45 
46 
47 for sector in range(1, 9): # Sectors from 1 to 8
48  for doubZ in [1, 2]:
49  for measPhi in [0,1]:
50  for gasGap in [0, 1, 2]:
51  cabling_data = {
52 
53  "station": station_name,
54  "eta": eta_index,
55  "phi" : sector,
56  "doubletR" : doubletR,
57  "doubletZ" : doubZ,
58  "doubletPhi": doubletPhi,
59  "measPhi": measPhi,
60  "gasGap": gasGap + 1,
61 
62  "subDetector": sub_detector,
63  "boardSector" : sector+16, # sectors from 0x0011 (17) to 0x0018 (24)
64  "flatCableId" : 0,
65  }
66 
67  if measPhi == 0: # Eta
68  if doubZ == 1:
69  cabling_data["firstStrip"] = 1
70  """
71  cabling_data["lastStrip"] = 32 # Standard: 32 eta strips for BIS7 -> special case: BIS7 with 40 eta strips added below
72  cabling_data["firstTdcChan"] = 0
73  cabling_data["lastTdcChan"] = 31 # Standard: 32 channels per TDC
74  """
75  cabling_data["board"] = gasGap
76  elif doubZ == 2:
77  cabling_data["firstStrip"] = 1 # MN: Problem: should firstStrip be -15, to start with strip 1 in channel 17?
78  """
79  cabling_data["lastStrip"] = 16 # Standard: 16 eta strips for BIS8 cabled on the second half of the TDC (that means the strips 1-16)
80  cabling_data["firstTdcChan"] = 16
81  cabling_data["lastTdcChan"] = 31 # Last 16 TDC channels
82  """
83  cabling_data["board"] = gasGap + 9
84  cabling_data["flatCableId"] = 1
85  idTranslateDict.append(deepcopy(cabling_data))
86 
87  if measPhi == 1: # Phi
88  if doubZ == 1:
89  cabling_data["firstStrip"] = 33
90  """
91  cabling_data["lastStrip"] = 64 # Total 64 phi strips for BIS7 -> First half
92  cabling_data["firstTdcChan"] = 0
93  cabling_data["lastTdcChan"] = 31 # Standard: 32 channels per TDC
94  """
95  cabling_data["board"] = gasGap + 3
96  cabling_data["flatCableId"] = 3
97  elif doubZ == 2:
98  cabling_data["firstStrip"] = 33
99  """
100  cabling_data["lastStrip"] = 64 # Total 64 phi strips for BIS7 -> First half
101  cabling_data["firstTdcChan"] = 0
102  cabling_data["lastTdcChan"] = 31 # Standard: 32 channels per TDC
103  """
104  cabling_data["board"] = gasGap + 12
105  cabling_data["flatCableId"] = 3
106  idTranslateDict.append(deepcopy(cabling_data))
107  if doubZ == 1:
108  cabling_data["firstStrip"] = 1
109  """
110  cabling_data["lastStrip"] = 32 # Total 64 phi strips for BIS7 -> Second half
111  cabling_data["firstTdcChan"] = 0
112  cabling_data["lastTdcChan"] = 31 # Standard: 32 channels per TDC
113  """
114  cabling_data["board"] = gasGap + 6
115  cabling_data["flatCableId"] = 3
116  elif doubZ == 2:
117  cabling_data["firstStrip"] = 1
118  """
119  cabling_data["lastStrip"] = 32 # Total 64 phi strips for BIS7 -> Second half
120  cabling_data["firstTdcChan"] = 0
121  cabling_data["lastTdcChan"] = 31 # Standard: 32 channels per TDC
122  """
123  cabling_data["board"] = gasGap + 15
124  cabling_data["flatCableId"] = 3
125 
126  idTranslateDict.append(deepcopy(cabling_data))
127 
128 # MN: Should we allow the doubling of TDC when different chambers are cabled in the same TDC?
129 # MN: need to review finalize() checks in: MuonSpectrometer/MuonCablings/MuonCablingData/src/MuonNRPC_CablingMap.cxx
130 # MN: For the moment using a different TDC number (WRONG!) to test the code
131  if measPhi == 0: # Eta
132  if doubZ == 1:
133  if sector == 1 or sector == 2 or sector == 3:
134  cabling_data["firstStrip"] = 33
135  """
136  cabling_data["lastStrip"] = 40 # Special case: BIS7 with 40 eta strips -> Adding the 8 leftover strips
137  cabling_data["firstTdcChan"] = 0
138  cabling_data["lastTdcChan"] = 7 # First 8 channels of the TDC used for BIS8 eta strips
139  """
140  cabling_data["board"] = gasGap + 9
141  cabling_data["flatCableId"] = 2
142  idTranslateDict.append(deepcopy(cabling_data))
143 
144 
145 print (len(idTranslateDict))
146 
147 json_dict= {"chamberMap" : idTranslateDict,
148  "readoutCards": readoutDict }
149 with open("CablingFile.json", "w") as my_file:
150  my_file.write(json.dumps(json_dict,indent=4))
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:194
Trk::open
@ open
Definition: BinningType.h:40