14Creating the xml file for tickness and density of each cell volume
15for the service matirial.
17Two kinds of material can be selected:
20 The thickness and density calculated
from the photo of actual
21 cable arrangement
and density of each cable.
24 No service matirial
in the gap.
27dom1 = xml.dom.getDOMImplementation()
28doc = dom1.createDocument(None, "TicknessDensity", None)
29top_element = doc.documentElement
31# Select which kind of material you want to input. Defalut value: 1, vacuum: 0
36 thickness_CDCback = (np.ones((16, 144)) * 1.0e-5).ravel()
39 thickness_CDCfor = (np.ones((16, 144)) * 1.0e-5).ravel()
42 thickness_ARICH = (np.ones((3, 144)) * 1.0e-5).ravel()
45 thickness_TOPback = (np.ones(144) * 1.0e-5).ravel()
48 thickness_TOPfor = (np.ones(144) * 1.0e-5).ravel()
51 thickness_ECLCOIL = (np.ones((92, 144)) * 1.0e-5).ravel()
54 thickness_ECLback = (np.ones((3, 5, 144)) * 1.0e-5).ravel()
57 thickness_ECLfor = (np.ones((3, 5, 144)) * 1.0e-5).ravel()
61 thickness_CDCback = (np.loadtxt(open(
"thickness_CDCback.csv",
"rb"), delimiter=
",")).ravel()
62 thickness_CDCback[thickness_CDCback < 1.0e-5] = 1.0e-5
68 thickness_CDCfor = (np.loadtxt(open(
"thickness_CDCfor.csv",
"rb"), delimiter=
",")).ravel()
69 thickness_CDCfor[thickness_CDCfor < 1.0e-5] = 1.0e-5
72 thickness_ARICH = (np.loadtxt(open(
"thickness_ARICH.csv",
"rb"), delimiter=
",")).ravel()
73 thickness_ARICH[thickness_ARICH < 1.0e-5] = 1.0e-5
76 thickness_TOPback = (np.loadtxt(open(
"thickness_TOP_back.csv",
"rb"), delimiter=
",")).ravel()
77 thickness_TOPback[thickness_TOPback < 1.0e-5] = 1.0e-5
80 thickness_TOPfor = (np.loadtxt(open(
"thickness_TOP_for.csv",
"rb"), delimiter=
",")).ravel()
81 thickness_TOPfor[thickness_TOPfor < 1.0e-5] = 1.0e-5
84 thickness_ECLCOIL = (np.loadtxt(open(
"thickness_ECLCOIL.csv",
"rb"), delimiter=
",")).ravel()
85 thickness_ECLCOIL[thickness_ECLCOIL < 1.0e-5] = 1.0e-5
88 thickness_ECLback = (np.loadtxt(open(
"thickness_ECLback.csv",
"rb"), delimiter=
",")).ravel()
89 thickness_ECLback[thickness_ECLback < 1.0e-5] = 1.0e-5
92 thickness_ECLfor = (np.loadtxt(open(
"thickness_ECLfor.csv",
"rb"), delimiter=
",")).ravel()
93 thickness_ECLfor[thickness_ECLfor < 1.0e-5] = 1.0e-5
95thickness_list = list(map(str, thickness_CDCback.tolist() +
96 thickness_CDCfor.tolist() +
97 thickness_ARICH.tolist() +
98 thickness_TOPback.tolist() +
99 thickness_TOPfor.tolist() +
100 thickness_ECLCOIL.tolist() +
101 thickness_ECLback.tolist() +
102 thickness_ECLfor.tolist()))
107 density_ARICH = (np.ones(3) * 1.29e-10).ravel()
108 density_TOPback = (np.ones(1) * 1.29e-10).ravel()
109 density_TOPfor = (np.ones(1) * 1.29e-10).ravel()
110 density_ECLCOIL = (np.ones(1) * 1.29e-10).ravel()
111 density_ECLback = (np.ones(5) * 1.29e-10).ravel()
112 density_ECLfor = (np.ones(5) * 1.29e-10).ravel()
114 density_ARICH = (np.ones(3) * 8.96).ravel()
115 density_TOPback = (np.ones(1) * 8.96).ravel()
116 density_TOPfor = (np.ones(1) * 8.96).ravel()
117 density_ECLCOIL = (np.ones(1) * 8.96).ravel()
118 density_ECLback = (np.ones(5) * 8.96).ravel()
119 density_ECLfor = (np.ones(5) * 8.96).ravel()
122density_list = list(map(str, density_ARICH.tolist() + density_TOPback.tolist() +
123 density_TOPfor.tolist() + density_ECLCOIL.tolist() +
124 density_ECLback.tolist() + density_ECLfor.tolist()))
127 'IRCDCBack':
'segmentation in R of backward',
128 'IPhiCDCBack':
'segmentation in Phi of backward',
129 'IRCDCFor':
'segmentation in R of forward',
130 'IPhiCDCFor':
'segmentation in Phi of forward',
131 'thicknesses':
'thicknesses',
132 'IZARICHFor':
'segmentation in Z of forward',
133 'IPhiARICHFor':
'segmentation in Phi of forward',
134 'IPhiTOPBack':
'segmentation in Phi of backward',
135 'IPhiTOPFor':
'segmentation in Phi of forward',
136 'IZECLCOILBar':
'segmentation in Z of barrel',
137 'IPhiECLCOILBar':
'segmentation in Phi of barrel',
138 'IRECLBack':
'segmentation in R of backward',
139 'IZECLBack':
'segmentation in Z of backward',
140 'IPhiECLBack':
'segmentation in Phi of backward',
141 'IRECLFor':
'segmentation in R of forward',
142 'IZECLFor':
'segmentation in Z of forward',
143 'IPhiECLFor':
'segmentation in Phi of forward'}
151 'thicknesses': thickness_list,
157 'IPhiECLCOILBar': 144,
184unit = {
'thicknesses':
'mm'}
186for element
in elements:
187 sNode = doc.createElement(element)
188 sNode.setAttribute(
'desc', desc[element])
189 if element
in unit.keys():
190 sNode.setAttribute(
'unit', unit[element])
191 if isinstance(value[element], list):
192 textNode = doc.createTextNode(
" ".join(value[element]))
194 textNode = doc.createTextNode(str(value[element]))
195 sNode.appendChild(textNode)
196 top_element.appendChild(sNode)
198xmlfile = open(
'GAPS-thickness-density.xml',
'w')
199doc.writexml(xmlfile, addindent=
' ' * 4, newl=
'\n', encoding=
'utf-8')