11 #include <cdc/dbobjects/CDCGeometry.h>
12 #include <framework/gearbox/GearDir.h>
13 #include <boost/format.hpp>
17 using namespace boost;
21 m_rmin.push_back(rmin);
22 m_rmax.push_back(rmax);
39 m_globalOffsetX = content.getLength(
"OffsetX");
40 m_globalOffsetY = content.getLength(
"OffsetY");
41 m_globalOffsetZ = content.getLength(
"OffsetZ");
42 m_globalPhiRotation = content.getAngle(
"GlobalPhiRotation");
43 m_globalOffsetA = content.getAngle(
"OffsetA");
44 m_globalOffsetB = content.getAngle(
"OffsetB");
45 m_globalOffsetC = content.getAngle(
"OffsetC");
48 const int nBound = content.getNumberNodes(
"MomVol/ZBound");
49 for (
int iBound = 0; iBound < nBound; iBound++) {
50 const double rmin = content.getLength((format(
"MomVol/ZBound[%1%]/Rmin") % (iBound + 1)).str()) /
Unit::mm;
51 const double rmax = content.getLength((format(
"MomVol/ZBound[%1%]/Rmax") % (iBound + 1)).str()) /
Unit::mm;
52 const double z = content.getLength((format(
"MomVol/ZBound[%1%]/Z") % (iBound + 1)).str()) /
Unit::mm;
53 m_mother.appendNode(rmin, rmax, z);
58 const int nSLayer = content.getNumberNodes(
"SLayers/SLayer");
60 for (
int iSLayer = 0; iSLayer < nSLayer; ++iSLayer) {
62 layerContent.
append((format(
"/SLayers/SLayer[%1%]/") % (iSLayer + 1)).str());
63 const double r = layerContent.
getLength(
"Radius");
64 const double zfwd = layerContent.
getLength(
"ForwardZ");
65 const double zbwd = layerContent.
getLength(
"BackwardZ");
66 const double dzfwd = layerContent.
getLength(
"FwdDeltaZ");
67 const double dzbwd = layerContent.
getLength(
"BwdDeltaZ");
68 const double offset = atof((layerContent.
getString(
"Offset")).c_str());
69 const int nWires = atoi((layerContent.
getString(
"NHoles")).c_str()) / 2;
70 const double nShifts = atof((layerContent.
getString(
"NShift")).c_str());
73 dzfwd, dzbwd, offset, nWires, nShifts);
75 m_senseLayers.push_back(sense);
79 const int nFLayer = content.getNumberNodes(
"FLayers/FLayer");
81 for (
int iFLayer = 0; iFLayer < nFLayer; ++iFLayer) {
83 layerContent.
append((format(
"/FLayers/FLayer[%1%]/") % (iFLayer + 1)).str());
84 const double r = layerContent.
getLength(
"Radius");
85 const double zfwd = layerContent.
getLength(
"ForwardZ");
86 const double zbwd = layerContent.
getLength(
"BackwardZ");
88 m_fieldLayers.push_back(field);
92 const int nEndplates = content.getNumberNodes(
"Endplates/Endplate");
93 for (
int i = 0; i < nEndplates; ++i) {
98 epContent.
append((format(
"/Endplates/Endplate[%1%]/") % (i + 1)).str());
101 for (
int iEPLayer = 0; iEPLayer < nEPLayer; ++iEPLayer) {
102 GearDir epLayerContent(epContent);
103 epLayerContent.
append((format(
"/EndplateLayer[%1%]/") % (iEPLayer + 1)).str());
104 string epName = epLayerContent.
getString(
"Name");
105 double rmin = epLayerContent.
getLength(
"InnerR");
106 double rmax = epLayerContent.
getLength(
"OuterR");
107 double zfwd = epLayerContent.
getLength(
"ForwardZ");
108 double zbwd = epLayerContent.
getLength(
"BackwardZ");
109 std::string name =
"Layer" + to_string(i) + epName + to_string(iEPLayer);
111 ep.
appendNew(name, iEPLayer, rmin, rmax, zfwd, zbwd);
113 m_endplates.push_back(ep);
117 const int nInnerWall = content.getNumberNodes(
"InnerWalls/InnerWall");
118 for (
int i = 0; i < nInnerWall; ++i) {
119 GearDir innerWallContent(content);
120 innerWallContent.
append((format(
"/InnerWalls/InnerWall[%1%]/") % (i + 1)).str());
122 string sInnerWallID = innerWallContent.
getString(
"@id");
123 const string name =
"InnerWall_" + sInnerWallID +
"_" + innerWallContent.
getString(
"Name");
124 const double rmin = innerWallContent.
getLength(
"InnerR");
125 const double rmax = innerWallContent.
getLength(
"OuterR");
126 const double zfwd = innerWallContent.
getLength(
"ForwardZ");
127 const double zbwd = innerWallContent.
getLength(
"BackwardZ");
128 const InnerWall wall(name, i, rmin, rmax, zfwd, zbwd);
129 m_innerWalls.push_back(wall);
130 if (innerWallContent.
getString(
"Name") ==
"Shield") {
131 m_fiducialRmin = rmax;
137 const int nOuterWall = content.getNumberNodes(
"OuterWalls/OuterWall");
138 for (
int i = 0; i < nOuterWall; ++i) {
139 GearDir outerWallContent(content);
140 outerWallContent.
append((format(
"/OuterWalls/OuterWall[%1%]/") % (i + 1)).str());
142 string sOuterWallID = outerWallContent.
getString(
"@id");
143 const string name =
"OuterWall_" + sOuterWallID +
"_" + outerWallContent.
getString(
"Name");
144 const double rmin = outerWallContent.
getLength(
"InnerR");
145 const double rmax = outerWallContent.
getLength(
"OuterR");
146 const double zfwd = outerWallContent.
getLength(
"ForwardZ");
147 const double zbwd = outerWallContent.
getLength(
"BackwardZ");
148 const OuterWall wall(name, i, rmin, rmax, zfwd, zbwd);
149 m_outerWalls.push_back(wall);
150 if (outerWallContent.
getString(
"Name") ==
"Shield") {
151 m_fiducialRmax = rmin;
157 const int nEB = content.getNumberNodes(
"ElectronicsBoards/ElectronicsBoard");
158 for (
int iEB = 0; iEB < nEB; ++iEB) {
160 ebContent.
append((format(
"/ElectronicsBoards/ElectronicsBoard[%1%]/") % (iEB + 1)).str());
162 const double rmin = ebContent.
getLength(
"EBInnerR");
163 const double rmax = ebContent.
getLength(
"EBOuterR");
164 const double zfwd = ebContent.
getLength(
"EBForwardZ");
165 const double zbwd = ebContent.
getLength(
"EBBackwardZ");
166 Frontend frontend(iEB, rmin, rmax, zfwd, zbwd);
167 m_frontends.push_back(frontend);
171 const int nShields = content.getNumberNodes(
"Shields/Shield");
172 for (
int i = 0; i < nShields; ++i) {
174 neuContent.
append((format(
"/Shields/Shield[%1%]/") % (i + 1)).str());
176 const double rmin1 = neuContent.
getLength(
"InnerR1");
177 const double rmin2 = neuContent.
getLength(
"InnerR2");
178 const double rmax1 = neuContent.
getLength(
"OuterR1");
179 const double rmax2 = neuContent.
getLength(
"OuterR2");
180 const double thick = neuContent.
getLength(
"Thickness");
181 const double z = neuContent.
getLength(
"PosZ");
182 NeutronShield shield(i, rmin1, rmin2, rmax1, rmax2, thick, z);
183 m_neutronShields.push_back(shield);
187 const int nCovers = content.getNumberNodes(
"Covers/Cover");
188 for (
int i = 0; i < nCovers; ++i) {
190 coverContent.
append((format(
"/Covers/Cover[%1%]/") % (i + 1)).str());
192 const int coverID = atoi((coverContent.
getString(
"@id")).c_str());
193 const double rmin1 = coverContent.
getLength(
"InnerR1");
194 const double rmin2 = coverContent.
getLength(
"InnerR2");
195 const double rmax1 = coverContent.
getLength(
"OuterR1");
196 const double rmax2 = coverContent.
getLength(
"OuterR2");
197 const double thick = coverContent.
getLength(
"Thickness");
198 const double z = coverContent.
getLength(
"PosZ");
199 Cover cover(coverID, rmin1, rmin2, rmax1, rmax2, thick, z);
200 m_covers.push_back(cover);
203 const int nCover2s = content.getNumberNodes(
"Covers/Cover2");
204 for (
int i = 0; i < nCover2s; ++i) {
205 GearDir cover2Content(content);
206 cover2Content.
append((format(
"/Covers/Cover2[%1%]/") % (i + 1)).str());
208 const int cover2ID = atoi((cover2Content.
getString(
"@id")).c_str());
209 const double rmin = cover2Content.
getLength(
"InnerR");
210 const double rmax = cover2Content.
getLength(
"OuterR");
211 const double phis = cover2Content.
getLength(
"StartPhi");
212 const double dphi = cover2Content.
getLength(
"DeltaPhi");
213 const double thick = cover2Content.
getLength(
"Thickness");
214 const double z = cover2Content.
getLength(
"PosZ");
215 Cover2 cover2(cover2ID, rmin, rmax, phis, dphi, thick, z);
216 m_cover2s.push_back(cover2);
219 const int nRibs = content.getNumberNodes(
"Covers/Rib");
220 for (
int i = 0; i < nRibs; ++i) {
222 ribContent.
append((format(
"/Covers/Rib[%1%]/") % (i + 1)).str());
224 const int ribID = atoi((ribContent.
getString(
"@id")).c_str());
225 const double length = ribContent.
getLength(
"Length");
226 const double width = ribContent.
getLength(
"Width");
227 const double thick = ribContent.
getLength(
"Thickness");
228 const double rotx = ribContent.
getLength(
"RotX");
229 const double roty = ribContent.
getLength(
"RotY");
230 const double rotz = ribContent.
getLength(
"RotZ");
231 const double x = ribContent.
getLength(
"PosX");
232 const double y = ribContent.
getLength(
"PosY");
233 const double z = ribContent.
getLength(
"PosZ");
234 const int offset = atoi((ribContent.
getString(
"Offset")).c_str());
235 const int ndiv = atoi((ribContent.
getString(
"NDiv")).c_str());
236 Rib rib(ribID, length, width, thick, rotx, roty, rotz, x, y, z, offset, ndiv);
237 m_ribs.push_back(rib);
240 const int nRib2s = content.getNumberNodes(
"Covers/Rib2");
241 for (
int i = 0; i < nRib2s; ++i) {
243 rib2Content.
append((format(
"/Covers/Rib2[%1%]/") % (i + 1)).str());
245 const int rib2ID = atoi((rib2Content.
getString(
"@id")).c_str());
246 const double length = rib2Content.
getLength(
"Length");
247 const double width = rib2Content.
getLength(
"Width");
248 const double thick = rib2Content.
getLength(
"Thickness");
249 const double width2 = rib2Content.
getLength(
"Width2");
250 const double thick2 = rib2Content.
getLength(
"Thickness2");
251 const double rotx = rib2Content.
getLength(
"RotX");
252 const double roty = rib2Content.
getLength(
"RotY");
253 const double rotz = rib2Content.
getLength(
"RotZ");
254 const double x = rib2Content.
getLength(
"PosX");
255 const double y = rib2Content.
getLength(
"PosY");
256 const double z = rib2Content.
getLength(
"PosZ");
257 const int ndiv = atoi((rib2Content.
getString(
"NDiv")).c_str());
258 Rib2 rib2(rib2ID, length, width, thick, width2, thick2, rotx, roty, rotz,
260 m_rib2s.push_back(rib2);
263 const int nRib3s = content.getNumberNodes(
"Covers/Rib3");
264 for (
int i = 0; i < nRib3s; ++i) {
266 rib3Content.
append((format(
"/Covers/Rib3[%1%]/") % (i + 1)).str());
268 const int rib3ID = atoi((rib3Content.
getString(
"@id")).c_str());
269 const double length = rib3Content.
getLength(
"Length");
270 const double width = rib3Content.
getLength(
"Width");
271 const double thick = rib3Content.
getLength(
"Thickness");
272 const double r = rib3Content.
getLength(
"HoleR");
273 const double x = rib3Content.
getLength(
"PosX");
274 const double y = rib3Content.
getLength(
"PosY");
275 const double z = rib3Content.
getLength(
"PosZ");
276 const double rx = rib3Content.
getLength(
"HoleX");
277 const double ry = rib3Content.
getLength(
"HoleY");
278 const double rz = rib3Content.
getLength(
"HoleZ");
279 const int offset = atoi((rib3Content.
getString(
"Offset")).c_str());
280 const int ndiv = atoi((rib3Content.
getString(
"NDiv")).c_str());
281 Rib3 rib3(rib3ID, length, width, thick, r, x, y, z, rx, ry, rz, offset, ndiv);
282 m_rib3s.push_back(rib3);
285 const int nRib4s = content.getNumberNodes(
"Covers/Rib4");
286 for (
int i = 0; i < nRib4s; ++i) {
288 rib4Content.
append((format(
"/Covers/Rib4[%1%]/") % (i + 1)).str());
290 const int rib4ID = atoi((rib4Content.
getString(
"@id")).c_str());
291 const double length = rib4Content.
getLength(
"Length");
292 const double width = rib4Content.
getLength(
"Width");
293 const double thick = rib4Content.
getLength(
"Thickness");
294 const double length2 = rib4Content.
getLength(
"Length2");
295 const double width2 = rib4Content.
getLength(
"Width2");
296 const double thick2 = rib4Content.
getLength(
"Thickness2");
297 const double x = rib4Content.
getLength(
"PosX");
298 const double y = rib4Content.
getLength(
"PosY");
299 const double z = rib4Content.
getLength(
"PosZ");
300 const double x2 = rib4Content.
getLength(
"HoleX");
301 const double y2 = rib4Content.
getLength(
"HoleY");
302 const double z2 = rib4Content.
getLength(
"HoleZ");
303 const int offset = atoi((rib4Content.
getString(
"Offset")).c_str());
304 const int ndiv = atoi((rib4Content.
getString(
"NDiv")).c_str());
305 Rib4 rib4(rib4ID, length, width, thick, length2, width2, thick2, x, y, z, x2, y2, z2, offset, ndiv);
306 m_rib4s.push_back(rib4);
309 const int nRib5s = content.getNumberNodes(
"Covers/Rib5");
310 for (
int i = 0; i < nRib5s; ++i) {
312 rib5Content.
append((format(
"/Covers/Rib5[%1%]/") % (i + 1)).str());
314 const int rib5ID = atoi((rib5Content.
getString(
"@id")).c_str());
315 const double dr = rib5Content.
getLength(
"DR");
316 const double dz = rib5Content.
getLength(
"DZ");
317 const double width = rib5Content.
getLength(
"Width");
318 const double thick = rib5Content.
getLength(
"Thickness");
319 const double rin = rib5Content.
getLength(
"Rin");
320 const double x = rib5Content.
getLength(
"PosX");
321 const double y = rib5Content.
getLength(
"PosY");
322 const double z = rib5Content.
getLength(
"PosZ");
323 const double rotx = rib5Content.
getLength(
"RotX");
324 const double roty = rib5Content.
getLength(
"RotY");
325 const double rotz = rib5Content.
getLength(
"RotZ");
326 const int offset = atoi((rib5Content.
getString(
"Offset")).c_str());
327 const int ndiv = atoi((rib5Content.
getString(
"NDiv")).c_str());
328 Rib5 rib5(rib5ID, dr, dz, width, thick, rin, x, y, z,
329 rotx, roty, rotz, offset, ndiv);
330 m_rib5s.push_back(rib5);
336 senseWire.
append(
"/SenseWire/");
337 m_senseWireDiameter = senseWire.
getLength(
"Diameter");
339 m_senseWireNumbers = atoi((senseWire.
getString(
"Number")).c_str());
343 fieldWire.
append(
"/FieldWire/");
344 m_fieldWireDiameter = fieldWire.
getLength(
"Diameter");
346 m_fieldWireNumbers = atoi((fieldWire.
getString(
"Number")).c_str());
350 m_feedThroughLength = content.getLength(
"/FeedThrough/Length");
354 m_clockFrequency = content.getDouble(
"ClockFrequencyForTDC");
355 m_nominalSpaceResolution = content.getLength(
"SenseWire/SpaceResol");